Irfan Tito Kurniawan / ros_lib
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CommandLong.h Source File

CommandLong.h

00001 #ifndef _ROS_SERVICE_CommandLong_h
00002 #define _ROS_SERVICE_CommandLong_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace mavros_msgs
00009 {
00010 
00011 static const char COMMANDLONG[] = "mavros_msgs/CommandLong";
00012 
00013   class CommandLongRequest : public ros::Msg
00014   {
00015     public:
00016       typedef bool _broadcast_type;
00017       _broadcast_type broadcast;
00018       typedef uint16_t _command_type;
00019       _command_type command;
00020       typedef uint8_t _confirmation_type;
00021       _confirmation_type confirmation;
00022       typedef float _param1_type;
00023       _param1_type param1;
00024       typedef float _param2_type;
00025       _param2_type param2;
00026       typedef float _param3_type;
00027       _param3_type param3;
00028       typedef float _param4_type;
00029       _param4_type param4;
00030       typedef float _param5_type;
00031       _param5_type param5;
00032       typedef float _param6_type;
00033       _param6_type param6;
00034       typedef float _param7_type;
00035       _param7_type param7;
00036 
00037     CommandLongRequest():
00038       broadcast(0),
00039       command(0),
00040       confirmation(0),
00041       param1(0),
00042       param2(0),
00043       param3(0),
00044       param4(0),
00045       param5(0),
00046       param6(0),
00047       param7(0)
00048     {
00049     }
00050 
00051     virtual int serialize(unsigned char *outbuffer) const
00052     {
00053       int offset = 0;
00054       union {
00055         bool real;
00056         uint8_t base;
00057       } u_broadcast;
00058       u_broadcast.real = this->broadcast;
00059       *(outbuffer + offset + 0) = (u_broadcast.base >> (8 * 0)) & 0xFF;
00060       offset += sizeof(this->broadcast);
00061       *(outbuffer + offset + 0) = (this->command >> (8 * 0)) & 0xFF;
00062       *(outbuffer + offset + 1) = (this->command >> (8 * 1)) & 0xFF;
00063       offset += sizeof(this->command);
00064       *(outbuffer + offset + 0) = (this->confirmation >> (8 * 0)) & 0xFF;
00065       offset += sizeof(this->confirmation);
00066       union {
00067         float real;
00068         uint32_t base;
00069       } u_param1;
00070       u_param1.real = this->param1;
00071       *(outbuffer + offset + 0) = (u_param1.base >> (8 * 0)) & 0xFF;
00072       *(outbuffer + offset + 1) = (u_param1.base >> (8 * 1)) & 0xFF;
00073       *(outbuffer + offset + 2) = (u_param1.base >> (8 * 2)) & 0xFF;
00074       *(outbuffer + offset + 3) = (u_param1.base >> (8 * 3)) & 0xFF;
00075       offset += sizeof(this->param1);
00076       union {
00077         float real;
00078         uint32_t base;
00079       } u_param2;
00080       u_param2.real = this->param2;
00081       *(outbuffer + offset + 0) = (u_param2.base >> (8 * 0)) & 0xFF;
00082       *(outbuffer + offset + 1) = (u_param2.base >> (8 * 1)) & 0xFF;
00083       *(outbuffer + offset + 2) = (u_param2.base >> (8 * 2)) & 0xFF;
00084       *(outbuffer + offset + 3) = (u_param2.base >> (8 * 3)) & 0xFF;
00085       offset += sizeof(this->param2);
00086       union {
00087         float real;
00088         uint32_t base;
00089       } u_param3;
00090       u_param3.real = this->param3;
00091       *(outbuffer + offset + 0) = (u_param3.base >> (8 * 0)) & 0xFF;
00092       *(outbuffer + offset + 1) = (u_param3.base >> (8 * 1)) & 0xFF;
00093       *(outbuffer + offset + 2) = (u_param3.base >> (8 * 2)) & 0xFF;
00094       *(outbuffer + offset + 3) = (u_param3.base >> (8 * 3)) & 0xFF;
00095       offset += sizeof(this->param3);
00096       union {
00097         float real;
00098         uint32_t base;
00099       } u_param4;
00100       u_param4.real = this->param4;
00101       *(outbuffer + offset + 0) = (u_param4.base >> (8 * 0)) & 0xFF;
00102       *(outbuffer + offset + 1) = (u_param4.base >> (8 * 1)) & 0xFF;
00103       *(outbuffer + offset + 2) = (u_param4.base >> (8 * 2)) & 0xFF;
00104       *(outbuffer + offset + 3) = (u_param4.base >> (8 * 3)) & 0xFF;
00105       offset += sizeof(this->param4);
00106       union {
00107         float real;
00108         uint32_t base;
00109       } u_param5;
00110       u_param5.real = this->param5;
00111       *(outbuffer + offset + 0) = (u_param5.base >> (8 * 0)) & 0xFF;
00112       *(outbuffer + offset + 1) = (u_param5.base >> (8 * 1)) & 0xFF;
00113       *(outbuffer + offset + 2) = (u_param5.base >> (8 * 2)) & 0xFF;
00114       *(outbuffer + offset + 3) = (u_param5.base >> (8 * 3)) & 0xFF;
00115       offset += sizeof(this->param5);
00116       union {
00117         float real;
00118         uint32_t base;
00119       } u_param6;
00120       u_param6.real = this->param6;
00121       *(outbuffer + offset + 0) = (u_param6.base >> (8 * 0)) & 0xFF;
00122       *(outbuffer + offset + 1) = (u_param6.base >> (8 * 1)) & 0xFF;
00123       *(outbuffer + offset + 2) = (u_param6.base >> (8 * 2)) & 0xFF;
00124       *(outbuffer + offset + 3) = (u_param6.base >> (8 * 3)) & 0xFF;
00125       offset += sizeof(this->param6);
00126       union {
00127         float real;
00128         uint32_t base;
00129       } u_param7;
00130       u_param7.real = this->param7;
00131       *(outbuffer + offset + 0) = (u_param7.base >> (8 * 0)) & 0xFF;
00132       *(outbuffer + offset + 1) = (u_param7.base >> (8 * 1)) & 0xFF;
00133       *(outbuffer + offset + 2) = (u_param7.base >> (8 * 2)) & 0xFF;
00134       *(outbuffer + offset + 3) = (u_param7.base >> (8 * 3)) & 0xFF;
00135       offset += sizeof(this->param7);
00136       return offset;
00137     }
00138 
00139     virtual int deserialize(unsigned char *inbuffer)
00140     {
00141       int offset = 0;
00142       union {
00143         bool real;
00144         uint8_t base;
00145       } u_broadcast;
00146       u_broadcast.base = 0;
00147       u_broadcast.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00148       this->broadcast = u_broadcast.real;
00149       offset += sizeof(this->broadcast);
00150       this->command =  ((uint16_t) (*(inbuffer + offset)));
00151       this->command |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00152       offset += sizeof(this->command);
00153       this->confirmation =  ((uint8_t) (*(inbuffer + offset)));
00154       offset += sizeof(this->confirmation);
00155       union {
00156         float real;
00157         uint32_t base;
00158       } u_param1;
00159       u_param1.base = 0;
00160       u_param1.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00161       u_param1.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00162       u_param1.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00163       u_param1.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00164       this->param1 = u_param1.real;
00165       offset += sizeof(this->param1);
00166       union {
00167         float real;
00168         uint32_t base;
00169       } u_param2;
00170       u_param2.base = 0;
00171       u_param2.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00172       u_param2.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00173       u_param2.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00174       u_param2.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00175       this->param2 = u_param2.real;
00176       offset += sizeof(this->param2);
00177       union {
00178         float real;
00179         uint32_t base;
00180       } u_param3;
00181       u_param3.base = 0;
00182       u_param3.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00183       u_param3.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00184       u_param3.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00185       u_param3.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00186       this->param3 = u_param3.real;
00187       offset += sizeof(this->param3);
00188       union {
00189         float real;
00190         uint32_t base;
00191       } u_param4;
00192       u_param4.base = 0;
00193       u_param4.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00194       u_param4.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00195       u_param4.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00196       u_param4.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00197       this->param4 = u_param4.real;
00198       offset += sizeof(this->param4);
00199       union {
00200         float real;
00201         uint32_t base;
00202       } u_param5;
00203       u_param5.base = 0;
00204       u_param5.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00205       u_param5.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00206       u_param5.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00207       u_param5.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00208       this->param5 = u_param5.real;
00209       offset += sizeof(this->param5);
00210       union {
00211         float real;
00212         uint32_t base;
00213       } u_param6;
00214       u_param6.base = 0;
00215       u_param6.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00216       u_param6.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00217       u_param6.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00218       u_param6.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00219       this->param6 = u_param6.real;
00220       offset += sizeof(this->param6);
00221       union {
00222         float real;
00223         uint32_t base;
00224       } u_param7;
00225       u_param7.base = 0;
00226       u_param7.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00227       u_param7.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00228       u_param7.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00229       u_param7.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00230       this->param7 = u_param7.real;
00231       offset += sizeof(this->param7);
00232      return offset;
00233     }
00234 
00235     const char * getType(){ return COMMANDLONG; };
00236     const char * getMD5(){ return "0ad16dd8ca2c8f209bfc6c32c71c0dd8"; };
00237 
00238   };
00239 
00240   class CommandLongResponse : public ros::Msg
00241   {
00242     public:
00243       typedef bool _success_type;
00244       _success_type success;
00245       typedef uint8_t _result_type;
00246       _result_type result;
00247 
00248     CommandLongResponse():
00249       success(0),
00250       result(0)
00251     {
00252     }
00253 
00254     virtual int serialize(unsigned char *outbuffer) const
00255     {
00256       int offset = 0;
00257       union {
00258         bool real;
00259         uint8_t base;
00260       } u_success;
00261       u_success.real = this->success;
00262       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00263       offset += sizeof(this->success);
00264       *(outbuffer + offset + 0) = (this->result >> (8 * 0)) & 0xFF;
00265       offset += sizeof(this->result);
00266       return offset;
00267     }
00268 
00269     virtual int deserialize(unsigned char *inbuffer)
00270     {
00271       int offset = 0;
00272       union {
00273         bool real;
00274         uint8_t base;
00275       } u_success;
00276       u_success.base = 0;
00277       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00278       this->success = u_success.real;
00279       offset += sizeof(this->success);
00280       this->result =  ((uint8_t) (*(inbuffer + offset)));
00281       offset += sizeof(this->result);
00282      return offset;
00283     }
00284 
00285     const char * getType(){ return COMMANDLONG; };
00286     const char * getMD5(){ return "1cd894375e4e3d2861d2222772894fdb"; };
00287 
00288   };
00289 
00290   class CommandLong {
00291     public:
00292     typedef CommandLongRequest Request;
00293     typedef CommandLongResponse Response;
00294   };
00295 
00296 }
00297 #endif