Test.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_Test_h
00002 #define _ROS_SERVICE_Test_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace rosserial_arduino
00009 {
00010 
00011 static const char TEST[] = "rosserial_arduino/Test";
00012 
00013   class TestRequest : public ros::Msg
00014   {
00015     public:
00016       const char* input;
00017 
00018     virtual int serialize(unsigned char *outbuffer) const
00019     {
00020       int offset = 0;
00021       uint32_t length_input = strlen(this->input);
00022       memcpy(outbuffer + offset, &length_input, sizeof(uint32_t));
00023       offset += 4;
00024       memcpy(outbuffer + offset, this->input, length_input);
00025       offset += length_input;
00026       return offset;
00027     }
00028 
00029     virtual int deserialize(unsigned char *inbuffer)
00030     {
00031       int offset = 0;
00032       uint32_t length_input;
00033       memcpy(&length_input, (inbuffer + offset), sizeof(uint32_t));
00034       offset += 4;
00035       for(unsigned int k= offset; k< offset+length_input; ++k){
00036           inbuffer[k-1]=inbuffer[k];
00037       }
00038       inbuffer[offset+length_input-1]=0;
00039       this->input = (char *)(inbuffer + offset-1);
00040       offset += length_input;
00041      return offset;
00042     }
00043 
00044     const char * getType(){ return TEST; };
00045     const char * getMD5(){ return "39e92f1778057359c64c7b8a7d7b19de"; };
00046 
00047   };
00048 
00049   class TestResponse : public ros::Msg
00050   {
00051     public:
00052       const char* output;
00053 
00054     virtual int serialize(unsigned char *outbuffer) const
00055     {
00056       int offset = 0;
00057       uint32_t length_output = strlen(this->output);
00058       memcpy(outbuffer + offset, &length_output, sizeof(uint32_t));
00059       offset += 4;
00060       memcpy(outbuffer + offset, this->output, length_output);
00061       offset += length_output;
00062       return offset;
00063     }
00064 
00065     virtual int deserialize(unsigned char *inbuffer)
00066     {
00067       int offset = 0;
00068       uint32_t length_output;
00069       memcpy(&length_output, (inbuffer + offset), sizeof(uint32_t));
00070       offset += 4;
00071       for(unsigned int k= offset; k< offset+length_output; ++k){
00072           inbuffer[k-1]=inbuffer[k];
00073       }
00074       inbuffer[offset+length_output-1]=0;
00075       this->output = (char *)(inbuffer + offset-1);
00076       offset += length_output;
00077      return offset;
00078     }
00079 
00080     const char * getType(){ return TEST; };
00081     const char * getMD5(){ return "0825d95fdfa2c8f4bbb4e9c74bccd3fd"; };
00082 
00083   };
00084 
00085   class Test {
00086     public:
00087     typedef TestRequest Request;
00088     typedef TestResponse Response;
00089   };
00090 
00091 }
00092 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:50