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 struct Data {
00038 Data() : docking(3) {}
00039 std::vector<uint8_t> docking;
00040 } data;
00041
00042 bool serialise(ecl::PushAndPop<unsigned char> & byteStream)
00043 {
00044 if (!(byteStream.size() > 0))
00045 {
00046 printf("kobuki_node: kobuki_dock_ir: serialise failed. empty byte stream.");
00047 return false;
00048 }
00049
00050 unsigned char length = 3;
00051 buildBytes(Header::DockInfraRed, byteStream);
00052 buildBytes(length, byteStream);
00053 buildBytes(data.docking[0], byteStream);
00054 buildBytes(data.docking[1], byteStream);
00055 buildBytes(data.docking[2], byteStream);
00056 return true;
00057 }
00058
00059 bool deserialise(ecl::PushAndPop<unsigned char> & byteStream)
00060 {
00061 if (!(byteStream.size() > 0))
00062 {
00063 printf("kobuki_node: kobuki_dock_ir: deserialise failed. empty byte stream.");
00064 return false;
00065 }
00066
00067 unsigned char header_id, length;
00068 buildVariable(header_id, byteStream);
00069 buildVariable(length, byteStream);
00070 buildVariable(data.docking[0], byteStream);
00071 buildVariable(data.docking[1], byteStream);
00072 buildVariable(data.docking[2], byteStream);
00073
00074
00075 return constrain();
00076 }
00077
00078 bool constrain()
00079 {
00080 return true;
00081 }
00082
00083 void showMe()
00084 {
00085
00086 }
00087 };
00088
00089 }
00090
00091 #endif