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

Dependencies:   rosserial_mbed_lib mbed Servo

Committer:
nucho
Date:
Sat Nov 12 23:53:04 2011 +0000
Revision:
3:dff241b66f84
This program supported the revision of 167 of rosserial.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 3:dff241b66f84 1 #ifndef _ROS_SERVICE_MuxDelete_h
nucho 3:dff241b66f84 2 #define _ROS_SERVICE_MuxDelete_h
nucho 3:dff241b66f84 3 #include <stdint.h>
nucho 3:dff241b66f84 4 #include <string.h>
nucho 3:dff241b66f84 5 #include <stdlib.h>
nucho 3:dff241b66f84 6 #include "ros/msg.h"
nucho 3:dff241b66f84 7
nucho 3:dff241b66f84 8 namespace topic_tools
nucho 3:dff241b66f84 9 {
nucho 3:dff241b66f84 10
nucho 3:dff241b66f84 11 static const char MUXDELETE[] = "topic_tools/MuxDelete";
nucho 3:dff241b66f84 12
nucho 3:dff241b66f84 13 class MuxDeleteRequest : public ros::Msg
nucho 3:dff241b66f84 14 {
nucho 3:dff241b66f84 15 public:
nucho 3:dff241b66f84 16 char * topic;
nucho 3:dff241b66f84 17
nucho 3:dff241b66f84 18 virtual int serialize(unsigned char *outbuffer) const
nucho 3:dff241b66f84 19 {
nucho 3:dff241b66f84 20 int offset = 0;
nucho 3:dff241b66f84 21 uint32_t * length_topic = (uint32_t *)(outbuffer + offset);
nucho 3:dff241b66f84 22 *length_topic = strlen( (const char*) this->topic);
nucho 3:dff241b66f84 23 offset += 4;
nucho 3:dff241b66f84 24 memcpy(outbuffer + offset, this->topic, *length_topic);
nucho 3:dff241b66f84 25 offset += *length_topic;
nucho 3:dff241b66f84 26 return offset;
nucho 3:dff241b66f84 27 }
nucho 3:dff241b66f84 28
nucho 3:dff241b66f84 29 virtual int deserialize(unsigned char *inbuffer)
nucho 3:dff241b66f84 30 {
nucho 3:dff241b66f84 31 int offset = 0;
nucho 3:dff241b66f84 32 uint32_t length_topic = *(uint32_t *)(inbuffer + offset);
nucho 3:dff241b66f84 33 offset += 4;
nucho 3:dff241b66f84 34 for(unsigned int k= offset; k< offset+length_topic; ++k){
nucho 3:dff241b66f84 35 inbuffer[k-1]=inbuffer[k];
nucho 3:dff241b66f84 36 }
nucho 3:dff241b66f84 37 inbuffer[offset+length_topic-1]=0;
nucho 3:dff241b66f84 38 this->topic = (char *)(inbuffer + offset-1);
nucho 3:dff241b66f84 39 offset += length_topic;
nucho 3:dff241b66f84 40 return offset;
nucho 3:dff241b66f84 41 }
nucho 3:dff241b66f84 42
nucho 3:dff241b66f84 43 virtual const char * getType(){ return MUXDELETE; };
nucho 3:dff241b66f84 44 virtual const char * getMD5(){ return "d8f94bae31b356b24d0427f80426d0c3"; };
nucho 3:dff241b66f84 45
nucho 3:dff241b66f84 46 };
nucho 3:dff241b66f84 47
nucho 3:dff241b66f84 48 class MuxDeleteResponse : public ros::Msg
nucho 3:dff241b66f84 49 {
nucho 3:dff241b66f84 50 public:
nucho 3:dff241b66f84 51
nucho 3:dff241b66f84 52 virtual int serialize(unsigned char *outbuffer) const
nucho 3:dff241b66f84 53 {
nucho 3:dff241b66f84 54 int offset = 0;
nucho 3:dff241b66f84 55 return offset;
nucho 3:dff241b66f84 56 }
nucho 3:dff241b66f84 57
nucho 3:dff241b66f84 58 virtual int deserialize(unsigned char *inbuffer)
nucho 3:dff241b66f84 59 {
nucho 3:dff241b66f84 60 int offset = 0;
nucho 3:dff241b66f84 61 return offset;
nucho 3:dff241b66f84 62 }
nucho 3:dff241b66f84 63
nucho 3:dff241b66f84 64 virtual const char * getType(){ return MUXDELETE; };
nucho 3:dff241b66f84 65 virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
nucho 3:dff241b66f84 66
nucho 3:dff241b66f84 67 };
nucho 3:dff241b66f84 68
nucho 3:dff241b66f84 69 class MuxDelete {
nucho 3:dff241b66f84 70 public:
nucho 3:dff241b66f84 71 typedef MuxDeleteRequest Request;
nucho 3:dff241b66f84 72 typedef MuxDeleteResponse Response;
nucho 3:dff241b66f84 73 };
nucho 3:dff241b66f84 74
nucho 3:dff241b66f84 75 }
nucho 3:dff241b66f84 76 #endif