rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
dynamic_reconfigure/ConfigDescription.h@0:30537dec6e0b, 2015-02-15 (annotated)
- Committer:
- akashvibhute
- Date:
- Sun Feb 15 10:53:43 2015 +0000
- Revision:
- 0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_dynamic_reconfigure_ConfigDescription_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_dynamic_reconfigure_ConfigDescription_h |
akashvibhute | 0:30537dec6e0b | 3 | |
akashvibhute | 0:30537dec6e0b | 4 | #include <stdint.h> |
akashvibhute | 0:30537dec6e0b | 5 | #include <string.h> |
akashvibhute | 0:30537dec6e0b | 6 | #include <stdlib.h> |
akashvibhute | 0:30537dec6e0b | 7 | #include "ros/msg.h" |
akashvibhute | 0:30537dec6e0b | 8 | #include "dynamic_reconfigure/Group.h" |
akashvibhute | 0:30537dec6e0b | 9 | #include "dynamic_reconfigure/Config.h" |
akashvibhute | 0:30537dec6e0b | 10 | |
akashvibhute | 0:30537dec6e0b | 11 | namespace dynamic_reconfigure |
akashvibhute | 0:30537dec6e0b | 12 | { |
akashvibhute | 0:30537dec6e0b | 13 | |
akashvibhute | 0:30537dec6e0b | 14 | class ConfigDescription : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 15 | { |
akashvibhute | 0:30537dec6e0b | 16 | public: |
akashvibhute | 0:30537dec6e0b | 17 | uint8_t groups_length; |
akashvibhute | 0:30537dec6e0b | 18 | dynamic_reconfigure::Group st_groups; |
akashvibhute | 0:30537dec6e0b | 19 | dynamic_reconfigure::Group * groups; |
akashvibhute | 0:30537dec6e0b | 20 | dynamic_reconfigure::Config max; |
akashvibhute | 0:30537dec6e0b | 21 | dynamic_reconfigure::Config min; |
akashvibhute | 0:30537dec6e0b | 22 | dynamic_reconfigure::Config dflt; |
akashvibhute | 0:30537dec6e0b | 23 | |
akashvibhute | 0:30537dec6e0b | 24 | ConfigDescription(): |
akashvibhute | 0:30537dec6e0b | 25 | groups_length(0), groups(NULL), |
akashvibhute | 0:30537dec6e0b | 26 | max(), |
akashvibhute | 0:30537dec6e0b | 27 | min(), |
akashvibhute | 0:30537dec6e0b | 28 | dflt() |
akashvibhute | 0:30537dec6e0b | 29 | { |
akashvibhute | 0:30537dec6e0b | 30 | } |
akashvibhute | 0:30537dec6e0b | 31 | |
akashvibhute | 0:30537dec6e0b | 32 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 33 | { |
akashvibhute | 0:30537dec6e0b | 34 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 35 | *(outbuffer + offset++) = groups_length; |
akashvibhute | 0:30537dec6e0b | 36 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 37 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 38 | *(outbuffer + offset++) = 0; |
akashvibhute | 0:30537dec6e0b | 39 | for( uint8_t i = 0; i < groups_length; i++){ |
akashvibhute | 0:30537dec6e0b | 40 | offset += this->groups[i].serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 41 | } |
akashvibhute | 0:30537dec6e0b | 42 | offset += this->max.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 43 | offset += this->min.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 44 | offset += this->dflt.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 45 | return offset; |
akashvibhute | 0:30537dec6e0b | 46 | } |
akashvibhute | 0:30537dec6e0b | 47 | |
akashvibhute | 0:30537dec6e0b | 48 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 49 | { |
akashvibhute | 0:30537dec6e0b | 50 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 51 | uint8_t groups_lengthT = *(inbuffer + offset++); |
akashvibhute | 0:30537dec6e0b | 52 | if(groups_lengthT > groups_length) |
akashvibhute | 0:30537dec6e0b | 53 | this->groups = (dynamic_reconfigure::Group*)realloc(this->groups, groups_lengthT * sizeof(dynamic_reconfigure::Group)); |
akashvibhute | 0:30537dec6e0b | 54 | offset += 3; |
akashvibhute | 0:30537dec6e0b | 55 | groups_length = groups_lengthT; |
akashvibhute | 0:30537dec6e0b | 56 | for( uint8_t i = 0; i < groups_length; i++){ |
akashvibhute | 0:30537dec6e0b | 57 | offset += this->st_groups.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 58 | memcpy( &(this->groups[i]), &(this->st_groups), sizeof(dynamic_reconfigure::Group)); |
akashvibhute | 0:30537dec6e0b | 59 | } |
akashvibhute | 0:30537dec6e0b | 60 | offset += this->max.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 61 | offset += this->min.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 62 | offset += this->dflt.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 63 | return offset; |
akashvibhute | 0:30537dec6e0b | 64 | } |
akashvibhute | 0:30537dec6e0b | 65 | |
akashvibhute | 0:30537dec6e0b | 66 | const char * getType(){ return "dynamic_reconfigure/ConfigDescription"; }; |
akashvibhute | 0:30537dec6e0b | 67 | const char * getMD5(){ return "757ce9d44ba8ddd801bb30bc456f946f"; }; |
akashvibhute | 0:30537dec6e0b | 68 | |
akashvibhute | 0:30537dec6e0b | 69 | }; |
akashvibhute | 0:30537dec6e0b | 70 | |
akashvibhute | 0:30537dec6e0b | 71 | } |
akashvibhute | 0:30537dec6e0b | 72 | #endif |