Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
industrial::simple_message::SimpleMessage Class Reference

This class defines a simple messaging protocol for communicating with an industrial robot controller. More...

#include <simple_message.h>

List of all members.

Public Member Functions

int getCommType ()
 Gets message type(see CommType)
industrial::byte_array::ByteArraygetData ()
 Returns a reference to the internal data member.
int getDataLength ()
 Gets length of message data portion.
int getMessageType ()
 Gets message type(see StandardMsgType)
int getMsgLength ()
 Gets message length (total size, HEADER + data)
int getReplyCode ()
 Gets reply code(see ReplyType)
bool init (int msgType, int commType, int replyCode, industrial::byte_array::ByteArray &data)
 Initializes a fully populated simple message.
bool init (int msgType, int commType, int replyCode)
 Initializes a simple message with an emtpy data payload.
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.
 SimpleMessage ()
 Constructs an empty message.
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.
bool validateMessage ()
 performs logical checks to ensure that the message is fully defined and adheres to the message conventions.
 ~SimpleMessage (void)
 Destructs a message.

Static Public Member Functions

static unsigned int getHeaderSize ()
 Gets size of message header in bytes(fixed)
static unsigned int getLengthSize ()
 Gets size of message length member in bytes (fixed)

Private Member Functions

void setCommType (int commType)
 Sets communications type.
void setData (industrial::byte_array::ByteArray &data)
 Sets data portion.
void setMessageType (int msgType)
 Sets message type.
void setReplyCode (int replyCode)
 Sets reply code.

Private Attributes

industrial::shared_types::shared_int comm_type_
 Communications type(see CommType)
industrial::byte_array::ByteArray data_
 Message data portion.
industrial::shared_types::shared_int message_type_
 Message type(see StandardMsgType)
industrial::shared_types::shared_int reply_code_
 Reply code(see ReplyType)

Static Private Attributes

static const unsigned int HEADER_SIZE
 Size(in bytes) of message header (fixed)
static const unsigned int LENGTH_SIZE = sizeof(industrial::shared_types::shared_int)
 Size (in bytes) of message length parameter (fixed)

Detailed Description

This class defines a simple messaging protocol for communicating with an industrial robot controller.

The protocol meets the following requirements:

1. Format should be simple enough that code can be shared between ROS and the controller (for those controllers that support C/C++). For those controllers that do not support C/C++, the protocol must be simple enough to be decoded with the limited capabilities of the typical robot programming language. A corollary to this requirement is that the protocol should not be so onerous as to overwhelm the limited resources of the robot controller

2. Format should allow for data streaming (ROS topic like)

3. Format should allow for data reply (ROS service like)

4. The protocol is not intended to encapsulate version information It is up to individual developers to ensure that code developed for communicating platforms does not have any version conflicts (this includes message type identifiers).

Message Structure

THIS CLASS IS NOT THREAD-SAFE

Definition at line 164 of file simple_message.h.


Constructor & Destructor Documentation

Constructs an empty message.

Definition at line 53 of file simple_message.cpp.

Destructs a message.

Definition at line 57 of file simple_message.cpp.


Member Function Documentation

Gets message type(see CommType)

Returns:
communications type

Definition at line 246 of file simple_message.h.

Returns a reference to the internal data member.

Returns:
reference to message data portion.

Definition at line 274 of file simple_message.h.

Gets length of message data portion.

Returns:
message data length

Definition at line 267 of file simple_message.h.

static unsigned int industrial::simple_message::SimpleMessage::getHeaderSize ( ) [inline, static]

Gets size of message header in bytes(fixed)

Returns:
message header size

Definition at line 225 of file simple_message.h.

static unsigned int industrial::simple_message::SimpleMessage::getLengthSize ( ) [inline, static]

Gets size of message length member in bytes (fixed)

Returns:
message header size

Definition at line 232 of file simple_message.h.

Gets message type(see StandardMsgType)

Returns:
message type

Definition at line 239 of file simple_message.h.

Gets message length (total size, HEADER + data)

Returns:
message length

Definition at line 260 of file simple_message.h.

Gets reply code(see ReplyType)

Returns:
reply code

Definition at line 253 of file simple_message.h.

bool industrial::simple_message::SimpleMessage::init ( int  msgType,
int  commType,
int  replyCode,
industrial::byte_array::ByteArray data 
)

Initializes a fully populated simple message.

Parameters:
messagetype. Globally unique message ID (see StandardMsgType)
communicationstypes (see CommType)
replycode(see ReplyType), only valide if comms type is a reply
datapayload for the message
Returns:
true if valid message created

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.

Parameters:
messagetype. Globally unique message ID (see StandardMsgType)
communicationstypes (see CommType)
replycode(see ReplyType), only valide if comms type is a reply
Returns:
true if valid message created

Definition at line 63 of file simple_message.cpp.

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.

Parameters:
validmessage (as bytes)
Returns:
true if valid message created

Definition at line 82 of file simple_message.cpp.

void industrial::simple_message::SimpleMessage::setCommType ( int  commType) [inline, private]

Sets communications type.

Parameters:
communicationstype

Definition at line 332 of file simple_message.h.

Sets data portion.

Parameters:
dataportion

Definition at line 128 of file simple_message.cpp.

void industrial::simple_message::SimpleMessage::setMessageType ( int  msgType) [inline, private]

Sets message type.

Parameters:
messagetype

Definition at line 325 of file simple_message.h.

void industrial::simple_message::SimpleMessage::setReplyCode ( int  replyCode) [inline, private]

Sets reply code.

Parameters:
replycode

Definition at line 339 of file simple_message.h.

Populates a raw byte array with the message. Any data stored in the passed in byte array is deleted.

Parameters:
bytearray to be populated

Definition at line 113 of file simple_message.cpp.

performs logical checks to ensure that the message is fully defined and adheres to the message conventions.

Returns:
true if message valid, false otherwise

Definition at line 134 of file simple_message.cpp.


Member Data Documentation

Communications type(see CommType)

Definition at line 296 of file simple_message.h.

Message data portion.

Definition at line 306 of file simple_message.h.

const unsigned int industrial::simple_message::SimpleMessage::HEADER_SIZE [static, private]
Initial value:

Size(in bytes) of message header (fixed)

Definition at line 311 of file simple_message.h.

Size (in bytes) of message length parameter (fixed)

Definition at line 318 of file simple_message.h.

Message type(see StandardMsgType)

Definition at line 291 of file simple_message.h.

Reply code(see ReplyType)

Definition at line 301 of file simple_message.h.


The documentation for this class was generated from the following files:


simple_message
Author(s): Shaun Edwards
autogenerated on Sat Jun 8 2019 20:43:24