Public Member Functions | Private Member Functions | List of all members
SickToolbox::SickLDMessage Class Reference

A class to represent all messages sent to and from the Sick LD unit. More...

#include <SickLDMessage.hh>

Inheritance diagram for SickToolbox::SickLDMessage:
Inheritance graph
[legend]

Public Member Functions

void BuildMessage (const uint8_t *const payload_buffer, const unsigned int payload_length)
 Constructs a Sick LD message given parameter values. More...
 
uint8_t GetChecksum () const
 
uint8_t GetServiceCode () const
 
uint8_t GetServiceSubcode () const
 
void ParseMessage (const uint8_t *const message_buffer)
 Parses a sequence of bytes into a SickLDMessage object. More...
 
void Print () const
 Print the message contents. More...
 
 SickLDMessage ()
 A default constructor. More...
 
 SickLDMessage (const uint8_t *const payload_buffer, const unsigned int payload_length)
 Another constructor. More...
 
 SickLDMessage (const uint8_t *const message_buffer)
 Another constructor. More...
 
 ~SickLDMessage ()
 
- Public Member Functions inherited from SickToolbox::SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN >
void BuildMessage (const uint8_t *const payload_buffer, const unsigned int payload_length)
 Constructs a Sick message given the parameter values. More...
 
virtual void Clear ()
 Reset all internal fields and buffers. More...
 
void GetMessage (uint8_t *const message_buffer) const
 Get the message as a sequence of well-formed bytes. More...
 
unsigned int GetMessageLength () const
 
void GetPayload (uint8_t *const payload_buffer) const
 Get the payload contents as a sequence of well-formed bytes. More...
 
void GetPayloadAsCStr (char *const payload_str) const
 
unsigned int GetPayloadLength () const
 
void GetPayloadSubregion (uint8_t *const payload_sub_buffer, const unsigned int start_idx, const unsigned int stop_idx) const
 Get a specified sub-region of the payload buffer. More...
 
bool IsPopulated () const
 
 SickMessage ()
 A default constructor. More...
 
virtual ~SickMessage ()
 A destructor. More...
 

Private Member Functions

uint8_t _computeXOR (const uint8_t *const data, const uint32_t length)
 Compute the message checksum (single-byte XOR). More...
 

Additional Inherited Members

- Static Public Attributes inherited from SickToolbox::SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN >
static const unsigned int MESSAGE_HEADER_LENGTH
 
static const unsigned int MESSAGE_MAX_LENGTH
 
static const unsigned int MESSAGE_PAYLOAD_MAX_LENGTH
 
static const unsigned int MESSAGE_TRAILER_LENGTH
 
- Protected Attributes inherited from SickToolbox::SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN >
uint8_t _message_buffer [MESSAGE_MAX_LENGTH]
 
unsigned int _message_length
 
unsigned int _payload_length
 
bool _populated
 

Detailed Description

A class to represent all messages sent to and from the Sick LD unit.

Definition at line 35 of file SickLDMessage.hh.

Constructor & Destructor Documentation

SickToolbox::SickLDMessage::SickLDMessage ( )

A default constructor.

A standard constructor

Definition at line 33 of file SickLDMessage.cc.

SickToolbox::SickLDMessage::SickLDMessage ( const uint8_t *const  payload_buffer,
const unsigned int  payload_length 
)

Another constructor.

Constructs a packet by using BuildMessage

Parameters
*payload_bufferThe payload for the packet as an array of bytes (including the header)
payload_lengthThe length of the payload array in bytes

Definition at line 45 of file SickLDMessage.cc.

SickToolbox::SickLDMessage::SickLDMessage ( const uint8_t *const  message_buffer)

Another constructor.

Constructs a packet using ParseMessage()

Parameters
*message_bufferA well-formed message to be parsed into the class' fields

Definition at line 56 of file SickLDMessage.cc.

SickToolbox::SickLDMessage::~SickLDMessage ( )

Destructor

Definition at line 151 of file SickLDMessage.cc.

Member Function Documentation

uint8_t SickToolbox::SickLDMessage::_computeXOR ( const uint8_t *const  data,
const uint32_t  length 
)
private

Compute the message checksum (single-byte XOR).

Computes the checksum of the frame. NOTE: Uses XOR of single bytes over packet payload data.

Parameters
dataThe address of the first data element in a sequence of bytes to be included in the sum
lengthThe number of byte in the data sequence

Definition at line 139 of file SickLDMessage.cc.

void SickToolbox::SickLDMessage::BuildMessage ( const uint8_t *const  payload_buffer,
const unsigned int  payload_length 
)

Constructs a Sick LD message given parameter values.

Construct a well-formed raw packet

Parameters
*payload_bufferAn address of the first byte to be copied into the message's payload
payload_lengthThe number of bytes to be copied into the message buffer

Definition at line 68 of file SickLDMessage.cc.

uint8_t SickToolbox::SickLDMessage::GetChecksum ( ) const
inline

Get the checksum for the packet

Definition at line 61 of file SickLDMessage.hh.

uint8_t SickToolbox::SickLDMessage::GetServiceCode ( ) const
inline

Get the length of the service code associated with the message

Definition at line 55 of file SickLDMessage.hh.

uint8_t SickToolbox::SickLDMessage::GetServiceSubcode ( ) const
inline

Get the service sub-code associated with the message

Definition at line 58 of file SickLDMessage.hh.

void SickToolbox::SickLDMessage::ParseMessage ( const uint8_t *const  message_buffer)
virtual

Parses a sequence of bytes into a SickLDMessage object.

Populates fields from a (well-formed) raw packet

Parameters
*message_bufferA well-formed message to be parsed into the class' fields

Implements SickToolbox::SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN >.

Definition at line 99 of file SickLDMessage.cc.

void SickToolbox::SickLDMessage::Print ( ) const
virtual

Print the message contents.

A debugging function that prints the contents of the frame.

Reimplemented from SickToolbox::SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN >.

Definition at line 122 of file SickLDMessage.cc.


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


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Tue Sep 10 2019 03:37:34