mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-15 05:02:21 +01:00
add network as member of Sprocket
This commit is contained in:
@@ -35,6 +35,8 @@ void MeshNet::update(){
|
||||
// only needed when no scheduler was passed to mesh.init
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
// example, not used, to be removed
|
||||
void MeshNet::onReceive( std::function<void(uint32_t from, String &msg)> cb) {
|
||||
mesh.onReceive(cb);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ Sprocket* Sprocket::activate() {
|
||||
|
||||
Sprocket* Sprocket::join(Network& net){
|
||||
Serial.println("join network");
|
||||
network = &net;
|
||||
net.init(&scheduler);
|
||||
net.onReceive(bind(&Sprocket::dispatch,this, _1, _2));
|
||||
net.connect();
|
||||
|
||||
@@ -17,6 +17,7 @@ struct SprocketConfig {
|
||||
class Sprocket {
|
||||
protected:
|
||||
Scheduler scheduler;
|
||||
Network* network;
|
||||
public:
|
||||
SprocketConfig config;
|
||||
Sprocket();
|
||||
|
||||
Reference in New Issue
Block a user