Roboid Control for C++
Loading...
Searching...
No Matches
BinaryMsg.h
1#pragma once
2
3#include "IMessage.h"
4#include "Thing.h"
5
6namespace RoboidControl {
7
9class BinaryMsg : public IMessage {
10 public:
12 static const unsigned char id = 0xB1;
15 static const unsigned length = 4;
16
18 unsigned char networkId;
20 unsigned char thingId;
23
24 unsigned char dataLength;
26 char* data = nullptr;
27
31 BinaryMsg(unsigned char networkId, Thing* thing);
33 BinaryMsg(char* buffer);
35 virtual ~BinaryMsg();
36
38 virtual unsigned char Serialize(char* buffer) override;
39};
40
41} // namespace RoboidControl
A message containing binary data for custom communication.
Definition BinaryMsg.h:9
virtual unsigned char Serialize(char *buffer) override
Serialize the message into a byte array for sending.
Definition BinaryMsg.cpp:29
virtual ~BinaryMsg()
Destructor for the message.
Definition BinaryMsg.cpp:25
unsigned char thingId
The ID of the thing.
Definition BinaryMsg.h:20
static const unsigned length
The length of the message in bytes, excluding the binary data For the total size of the message this....
Definition BinaryMsg.h:15
char * data
The binary data which is communicated.
Definition BinaryMsg.h:26
Thing * thing
The thing for which the binary data is communicated.
Definition BinaryMsg.h:22
unsigned char networkId
The network ID of the thing.
Definition BinaryMsg.h:18
Root structure for all communcation messages.
Definition IMessage.h:6
A thing is the primitive building block.
Definition Thing.h:20