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 RequestServiceInfo.h Source File

RequestServiceInfo.h

00001 #ifndef _ROS_SERVICE_RequestServiceInfo_h
00002 #define _ROS_SERVICE_RequestServiceInfo_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 REQUESTSERVICEINFO[] = "rosserial_msgs/RequestServiceInfo";
00012 
00013   class RequestServiceInfoRequest : public ros::Msg
00014   {
00015     public:
00016       const char* service;
00017 
00018     RequestServiceInfoRequest():
00019       service("")
00020     {
00021     }
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       uint32_t length_service = strlen(this->service);
00027       memcpy(outbuffer + offset, &length_service, sizeof(uint32_t));
00028       offset += 4;
00029       memcpy(outbuffer + offset, this->service, length_service);
00030       offset += length_service;
00031       return offset;
00032     }
00033 
00034     virtual int deserialize(unsigned char *inbuffer)
00035     {
00036       int offset = 0;
00037       uint32_t length_service;
00038       memcpy(&length_service, (inbuffer + offset), sizeof(uint32_t));
00039       offset += 4;
00040       for(unsigned int k= offset; k< offset+length_service; ++k){
00041           inbuffer[k-1]=inbuffer[k];
00042       }
00043       inbuffer[offset+length_service-1]=0;
00044       this->service = (char *)(inbuffer + offset-1);
00045       offset += length_service;
00046      return offset;
00047     }
00048 
00049     const char * getType(){ return REQUESTSERVICEINFO; };
00050     const char * getMD5(){ return "1cbcfa13b08f6d36710b9af8741e6112"; };
00051 
00052   };
00053 
00054   class RequestServiceInfoResponse : public ros::Msg
00055   {
00056     public:
00057       const char* service_md5;
00058       const char* request_md5;
00059       const char* response_md5;
00060 
00061     RequestServiceInfoResponse():
00062       service_md5(""),
00063       request_md5(""),
00064       response_md5("")
00065     {
00066     }
00067 
00068     virtual int serialize(unsigned char *outbuffer) const
00069     {
00070       int offset = 0;
00071       uint32_t length_service_md5 = strlen(this->service_md5);
00072       memcpy(outbuffer + offset, &length_service_md5, sizeof(uint32_t));
00073       offset += 4;
00074       memcpy(outbuffer + offset, this->service_md5, length_service_md5);
00075       offset += length_service_md5;
00076       uint32_t length_request_md5 = strlen(this->request_md5);
00077       memcpy(outbuffer + offset, &length_request_md5, sizeof(uint32_t));
00078       offset += 4;
00079       memcpy(outbuffer + offset, this->request_md5, length_request_md5);
00080       offset += length_request_md5;
00081       uint32_t length_response_md5 = strlen(this->response_md5);
00082       memcpy(outbuffer + offset, &length_response_md5, sizeof(uint32_t));
00083       offset += 4;
00084       memcpy(outbuffer + offset, this->response_md5, length_response_md5);
00085       offset += length_response_md5;
00086       return offset;
00087     }
00088 
00089     virtual int deserialize(unsigned char *inbuffer)
00090     {
00091       int offset = 0;
00092       uint32_t length_service_md5;
00093       memcpy(&length_service_md5, (inbuffer + offset), sizeof(uint32_t));
00094       offset += 4;
00095       for(unsigned int k= offset; k< offset+length_service_md5; ++k){
00096           inbuffer[k-1]=inbuffer[k];
00097       }
00098       inbuffer[offset+length_service_md5-1]=0;
00099       this->service_md5 = (char *)(inbuffer + offset-1);
00100       offset += length_service_md5;
00101       uint32_t length_request_md5;
00102       memcpy(&length_request_md5, (inbuffer + offset), sizeof(uint32_t));
00103       offset += 4;
00104       for(unsigned int k= offset; k< offset+length_request_md5; ++k){
00105           inbuffer[k-1]=inbuffer[k];
00106       }
00107       inbuffer[offset+length_request_md5-1]=0;
00108       this->request_md5 = (char *)(inbuffer + offset-1);
00109       offset += length_request_md5;
00110       uint32_t length_response_md5;
00111       memcpy(&length_response_md5, (inbuffer + offset), sizeof(uint32_t));
00112       offset += 4;
00113       for(unsigned int k= offset; k< offset+length_response_md5; ++k){
00114           inbuffer[k-1]=inbuffer[k];
00115       }
00116       inbuffer[offset+length_response_md5-1]=0;
00117       this->response_md5 = (char *)(inbuffer + offset-1);
00118       offset += length_response_md5;
00119      return offset;
00120     }
00121 
00122     const char * getType(){ return REQUESTSERVICEINFO; };
00123     const char * getMD5(){ return "c3d6dd25b909596479fbbc6559fa6874"; };
00124 
00125   };
00126 
00127   class RequestServiceInfo {
00128     public:
00129     typedef RequestServiceInfoRequest Request;
00130     typedef RequestServiceInfoResponse Response;
00131   };
00132 
00133 }
00134 #endif