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.
Fork of rosserial_mbed_lib by
MuxList.h
00001 #ifndef _ROS_SERVICE_MuxList_h 00002 #define _ROS_SERVICE_MuxList_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 MUXLIST[] = "topic_tools/MuxList"; 00012 00013 class MuxListRequest : public ros::Msg 00014 { 00015 public: 00016 00017 virtual int serialize(unsigned char *outbuffer) const 00018 { 00019 int offset = 0; 00020 return offset; 00021 } 00022 00023 virtual int deserialize(unsigned char *inbuffer) 00024 { 00025 int offset = 0; 00026 return offset; 00027 } 00028 00029 virtual const char * getType(){ return MUXLIST; }; 00030 virtual const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; 00031 00032 }; 00033 00034 class MuxListResponse : public ros::Msg 00035 { 00036 public: 00037 uint8_t topics_length; 00038 char* st_topics; 00039 char* * topics; 00040 00041 virtual int serialize(unsigned char *outbuffer) const 00042 { 00043 int offset = 0; 00044 *(outbuffer + offset++) = topics_length; 00045 *(outbuffer + offset++) = 0; 00046 *(outbuffer + offset++) = 0; 00047 *(outbuffer + offset++) = 0; 00048 for( uint8_t i = 0; i < topics_length; i++){ 00049 uint32_t * length_topicsi = (uint32_t *)(outbuffer + offset); 00050 *length_topicsi = strlen( (const char*) this->topics[i]); 00051 offset += 4; 00052 memcpy(outbuffer + offset, this->topics[i], *length_topicsi); 00053 offset += *length_topicsi; 00054 } 00055 return offset; 00056 } 00057 00058 virtual int deserialize(unsigned char *inbuffer) 00059 { 00060 int offset = 0; 00061 uint8_t topics_lengthT = *(inbuffer + offset++); 00062 if(topics_lengthT > topics_length) 00063 this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*)); 00064 offset += 3; 00065 topics_length = topics_lengthT; 00066 for( uint8_t i = 0; i < topics_length; i++){ 00067 uint32_t length_st_topics = *(uint32_t *)(inbuffer + offset); 00068 offset += 4; 00069 for(unsigned int k= offset; k< offset+length_st_topics; ++k){ 00070 inbuffer[k-1]=inbuffer[k]; 00071 } 00072 inbuffer[offset+length_st_topics-1]=0; 00073 this->st_topics = (char *)(inbuffer + offset-1); 00074 offset += length_st_topics; 00075 memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*)); 00076 } 00077 return offset; 00078 } 00079 00080 virtual const char * getType(){ return MUXLIST; }; 00081 virtual const char * getMD5(){ return "b0eef9a05d4e829092fc2f2c3c2aad3d"; }; 00082 00083 }; 00084 00085 class MuxList { 00086 public: 00087 typedef MuxListRequest Request; 00088 typedef MuxListResponse Response; 00089 }; 00090 00091 } 00092 #endif
Generated on Tue Jul 12 2022 19:53:57 by
1.7.2
