ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
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 MuxListRequest() 00018 { 00019 } 00020 00021 virtual int serialize(unsigned char *outbuffer) const 00022 { 00023 int offset = 0; 00024 return offset; 00025 } 00026 00027 virtual int deserialize(unsigned char *inbuffer) 00028 { 00029 int offset = 0; 00030 return offset; 00031 } 00032 00033 const char * getType(){ return MUXLIST; }; 00034 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; 00035 00036 }; 00037 00038 class MuxListResponse : public ros::Msg 00039 { 00040 public: 00041 uint8_t topics_length; 00042 char* st_topics; 00043 char* * topics; 00044 00045 MuxListResponse(): 00046 topics_length(0), topics(NULL) 00047 { 00048 } 00049 00050 virtual int serialize(unsigned char *outbuffer) const 00051 { 00052 int offset = 0; 00053 *(outbuffer + offset++) = topics_length; 00054 *(outbuffer + offset++) = 0; 00055 *(outbuffer + offset++) = 0; 00056 *(outbuffer + offset++) = 0; 00057 for( uint8_t i = 0; i < topics_length; i++){ 00058 uint32_t length_topicsi = strlen(this->topics[i]); 00059 memcpy(outbuffer + offset, &length_topicsi, sizeof(uint32_t)); 00060 offset += 4; 00061 memcpy(outbuffer + offset, this->topics[i], length_topicsi); 00062 offset += length_topicsi; 00063 } 00064 return offset; 00065 } 00066 00067 virtual int deserialize(unsigned char *inbuffer) 00068 { 00069 int offset = 0; 00070 uint8_t topics_lengthT = *(inbuffer + offset++); 00071 if(topics_lengthT > topics_length) 00072 this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*)); 00073 offset += 3; 00074 topics_length = topics_lengthT; 00075 for( uint8_t i = 0; i < topics_length; i++){ 00076 uint32_t length_st_topics; 00077 memcpy(&length_st_topics, (inbuffer + offset), sizeof(uint32_t)); 00078 offset += 4; 00079 for(unsigned int k= offset; k< offset+length_st_topics; ++k){ 00080 inbuffer[k-1]=inbuffer[k]; 00081 } 00082 inbuffer[offset+length_st_topics-1]=0; 00083 this->st_topics = (char *)(inbuffer + offset-1); 00084 offset += length_st_topics; 00085 memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*)); 00086 } 00087 return offset; 00088 } 00089 00090 const char * getType(){ return MUXLIST; }; 00091 const char * getMD5(){ return "b0eef9a05d4e829092fc2f2c3c2aad3d"; }; 00092 00093 }; 00094 00095 class MuxList { 00096 public: 00097 typedef MuxListRequest Request; 00098 typedef MuxListResponse Response; 00099 }; 00100 00101 } 00102 #endif
Generated on Tue Jul 12 2022 18:39:40 by 1.7.2