This class defines a simple messaging protocol for communicating with an industrial robot controller. More...
#include <simple_message.h>
Public Member Functions | |
| int | getCommType () |
| Gets message type(see CommType) More... | |
| industrial::byte_array::ByteArray & | getData () |
| Returns a reference to the internal data member. More... | |
| int | getDataLength () |
| Gets length of message data portion. More... | |
| int | getMessageType () |
| Gets message type(see StandardMsgType) More... | |
| int | getMsgLength () |
| Gets message length (total size, HEADER + data) More... | |
| int | getReplyCode () |
| Gets reply code(see ReplyType) More... | |
| bool | init (int msgType, int commType, int replyCode, industrial::byte_array::ByteArray &data) |
| Initializes a fully populated simple message. More... | |
| bool | init (int msgType, int commType, int replyCode) |
| Initializes a simple message with an emtpy data payload. More... | |
| bool | init (industrial::byte_array::ByteArray &msg) |
| Initializes a simple message from a generic byte array. The byte array is assumed to hold a valid message with a HEADER and data payload. More... | |
| SimpleMessage () | |
| Constructs an empty message. More... | |
| void | toByteArray (industrial::byte_array::ByteArray &msg) |
| Populates a raw byte array with the message. Any data stored in the passed in byte array is deleted. More... | |
| bool | validateMessage () |
| performs logical checks to ensure that the message is fully defined and adheres to the message conventions. More... | |
| ~SimpleMessage (void) | |
| Destructs a message. More... | |
Static Public Member Functions | |
| static unsigned int | getHeaderSize () |
| Gets size of message header in bytes(fixed) More... | |
| static unsigned int | getLengthSize () |
| Gets size of message length member in bytes (fixed) More... | |
Private Member Functions | |
| void | setCommType (int commType) |
| Sets communications type. More... | |
| void | setData (industrial::byte_array::ByteArray &data) |
| Sets data portion. More... | |
| void | setMessageType (int msgType) |
| Sets message type. More... | |
| void | setReplyCode (int replyCode) |
| Sets reply code. More... | |
Private Attributes | |
| industrial::shared_types::shared_int | comm_type_ |
| Communications type(see CommType) More... | |
| industrial::byte_array::ByteArray | data_ |
| Message data portion. More... | |
| industrial::shared_types::shared_int | message_type_ |
| Message type(see StandardMsgType) More... | |
| industrial::shared_types::shared_int | reply_code_ |
| Reply code(see ReplyType) More... | |
Static Private Attributes | |
| static const unsigned int | HEADER_SIZE |
| Size(in bytes) of message header (fixed) More... | |
| static const unsigned int | LENGTH_SIZE = sizeof(industrial::shared_types::shared_int) |
| Size (in bytes) of message length parameter (fixed) More... | |
This class defines a simple messaging protocol for communicating with an industrial robot controller.
The protocol meets the following requirements:
Message Structure
THIS CLASS IS NOT THREAD-SAFE
Definition at line 164 of file simple_message.h.
| industrial::simple_message::SimpleMessage::SimpleMessage | ( | void | ) |
Constructs an empty message.
Definition at line 53 of file simple_message.cpp.
| industrial::simple_message::SimpleMessage::~SimpleMessage | ( | void | ) |
Destructs a message.
Definition at line 57 of file simple_message.cpp.
|
inline |
Gets message type(see CommType)
Definition at line 246 of file simple_message.h.
|
inline |
Returns a reference to the internal data member.
Definition at line 274 of file simple_message.h.
|
inline |
Gets length of message data portion.
Definition at line 267 of file simple_message.h.
|
inlinestatic |
Gets size of message header in bytes(fixed)
Definition at line 225 of file simple_message.h.
|
inlinestatic |
Gets size of message length member in bytes (fixed)
Definition at line 232 of file simple_message.h.
|
inline |
Gets message type(see StandardMsgType)
Definition at line 239 of file simple_message.h.
|
inline |
Gets message length (total size, HEADER + data)
Definition at line 260 of file simple_message.h.
|
inline |
| bool industrial::simple_message::SimpleMessage::init | ( | int | msgType, |
| int | commType, | ||
| int | replyCode, | ||
| industrial::byte_array::ByteArray & | data | ||
| ) |
Initializes a fully populated simple message.
| message | type. Globally unique message ID (see StandardMsgType) |
| communications | types (see CommType) |
| reply | code(see ReplyType), only valide if comms type is a reply |
| data | payload for the message |
Definition at line 70 of file simple_message.cpp.
| bool industrial::simple_message::SimpleMessage::init | ( | int | msgType, |
| int | commType, | ||
| int | replyCode | ||
| ) |
Initializes a simple message with an emtpy data payload.
| message | type. Globally unique message ID (see StandardMsgType) |
| communications | types (see CommType) |
| reply | code(see ReplyType), only valide if comms type is a reply |
Definition at line 63 of file simple_message.cpp.
| bool industrial::simple_message::SimpleMessage::init | ( | industrial::byte_array::ByteArray & | msg | ) |
Initializes a simple message from a generic byte array. The byte array is assumed to hold a valid message with a HEADER and data payload.
| valid | message (as bytes) |
Definition at line 82 of file simple_message.cpp.
|
inlineprivate |
Sets communications type.
| communications | type |
Definition at line 332 of file simple_message.h.
|
private |
|
inlineprivate |
|
inlineprivate |
| void industrial::simple_message::SimpleMessage::toByteArray | ( | industrial::byte_array::ByteArray & | msg | ) |
Populates a raw byte array with the message. Any data stored in the passed in byte array is deleted.
| byte | array to be populated |
Definition at line 113 of file simple_message.cpp.
| bool industrial::simple_message::SimpleMessage::validateMessage | ( | ) |
performs logical checks to ensure that the message is fully defined and adheres to the message conventions.
Definition at line 134 of file simple_message.cpp.
|
private |
Communications type(see CommType)
Definition at line 296 of file simple_message.h.
|
private |
Message data portion.
Definition at line 306 of file simple_message.h.
|
staticprivate |
Size(in bytes) of message header (fixed)
Definition at line 311 of file simple_message.h.
|
staticprivate |
Size (in bytes) of message length parameter (fixed)
Definition at line 318 of file simple_message.h.
|
private |
Message type(see StandardMsgType)
Definition at line 291 of file simple_message.h.
|
private |
Reply code(see ReplyType)
Definition at line 301 of file simple_message.h.