ParseTCPPacket.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 
00024 // -- END LICENSE BLOCK ------------------------------------------------
00025 
00026 //----------------------------------------------------------------------
00033 //----------------------------------------------------------------------
00034 
00035 #ifndef SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSETCPPACKET_H
00036 #define SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSETCPPACKET_H
00037 
00038 #include <sick_safetyscanners/datastructure/Data.h>
00039 #include <sick_safetyscanners/datastructure/DerivedValues.h>
00040 #include <sick_safetyscanners/datastructure/PacketBuffer.h>
00041 
00042 #include <sick_safetyscanners/data_processing/ReadWriteHelper.h>
00043 
00044 namespace sick {
00045 
00046 namespace cola2 {
00050 class Command;
00051 } // namespace cola2
00052 
00053 namespace data_processing {
00054 
00055 
00059 class ParseTCPPacket
00060 {
00061 public:
00065   ParseTCPPacket();
00066 
00075   bool parseTCPSequence(const datastructure::PacketBuffer& buffer,
00076                         sick::cola2::Command& command) const;
00077 
00085   uint32_t getExpectedPacketLength(const datastructure::PacketBuffer& buffer);
00086 
00094   uint16_t getRequestID(const datastructure::PacketBuffer& buffer) const;
00095 
00096 private:
00097   std::shared_ptr<sick::data_processing::ReadWriteHelper> m_reader_ptr;
00098   uint32_t readSTx(const uint8_t*& data_ptr) const;
00099   uint32_t readLength(const uint8_t*& data_ptr) const;
00100   uint16_t readRequestID(const uint8_t*& data_ptr) const;
00101   uint8_t readHubCntr(const uint8_t*& data_ptr) const;
00102   uint8_t readNoC(const uint8_t*& data_ptr) const;
00103   uint32_t readSessionID(const uint8_t*& data_ptr) const;
00104   uint8_t readCommandType(const uint8_t*& data_ptr) const;
00105   uint8_t readCommandMode(const uint8_t*& data_ptr) const;
00106   uint16_t readErrorCode(const uint8_t*& data_ptr) const;
00107   void readData(const datastructure::PacketBuffer& buffer, std::vector<uint8_t>& byteVector) const;
00108   void setCommandValuesFromPacket(const sick::datastructure::PacketBuffer& buffer,
00109                                   sick::cola2::Command& command) const;
00110 };
00111 
00112 } // namespace data_processing
00113 } // namespace sick
00114 
00115 #endif // SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSETCPPACKET_H


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Tue May 7 2019 03:27:36