42 #ifdef SIMPLE_MESSAGE_MOTOPLUS 53 namespace smpl_msg_connection
67 sendBuffer.
load(msgData);
68 rtn = this->sendBytes(sendBuffer);
73 LOG_ERROR(
"Message validation failed, message not sent");
82 return receiveMsg(message, -1);
95 rtn = this->receiveBytes(lengthBuffer, message.
getLengthSize(), timeout_ms);
99 rtn = lengthBuffer.
unload(length);
100 LOG_COMM(
"Message length: %d", length);
104 rtn = this->receiveBytes(msgBuffer, length, timeout_ms);
108 rtn = message.
init(msgBuffer);
112 LOG_ERROR(
"Failed to initialize message");
125 LOG_ERROR(
"Failed to receive message length");
135 return sendAndReceiveMsg(send, recv, -1, verbose);
142 rtn = this->sendMsg(send);
148 rtn = this->receiveMsg(recv, timeout_ms);
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...
Contains platform specific type definitions that guarantee the size of primitive data types...
bool validateMessage()
performs logical checks to ensure that the message is fully defined and adheres to the message conven...
This class defines a simple messaging protocol for communicating with an industrial robot controller...
#define LOG_COMM(format,...)
bool load(industrial::shared_types::shared_bool value)
loads a boolean into the byte array
#define LOG_ERROR(format,...)
The byte array wraps a dynamic array of bytes (i.e. char).
bool init(int msgType, int commType, int replyCode, industrial::byte_array::ByteArray &data)
Initializes a fully populated simple message.
static unsigned int getLengthSize()
Gets size of message length member in bytes (fixed)
unsigned int getBufferSize()
gets current buffer size
bool unload(industrial::shared_types::shared_bool &value)
unloads a boolean value from the byte array