give the No-Op message it's own class

This commit is contained in:
Kevin Matz 2023-04-09 19:33:03 -04:00
parent be4064bb14
commit b6e080f7b4

View File

@ -79,17 +79,27 @@ struct MessageData
/** /**
* @brief Initialize MessageData with the appropriate Label * @brief Initialize MessageData with the appropriate Label
* @param l Label * @param l Label
*/
MessageData(uint8_t l) : label(l) {};
const uint8_t label; //!< Message ID label (OpCode)
};
/**
* @brief No Op message (Label = 0, no data)
* *
* While null messages (label = 0) are not present in the API spec., allow their IO, * While null messages (label = 0) are not present in the API spec., allow their IO,
* perhaps to act as a "ping/echo" to detect emulated devices. * perhaps to act as a "ping/echo" to detect emulated devices.
*/ */
MessageData(uint8_t l = 0) : label(l) {}; struct MsgNoop
: public MessageData
{
MsgNoop() : MessageData(0) {};
size_t streamSize() const override { return 0; }; virtual size_t streamSize() const override { return 0; };
void iStream(std::shared_ptr<bufferstream>) override {}; virtual void iStream(std::shared_ptr<bufferstream>) override {};
void oStream(std::shared_ptr<bufferstream>) const override{}; virtual void oStream(std::shared_ptr<bufferstream>) const override{};
const uint8_t label; //!< Message ID label (OpCode)
}; };