This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MuxAdd.h Source File

MuxAdd.h

00001 #ifndef _ROS_SERVICE_MuxAdd_h
00002 #define _ROS_SERVICE_MuxAdd_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 MUXADD[] = "topic_tools/MuxAdd";
00012 
00013   class MuxAddRequest : public ros::Msg
00014   {
00015     public:
00016       char * topic;
00017 
00018     virtual int serialize(unsigned char *outbuffer) const
00019     {
00020       int offset = 0;
00021       uint32_t * length_topic = (uint32_t *)(outbuffer + offset);
00022       *length_topic = strlen( (const char*) this->topic);
00023       offset += 4;
00024       memcpy(outbuffer + offset, this->topic, *length_topic);
00025       offset += *length_topic;
00026       return offset;
00027     }
00028 
00029     virtual int deserialize(unsigned char *inbuffer)
00030     {
00031       int offset = 0;
00032       uint32_t length_topic = *(uint32_t *)(inbuffer + offset);
00033       offset += 4;
00034       for(unsigned int k= offset; k< offset+length_topic; ++k){
00035           inbuffer[k-1]=inbuffer[k];
00036       }
00037       inbuffer[offset+length_topic-1]=0;
00038       this->topic = (char *)(inbuffer + offset-1);
00039       offset += length_topic;
00040      return offset;
00041     }
00042 
00043     virtual const char * getType(){ return MUXADD; };
00044     virtual const char * getMD5(){ return "d8f94bae31b356b24d0427f80426d0c3"; };
00045 
00046   };
00047 
00048   class MuxAddResponse : public ros::Msg
00049   {
00050     public:
00051 
00052     virtual int serialize(unsigned char *outbuffer) const
00053     {
00054       int offset = 0;
00055       return offset;
00056     }
00057 
00058     virtual int deserialize(unsigned char *inbuffer)
00059     {
00060       int offset = 0;
00061      return offset;
00062     }
00063 
00064     virtual const char * getType(){ return MUXADD; };
00065     virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00066 
00067   };
00068 
00069   class MuxAdd {
00070     public:
00071     typedef MuxAddRequest Request;
00072     typedef MuxAddResponse Response;
00073   };
00074 
00075 }
00076 #endif