Plugins refactoring: handleReceived return enumeration ProcessMessage

Use `ProcessMessage::CONTINUE` to allows other modules to process a message.
Use `ProcessMessage::STOP` to stop further message processing.
This commit is contained in:
Vladislav Osmanov
2021-09-23 04:42:09 +03:00
parent b182819aff
commit debae67ae7
13 changed files with 39 additions and 27 deletions

View File

@@ -49,9 +49,9 @@ template <class T> class ProtobufPlugin : protected SinglePortPlugin
private:
/** 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
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
virtual bool handleReceived(const MeshPacket &mp)
virtual ProcessMessage handleReceived(const MeshPacket &mp)
{
// FIXME - we currently update position data in the DB only if the message was a broadcast or destined to us
// it would be better to update even if the message was destined to others.
@@ -70,6 +70,6 @@ template <class T> class ProtobufPlugin : protected SinglePortPlugin
DEBUG_MSG("Error decoding protobuf plugin!\n");
}
return handleReceivedProtobuf(mp, decoded);
return handleReceivedProtobuf(mp, decoded) ? ProcessMessage::STOP : ProcessMessage::CONTINUE;
}
};