Roboid Control for C++
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
RoboidControl::BinaryMsg Class Reference

Detailed Description

A message containing binary data for custom communication.

#include <BinaryMsg.h>

Inheritance diagram for RoboidControl::BinaryMsg:
RoboidControl::IMessage

Public Member Functions

 BinaryMsg (unsigned char networkId, Thing *thing)
 Create a BinaryMsg.
 
 BinaryMsg (char *buffer)
 
virtual ~BinaryMsg ()
 Destructor for the message.
 
virtual unsigned char Serialize (char *buffer) override
 Serialize the message into a byte array for sending.
 

Public Attributes

unsigned char networkId
 The network ID of the thing.
 
unsigned char thingId
 The ID of the thing.
 
Thingthing
 The thing for which the binary data is communicated.
 
unsigned char dataLength
 
char * data = nullptr
 The binary data which is communicated.
 

Static Public Attributes

static const unsigned char id = 0xB1
 The message ID.
 
static const unsigned length = 4
 The length of the message in bytes, excluding the binary data For the total size of the message this.bytes.Length should be added to this value.
 

Constructor & Destructor Documentation

◆ BinaryMsg() [1/2]

RoboidControl::BinaryMsg::BinaryMsg ( unsigned char  networkId,
Thing thing 
)

Create a BinaryMsg.

Parameters
networkIdThe network ID of the thing
thingThe thing for which binary data is sent

◆ BinaryMsg() [2/2]

RoboidControl::BinaryMsg::BinaryMsg ( char *  buffer)

Member Function Documentation

◆ Serialize()

unsigned char RoboidControl::BinaryMsg::Serialize ( char *  buffer)
overridevirtual

Serialize the message into a byte array for sending.

Parameters
bufferThe buffer to serilize into
Returns
The length of the message in the buffer

Reimplemented from RoboidControl::IMessage.