Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
State.h
00001 #ifndef _ROS_wiimote_State_h 00002 #define _ROS_wiimote_State_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 #include "geometry_msgs/Vector3.h" 00010 #include "wiimote/IrSourceInfo.h" 00011 #include "ros/time.h" 00012 00013 namespace wiimote 00014 { 00015 00016 class State : public ros::Msg 00017 { 00018 public: 00019 typedef std_msgs::Header _header_type; 00020 _header_type header; 00021 typedef geometry_msgs::Vector3 _angular_velocity_zeroed_type; 00022 _angular_velocity_zeroed_type angular_velocity_zeroed; 00023 typedef geometry_msgs::Vector3 _angular_velocity_raw_type; 00024 _angular_velocity_raw_type angular_velocity_raw; 00025 double angular_velocity_covariance[9]; 00026 typedef geometry_msgs::Vector3 _linear_acceleration_zeroed_type; 00027 _linear_acceleration_zeroed_type linear_acceleration_zeroed; 00028 typedef geometry_msgs::Vector3 _linear_acceleration_raw_type; 00029 _linear_acceleration_raw_type linear_acceleration_raw; 00030 double linear_acceleration_covariance[9]; 00031 typedef geometry_msgs::Vector3 _nunchuk_acceleration_zeroed_type; 00032 _nunchuk_acceleration_zeroed_type nunchuk_acceleration_zeroed; 00033 typedef geometry_msgs::Vector3 _nunchuk_acceleration_raw_type; 00034 _nunchuk_acceleration_raw_type nunchuk_acceleration_raw; 00035 float nunchuk_joystick_zeroed[2]; 00036 float nunchuk_joystick_raw[2]; 00037 bool buttons[11]; 00038 bool nunchuk_buttons[2]; 00039 bool LEDs[4]; 00040 typedef bool _rumble_type; 00041 _rumble_type rumble; 00042 uint32_t ir_tracking_length; 00043 typedef wiimote::IrSourceInfo _ir_tracking_type; 00044 _ir_tracking_type st_ir_tracking; 00045 _ir_tracking_type * ir_tracking; 00046 typedef float _raw_battery_type; 00047 _raw_battery_type raw_battery; 00048 typedef float _percent_battery_type; 00049 _percent_battery_type percent_battery; 00050 typedef ros::Time _zeroing_time_type; 00051 _zeroing_time_type zeroing_time; 00052 typedef uint64_t _errors_type; 00053 _errors_type errors; 00054 enum { INVALID = -1 }; 00055 enum { INVALID_FLOAT = -1.0 }; 00056 enum { MSG_BTN_1 = 0 }; 00057 enum { MSG_BTN_2 = 1 }; 00058 enum { MSG_BTN_A = 2 }; 00059 enum { MSG_BTN_B = 3 }; 00060 enum { MSG_BTN_PLUS = 4 }; 00061 enum { MSG_BTN_MINUS = 5 }; 00062 enum { MSG_BTN_LEFT = 6 }; 00063 enum { MSG_BTN_RIGHT = 7 }; 00064 enum { MSG_BTN_UP = 8 }; 00065 enum { MSG_BTN_DOWN = 9 }; 00066 enum { MSG_BTN_HOME = 10 }; 00067 enum { MSG_BTN_Z = 0 }; 00068 enum { MSG_BTN_C = 1 }; 00069 enum { MSG_CLASSIC_BTN_X = 0 }; 00070 enum { MSG_CLASSIC_BTN_Y = 1 }; 00071 enum { MSG_CLASSIC_BTN_A = 2 }; 00072 enum { MSG_CLASSIC_BTN_B = 3 }; 00073 enum { MSG_CLASSIC_BTN_PLUS = 4 }; 00074 enum { MSG_CLASSIC_BTN_MINUS = 5 }; 00075 enum { MSG_CLASSIC_BTN_LEFT = 6 }; 00076 enum { MSG_CLASSIC_BTN_RIGHT = 7 }; 00077 enum { MSG_CLASSIC_BTN_UP = 8 }; 00078 enum { MSG_CLASSIC_BTN_DOWN = 9 }; 00079 enum { MSG_CLASSIC_BTN_HOME = 10 }; 00080 enum { MSG_CLASSIC_BTN_L = 11 }; 00081 enum { MSG_CLASSIC_BTN_R = 12 }; 00082 enum { MSG_CLASSIC_BTN_ZL = 13 }; 00083 enum { MSG_CLASSIC_BTN_ZR = 14 }; 00084 00085 State(): 00086 header(), 00087 angular_velocity_zeroed(), 00088 angular_velocity_raw(), 00089 angular_velocity_covariance(), 00090 linear_acceleration_zeroed(), 00091 linear_acceleration_raw(), 00092 linear_acceleration_covariance(), 00093 nunchuk_acceleration_zeroed(), 00094 nunchuk_acceleration_raw(), 00095 nunchuk_joystick_zeroed(), 00096 nunchuk_joystick_raw(), 00097 buttons(), 00098 nunchuk_buttons(), 00099 LEDs(), 00100 rumble(0), 00101 ir_tracking_length(0), ir_tracking(NULL), 00102 raw_battery(0), 00103 percent_battery(0), 00104 zeroing_time(), 00105 errors(0) 00106 { 00107 } 00108 00109 virtual int serialize(unsigned char *outbuffer) const 00110 { 00111 int offset = 0; 00112 offset += this->header.serialize(outbuffer + offset); 00113 offset += this->angular_velocity_zeroed.serialize(outbuffer + offset); 00114 offset += this->angular_velocity_raw.serialize(outbuffer + offset); 00115 for( uint32_t i = 0; i < 9; i++){ 00116 union { 00117 double real; 00118 uint64_t base; 00119 } u_angular_velocity_covariancei; 00120 u_angular_velocity_covariancei.real = this->angular_velocity_covariance[i]; 00121 *(outbuffer + offset + 0) = (u_angular_velocity_covariancei.base >> (8 * 0)) & 0xFF; 00122 *(outbuffer + offset + 1) = (u_angular_velocity_covariancei.base >> (8 * 1)) & 0xFF; 00123 *(outbuffer + offset + 2) = (u_angular_velocity_covariancei.base >> (8 * 2)) & 0xFF; 00124 *(outbuffer + offset + 3) = (u_angular_velocity_covariancei.base >> (8 * 3)) & 0xFF; 00125 *(outbuffer + offset + 4) = (u_angular_velocity_covariancei.base >> (8 * 4)) & 0xFF; 00126 *(outbuffer + offset + 5) = (u_angular_velocity_covariancei.base >> (8 * 5)) & 0xFF; 00127 *(outbuffer + offset + 6) = (u_angular_velocity_covariancei.base >> (8 * 6)) & 0xFF; 00128 *(outbuffer + offset + 7) = (u_angular_velocity_covariancei.base >> (8 * 7)) & 0xFF; 00129 offset += sizeof(this->angular_velocity_covariance[i]); 00130 } 00131 offset += this->linear_acceleration_zeroed.serialize(outbuffer + offset); 00132 offset += this->linear_acceleration_raw.serialize(outbuffer + offset); 00133 for( uint32_t i = 0; i < 9; i++){ 00134 union { 00135 double real; 00136 uint64_t base; 00137 } u_linear_acceleration_covariancei; 00138 u_linear_acceleration_covariancei.real = this->linear_acceleration_covariance[i]; 00139 *(outbuffer + offset + 0) = (u_linear_acceleration_covariancei.base >> (8 * 0)) & 0xFF; 00140 *(outbuffer + offset + 1) = (u_linear_acceleration_covariancei.base >> (8 * 1)) & 0xFF; 00141 *(outbuffer + offset + 2) = (u_linear_acceleration_covariancei.base >> (8 * 2)) & 0xFF; 00142 *(outbuffer + offset + 3) = (u_linear_acceleration_covariancei.base >> (8 * 3)) & 0xFF; 00143 *(outbuffer + offset + 4) = (u_linear_acceleration_covariancei.base >> (8 * 4)) & 0xFF; 00144 *(outbuffer + offset + 5) = (u_linear_acceleration_covariancei.base >> (8 * 5)) & 0xFF; 00145 *(outbuffer + offset + 6) = (u_linear_acceleration_covariancei.base >> (8 * 6)) & 0xFF; 00146 *(outbuffer + offset + 7) = (u_linear_acceleration_covariancei.base >> (8 * 7)) & 0xFF; 00147 offset += sizeof(this->linear_acceleration_covariance[i]); 00148 } 00149 offset += this->nunchuk_acceleration_zeroed.serialize(outbuffer + offset); 00150 offset += this->nunchuk_acceleration_raw.serialize(outbuffer + offset); 00151 for( uint32_t i = 0; i < 2; i++){ 00152 union { 00153 float real; 00154 uint32_t base; 00155 } u_nunchuk_joystick_zeroedi; 00156 u_nunchuk_joystick_zeroedi.real = this->nunchuk_joystick_zeroed[i]; 00157 *(outbuffer + offset + 0) = (u_nunchuk_joystick_zeroedi.base >> (8 * 0)) & 0xFF; 00158 *(outbuffer + offset + 1) = (u_nunchuk_joystick_zeroedi.base >> (8 * 1)) & 0xFF; 00159 *(outbuffer + offset + 2) = (u_nunchuk_joystick_zeroedi.base >> (8 * 2)) & 0xFF; 00160 *(outbuffer + offset + 3) = (u_nunchuk_joystick_zeroedi.base >> (8 * 3)) & 0xFF; 00161 offset += sizeof(this->nunchuk_joystick_zeroed[i]); 00162 } 00163 for( uint32_t i = 0; i < 2; i++){ 00164 union { 00165 float real; 00166 uint32_t base; 00167 } u_nunchuk_joystick_rawi; 00168 u_nunchuk_joystick_rawi.real = this->nunchuk_joystick_raw[i]; 00169 *(outbuffer + offset + 0) = (u_nunchuk_joystick_rawi.base >> (8 * 0)) & 0xFF; 00170 *(outbuffer + offset + 1) = (u_nunchuk_joystick_rawi.base >> (8 * 1)) & 0xFF; 00171 *(outbuffer + offset + 2) = (u_nunchuk_joystick_rawi.base >> (8 * 2)) & 0xFF; 00172 *(outbuffer + offset + 3) = (u_nunchuk_joystick_rawi.base >> (8 * 3)) & 0xFF; 00173 offset += sizeof(this->nunchuk_joystick_raw[i]); 00174 } 00175 for( uint32_t i = 0; i < 11; i++){ 00176 union { 00177 bool real; 00178 uint8_t base; 00179 } u_buttonsi; 00180 u_buttonsi.real = this->buttons[i]; 00181 *(outbuffer + offset + 0) = (u_buttonsi.base >> (8 * 0)) & 0xFF; 00182 offset += sizeof(this->buttons[i]); 00183 } 00184 for( uint32_t i = 0; i < 2; i++){ 00185 union { 00186 bool real; 00187 uint8_t base; 00188 } u_nunchuk_buttonsi; 00189 u_nunchuk_buttonsi.real = this->nunchuk_buttons[i]; 00190 *(outbuffer + offset + 0) = (u_nunchuk_buttonsi.base >> (8 * 0)) & 0xFF; 00191 offset += sizeof(this->nunchuk_buttons[i]); 00192 } 00193 for( uint32_t i = 0; i < 4; i++){ 00194 union { 00195 bool real; 00196 uint8_t base; 00197 } u_LEDsi; 00198 u_LEDsi.real = this->LEDs[i]; 00199 *(outbuffer + offset + 0) = (u_LEDsi.base >> (8 * 0)) & 0xFF; 00200 offset += sizeof(this->LEDs[i]); 00201 } 00202 union { 00203 bool real; 00204 uint8_t base; 00205 } u_rumble; 00206 u_rumble.real = this->rumble; 00207 *(outbuffer + offset + 0) = (u_rumble.base >> (8 * 0)) & 0xFF; 00208 offset += sizeof(this->rumble); 00209 *(outbuffer + offset + 0) = (this->ir_tracking_length >> (8 * 0)) & 0xFF; 00210 *(outbuffer + offset + 1) = (this->ir_tracking_length >> (8 * 1)) & 0xFF; 00211 *(outbuffer + offset + 2) = (this->ir_tracking_length >> (8 * 2)) & 0xFF; 00212 *(outbuffer + offset + 3) = (this->ir_tracking_length >> (8 * 3)) & 0xFF; 00213 offset += sizeof(this->ir_tracking_length); 00214 for( uint32_t i = 0; i < ir_tracking_length; i++){ 00215 offset += this->ir_tracking[i].serialize(outbuffer + offset); 00216 } 00217 union { 00218 float real; 00219 uint32_t base; 00220 } u_raw_battery; 00221 u_raw_battery.real = this->raw_battery; 00222 *(outbuffer + offset + 0) = (u_raw_battery.base >> (8 * 0)) & 0xFF; 00223 *(outbuffer + offset + 1) = (u_raw_battery.base >> (8 * 1)) & 0xFF; 00224 *(outbuffer + offset + 2) = (u_raw_battery.base >> (8 * 2)) & 0xFF; 00225 *(outbuffer + offset + 3) = (u_raw_battery.base >> (8 * 3)) & 0xFF; 00226 offset += sizeof(this->raw_battery); 00227 union { 00228 float real; 00229 uint32_t base; 00230 } u_percent_battery; 00231 u_percent_battery.real = this->percent_battery; 00232 *(outbuffer + offset + 0) = (u_percent_battery.base >> (8 * 0)) & 0xFF; 00233 *(outbuffer + offset + 1) = (u_percent_battery.base >> (8 * 1)) & 0xFF; 00234 *(outbuffer + offset + 2) = (u_percent_battery.base >> (8 * 2)) & 0xFF; 00235 *(outbuffer + offset + 3) = (u_percent_battery.base >> (8 * 3)) & 0xFF; 00236 offset += sizeof(this->percent_battery); 00237 *(outbuffer + offset + 0) = (this->zeroing_time.sec >> (8 * 0)) & 0xFF; 00238 *(outbuffer + offset + 1) = (this->zeroing_time.sec >> (8 * 1)) & 0xFF; 00239 *(outbuffer + offset + 2) = (this->zeroing_time.sec >> (8 * 2)) & 0xFF; 00240 *(outbuffer + offset + 3) = (this->zeroing_time.sec >> (8 * 3)) & 0xFF; 00241 offset += sizeof(this->zeroing_time.sec); 00242 *(outbuffer + offset + 0) = (this->zeroing_time.nsec >> (8 * 0)) & 0xFF; 00243 *(outbuffer + offset + 1) = (this->zeroing_time.nsec >> (8 * 1)) & 0xFF; 00244 *(outbuffer + offset + 2) = (this->zeroing_time.nsec >> (8 * 2)) & 0xFF; 00245 *(outbuffer + offset + 3) = (this->zeroing_time.nsec >> (8 * 3)) & 0xFF; 00246 offset += sizeof(this->zeroing_time.nsec); 00247 union { 00248 uint64_t real; 00249 uint32_t base; 00250 } u_errors; 00251 u_errors.real = this->errors; 00252 *(outbuffer + offset + 0) = (u_errors.base >> (8 * 0)) & 0xFF; 00253 *(outbuffer + offset + 1) = (u_errors.base >> (8 * 1)) & 0xFF; 00254 *(outbuffer + offset + 2) = (u_errors.base >> (8 * 2)) & 0xFF; 00255 *(outbuffer + offset + 3) = (u_errors.base >> (8 * 3)) & 0xFF; 00256 offset += sizeof(this->errors); 00257 return offset; 00258 } 00259 00260 virtual int deserialize(unsigned char *inbuffer) 00261 { 00262 int offset = 0; 00263 offset += this->header.deserialize(inbuffer + offset); 00264 offset += this->angular_velocity_zeroed.deserialize(inbuffer + offset); 00265 offset += this->angular_velocity_raw.deserialize(inbuffer + offset); 00266 for( uint32_t i = 0; i < 9; i++){ 00267 union { 00268 double real; 00269 uint64_t base; 00270 } u_angular_velocity_covariancei; 00271 u_angular_velocity_covariancei.base = 0; 00272 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00273 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00274 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00275 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00276 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00277 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00278 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00279 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00280 this->angular_velocity_covariance[i] = u_angular_velocity_covariancei.real; 00281 offset += sizeof(this->angular_velocity_covariance[i]); 00282 } 00283 offset += this->linear_acceleration_zeroed.deserialize(inbuffer + offset); 00284 offset += this->linear_acceleration_raw.deserialize(inbuffer + offset); 00285 for( uint32_t i = 0; i < 9; i++){ 00286 union { 00287 double real; 00288 uint64_t base; 00289 } u_linear_acceleration_covariancei; 00290 u_linear_acceleration_covariancei.base = 0; 00291 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00292 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00293 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00294 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00295 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00296 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00297 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00298 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00299 this->linear_acceleration_covariance[i] = u_linear_acceleration_covariancei.real; 00300 offset += sizeof(this->linear_acceleration_covariance[i]); 00301 } 00302 offset += this->nunchuk_acceleration_zeroed.deserialize(inbuffer + offset); 00303 offset += this->nunchuk_acceleration_raw.deserialize(inbuffer + offset); 00304 for( uint32_t i = 0; i < 2; i++){ 00305 union { 00306 float real; 00307 uint32_t base; 00308 } u_nunchuk_joystick_zeroedi; 00309 u_nunchuk_joystick_zeroedi.base = 0; 00310 u_nunchuk_joystick_zeroedi.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00311 u_nunchuk_joystick_zeroedi.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00312 u_nunchuk_joystick_zeroedi.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00313 u_nunchuk_joystick_zeroedi.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00314 this->nunchuk_joystick_zeroed[i] = u_nunchuk_joystick_zeroedi.real; 00315 offset += sizeof(this->nunchuk_joystick_zeroed[i]); 00316 } 00317 for( uint32_t i = 0; i < 2; i++){ 00318 union { 00319 float real; 00320 uint32_t base; 00321 } u_nunchuk_joystick_rawi; 00322 u_nunchuk_joystick_rawi.base = 0; 00323 u_nunchuk_joystick_rawi.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00324 u_nunchuk_joystick_rawi.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00325 u_nunchuk_joystick_rawi.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00326 u_nunchuk_joystick_rawi.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00327 this->nunchuk_joystick_raw[i] = u_nunchuk_joystick_rawi.real; 00328 offset += sizeof(this->nunchuk_joystick_raw[i]); 00329 } 00330 for( uint32_t i = 0; i < 11; i++){ 00331 union { 00332 bool real; 00333 uint8_t base; 00334 } u_buttonsi; 00335 u_buttonsi.base = 0; 00336 u_buttonsi.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00337 this->buttons[i] = u_buttonsi.real; 00338 offset += sizeof(this->buttons[i]); 00339 } 00340 for( uint32_t i = 0; i < 2; i++){ 00341 union { 00342 bool real; 00343 uint8_t base; 00344 } u_nunchuk_buttonsi; 00345 u_nunchuk_buttonsi.base = 0; 00346 u_nunchuk_buttonsi.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00347 this->nunchuk_buttons[i] = u_nunchuk_buttonsi.real; 00348 offset += sizeof(this->nunchuk_buttons[i]); 00349 } 00350 for( uint32_t i = 0; i < 4; i++){ 00351 union { 00352 bool real; 00353 uint8_t base; 00354 } u_LEDsi; 00355 u_LEDsi.base = 0; 00356 u_LEDsi.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00357 this->LEDs[i] = u_LEDsi.real; 00358 offset += sizeof(this->LEDs[i]); 00359 } 00360 union { 00361 bool real; 00362 uint8_t base; 00363 } u_rumble; 00364 u_rumble.base = 0; 00365 u_rumble.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00366 this->rumble = u_rumble.real; 00367 offset += sizeof(this->rumble); 00368 uint32_t ir_tracking_lengthT = ((uint32_t) (*(inbuffer + offset))); 00369 ir_tracking_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00370 ir_tracking_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00371 ir_tracking_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00372 offset += sizeof(this->ir_tracking_length); 00373 if(ir_tracking_lengthT > ir_tracking_length) 00374 this->ir_tracking = (wiimote::IrSourceInfo*)realloc(this->ir_tracking, ir_tracking_lengthT * sizeof(wiimote::IrSourceInfo)); 00375 ir_tracking_length = ir_tracking_lengthT; 00376 for( uint32_t i = 0; i < ir_tracking_length; i++){ 00377 offset += this->st_ir_tracking.deserialize(inbuffer + offset); 00378 memcpy( &(this->ir_tracking[i]), &(this->st_ir_tracking), sizeof(wiimote::IrSourceInfo)); 00379 } 00380 union { 00381 float real; 00382 uint32_t base; 00383 } u_raw_battery; 00384 u_raw_battery.base = 0; 00385 u_raw_battery.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00386 u_raw_battery.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00387 u_raw_battery.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00388 u_raw_battery.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00389 this->raw_battery = u_raw_battery.real; 00390 offset += sizeof(this->raw_battery); 00391 union { 00392 float real; 00393 uint32_t base; 00394 } u_percent_battery; 00395 u_percent_battery.base = 0; 00396 u_percent_battery.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00397 u_percent_battery.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00398 u_percent_battery.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00399 u_percent_battery.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00400 this->percent_battery = u_percent_battery.real; 00401 offset += sizeof(this->percent_battery); 00402 this->zeroing_time.sec = ((uint32_t) (*(inbuffer + offset))); 00403 this->zeroing_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00404 this->zeroing_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00405 this->zeroing_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00406 offset += sizeof(this->zeroing_time.sec); 00407 this->zeroing_time.nsec = ((uint32_t) (*(inbuffer + offset))); 00408 this->zeroing_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00409 this->zeroing_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00410 this->zeroing_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00411 offset += sizeof(this->zeroing_time.nsec); 00412 union { 00413 uint64_t real; 00414 uint32_t base; 00415 } u_errors; 00416 u_errors.base = 0; 00417 u_errors.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00418 u_errors.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00419 u_errors.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00420 u_errors.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00421 this->errors = u_errors.real; 00422 offset += sizeof(this->errors); 00423 return offset; 00424 } 00425 00426 virtual const char * getType(){ return "wiimote/State"; }; 00427 virtual const char * getMD5(){ return "a69651e8129655c6ed3c5039e468362c"; }; 00428 00429 }; 00430 00431 } 00432 #endif
Generated on Mon Sep 26 2022 13:47:03 by
