Go to the documentation of this file.00001
00009
00010
00011
00012
00013 #ifndef KOBUKI_DOCK_IR_DATA_HPP__
00014 #define KOBUKI_DOCK_IR_DATA_HPP__
00015
00016
00017
00018
00019
00020 #include "../packet_handler/payload_base.hpp"
00021 #include "../packet_handler/payload_headers.hpp"
00022
00023
00024
00025
00026
00027 namespace kobuki
00028 {
00029
00030
00031
00032
00033
00034 class DockIR : public packet_handler::payloadBase
00035 {
00036 public:
00037 DockIR() : packet_handler::payloadBase(false, 3) {};
00038 struct Data {
00039 Data() : docking(3) {}
00040 std::vector<uint8_t> docking;
00041 } data;
00042
00043 bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
00044 {
00045 buildBytes(Header::DockInfraRed, byteStream);
00046 buildBytes(length, byteStream);
00047 buildBytes(data.docking[0], byteStream);
00048 buildBytes(data.docking[1], byteStream);
00049 buildBytes(data.docking[2], byteStream);
00050 return true;
00051 }
00052
00053 bool deserialise(ecl::PushAndPop<unsigned char> & byteStream)
00054 {
00055 if (byteStream.size() < length+2)
00056 {
00057
00058 return false;
00059 }
00060
00061 unsigned char header_id, length_packed;
00062 buildVariable(header_id, byteStream);
00063 buildVariable(length_packed, byteStream);
00064 if( header_id != Header::DockInfraRed ) return false;
00065 if( length_packed != length ) return false;
00066
00067 buildVariable(data.docking[0], byteStream);
00068 buildVariable(data.docking[1], byteStream);
00069 buildVariable(data.docking[2], byteStream);
00070
00071
00072 return constrain();
00073 }
00074
00075 bool constrain()
00076 {
00077 return true;
00078 }
00079
00080 void showMe()
00081 {
00082
00083 }
00084 };
00085
00086 }
00087
00088 #endif