ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RequestMessageInfo.h Source File

RequestMessageInfo.h

00001 #ifndef _ROS_SERVICE_RequestMessageInfo_h
00002 #define _ROS_SERVICE_RequestMessageInfo_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace rosserial_msgs
00009 {
00010 
00011 static const char REQUESTMESSAGEINFO[] = "rosserial_msgs/RequestMessageInfo";
00012 
00013   class RequestMessageInfoRequest : public ros::Msg
00014   {
00015     public:
00016       const char* type;
00017 
00018     RequestMessageInfoRequest():
00019       type("")
00020     {
00021     }
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       uint32_t length_type = strlen(this->type);
00027       memcpy(outbuffer + offset, &length_type, sizeof(uint32_t));
00028       offset += 4;
00029       memcpy(outbuffer + offset, this->type, length_type);
00030       offset += length_type;
00031       return offset;
00032     }
00033 
00034     virtual int deserialize(unsigned char *inbuffer)
00035     {
00036       int offset = 0;
00037       uint32_t length_type;
00038       memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t));
00039       offset += 4;
00040       for(unsigned int k= offset; k< offset+length_type; ++k){
00041           inbuffer[k-1]=inbuffer[k];
00042       }
00043       inbuffer[offset+length_type-1]=0;
00044       this->type = (char *)(inbuffer + offset-1);
00045       offset += length_type;
00046      return offset;
00047     }
00048 
00049     const char * getType(){ return REQUESTMESSAGEINFO; };
00050     const char * getMD5(){ return "dc67331de85cf97091b7d45e5c64ab75"; };
00051 
00052   };
00053 
00054   class RequestMessageInfoResponse : public ros::Msg
00055   {
00056     public:
00057       const char* md5;
00058       const char* definition;
00059 
00060     RequestMessageInfoResponse():
00061       md5(""),
00062       definition("")
00063     {
00064     }
00065 
00066     virtual int serialize(unsigned char *outbuffer) const
00067     {
00068       int offset = 0;
00069       uint32_t length_md5 = strlen(this->md5);
00070       memcpy(outbuffer + offset, &length_md5, sizeof(uint32_t));
00071       offset += 4;
00072       memcpy(outbuffer + offset, this->md5, length_md5);
00073       offset += length_md5;
00074       uint32_t length_definition = strlen(this->definition);
00075       memcpy(outbuffer + offset, &length_definition, sizeof(uint32_t));
00076       offset += 4;
00077       memcpy(outbuffer + offset, this->definition, length_definition);
00078       offset += length_definition;
00079       return offset;
00080     }
00081 
00082     virtual int deserialize(unsigned char *inbuffer)
00083     {
00084       int offset = 0;
00085       uint32_t length_md5;
00086       memcpy(&length_md5, (inbuffer + offset), sizeof(uint32_t));
00087       offset += 4;
00088       for(unsigned int k= offset; k< offset+length_md5; ++k){
00089           inbuffer[k-1]=inbuffer[k];
00090       }
00091       inbuffer[offset+length_md5-1]=0;
00092       this->md5 = (char *)(inbuffer + offset-1);
00093       offset += length_md5;
00094       uint32_t length_definition;
00095       memcpy(&length_definition, (inbuffer + offset), sizeof(uint32_t));
00096       offset += 4;
00097       for(unsigned int k= offset; k< offset+length_definition; ++k){
00098           inbuffer[k-1]=inbuffer[k];
00099       }
00100       inbuffer[offset+length_definition-1]=0;
00101       this->definition = (char *)(inbuffer + offset-1);
00102       offset += length_definition;
00103      return offset;
00104     }
00105 
00106     const char * getType(){ return REQUESTMESSAGEINFO; };
00107     const char * getMD5(){ return "fe452186a069bed40f09b8628fe5eac8"; };
00108 
00109   };
00110 
00111   class RequestMessageInfo {
00112     public:
00113     typedef RequestMessageInfoRequest Request;
00114     typedef RequestMessageInfoResponse Response;
00115   };
00116 
00117 }
00118 #endif