Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SetBool.h Source File

SetBool.h

00001 #ifndef _ROS_SERVICE_SetBool_h
00002 #define _ROS_SERVICE_SetBool_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace std_srvs
00009 {
00010 
00011 static const char SETBOOL[] = "std_srvs/SetBool";
00012 
00013   class SetBoolRequest : public ros::Msg
00014   {
00015     public:
00016       typedef bool _data_type;
00017       _data_type data;
00018 
00019     SetBoolRequest():
00020       data(0)
00021     {
00022     }
00023 
00024     virtual int serialize(unsigned char *outbuffer) const
00025     {
00026       int offset = 0;
00027       union {
00028         bool real;
00029         uint8_t base;
00030       } u_data;
00031       u_data.real = this->data;
00032       *(outbuffer + offset + 0) = (u_data.base >> (8 * 0)) & 0xFF;
00033       offset += sizeof(this->data);
00034       return offset;
00035     }
00036 
00037     virtual int deserialize(unsigned char *inbuffer)
00038     {
00039       int offset = 0;
00040       union {
00041         bool real;
00042         uint8_t base;
00043       } u_data;
00044       u_data.base = 0;
00045       u_data.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00046       this->data = u_data.real;
00047       offset += sizeof(this->data);
00048      return offset;
00049     }
00050 
00051     const char * getType(){ return SETBOOL; };
00052     const char * getMD5(){ return "8b94c1b53db61fb6aed406028ad6332a"; };
00053 
00054   };
00055 
00056   class SetBoolResponse : public ros::Msg
00057   {
00058     public:
00059       typedef bool _success_type;
00060       _success_type success;
00061       typedef const char* _message_type;
00062       _message_type message;
00063 
00064     SetBoolResponse():
00065       success(0),
00066       message("")
00067     {
00068     }
00069 
00070     virtual int serialize(unsigned char *outbuffer) const
00071     {
00072       int offset = 0;
00073       union {
00074         bool real;
00075         uint8_t base;
00076       } u_success;
00077       u_success.real = this->success;
00078       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00079       offset += sizeof(this->success);
00080       uint32_t length_message = strlen(this->message);
00081       varToArr(outbuffer + offset, length_message);
00082       offset += 4;
00083       memcpy(outbuffer + offset, this->message, length_message);
00084       offset += length_message;
00085       return offset;
00086     }
00087 
00088     virtual int deserialize(unsigned char *inbuffer)
00089     {
00090       int offset = 0;
00091       union {
00092         bool real;
00093         uint8_t base;
00094       } u_success;
00095       u_success.base = 0;
00096       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00097       this->success = u_success.real;
00098       offset += sizeof(this->success);
00099       uint32_t length_message;
00100       arrToVar(length_message, (inbuffer + offset));
00101       offset += 4;
00102       for(unsigned int k= offset; k< offset+length_message; ++k){
00103           inbuffer[k-1]=inbuffer[k];
00104       }
00105       inbuffer[offset+length_message-1]=0;
00106       this->message = (char *)(inbuffer + offset-1);
00107       offset += length_message;
00108      return offset;
00109     }
00110 
00111     const char * getType(){ return SETBOOL; };
00112     const char * getMD5(){ return "937c9679a518e3a18d831e57125ea522"; };
00113 
00114   };
00115 
00116   class SetBool {
00117     public:
00118     typedef SetBoolRequest Request;
00119     typedef SetBoolResponse Response;
00120   };
00121 
00122 }
00123 #endif