ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BadTwoInts.h Source File

BadTwoInts.h

00001 #ifndef _ROS_SERVICE_BadTwoInts_h
00002 #define _ROS_SERVICE_BadTwoInts_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace rospy_tutorials
00009 {
00010 
00011 static const char BADTWOINTS[] = "rospy_tutorials/BadTwoInts";
00012 
00013   class BadTwoIntsRequest : public ros::Msg
00014   {
00015     public:
00016       int64_t a;
00017       int32_t b;
00018 
00019     BadTwoIntsRequest():
00020       a(0),
00021       b(0)
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       union {
00029         int64_t real;
00030         uint64_t base;
00031       } u_a;
00032       u_a.real = this->a;
00033       *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
00037       *(outbuffer + offset + 4) = (u_a.base >> (8 * 4)) & 0xFF;
00038       *(outbuffer + offset + 5) = (u_a.base >> (8 * 5)) & 0xFF;
00039       *(outbuffer + offset + 6) = (u_a.base >> (8 * 6)) & 0xFF;
00040       *(outbuffer + offset + 7) = (u_a.base >> (8 * 7)) & 0xFF;
00041       offset += sizeof(this->a);
00042       union {
00043         int32_t real;
00044         uint32_t base;
00045       } u_b;
00046       u_b.real = this->b;
00047       *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
00048       *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
00049       *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
00050       *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
00051       offset += sizeof(this->b);
00052       return offset;
00053     }
00054 
00055     virtual int deserialize(unsigned char *inbuffer)
00056     {
00057       int offset = 0;
00058       union {
00059         int64_t real;
00060         uint64_t base;
00061       } u_a;
00062       u_a.base = 0;
00063       u_a.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00064       u_a.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00065       u_a.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00066       u_a.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00067       u_a.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00068       u_a.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00069       u_a.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00070       u_a.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00071       this->a = u_a.real;
00072       offset += sizeof(this->a);
00073       union {
00074         int32_t real;
00075         uint32_t base;
00076       } u_b;
00077       u_b.base = 0;
00078       u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00079       u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00080       u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00081       u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00082       this->b = u_b.real;
00083       offset += sizeof(this->b);
00084      return offset;
00085     }
00086 
00087     const char * getType(){ return BADTWOINTS; };
00088     const char * getMD5(){ return "29bb5c7dea8bf822f53e94b0ee5a3a56"; };
00089 
00090   };
00091 
00092   class BadTwoIntsResponse : public ros::Msg
00093   {
00094     public:
00095       int32_t sum;
00096 
00097     BadTwoIntsResponse():
00098       sum(0)
00099     {
00100     }
00101 
00102     virtual int serialize(unsigned char *outbuffer) const
00103     {
00104       int offset = 0;
00105       union {
00106         int32_t real;
00107         uint32_t base;
00108       } u_sum;
00109       u_sum.real = this->sum;
00110       *(outbuffer + offset + 0) = (u_sum.base >> (8 * 0)) & 0xFF;
00111       *(outbuffer + offset + 1) = (u_sum.base >> (8 * 1)) & 0xFF;
00112       *(outbuffer + offset + 2) = (u_sum.base >> (8 * 2)) & 0xFF;
00113       *(outbuffer + offset + 3) = (u_sum.base >> (8 * 3)) & 0xFF;
00114       offset += sizeof(this->sum);
00115       return offset;
00116     }
00117 
00118     virtual int deserialize(unsigned char *inbuffer)
00119     {
00120       int offset = 0;
00121       union {
00122         int32_t real;
00123         uint32_t base;
00124       } u_sum;
00125       u_sum.base = 0;
00126       u_sum.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00127       u_sum.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00128       u_sum.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00129       u_sum.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00130       this->sum = u_sum.real;
00131       offset += sizeof(this->sum);
00132      return offset;
00133     }
00134 
00135     const char * getType(){ return BADTWOINTS; };
00136     const char * getMD5(){ return "0ba699c25c9418c0366f3595c0c8e8ec"; };
00137 
00138   };
00139 
00140   class BadTwoInts {
00141     public:
00142     typedef BadTwoIntsRequest Request;
00143     typedef BadTwoIntsResponse Response;
00144   };
00145 
00146 }
00147 #endif