mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-16 13:25:03 +01:00
remove network from sprocket
This commit is contained in:
@@ -21,8 +21,6 @@ Sprocket* Sprocket::activate() {
|
|||||||
|
|
||||||
Sprocket* Sprocket::join(Network& net){
|
Sprocket* Sprocket::join(Network& net){
|
||||||
Serial.println("join network");
|
Serial.println("join network");
|
||||||
hasNetwork = 1;
|
|
||||||
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();
|
||||||
@@ -37,5 +35,4 @@ Sprocket* Sprocket::addTask(Task& tsk){
|
|||||||
|
|
||||||
void Sprocket::loop(){
|
void Sprocket::loop(){
|
||||||
scheduler.execute();
|
scheduler.execute();
|
||||||
if(hasNetwork) network->update();
|
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,6 @@ struct SprocketConfig {
|
|||||||
class Sprocket {
|
class Sprocket {
|
||||||
protected:
|
protected:
|
||||||
Scheduler scheduler;
|
Scheduler scheduler;
|
||||||
Network* network;
|
|
||||||
int hasNetwork = 0;
|
|
||||||
public:
|
public:
|
||||||
SprocketConfig config;
|
SprocketConfig config;
|
||||||
Sprocket();
|
Sprocket();
|
||||||
@@ -30,7 +28,7 @@ class Sprocket {
|
|||||||
virtual Sprocket* activate();
|
virtual Sprocket* activate();
|
||||||
virtual Sprocket* activate(Scheduler*) { return this; }
|
virtual Sprocket* activate(Scheduler*) { return this; }
|
||||||
virtual Sprocket* activate(Scheduler*, Network*) { return this; }
|
virtual Sprocket* activate(Scheduler*, Network*) { return this; }
|
||||||
virtual void dispatch(uint32_t from, String &msg) {};
|
virtual void dispatch(uint32_t from, String &msg) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user