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

Revision:
1:ff0ec969dad1
Parent:
0:77afd7560544
Child:
3:1cf99502f396
--- a/rosserial_msgs/TopicInfo.h	Fri Aug 19 09:06:30 2011 +0000
+++ b/rosserial_msgs/TopicInfo.h	Sun Oct 16 07:19:36 2011 +0000
@@ -1,20 +1,19 @@
-#ifndef ros_TopicInfo_h
-#define ros_TopicInfo_h
+#ifndef ros_rosserial_msgs_TopicInfo_h
+#define ros_rosserial_msgs_TopicInfo_h
 
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
 #include "../ros/msg.h"
-
 namespace rosserial_msgs
 {
-
   class TopicInfo : public ros::Msg
   {
     public:
       unsigned short topic_id;
       char * topic_name;
       char * message_type;
+      char * md5_checksum;
       enum { ID_PUBLISHER = 0 };
       enum { ID_SUBSCRIBER = 1 };
       enum { ID_SERVICE_SERVER = 2 };
@@ -27,23 +26,32 @@
     {
       int offset = 0;
       union {
-        unsigned short real;
-        unsigned short base;
+        uint16_t real;
+        uint16_t base;
       } u_topic_id;
       u_topic_id.real = this->topic_id;
       *(outbuffer + offset + 0) = (u_topic_id.base >> (8 * 0)) & 0xFF;
       *(outbuffer + offset + 1) = (u_topic_id.base >> (8 * 1)) & 0xFF;
       offset += sizeof(this->topic_id);
+      
       long * length_topic_name = (long *)(outbuffer + offset);
       *length_topic_name = strlen( (const char*) this->topic_name);
       offset += 4;
       memcpy(outbuffer + offset, this->topic_name, *length_topic_name);
       offset += *length_topic_name;
+      
       long * length_message_type = (long *)(outbuffer + offset);
       *length_message_type = strlen( (const char*) this->message_type);
       offset += 4;
       memcpy(outbuffer + offset, this->message_type, *length_message_type);
       offset += *length_message_type;
+
+      long * length_md5_checksum = (long *)(outbuffer + offset);
+      *length_md5_checksum = strlen( (const char*) this->md5_checksum);
+      offset += 4;
+      memcpy(outbuffer + offset, this->md5_checksum, *length_md5_checksum);
+      offset += *length_md5_checksum;
+      
       return offset;
     }
 
@@ -75,6 +83,16 @@
       inbuffer[offset+length_message_type-1]=0;
       this->message_type = (char *)(inbuffer + offset-1);
       offset += length_message_type;
+
+      uint32_t length_md5_checksum = *(uint32_t *)(inbuffer + offset);
+      offset += 4;
+      for(unsigned int k= offset; k< offset+length_md5_checksum; ++k){
+          inbuffer[k-1]=inbuffer[k];
+           }
+      inbuffer[offset+length_md5_checksum-1]=0;
+      this->md5_checksum = (char *)(inbuffer + offset-1);
+      offset += length_md5_checksum;
+
      return offset;
     }