This commit is contained in:
2018-09-03 02:14:14 +02:00
parent 1af30e4243
commit b9964e0ac1
2 changed files with 1 additions and 17 deletions

View File

@@ -22,28 +22,14 @@ class MeshSprocket : public Sprocket {
}
virtual void onChangedConnections(){};
virtual void onNewConnection(){};
Sprocket* activate(Scheduler* scheduler, Network* network) {
Sprocket::activate(scheduler, network);
net = static_cast<MeshNet*>(network);
net->onReceive(bind(&MeshSprocket::dispatch,this, _1, _2));
net->mesh.onNewConnection(bind(&MeshSprocket::newConnection,this, _1));
net->mesh.onChangedConnections(bind(&MeshSprocket::connectionChanged,this));
return this;
} using Sprocket::activate;
virtual void newConnection(uint32_t nodeId){
PRINT_MSG(Serial, "MeshSprocket", "connected to %u", nodeId);
onNewConnection();
}
virtual void connectionChanged(){
PRINT_MSG(Serial, "MeshSprocket", "connection changed");
onChangedConnections();
}
virtual void onMessage(uint32_t from, String &msg) {
Serial.printf("MeshSprocket onMessage: received from %u msg=%s\n", from, msg.c_str());
};