Go to the documentation of this file.00001 #ifndef ros_rosserial_arduino_Adc_h
00002 #define ros_rosserial_arduino_Adc_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "../ros/msg.h"
00008
00009 namespace rosserial_arduino
00010 {
00011
00012 class Adc : public ros::Msg
00013 {
00014 public:
00015 unsigned int adc0;
00016 unsigned int adc1;
00017 unsigned int adc2;
00018 unsigned int adc3;
00019 unsigned int adc4;
00020 unsigned int adc5;
00021
00022 virtual int serialize(unsigned char *outbuffer)
00023 {
00024 int offset = 0;
00025 union {
00026 unsigned int real;
00027 unsigned int base;
00028 } u_adc0;
00029 u_adc0.real = this->adc0;
00030 *(outbuffer + offset + 0) = (u_adc0.base >> (8 * 0)) & 0xFF;
00031 *(outbuffer + offset + 1) = (u_adc0.base >> (8 * 1)) & 0xFF;
00032 offset += sizeof(this->adc0);
00033 union {
00034 unsigned int real;
00035 unsigned int base;
00036 } u_adc1;
00037 u_adc1.real = this->adc1;
00038 *(outbuffer + offset + 0) = (u_adc1.base >> (8 * 0)) & 0xFF;
00039 *(outbuffer + offset + 1) = (u_adc1.base >> (8 * 1)) & 0xFF;
00040 offset += sizeof(this->adc1);
00041 union {
00042 unsigned int real;
00043 unsigned int base;
00044 } u_adc2;
00045 u_adc2.real = this->adc2;
00046 *(outbuffer + offset + 0) = (u_adc2.base >> (8 * 0)) & 0xFF;
00047 *(outbuffer + offset + 1) = (u_adc2.base >> (8 * 1)) & 0xFF;
00048 offset += sizeof(this->adc2);
00049 union {
00050 unsigned int real;
00051 unsigned int base;
00052 } u_adc3;
00053 u_adc3.real = this->adc3;
00054 *(outbuffer + offset + 0) = (u_adc3.base >> (8 * 0)) & 0xFF;
00055 *(outbuffer + offset + 1) = (u_adc3.base >> (8 * 1)) & 0xFF;
00056 offset += sizeof(this->adc3);
00057 union {
00058 unsigned int real;
00059 unsigned int base;
00060 } u_adc4;
00061 u_adc4.real = this->adc4;
00062 *(outbuffer + offset + 0) = (u_adc4.base >> (8 * 0)) & 0xFF;
00063 *(outbuffer + offset + 1) = (u_adc4.base >> (8 * 1)) & 0xFF;
00064 offset += sizeof(this->adc4);
00065 union {
00066 unsigned int real;
00067 unsigned int base;
00068 } u_adc5;
00069 u_adc5.real = this->adc5;
00070 *(outbuffer + offset + 0) = (u_adc5.base >> (8 * 0)) & 0xFF;
00071 *(outbuffer + offset + 1) = (u_adc5.base >> (8 * 1)) & 0xFF;
00072 offset += sizeof(this->adc5);
00073 return offset;
00074 }
00075
00076 virtual int deserialize(unsigned char *inbuffer)
00077 {
00078 int offset = 0;
00079 union {
00080 unsigned int real;
00081 unsigned int base;
00082 } u_adc0;
00083 u_adc0.base = 0;
00084 u_adc0.base |= ((typeof(u_adc0.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00085 u_adc0.base |= ((typeof(u_adc0.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00086 this->adc0 = u_adc0.real;
00087 offset += sizeof(this->adc0);
00088 union {
00089 unsigned int real;
00090 unsigned int base;
00091 } u_adc1;
00092 u_adc1.base = 0;
00093 u_adc1.base |= ((typeof(u_adc1.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00094 u_adc1.base |= ((typeof(u_adc1.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00095 this->adc1 = u_adc1.real;
00096 offset += sizeof(this->adc1);
00097 union {
00098 unsigned int real;
00099 unsigned int base;
00100 } u_adc2;
00101 u_adc2.base = 0;
00102 u_adc2.base |= ((typeof(u_adc2.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00103 u_adc2.base |= ((typeof(u_adc2.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00104 this->adc2 = u_adc2.real;
00105 offset += sizeof(this->adc2);
00106 union {
00107 unsigned int real;
00108 unsigned int base;
00109 } u_adc3;
00110 u_adc3.base = 0;
00111 u_adc3.base |= ((typeof(u_adc3.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00112 u_adc3.base |= ((typeof(u_adc3.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00113 this->adc3 = u_adc3.real;
00114 offset += sizeof(this->adc3);
00115 union {
00116 unsigned int real;
00117 unsigned int base;
00118 } u_adc4;
00119 u_adc4.base = 0;
00120 u_adc4.base |= ((typeof(u_adc4.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00121 u_adc4.base |= ((typeof(u_adc4.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00122 this->adc4 = u_adc4.real;
00123 offset += sizeof(this->adc4);
00124 union {
00125 unsigned int real;
00126 unsigned int base;
00127 } u_adc5;
00128 u_adc5.base = 0;
00129 u_adc5.base |= ((typeof(u_adc5.base)) (*(inbuffer + offset + 0))) << (8 * 0);
00130 u_adc5.base |= ((typeof(u_adc5.base)) (*(inbuffer + offset + 1))) << (8 * 1);
00131 this->adc5 = u_adc5.real;
00132 offset += sizeof(this->adc5);
00133 return offset;
00134 }
00135
00136 const char * getType(){ return "rosserial_arduino/Adc"; };
00137
00138 };
00139
00140 }
00141 #endif