Status.h
Go to the documentation of this file.
00001 #ifndef _ROS_bond_Status_h
00002 #define _ROS_bond_Status_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace bond
00011 {
00012 
00013   class Status : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       const char* id;
00018       const char* instance_id;
00019       bool active;
00020       float heartbeat_timeout;
00021       float heartbeat_period;
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       offset += this->header.serialize(outbuffer + offset);
00027       uint32_t length_id = strlen(this->id);
00028       memcpy(outbuffer + offset, &length_id, sizeof(uint32_t));
00029       offset += 4;
00030       memcpy(outbuffer + offset, this->id, length_id);
00031       offset += length_id;
00032       uint32_t length_instance_id = strlen(this->instance_id);
00033       memcpy(outbuffer + offset, &length_instance_id, sizeof(uint32_t));
00034       offset += 4;
00035       memcpy(outbuffer + offset, this->instance_id, length_instance_id);
00036       offset += length_instance_id;
00037       union {
00038         bool real;
00039         uint8_t base;
00040       } u_active;
00041       u_active.real = this->active;
00042       *(outbuffer + offset + 0) = (u_active.base >> (8 * 0)) & 0xFF;
00043       offset += sizeof(this->active);
00044       union {
00045         float real;
00046         uint32_t base;
00047       } u_heartbeat_timeout;
00048       u_heartbeat_timeout.real = this->heartbeat_timeout;
00049       *(outbuffer + offset + 0) = (u_heartbeat_timeout.base >> (8 * 0)) & 0xFF;
00050       *(outbuffer + offset + 1) = (u_heartbeat_timeout.base >> (8 * 1)) & 0xFF;
00051       *(outbuffer + offset + 2) = (u_heartbeat_timeout.base >> (8 * 2)) & 0xFF;
00052       *(outbuffer + offset + 3) = (u_heartbeat_timeout.base >> (8 * 3)) & 0xFF;
00053       offset += sizeof(this->heartbeat_timeout);
00054       union {
00055         float real;
00056         uint32_t base;
00057       } u_heartbeat_period;
00058       u_heartbeat_period.real = this->heartbeat_period;
00059       *(outbuffer + offset + 0) = (u_heartbeat_period.base >> (8 * 0)) & 0xFF;
00060       *(outbuffer + offset + 1) = (u_heartbeat_period.base >> (8 * 1)) & 0xFF;
00061       *(outbuffer + offset + 2) = (u_heartbeat_period.base >> (8 * 2)) & 0xFF;
00062       *(outbuffer + offset + 3) = (u_heartbeat_period.base >> (8 * 3)) & 0xFF;
00063       offset += sizeof(this->heartbeat_period);
00064       return offset;
00065     }
00066 
00067     virtual int deserialize(unsigned char *inbuffer)
00068     {
00069       int offset = 0;
00070       offset += this->header.deserialize(inbuffer + offset);
00071       uint32_t length_id;
00072       memcpy(&length_id, (inbuffer + offset), sizeof(uint32_t));
00073       offset += 4;
00074       for(unsigned int k= offset; k< offset+length_id; ++k){
00075           inbuffer[k-1]=inbuffer[k];
00076       }
00077       inbuffer[offset+length_id-1]=0;
00078       this->id = (char *)(inbuffer + offset-1);
00079       offset += length_id;
00080       uint32_t length_instance_id;
00081       memcpy(&length_instance_id, (inbuffer + offset), sizeof(uint32_t));
00082       offset += 4;
00083       for(unsigned int k= offset; k< offset+length_instance_id; ++k){
00084           inbuffer[k-1]=inbuffer[k];
00085       }
00086       inbuffer[offset+length_instance_id-1]=0;
00087       this->instance_id = (char *)(inbuffer + offset-1);
00088       offset += length_instance_id;
00089       union {
00090         bool real;
00091         uint8_t base;
00092       } u_active;
00093       u_active.base = 0;
00094       u_active.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00095       this->active = u_active.real;
00096       offset += sizeof(this->active);
00097       union {
00098         float real;
00099         uint32_t base;
00100       } u_heartbeat_timeout;
00101       u_heartbeat_timeout.base = 0;
00102       u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00103       u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00104       u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00105       u_heartbeat_timeout.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00106       this->heartbeat_timeout = u_heartbeat_timeout.real;
00107       offset += sizeof(this->heartbeat_timeout);
00108       union {
00109         float real;
00110         uint32_t base;
00111       } u_heartbeat_period;
00112       u_heartbeat_period.base = 0;
00113       u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00114       u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00115       u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00116       u_heartbeat_period.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00117       this->heartbeat_period = u_heartbeat_period.real;
00118       offset += sizeof(this->heartbeat_period);
00119      return offset;
00120     }
00121 
00122     const char * getType(){ return "bond/Status"; };
00123     const char * getMD5(){ return "eacc84bf5d65b6777d4c50f463dfb9c8"; };
00124 
00125   };
00126 
00127 }
00128 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:50