00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef SICK_LD_MESSAGE_HH
00017 #define SICK_LD_MESSAGE_HH
00018
00019
00020 #include "SickConfig.hh"
00021
00022
00023 #include <string.h>
00024 #include <arpa/inet.h>
00025 #include "SickMessage.hh"
00026
00027 #define SICK_LD_MSG_HEADER_LEN (8)
00028 #define SICK_LD_MSG_PAYLOAD_MAX_LEN (5816)
00029 #define SICK_LD_MSG_TRAILER_LEN (1)
00030
00031
00032 namespace SickToolbox {
00033
00034
00035
00036
00037
00038 class SickLDMessage : public SickMessage< SICK_LD_MSG_HEADER_LEN, SICK_LD_MSG_PAYLOAD_MAX_LEN, SICK_LD_MSG_TRAILER_LEN > {
00039
00040 public:
00041
00042
00043 SickLDMessage( );
00044
00045
00046 SickLDMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
00047
00048
00049 SickLDMessage( const uint8_t * const message_buffer );
00050
00051
00052 void BuildMessage( const uint8_t * const payload_buffer, const unsigned int payload_length );
00053
00054
00055 void ParseMessage( const uint8_t * const message_buffer );
00056
00057
00058 uint8_t GetServiceCode( ) const { return _message_buffer[8]; }
00059
00060
00061 uint8_t GetServiceSubcode( ) const { return _message_buffer[9]; }
00062
00063
00064 uint8_t GetChecksum( ) const { return _message_buffer[_message_length-1]; }
00065
00066
00067 void Print( ) const;
00068
00069
00070 ~SickLDMessage( );
00071
00072 private:
00073
00074
00075
00076
00077 uint8_t _computeXOR( const uint8_t * const data, const uint32_t length );
00078
00079 };
00080
00081 }
00082
00083 #endif