1
0
Fork 0

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
1 changed files with 18 additions and 8 deletions

View File

@ -79,20 +79,30 @@ struct MessageData
/**
* @brief Initialize MessageData with the appropriate Label
* @param l Label
*
* 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.
*/
MessageData(uint8_t l = 0) : label(l) {};
size_t streamSize() const override { return 0; };
void iStream(std::shared_ptr<bufferstream>) override {};
void oStream(std::shared_ptr<bufferstream>) const override{};
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,
* perhaps to act as a "ping/echo" to detect emulated devices.
*/
struct MsgNoop
: public MessageData
{
MsgNoop() : MessageData(0) {};
virtual size_t streamSize() const override { return 0; };
virtual void iStream(std::shared_ptr<bufferstream>) override {};
virtual void oStream(std::shared_ptr<bufferstream>) const override{};
};
/**
* @brief 1. Reprogram Firmware Request (Label = 1, no data)
*