Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: rosserial_mbed_lib mbed Servo
Diff: rosserial_msgs/TopicInfo.h
- Revision:
- 1:098e75fd5ad2
- Parent:
- 0:06fc856e99ca
- Child:
- 3:dff241b66f84
--- a/rosserial_msgs/TopicInfo.h Fri Aug 19 09:06:16 2011 +0000
+++ b/rosserial_msgs/TopicInfo.h Sun Oct 16 07:17:43 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;
}