Illuminance.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_Illuminance_h
00002 #define _ROS_sensor_msgs_Illuminance_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 sensor_msgs
00011 {
00012 
00013   class Illuminance : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       float illuminance;
00018       float variance;
00019 
00020     virtual int serialize(unsigned char *outbuffer) const
00021     {
00022       int offset = 0;
00023       offset += this->header.serialize(outbuffer + offset);
00024       int32_t * val_illuminance = (int32_t *) &(this->illuminance);
00025       int32_t exp_illuminance = (((*val_illuminance)>>23)&255);
00026       if(exp_illuminance != 0)
00027         exp_illuminance += 1023-127;
00028       int32_t sig_illuminance = *val_illuminance;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       *(outbuffer + offset++) = (sig_illuminance<<5) & 0xff;
00033       *(outbuffer + offset++) = (sig_illuminance>>3) & 0xff;
00034       *(outbuffer + offset++) = (sig_illuminance>>11) & 0xff;
00035       *(outbuffer + offset++) = ((exp_illuminance<<4) & 0xF0) | ((sig_illuminance>>19)&0x0F);
00036       *(outbuffer + offset++) = (exp_illuminance>>4) & 0x7F;
00037       if(this->illuminance < 0) *(outbuffer + offset -1) |= 0x80;
00038       int32_t * val_variance = (int32_t *) &(this->variance);
00039       int32_t exp_variance = (((*val_variance)>>23)&255);
00040       if(exp_variance != 0)
00041         exp_variance += 1023-127;
00042       int32_t sig_variance = *val_variance;
00043       *(outbuffer + offset++) = 0;
00044       *(outbuffer + offset++) = 0;
00045       *(outbuffer + offset++) = 0;
00046       *(outbuffer + offset++) = (sig_variance<<5) & 0xff;
00047       *(outbuffer + offset++) = (sig_variance>>3) & 0xff;
00048       *(outbuffer + offset++) = (sig_variance>>11) & 0xff;
00049       *(outbuffer + offset++) = ((exp_variance<<4) & 0xF0) | ((sig_variance>>19)&0x0F);
00050       *(outbuffer + offset++) = (exp_variance>>4) & 0x7F;
00051       if(this->variance < 0) *(outbuffer + offset -1) |= 0x80;
00052       return offset;
00053     }
00054 
00055     virtual int deserialize(unsigned char *inbuffer)
00056     {
00057       int offset = 0;
00058       offset += this->header.deserialize(inbuffer + offset);
00059       uint32_t * val_illuminance = (uint32_t*) &(this->illuminance);
00060       offset += 3;
00061       *val_illuminance = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00062       *val_illuminance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00063       *val_illuminance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00064       *val_illuminance |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00065       uint32_t exp_illuminance = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00066       exp_illuminance |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00067       if(exp_illuminance !=0)
00068         *val_illuminance |= ((exp_illuminance)-1023+127)<<23;
00069       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->illuminance = -this->illuminance;
00070       uint32_t * val_variance = (uint32_t*) &(this->variance);
00071       offset += 3;
00072       *val_variance = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00073       *val_variance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00074       *val_variance |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00075       *val_variance |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00076       uint32_t exp_variance = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00077       exp_variance |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00078       if(exp_variance !=0)
00079         *val_variance |= ((exp_variance)-1023+127)<<23;
00080       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->variance = -this->variance;
00081      return offset;
00082     }
00083 
00084     const char * getType(){ return "sensor_msgs/Illuminance"; };
00085     const char * getMD5(){ return "8cf5febb0952fca9d650c3d11a81a188"; };
00086 
00087   };
00088 
00089 }
00090 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55