ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ParamDescription.h Source File

ParamDescription.h

00001 #ifndef _ROS_dynamic_reconfigure_ParamDescription_h
00002 #define _ROS_dynamic_reconfigure_ParamDescription_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace dynamic_reconfigure
00010 {
00011 
00012   class ParamDescription : public ros::Msg
00013   {
00014     public:
00015       const char* name;
00016       const char* type;
00017       uint32_t level;
00018       const char* description;
00019       const char* edit_method;
00020 
00021     ParamDescription():
00022       name(""),
00023       type(""),
00024       level(0),
00025       description(""),
00026       edit_method("")
00027     {
00028     }
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       uint32_t length_name = strlen(this->name);
00034       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00035       offset += 4;
00036       memcpy(outbuffer + offset, this->name, length_name);
00037       offset += length_name;
00038       uint32_t length_type = strlen(this->type);
00039       memcpy(outbuffer + offset, &length_type, sizeof(uint32_t));
00040       offset += 4;
00041       memcpy(outbuffer + offset, this->type, length_type);
00042       offset += length_type;
00043       *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (this->level >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (this->level >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (this->level >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->level);
00048       uint32_t length_description = strlen(this->description);
00049       memcpy(outbuffer + offset, &length_description, sizeof(uint32_t));
00050       offset += 4;
00051       memcpy(outbuffer + offset, this->description, length_description);
00052       offset += length_description;
00053       uint32_t length_edit_method = strlen(this->edit_method);
00054       memcpy(outbuffer + offset, &length_edit_method, sizeof(uint32_t));
00055       offset += 4;
00056       memcpy(outbuffer + offset, this->edit_method, length_edit_method);
00057       offset += length_edit_method;
00058       return offset;
00059     }
00060 
00061     virtual int deserialize(unsigned char *inbuffer)
00062     {
00063       int offset = 0;
00064       uint32_t length_name;
00065       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00066       offset += 4;
00067       for(unsigned int k= offset; k< offset+length_name; ++k){
00068           inbuffer[k-1]=inbuffer[k];
00069       }
00070       inbuffer[offset+length_name-1]=0;
00071       this->name = (char *)(inbuffer + offset-1);
00072       offset += length_name;
00073       uint32_t length_type;
00074       memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t));
00075       offset += 4;
00076       for(unsigned int k= offset; k< offset+length_type; ++k){
00077           inbuffer[k-1]=inbuffer[k];
00078       }
00079       inbuffer[offset+length_type-1]=0;
00080       this->type = (char *)(inbuffer + offset-1);
00081       offset += length_type;
00082       this->level =  ((uint32_t) (*(inbuffer + offset)));
00083       this->level |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00084       this->level |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00085       this->level |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00086       offset += sizeof(this->level);
00087       uint32_t length_description;
00088       memcpy(&length_description, (inbuffer + offset), sizeof(uint32_t));
00089       offset += 4;
00090       for(unsigned int k= offset; k< offset+length_description; ++k){
00091           inbuffer[k-1]=inbuffer[k];
00092       }
00093       inbuffer[offset+length_description-1]=0;
00094       this->description = (char *)(inbuffer + offset-1);
00095       offset += length_description;
00096       uint32_t length_edit_method;
00097       memcpy(&length_edit_method, (inbuffer + offset), sizeof(uint32_t));
00098       offset += 4;
00099       for(unsigned int k= offset; k< offset+length_edit_method; ++k){
00100           inbuffer[k-1]=inbuffer[k];
00101       }
00102       inbuffer[offset+length_edit_method-1]=0;
00103       this->edit_method = (char *)(inbuffer + offset-1);
00104       offset += length_edit_method;
00105      return offset;
00106     }
00107 
00108     const char * getType(){ return "dynamic_reconfigure/ParamDescription"; };
00109     const char * getMD5(){ return "7434fcb9348c13054e0c3b267c8cb34d"; };
00110 
00111   };
00112 
00113 }
00114 #endif