unique_device_id.hpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Preprocessor
00011 *****************************************************************************/
00012 
00013 #ifndef KOBUKI_UDID_DATA_HPP__
00014 #define KOBUKI_UDID_DATA_HPP__
00015 
00016 /*****************************************************************************
00017 ** Include
00018 *****************************************************************************/
00019 
00020 #include "../packet_handler/payload_base.hpp"
00021 #include "../packet_handler/payload_headers.hpp"
00022 
00023 /*****************************************************************************
00024 ** Namespace
00025 *****************************************************************************/
00026 
00027 namespace kobuki
00028 {
00029 
00030 /*****************************************************************************
00031 ** Interface
00032 *****************************************************************************/
00033 
00034 class UniqueDeviceID : public packet_handler::payloadBase
00035 {
00036 public:
00037   UniqueDeviceID() : packet_handler::payloadBase(false, 12) {};
00038 
00039   struct Data {
00040     uint32_t udid0;
00041     uint32_t udid1;
00042     uint32_t udid2;
00043   } data;
00044 
00045   // methods
00046   bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
00047   {
00048     buildBytes(Header::UniqueDeviceID, byteStream);
00049     buildBytes(length, byteStream);
00050     buildBytes(data.udid0, byteStream);
00051     buildBytes(data.udid1, byteStream);
00052     buildBytes(data.udid2, byteStream);
00053     return true;
00054   }
00055 
00056   bool deserialise(ecl::PushAndPop<unsigned char> & byteStream)
00057   {
00058     if (byteStream.size() < length+2)
00059     {
00060       //std::cout << "kobuki_node: kobuki_udid: deserialise failed. not enough byte stream." << std::endl;
00061       return false;
00062     }
00063 
00064     unsigned char header_id, length_packed;
00065     buildVariable(header_id, byteStream);
00066     buildVariable(length_packed, byteStream);
00067     if( header_id != Header::UniqueDeviceID ) return false;
00068     if( length_packed != length ) return false;
00069 
00070     buildVariable(data.udid0, byteStream);
00071     buildVariable(data.udid1, byteStream);
00072     buildVariable(data.udid2, byteStream);
00073 
00074     //showMe();
00075     return constrain();
00076   }
00077 
00078   bool constrain()
00079   {
00080     return true;
00081   }
00082 
00083   void showMe()
00084   {
00085   }
00086 };
00087 
00088 } // namespace kobuki
00089 
00090 #endif /* KOBUKI_UDID_DATA_HPP__ */
00091 


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Thu Aug 27 2015 13:43:58