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 GroupState.h Source File

GroupState.h

00001 #ifndef _ROS_dynamic_reconfigure_GroupState_h
00002 #define _ROS_dynamic_reconfigure_GroupState_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 GroupState : public ros::Msg
00013   {
00014     public:
00015       const char* name;
00016       bool state;
00017       int32_t id;
00018       int32_t parent;
00019 
00020     GroupState():
00021       name(""),
00022       state(0),
00023       id(0),
00024       parent(0)
00025     {
00026     }
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       uint32_t length_name = strlen(this->name);
00032       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->name, length_name);
00035       offset += length_name;
00036       union {
00037         bool real;
00038         uint8_t base;
00039       } u_state;
00040       u_state.real = this->state;
00041       *(outbuffer + offset + 0) = (u_state.base >> (8 * 0)) & 0xFF;
00042       offset += sizeof(this->state);
00043       union {
00044         int32_t real;
00045         uint32_t base;
00046       } u_id;
00047       u_id.real = this->id;
00048       *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF;
00049       *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF;
00050       *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF;
00051       *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF;
00052       offset += sizeof(this->id);
00053       union {
00054         int32_t real;
00055         uint32_t base;
00056       } u_parent;
00057       u_parent.real = this->parent;
00058       *(outbuffer + offset + 0) = (u_parent.base >> (8 * 0)) & 0xFF;
00059       *(outbuffer + offset + 1) = (u_parent.base >> (8 * 1)) & 0xFF;
00060       *(outbuffer + offset + 2) = (u_parent.base >> (8 * 2)) & 0xFF;
00061       *(outbuffer + offset + 3) = (u_parent.base >> (8 * 3)) & 0xFF;
00062       offset += sizeof(this->parent);
00063       return offset;
00064     }
00065 
00066     virtual int deserialize(unsigned char *inbuffer)
00067     {
00068       int offset = 0;
00069       uint32_t length_name;
00070       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00071       offset += 4;
00072       for(unsigned int k= offset; k< offset+length_name; ++k){
00073           inbuffer[k-1]=inbuffer[k];
00074       }
00075       inbuffer[offset+length_name-1]=0;
00076       this->name = (char *)(inbuffer + offset-1);
00077       offset += length_name;
00078       union {
00079         bool real;
00080         uint8_t base;
00081       } u_state;
00082       u_state.base = 0;
00083       u_state.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00084       this->state = u_state.real;
00085       offset += sizeof(this->state);
00086       union {
00087         int32_t real;
00088         uint32_t base;
00089       } u_id;
00090       u_id.base = 0;
00091       u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00092       u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00093       u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00094       u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00095       this->id = u_id.real;
00096       offset += sizeof(this->id);
00097       union {
00098         int32_t real;
00099         uint32_t base;
00100       } u_parent;
00101       u_parent.base = 0;
00102       u_parent.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00103       u_parent.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00104       u_parent.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00105       u_parent.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00106       this->parent = u_parent.real;
00107       offset += sizeof(this->parent);
00108      return offset;
00109     }
00110 
00111     const char * getType(){ return "dynamic_reconfigure/GroupState"; };
00112     const char * getMD5(){ return "a2d87f51dc22930325041a2f8b1571f8"; };
00113 
00114   };
00115 
00116 }
00117 #endif