mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 11:10:52 +00:00
move want_replies into new plugin system
This commit is contained in:
@@ -37,3 +37,13 @@ void NodeInfoPlugin::sendOurNodeInfo(NodeNum dest, bool wantReplies)
|
||||
|
||||
service.sendToMesh(p);
|
||||
}
|
||||
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender. Implementing this method
|
||||
* is optional
|
||||
*/
|
||||
void NodeInfoPlugin::sendResponse(NodeNum to) {
|
||||
DEBUG_MSG("Sending user reply\n");
|
||||
sendOurNodeInfo(to, false);
|
||||
}
|
||||
@@ -18,12 +18,17 @@ class NodeInfoPlugin : public ProtobufPlugin<User>
|
||||
void sendOurNodeInfo(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||
|
||||
protected:
|
||||
|
||||
/** Called to handle a particular incoming message
|
||||
|
||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
*/
|
||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const User &p);
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender. Implementing this method
|
||||
* is optional
|
||||
*/
|
||||
virtual void sendResponse(NodeNum to);
|
||||
};
|
||||
|
||||
extern NodeInfoPlugin nodeInfoPlugin;
|
||||
@@ -44,3 +44,12 @@ void PositionPlugin::sendOurPosition(NodeNum dest, bool wantReplies)
|
||||
|
||||
service.sendToMesh(p);
|
||||
}
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender. Implementing this method
|
||||
* is optional
|
||||
*/
|
||||
void PositionPlugin::sendResponse(NodeNum to) {
|
||||
DEBUG_MSG("Sending posistion reply\n");
|
||||
sendOurPosition(to, false);
|
||||
}
|
||||
@@ -24,6 +24,12 @@ class PositionPlugin : public ProtobufPlugin<Position>
|
||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
*/
|
||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const Position &p);
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender. Implementing this method
|
||||
* is optional
|
||||
*/
|
||||
virtual void sendResponse(NodeNum to);
|
||||
};
|
||||
|
||||
extern PositionPlugin positionPlugin;
|
||||
Reference in New Issue
Block a user