mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-17 21:56:40 +01:00
use mediator for internal messaging
This commit is contained in:
@@ -17,6 +17,7 @@ using namespace std::placeholders;
|
||||
class MeshSprocket : public Sprocket {
|
||||
public:
|
||||
MeshNet* net;
|
||||
|
||||
MeshSprocket(){};
|
||||
MeshSprocket(SprocketConfig cfg) : Sprocket(cfg) {
|
||||
|
||||
@@ -31,7 +32,11 @@ class MeshSprocket : public Sprocket {
|
||||
} using Sprocket::activate;
|
||||
|
||||
virtual void onMessage(uint32_t from, String &msg) {
|
||||
Serial.printf("MeshSprocket onMessage: received from %u msg=%s\n", from, msg.c_str());
|
||||
//Serial.printf("MeshSprocket onMessage: received from %u msg=%s\n", from, msg.c_str());
|
||||
SprocketMessage sMsg;
|
||||
sMsg.fromJsonString(msg);
|
||||
sMsg.from = from;
|
||||
publish(sMsg.topic, sMsg.payload);
|
||||
};
|
||||
|
||||
void dispatch( uint32_t from, String &msg ) {
|
||||
|
||||
Reference in New Issue
Block a user