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
NodeletList.h
00001 #ifndef _ROS_SERVICE_NodeletList_h 00002 #define _ROS_SERVICE_NodeletList_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 00008 namespace nodelet 00009 { 00010 00011 static const char NODELETLIST[] = "nodelet/NodeletList"; 00012 00013 class NodeletListRequest : public ros::Msg 00014 { 00015 public: 00016 00017 NodeletListRequest() 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 NODELETLIST; }; 00034 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; 00035 00036 }; 00037 00038 class NodeletListResponse : public ros::Msg 00039 { 00040 public: 00041 uint8_t nodelets_length; 00042 char* st_nodelets; 00043 char* * nodelets; 00044 00045 NodeletListResponse(): 00046 nodelets_length(0), nodelets(NULL) 00047 { 00048 } 00049 00050 virtual int serialize(unsigned char *outbuffer) const 00051 { 00052 int offset = 0; 00053 *(outbuffer + offset++) = nodelets_length; 00054 *(outbuffer + offset++) = 0; 00055 *(outbuffer + offset++) = 0; 00056 *(outbuffer + offset++) = 0; 00057 for( uint8_t i = 0; i < nodelets_length; i++){ 00058 uint32_t length_nodeletsi = strlen(this->nodelets[i]); 00059 memcpy(outbuffer + offset, &length_nodeletsi, sizeof(uint32_t)); 00060 offset += 4; 00061 memcpy(outbuffer + offset, this->nodelets[i], length_nodeletsi); 00062 offset += length_nodeletsi; 00063 } 00064 return offset; 00065 } 00066 00067 virtual int deserialize(unsigned char *inbuffer) 00068 { 00069 int offset = 0; 00070 uint8_t nodelets_lengthT = *(inbuffer + offset++); 00071 if(nodelets_lengthT > nodelets_length) 00072 this->nodelets = (char**)realloc(this->nodelets, nodelets_lengthT * sizeof(char*)); 00073 offset += 3; 00074 nodelets_length = nodelets_lengthT; 00075 for( uint8_t i = 0; i < nodelets_length; i++){ 00076 uint32_t length_st_nodelets; 00077 memcpy(&length_st_nodelets, (inbuffer + offset), sizeof(uint32_t)); 00078 offset += 4; 00079 for(unsigned int k= offset; k< offset+length_st_nodelets; ++k){ 00080 inbuffer[k-1]=inbuffer[k]; 00081 } 00082 inbuffer[offset+length_st_nodelets-1]=0; 00083 this->st_nodelets = (char *)(inbuffer + offset-1); 00084 offset += length_st_nodelets; 00085 memcpy( &(this->nodelets[i]), &(this->st_nodelets), sizeof(char*)); 00086 } 00087 return offset; 00088 } 00089 00090 const char * getType(){ return NODELETLIST; }; 00091 const char * getMD5(){ return "99c7b10e794f5600b8030e697e946ca7"; }; 00092 00093 }; 00094 00095 class NodeletList { 00096 public: 00097 typedef NodeletListRequest Request; 00098 typedef NodeletListResponse Response; 00099 }; 00100 00101 } 00102 #endif
Generated on Tue Jul 12 2022 18:39:40 by 1.7.2