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