Set the protocol version in PixelMessage automagically
This commit is contained in:
parent
ad1bcba459
commit
a2173bc0e3
3 changed files with 18 additions and 20 deletions
|
@ -141,4 +141,3 @@ bool PixelBot::Tick()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "PixelMessage.h"
|
||||
#include "PixelBot.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
PixelMessage::PixelMessage()
|
||||
{
|
||||
|
||||
ProtocolVersion = PixelBot::PROTOCOL_VERSION;
|
||||
}
|
||||
PixelMessage::PixelMessage(byte* rawMessage) : PixelMessage()
|
||||
{
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
struct PixelMessage
|
||||
{
|
||||
public:
|
||||
PixelMessage();
|
||||
PixelMessage(byte* rawMessage);
|
||||
~PixelMessage();
|
||||
PixelMessage();
|
||||
PixelMessage(byte* rawMessage);
|
||||
~PixelMessage();
|
||||
|
||||
/// <summary>
|
||||
/// The length of the message header, in bytes.
|
||||
/// The message header contains things like the protocol version, the payload length, and the message type.
|
||||
/// </summary>
|
||||
static const unsigned int MESSAGE_HEADER_LENGTH = 12;
|
||||
/// <summary>
|
||||
/// The length of the message header, in bytes.
|
||||
/// The message header contains things like the protocol version, the payload length, and the message type.
|
||||
/// </summary>
|
||||
static const unsigned int MESSAGE_HEADER_LENGTH = 12;
|
||||
|
||||
// The protocol version associated with this message.
|
||||
unsigned short ProtocolVersion = 1;
|
||||
unsigned short MessageType = 1;
|
||||
unsigned int MessageId = 0;
|
||||
unsigned int MessageLength = 0;
|
||||
// The protocol version associated with this message.
|
||||
unsigned short ProtocolVersion = 1;
|
||||
unsigned short MessageType = 1;
|
||||
unsigned int MessageId = 0;
|
||||
unsigned int MessageLength = 0;
|
||||
|
||||
//const byte* Payload;
|
||||
|
||||
//const byte* Payload;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
|
Reference in a new issue