Go to the documentation of this file.00001 #ifndef _ROS_sensor_msgs_RelativeHumidity_h
00002 #define _ROS_sensor_msgs_RelativeHumidity_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 RelativeHumidity : public ros::Msg
00014 {
00015 public:
00016 std_msgs::Header header;
00017 float relative_humidity;
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_relative_humidity = (int32_t *) &(this->relative_humidity);
00025 int32_t exp_relative_humidity = (((*val_relative_humidity)>>23)&255);
00026 if(exp_relative_humidity != 0)
00027 exp_relative_humidity += 1023-127;
00028 int32_t sig_relative_humidity = *val_relative_humidity;
00029 *(outbuffer + offset++) = 0;
00030 *(outbuffer + offset++) = 0;
00031 *(outbuffer + offset++) = 0;
00032 *(outbuffer + offset++) = (sig_relative_humidity<<5) & 0xff;
00033 *(outbuffer + offset++) = (sig_relative_humidity>>3) & 0xff;
00034 *(outbuffer + offset++) = (sig_relative_humidity>>11) & 0xff;
00035 *(outbuffer + offset++) = ((exp_relative_humidity<<4) & 0xF0) | ((sig_relative_humidity>>19)&0x0F);
00036 *(outbuffer + offset++) = (exp_relative_humidity>>4) & 0x7F;
00037 if(this->relative_humidity < 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_relative_humidity = (uint32_t*) &(this->relative_humidity);
00060 offset += 3;
00061 *val_relative_humidity = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00062 *val_relative_humidity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00063 *val_relative_humidity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00064 *val_relative_humidity |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00065 uint32_t exp_relative_humidity = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00066 exp_relative_humidity |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00067 if(exp_relative_humidity !=0)
00068 *val_relative_humidity |= ((exp_relative_humidity)-1023+127)<<23;
00069 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->relative_humidity = -this->relative_humidity;
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/RelativeHumidity"; };
00085 const char * getMD5(){ return "8730015b05955b7e992ce29a2678d90f"; };
00086
00087 };
00088
00089 }
00090 #endif