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

DemuxSelect.h

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