SickLDMessage.hh
Go to the documentation of this file.
1 
16 #ifndef SICK_LD_MESSAGE_HH
17 #define SICK_LD_MESSAGE_HH
18 
19 /* Definition dependencies */
20 #include <string.h>
21 #include <arpa/inet.h>
22 #include "SickMessage.hh"
23 
24 #define SICK_LD_MSG_HEADER_LEN (8)
25 #define SICK_LD_MSG_PAYLOAD_MAX_LEN (5816)
26 #define SICK_LD_MSG_TRAILER_LEN (1)
27 
28 /* Associate the namespace */
29 namespace SickToolbox {
30 
35  class SickLDMessage : public SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN > {
36 
37  public:
38 
40  SickLDMessage( );
41 
43  SickLDMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
44 
46  SickLDMessage( const uint8_t * const message_buffer );
47 
49  void BuildMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
50 
52  void ParseMessage( const uint8_t * const message_buffer );
53 
55  uint8_t GetServiceCode( ) const { return _message_buffer[8]; }
56 
58  uint8_t GetServiceSubcode( ) const { return _message_buffer[9]; }
59 
61  uint8_t GetChecksum( ) const { return _message_buffer[_message_length-1]; }
62 
64  void Print( ) const;
65 
67  ~SickLDMessage( );
68 
69  private:
70 
74  uint8_t _computeXOR( const uint8_t * const data, const uint32_t length );
75 
76  };
77 
78 } /* namespace SickToolbox */
79 
80 #endif /* SICK_LD_MESSAGE_HH */
void ParseMessage(const uint8_t *const message_buffer)
Parses a sequence of bytes into a SickLDMessage object.
void BuildMessage(const uint8_t *const payload_buffer, const unsigned int payload_length)
Constructs a Sick LD message given parameter values.
uint8_t GetServiceSubcode() const
uint8_t GetServiceCode() const
SickLDMessage()
A default constructor.
A class to represent all messages sent to and from the Sick LD unit.
void Print() const
Print the message contents.
uint8_t _computeXOR(const uint8_t *const data, const uint32_t length)
Compute the message checksum (single-byte XOR).
Defines the abstract parent class for all Sick messages.
Provides an abstract parent for all Sick messages.
Definition: SickMessage.hh:32
Encapsulates the Sick LIDAR Matlab/C++ toolbox.
Definition: SickLD.cc:44
uint8_t GetChecksum() const


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