CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
ControlMessage.h
Go to the documentation of this file.
1
12
13#if !defined(_CONTROLMESSAGE_H_)
14#define _CONTROLMESSAGE_H_
15
16#include "PsyTime.h"
17#include "ObjectIDs.h"
18
19namespace cmlabs {
20
21
27 uint32 size;
28 uint32 cid;
29 uint64 time;
30 uint64 from;
31 uint64 to;
32
33 uint16 command;
34 uint16 status;
35};
36
50public:
57 ControlMessage(uint16 command, uint64 from, uint64 to, char* data = NULL, uint32 dataSize = 0);
60 ControlMessage(char* data);
63
64 uint32 getSize();
65 uint16 getCommand();
66 uint64 getTime();
67 uint64 getFrom();
68 uint64 getTo();
69
70 uint16 getStatus();
74 bool setStatus(uint16 status);
75
77 static bool UnitTest();
78
80 char* data;
81};
82
83} // namespace cmlabs
84
85#endif //_CONTROLMESSAGE_H_
86
Object type ids used to tag and verify every binary structure in CMSDK memory.
CMSDK time: µs-resolution 64-bit timestamps and the Time Mapping Constant (TMC).
char * data
The flat message block (ControlMessageHeader + payload); see class notes on ownership.
static bool UnitTest()
Run the built-in self test.
bool setStatus(uint16 status)
Set the status/result code.
ControlMessage(uint16 command, uint64 from, uint64 to, char *data=NULL, uint32 dataSize=0)
Create a new control message.
Wire/shared-memory header of a ControlMessage; any payload follows immediately after.
uint16 status
Status/result code, typically filled in by the receiver.
uint32 size
Total block size in bytes (header + payload).
uint64 time
Creation time in microseconds since epoch.
uint64 from
Sender id (wider than DataMessage's: can encode node+component).
uint16 command
Command code — what the receiver should do.
uint32 cid
Object id, always CONTROLMESSAGEID for a valid message.