Public Member Functions | Protected Attributes | Private Member Functions
SickToolbox::SickPLSMessage Class Reference

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

#include <SickPLSMessage.hh>

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

List of all members.

Public Member Functions

void BuildMessage (uint8_t dest_address, const uint8_t *const payload_buffer, const unsigned int payload_length)
 Consructs a message object from given parameter values.
void Clear ()
 Reset all internal fields and buffers associated with the object.
uint16_t GetChecksum () const
uint8_t GetCommandCode () const
uint8_t GetDestAddress () const
uint8_t GetStatusByte () const
void ParseMessage (const uint8_t *const message_buffer)
 Parses a sequence of bytes into a well-formed message.
void Print () const
 Print the message contents.
 SickPLSMessage ()
 A default constructor.
 SickPLSMessage (const uint8_t dest_address, const uint8_t *const payload_buffer, const unsigned int payload_length)
 A constructor for building a message from the given parameter values.
 SickPLSMessage (uint8_t *const message_buffer)
 A constructor for parsing a byte sequence into a message object.
 ~SickPLSMessage ()

Protected Attributes

uint16_t _checksum

Private Member Functions

uint16_t _computeCRC (uint8_t *data, unsigned int data_length) const
 Computes the CRC16 of the given data buffer.

Detailed Description

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

This class helps to construct messages to be sent to the Sick. It also provides a container for received messages to be parsed into.

Definition at line 43 of file SickPLSMessage.hh.


Constructor & Destructor Documentation

A default constructor.

Default constructor. Constructs an empty message (not well-formed!).

Definition at line 33 of file SickPLSMessage.cc.

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

A constructor for building a message from the given parameter values.

Constructs a frame by using BuildMessage().

Parameters:
dest_addressThe source address of the message
payload_bufferThe payload of the message as an array of bytes (including the command code)
payload_lengthThe length of the payload array in bytes

Definition at line 46 of file SickPLSMessage.cc.

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

A constructor for parsing a byte sequence into a message object.

Constructs a frame using ParseMessage().

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

Definition at line 58 of file SickPLSMessage.cc.

Destructor

Definition at line 191 of file SickPLSMessage.cc.


Member Function Documentation

uint16_t SickToolbox::SickPLSMessage::_computeCRC ( uint8_t *  data,
unsigned int  data_length 
) const [private]

Computes the CRC16 of the given data buffer.

Computes the checksum of the frame.

Parameters:
dataAn array of bytes whose checksum to compute
lenThe length of the data array
Returns:
CRC16 computed over given data buffer

Definition at line 167 of file SickPLSMessage.cc.

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

Consructs a message object from given parameter values.

Constructs a well-formed raw frame from input fields.

Parameters:
dest_addressThe destination address of the frame
*payload_bufferThe payload for the frame as an array of bytes (including the command code)
payload_lengthThe length of the payload array in bytes

Definition at line 72 of file SickPLSMessage.cc.

Reset all internal fields and buffers associated with the object.

Reset the data associated with this message (for initialization purposes)

Reimplemented from SickToolbox::SickMessage< SICK_PLS_MSG_HEADER_LEN, SICK_PLS_MSG_PAYLOAD_MAX_LEN, SICK_PLS_MSG_TRAILER_LEN >.

Definition at line 134 of file SickPLSMessage.cc.

uint16_t SickToolbox::SickPLSMessage::GetChecksum ( ) const [inline]

Gets the checksum for the message.

Definition at line 74 of file SickPLSMessage.hh.

uint8_t SickToolbox::SickPLSMessage::GetCommandCode ( ) const [inline]

Gets the command code associated with the message

Definition at line 68 of file SickPLSMessage.hh.

uint8_t SickToolbox::SickPLSMessage::GetDestAddress ( ) const [inline]

Gets the address of the frame.

Definition at line 65 of file SickPLSMessage.hh.

uint8_t SickToolbox::SickPLSMessage::GetStatusByte ( ) const [inline]

Gets the status byte from an LMS response message (NOTE: only applies to Sick LMS response telegrams!)

Definition at line 71 of file SickPLSMessage.hh.

void SickToolbox::SickPLSMessage::ParseMessage ( const uint8_t *const  message_buffer) [virtual]

Parses a sequence of bytes into a well-formed message.

Populates fields from a (well-formed) raw frame.

Parameters:
*message_bufferThe buffer containing the source message

Implements SickToolbox::SickMessage< SICK_PLS_MSG_HEADER_LEN, SICK_PLS_MSG_PAYLOAD_MAX_LEN, SICK_PLS_MSG_TRAILER_LEN >.

Definition at line 105 of file SickPLSMessage.cc.

void SickToolbox::SickPLSMessage::Print ( ) const [virtual]

Print the message contents.

A debugging function that prints the contents of the message.

Reimplemented from SickToolbox::SickMessage< SICK_PLS_MSG_HEADER_LEN, SICK_PLS_MSG_PAYLOAD_MAX_LEN, SICK_PLS_MSG_TRAILER_LEN >.

Definition at line 148 of file SickPLSMessage.cc.


Member Data Documentation

The checksum (CRC16)

Definition at line 88 of file SickPLSMessage.hh.


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


asr_mild_base_laserscanner
Author(s): Aumann Florian, Borella Jocelyn, Dehmani Souheil, Marek Felix, Reckling Reno
autogenerated on Thu Jun 6 2019 21:02:16