Go to the documentation of this file.00001
00016 #ifndef SICK_LD_MESSAGE_HH
00017 #define SICK_LD_MESSAGE_HH
00018
00019
00020 #include <string.h>
00021 #include <arpa/inet.h>
00022 #include "SickMessage.hh"
00023
00024 #define SICK_LD_MSG_HEADER_LEN (8) ///< Sick LD message header length in bytes
00025 #define SICK_LD_MSG_PAYLOAD_MAX_LEN (5816) ///< Sick LD maximum payload length
00026 #define SICK_LD_MSG_TRAILER_LEN (1) ///< Sick LD length of the message trailer
00027
00028
00029 namespace SickToolbox {
00030
00035 class SickLDMessage : public SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN > {
00036
00037 public:
00038
00040 SickLDMessage( );
00041
00043 SickLDMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
00044
00046 SickLDMessage( const uint8_t * const message_buffer );
00047
00049 void BuildMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
00050
00052 void ParseMessage( const uint8_t * const message_buffer );
00053
00055 uint8_t GetServiceCode( ) const { return _message_buffer[8]; }
00056
00058 uint8_t GetServiceSubcode( ) const { return _message_buffer[9]; }
00059
00061 uint8_t GetChecksum( ) const { return _message_buffer[_message_length-1]; }
00062
00064 void Print( ) const;
00065
00067 ~SickLDMessage( );
00068
00069 private:
00070
00074 uint8_t _computeXOR( const uint8_t * const data, const uint32_t length );
00075
00076 };
00077
00078 }
00079
00080 #endif