catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CheckCircle.h Source File

CheckCircle.h

00001 #ifndef _ROS_SERVICE_CheckCircle_h
00002 #define _ROS_SERVICE_CheckCircle_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "geometry_msgs/Point.h"
00008 
00009 namespace jsk_recognition_msgs
00010 {
00011 
00012 static const char CHECKCIRCLE[] = "jsk_recognition_msgs/CheckCircle";
00013 
00014   class CheckCircleRequest : public ros::Msg
00015   {
00016     public:
00017       typedef geometry_msgs::Point _point_type;
00018       _point_type point;
00019 
00020     CheckCircleRequest():
00021       point()
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       offset += this->point.serialize(outbuffer + offset);
00029       return offset;
00030     }
00031 
00032     virtual int deserialize(unsigned char *inbuffer)
00033     {
00034       int offset = 0;
00035       offset += this->point.deserialize(inbuffer + offset);
00036      return offset;
00037     }
00038 
00039     virtual const char * getType(){ return CHECKCIRCLE; };
00040     virtual const char * getMD5(){ return "a7c84ff13976aa04656e56e300124444"; };
00041 
00042   };
00043 
00044   class CheckCircleResponse : public ros::Msg
00045   {
00046     public:
00047       typedef bool _clicked_type;
00048       _clicked_type clicked;
00049       typedef int32_t _index_type;
00050       _index_type index;
00051       typedef const char* _msg_type;
00052       _msg_type msg;
00053 
00054     CheckCircleResponse():
00055       clicked(0),
00056       index(0),
00057       msg("")
00058     {
00059     }
00060 
00061     virtual int serialize(unsigned char *outbuffer) const
00062     {
00063       int offset = 0;
00064       union {
00065         bool real;
00066         uint8_t base;
00067       } u_clicked;
00068       u_clicked.real = this->clicked;
00069       *(outbuffer + offset + 0) = (u_clicked.base >> (8 * 0)) & 0xFF;
00070       offset += sizeof(this->clicked);
00071       union {
00072         int32_t real;
00073         uint32_t base;
00074       } u_index;
00075       u_index.real = this->index;
00076       *(outbuffer + offset + 0) = (u_index.base >> (8 * 0)) & 0xFF;
00077       *(outbuffer + offset + 1) = (u_index.base >> (8 * 1)) & 0xFF;
00078       *(outbuffer + offset + 2) = (u_index.base >> (8 * 2)) & 0xFF;
00079       *(outbuffer + offset + 3) = (u_index.base >> (8 * 3)) & 0xFF;
00080       offset += sizeof(this->index);
00081       uint32_t length_msg = strlen(this->msg);
00082       varToArr(outbuffer + offset, length_msg);
00083       offset += 4;
00084       memcpy(outbuffer + offset, this->msg, length_msg);
00085       offset += length_msg;
00086       return offset;
00087     }
00088 
00089     virtual int deserialize(unsigned char *inbuffer)
00090     {
00091       int offset = 0;
00092       union {
00093         bool real;
00094         uint8_t base;
00095       } u_clicked;
00096       u_clicked.base = 0;
00097       u_clicked.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00098       this->clicked = u_clicked.real;
00099       offset += sizeof(this->clicked);
00100       union {
00101         int32_t real;
00102         uint32_t base;
00103       } u_index;
00104       u_index.base = 0;
00105       u_index.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00106       u_index.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00107       u_index.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00108       u_index.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00109       this->index = u_index.real;
00110       offset += sizeof(this->index);
00111       uint32_t length_msg;
00112       arrToVar(length_msg, (inbuffer + offset));
00113       offset += 4;
00114       for(unsigned int k= offset; k< offset+length_msg; ++k){
00115           inbuffer[k-1]=inbuffer[k];
00116       }
00117       inbuffer[offset+length_msg-1]=0;
00118       this->msg = (char *)(inbuffer + offset-1);
00119       offset += length_msg;
00120      return offset;
00121     }
00122 
00123     virtual const char * getType(){ return CHECKCIRCLE; };
00124     virtual const char * getMD5(){ return "94ed41c732187b6ea58431df72ab10b2"; };
00125 
00126   };
00127 
00128   class CheckCircle {
00129     public:
00130     typedef CheckCircleRequest Request;
00131     typedef CheckCircleResponse Response;
00132   };
00133 
00134 }
00135 #endif