catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SwitchTopic.h Source File

SwitchTopic.h

00001 #ifndef _ROS_SERVICE_SwitchTopic_h
00002 #define _ROS_SERVICE_SwitchTopic_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace jsk_recognition_msgs
00009 {
00010 
00011 static const char SWITCHTOPIC[] = "jsk_recognition_msgs/SwitchTopic";
00012 
00013   class SwitchTopicRequest : public ros::Msg
00014   {
00015     public:
00016       typedef const char* _camera_info_type;
00017       _camera_info_type camera_info;
00018       typedef const char* _points_type;
00019       _points_type points;
00020 
00021     SwitchTopicRequest():
00022       camera_info(""),
00023       points("")
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       uint32_t length_camera_info = strlen(this->camera_info);
00031       varToArr(outbuffer + offset, length_camera_info);
00032       offset += 4;
00033       memcpy(outbuffer + offset, this->camera_info, length_camera_info);
00034       offset += length_camera_info;
00035       uint32_t length_points = strlen(this->points);
00036       varToArr(outbuffer + offset, length_points);
00037       offset += 4;
00038       memcpy(outbuffer + offset, this->points, length_points);
00039       offset += length_points;
00040       return offset;
00041     }
00042 
00043     virtual int deserialize(unsigned char *inbuffer)
00044     {
00045       int offset = 0;
00046       uint32_t length_camera_info;
00047       arrToVar(length_camera_info, (inbuffer + offset));
00048       offset += 4;
00049       for(unsigned int k= offset; k< offset+length_camera_info; ++k){
00050           inbuffer[k-1]=inbuffer[k];
00051       }
00052       inbuffer[offset+length_camera_info-1]=0;
00053       this->camera_info = (char *)(inbuffer + offset-1);
00054       offset += length_camera_info;
00055       uint32_t length_points;
00056       arrToVar(length_points, (inbuffer + offset));
00057       offset += 4;
00058       for(unsigned int k= offset; k< offset+length_points; ++k){
00059           inbuffer[k-1]=inbuffer[k];
00060       }
00061       inbuffer[offset+length_points-1]=0;
00062       this->points = (char *)(inbuffer + offset-1);
00063       offset += length_points;
00064      return offset;
00065     }
00066 
00067     virtual const char * getType(){ return SWITCHTOPIC; };
00068     virtual const char * getMD5(){ return "e4a276b5a9b7b8fd97441d0fd991bdb9"; };
00069 
00070   };
00071 
00072   class SwitchTopicResponse : public ros::Msg
00073   {
00074     public:
00075 
00076     SwitchTopicResponse()
00077     {
00078     }
00079 
00080     virtual int serialize(unsigned char *outbuffer) const
00081     {
00082       int offset = 0;
00083       return offset;
00084     }
00085 
00086     virtual int deserialize(unsigned char *inbuffer)
00087     {
00088       int offset = 0;
00089      return offset;
00090     }
00091 
00092     virtual const char * getType(){ return SWITCHTOPIC; };
00093     virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00094 
00095   };
00096 
00097   class SwitchTopic {
00098     public:
00099     typedef SwitchTopicRequest Request;
00100     typedef SwitchTopicResponse Response;
00101   };
00102 
00103 }
00104 #endif