SickLMS2xxMessage.hh
Go to the documentation of this file.
1 
16 #ifndef SICK_LMS_2XX_MESSAGE_HH
17 #define SICK_LMS_2XX_MESSAGE_HH
18 
19 /* Definition dependencies */
20 #include <string.h>
21 #include <netinet/in.h>
22 #include "SickMessage.hh"
23 #include "SickException.hh"
24 
25 #define CRC16_GEN_POL 0x8005
26 
27 
28 #define MKSHORT(a,b) ((unsigned short) (a) | ((unsigned short)(b) << 8))
29 
30 #define SICK_LMS_2XX_MSG_HEADER_LEN (4)
31 #define SICK_LMS_2XX_MSG_PAYLOAD_MAX_LEN (812)
32 #define SICK_LMS_2XX_MSG_TRAILER_LEN (2)
33 
34 /* Associate the namespace */
35 namespace SickToolbox {
36 
43  class SickLMS2xxMessage : public SickMessage< SICK_LMS_2XX_MSG_HEADER_LEN, SICK_LMS_2XX_MSG_PAYLOAD_MAX_LEN, SICK_LMS_2XX_MSG_TRAILER_LEN >
44  {
45 
46  public:
47 
50 
52  SickLMS2xxMessage( const uint8_t dest_address, const uint8_t * const payload_buffer, const unsigned int payload_length );
53 
55  SickLMS2xxMessage( uint8_t * const message_buffer );
56 
58  void BuildMessage( uint8_t dest_address, const uint8_t * const payload_buffer,
59  const unsigned int payload_length );
60 
62  void ParseMessage( const uint8_t * const message_buffer );
63 
65  uint8_t GetDestAddress( ) const { return _message_buffer[1]; }
66 
69 
72 
74  uint16_t GetChecksum( ) const { return _checksum; }
75 
77  void Clear( );
78 
80  void Print( ) const;
81 
84 
85  protected:
86 
88  uint16_t _checksum;
89 
90  private:
91 
93  uint16_t _computeCRC( uint8_t * data, unsigned int data_length ) const;
94 
95  };
96 
97 } /* namespace SickToolbox */
98 
99 #endif //SICK_LMS_2XX_MESSAGE_HH
uint16_t _computeCRC(uint8_t *data, unsigned int data_length) const
Computes the CRC16 of the given data buffer.
Contains some simple exception classes.
void Clear()
Reset all internal fields and buffers associated with the object.
void ParseMessage(const uint8_t *const message_buffer)
Parses a sequence of bytes into a well-formed message.
Defines the abstract parent class for all Sick messages.
SickLMS2xxMessage()
A default constructor.
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.
Provides an abstract parent for all Sick messages.
Definition: SickMessage.hh:32
void Print() const
Print the message contents.
Encapsulates the Sick LIDAR Matlab/C++ toolbox.
Definition: SickLD.cc:44
A class to represent all messages sent to and from the Sick LMS 2xx.


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