mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-14 20:56:38 +01:00
use same scheduler
This commit is contained in:
@@ -13,23 +13,18 @@ using namespace std::placeholders;
|
|||||||
|
|
||||||
class MeshNetworkPlugin : public NetworkPlugin
|
class MeshNetworkPlugin : public NetworkPlugin
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
Scheduler *meshScheduler;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MeshNetworkPlugin(MeshConfig cfg)
|
MeshNetworkPlugin(MeshConfig cfg)
|
||||||
{
|
{
|
||||||
network = new MeshNet(cfg);
|
network = new MeshNet(cfg);
|
||||||
meshScheduler = new Scheduler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void activate(Scheduler *userScheduler)
|
void activate(Scheduler *userScheduler)
|
||||||
{
|
{
|
||||||
userScheduler->setHighPriorityScheduler(meshScheduler);
|
|
||||||
network->onReceive(bind(&MeshNetworkPlugin::dispatch, this, _1, _2));
|
network->onReceive(bind(&MeshNetworkPlugin::dispatch, this, _1, _2));
|
||||||
subscribe("mesh/broadcast", bind(&MeshNetworkPlugin::broadcast, this, _1));
|
subscribe("mesh/broadcast", bind(&MeshNetworkPlugin::broadcast, this, _1));
|
||||||
// TODO mesh/sendTo
|
// TODO mesh/sendTo
|
||||||
NetworkPlugin::activate(meshScheduler);
|
NetworkPlugin::activate(userScheduler);
|
||||||
}
|
}
|
||||||
void broadcast(String msg)
|
void broadcast(String msg)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user