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

Dependencies:   BufferedSerial

Dependents:   mbed-os-example-blinky

Committer:
garyservin
Date:
Sat Dec 31 00:48:34 2016 +0000
Revision:
0:9e9b7db60fd5
Initial commit, generated based on a clean kinetic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_dynamic_reconfigure_ParamDescription_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_dynamic_reconfigure_ParamDescription_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8
garyservin 0:9e9b7db60fd5 9 namespace dynamic_reconfigure
garyservin 0:9e9b7db60fd5 10 {
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 class ParamDescription : public ros::Msg
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14 public:
garyservin 0:9e9b7db60fd5 15 typedef const char* _name_type;
garyservin 0:9e9b7db60fd5 16 _name_type name;
garyservin 0:9e9b7db60fd5 17 typedef const char* _type_type;
garyservin 0:9e9b7db60fd5 18 _type_type type;
garyservin 0:9e9b7db60fd5 19 typedef uint32_t _level_type;
garyservin 0:9e9b7db60fd5 20 _level_type level;
garyservin 0:9e9b7db60fd5 21 typedef const char* _description_type;
garyservin 0:9e9b7db60fd5 22 _description_type description;
garyservin 0:9e9b7db60fd5 23 typedef const char* _edit_method_type;
garyservin 0:9e9b7db60fd5 24 _edit_method_type edit_method;
garyservin 0:9e9b7db60fd5 25
garyservin 0:9e9b7db60fd5 26 ParamDescription():
garyservin 0:9e9b7db60fd5 27 name(""),
garyservin 0:9e9b7db60fd5 28 type(""),
garyservin 0:9e9b7db60fd5 29 level(0),
garyservin 0:9e9b7db60fd5 30 description(""),
garyservin 0:9e9b7db60fd5 31 edit_method("")
garyservin 0:9e9b7db60fd5 32 {
garyservin 0:9e9b7db60fd5 33 }
garyservin 0:9e9b7db60fd5 34
garyservin 0:9e9b7db60fd5 35 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 36 {
garyservin 0:9e9b7db60fd5 37 int offset = 0;
garyservin 0:9e9b7db60fd5 38 uint32_t length_name = strlen(this->name);
garyservin 0:9e9b7db60fd5 39 varToArr(outbuffer + offset, length_name);
garyservin 0:9e9b7db60fd5 40 offset += 4;
garyservin 0:9e9b7db60fd5 41 memcpy(outbuffer + offset, this->name, length_name);
garyservin 0:9e9b7db60fd5 42 offset += length_name;
garyservin 0:9e9b7db60fd5 43 uint32_t length_type = strlen(this->type);
garyservin 0:9e9b7db60fd5 44 varToArr(outbuffer + offset, length_type);
garyservin 0:9e9b7db60fd5 45 offset += 4;
garyservin 0:9e9b7db60fd5 46 memcpy(outbuffer + offset, this->type, length_type);
garyservin 0:9e9b7db60fd5 47 offset += length_type;
garyservin 0:9e9b7db60fd5 48 *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 49 *(outbuffer + offset + 1) = (this->level >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 50 *(outbuffer + offset + 2) = (this->level >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 51 *(outbuffer + offset + 3) = (this->level >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 52 offset += sizeof(this->level);
garyservin 0:9e9b7db60fd5 53 uint32_t length_description = strlen(this->description);
garyservin 0:9e9b7db60fd5 54 varToArr(outbuffer + offset, length_description);
garyservin 0:9e9b7db60fd5 55 offset += 4;
garyservin 0:9e9b7db60fd5 56 memcpy(outbuffer + offset, this->description, length_description);
garyservin 0:9e9b7db60fd5 57 offset += length_description;
garyservin 0:9e9b7db60fd5 58 uint32_t length_edit_method = strlen(this->edit_method);
garyservin 0:9e9b7db60fd5 59 varToArr(outbuffer + offset, length_edit_method);
garyservin 0:9e9b7db60fd5 60 offset += 4;
garyservin 0:9e9b7db60fd5 61 memcpy(outbuffer + offset, this->edit_method, length_edit_method);
garyservin 0:9e9b7db60fd5 62 offset += length_edit_method;
garyservin 0:9e9b7db60fd5 63 return offset;
garyservin 0:9e9b7db60fd5 64 }
garyservin 0:9e9b7db60fd5 65
garyservin 0:9e9b7db60fd5 66 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 67 {
garyservin 0:9e9b7db60fd5 68 int offset = 0;
garyservin 0:9e9b7db60fd5 69 uint32_t length_name;
garyservin 0:9e9b7db60fd5 70 arrToVar(length_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 71 offset += 4;
garyservin 0:9e9b7db60fd5 72 for(unsigned int k= offset; k< offset+length_name; ++k){
garyservin 0:9e9b7db60fd5 73 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 74 }
garyservin 0:9e9b7db60fd5 75 inbuffer[offset+length_name-1]=0;
garyservin 0:9e9b7db60fd5 76 this->name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 77 offset += length_name;
garyservin 0:9e9b7db60fd5 78 uint32_t length_type;
garyservin 0:9e9b7db60fd5 79 arrToVar(length_type, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 80 offset += 4;
garyservin 0:9e9b7db60fd5 81 for(unsigned int k= offset; k< offset+length_type; ++k){
garyservin 0:9e9b7db60fd5 82 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 83 }
garyservin 0:9e9b7db60fd5 84 inbuffer[offset+length_type-1]=0;
garyservin 0:9e9b7db60fd5 85 this->type = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 86 offset += length_type;
garyservin 0:9e9b7db60fd5 87 this->level = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 88 this->level |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 89 this->level |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 90 this->level |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 91 offset += sizeof(this->level);
garyservin 0:9e9b7db60fd5 92 uint32_t length_description;
garyservin 0:9e9b7db60fd5 93 arrToVar(length_description, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 94 offset += 4;
garyservin 0:9e9b7db60fd5 95 for(unsigned int k= offset; k< offset+length_description; ++k){
garyservin 0:9e9b7db60fd5 96 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 97 }
garyservin 0:9e9b7db60fd5 98 inbuffer[offset+length_description-1]=0;
garyservin 0:9e9b7db60fd5 99 this->description = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 100 offset += length_description;
garyservin 0:9e9b7db60fd5 101 uint32_t length_edit_method;
garyservin 0:9e9b7db60fd5 102 arrToVar(length_edit_method, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 103 offset += 4;
garyservin 0:9e9b7db60fd5 104 for(unsigned int k= offset; k< offset+length_edit_method; ++k){
garyservin 0:9e9b7db60fd5 105 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 106 }
garyservin 0:9e9b7db60fd5 107 inbuffer[offset+length_edit_method-1]=0;
garyservin 0:9e9b7db60fd5 108 this->edit_method = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 109 offset += length_edit_method;
garyservin 0:9e9b7db60fd5 110 return offset;
garyservin 0:9e9b7db60fd5 111 }
garyservin 0:9e9b7db60fd5 112
garyservin 0:9e9b7db60fd5 113 const char * getType(){ return "dynamic_reconfigure/ParamDescription"; };
garyservin 0:9e9b7db60fd5 114 const char * getMD5(){ return "7434fcb9348c13054e0c3b267c8cb34d"; };
garyservin 0:9e9b7db60fd5 115
garyservin 0:9e9b7db60fd5 116 };
garyservin 0:9e9b7db60fd5 117
garyservin 0:9e9b7db60fd5 118 }
garyservin 0:9e9b7db60fd5 119 #endif