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   struct Data {
00038     uint32_t udid0;
00039     uint32_t udid1;
00040     uint32_t udid2;
00041   } data;
00042 
00043   // methods
00044   bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
00045   {
00046     if (!(byteStream.size() > 0))
00047     {
00048       printf("kobuki_node: kobuki_udid: serialise failed. empty byte stream.");
00049       return false;
00050     }
00051 
00052     unsigned char length = 12;
00053     buildBytes(Header::UniqueDeviceID, byteStream);
00054     buildBytes(length, byteStream);
00055     buildBytes(data.udid0, byteStream);
00056     buildBytes(data.udid1, byteStream);
00057     buildBytes(data.udid2, byteStream);
00058     return true;
00059   }
00060 
00061   bool deserialise(ecl::PushAndPop<unsigned char> & byteStream)
00062   {
00063     if (!(byteStream.size() > 0))
00064     {
00065       printf("kobuki_node: kobuki_udid: deserialise failed. empty byte stream.");
00066       return false;
00067     }
00068 
00069     unsigned char header_id, length;
00070     buildVariable(header_id, byteStream);
00071     buildVariable(length, byteStream);
00072     buildVariable(data.udid0, byteStream);
00073     buildVariable(data.udid1, byteStream);
00074     buildVariable(data.udid2, byteStream);
00075 
00076     //showMe();
00077     return constrain();
00078   }
00079 
00080   bool constrain()
00081   {
00082     return true;
00083   }
00084 
00085   void showMe()
00086   {
00087     //printf("--[%02x || %03d | %03d | %03d]\n", data.bump, acc[2], acc[1], acc[0] );
00088   }
00089 };
00090 
00091 } // namespace kobuki
00092 
00093 #endif /* KOBUKI_UDID_DATA_HPP__ */
00094 


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Mon Oct 6 2014 01:31:10