RoboidControl-cpp/Messages/InvestigateMsg.cpp
2025-04-11 11:15:20 +02:00

28 lines
765 B
C++

#include "InvestigateMsg.h"
namespace RoboidControl {
InvestigateMsg::InvestigateMsg(char* buffer) {
unsigned ix = 1; // first byte is msgId
this->networkId = buffer[ix++];
this->thingId = buffer[ix++];
}
InvestigateMsg::InvestigateMsg(unsigned char networkId, unsigned char thingId) {
this->networkId = networkId;
this->thingId = thingId;
}
InvestigateMsg::~InvestigateMsg() {}
unsigned char InvestigateMsg::Serialize(char* buffer) {
#if defined(DEBUG)
std::cout << "Send InvestigateMsg [" << (int)this->networkId << "/" << (int)this->thingId
<< "] " << std::endl;
#endif
unsigned char ix = 0;
buffer[ix++] = this->id;
buffer[ix++] = this->networkId;
buffer[ix++] = this->thingId;
return ix;
}
} // namespace RoboidControl