rosserial library for mbed Inspired by nucho's rosserial library This library is still under development

Dependencies:   MODSERIAL mbed

Dependents:   mbed_roshydro_test

Library still under development!

Committer:
akashvibhute
Date:
Sun Feb 15 10:53:43 2015 +0000
Revision:
0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 0:30537dec6e0b 1 #ifndef _ROS_SERVICE_BadTwoInts_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_SERVICE_BadTwoInts_h
akashvibhute 0:30537dec6e0b 3 #include <stdint.h>
akashvibhute 0:30537dec6e0b 4 #include <string.h>
akashvibhute 0:30537dec6e0b 5 #include <stdlib.h>
akashvibhute 0:30537dec6e0b 6 #include "ros/msg.h"
akashvibhute 0:30537dec6e0b 7
akashvibhute 0:30537dec6e0b 8 namespace rospy_tutorials
akashvibhute 0:30537dec6e0b 9 {
akashvibhute 0:30537dec6e0b 10
akashvibhute 0:30537dec6e0b 11 static const char BADTWOINTS[] = "rospy_tutorials/BadTwoInts";
akashvibhute 0:30537dec6e0b 12
akashvibhute 0:30537dec6e0b 13 class BadTwoIntsRequest : public ros::Msg
akashvibhute 0:30537dec6e0b 14 {
akashvibhute 0:30537dec6e0b 15 public:
akashvibhute 0:30537dec6e0b 16 int64_t a;
akashvibhute 0:30537dec6e0b 17 int32_t b;
akashvibhute 0:30537dec6e0b 18
akashvibhute 0:30537dec6e0b 19 BadTwoIntsRequest():
akashvibhute 0:30537dec6e0b 20 a(0),
akashvibhute 0:30537dec6e0b 21 b(0)
akashvibhute 0:30537dec6e0b 22 {
akashvibhute 0:30537dec6e0b 23 }
akashvibhute 0:30537dec6e0b 24
akashvibhute 0:30537dec6e0b 25 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 26 {
akashvibhute 0:30537dec6e0b 27 int offset = 0;
akashvibhute 0:30537dec6e0b 28 union {
akashvibhute 0:30537dec6e0b 29 int64_t real;
akashvibhute 0:30537dec6e0b 30 uint64_t base;
akashvibhute 0:30537dec6e0b 31 } u_a;
akashvibhute 0:30537dec6e0b 32 u_a.real = this->a;
akashvibhute 0:30537dec6e0b 33 *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 34 *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 35 *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 36 *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 37 *(outbuffer + offset + 4) = (u_a.base >> (8 * 4)) & 0xFF;
akashvibhute 0:30537dec6e0b 38 *(outbuffer + offset + 5) = (u_a.base >> (8 * 5)) & 0xFF;
akashvibhute 0:30537dec6e0b 39 *(outbuffer + offset + 6) = (u_a.base >> (8 * 6)) & 0xFF;
akashvibhute 0:30537dec6e0b 40 *(outbuffer + offset + 7) = (u_a.base >> (8 * 7)) & 0xFF;
akashvibhute 0:30537dec6e0b 41 offset += sizeof(this->a);
akashvibhute 0:30537dec6e0b 42 union {
akashvibhute 0:30537dec6e0b 43 int32_t real;
akashvibhute 0:30537dec6e0b 44 uint32_t base;
akashvibhute 0:30537dec6e0b 45 } u_b;
akashvibhute 0:30537dec6e0b 46 u_b.real = this->b;
akashvibhute 0:30537dec6e0b 47 *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 48 *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 49 *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 50 *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 51 offset += sizeof(this->b);
akashvibhute 0:30537dec6e0b 52 return offset;
akashvibhute 0:30537dec6e0b 53 }
akashvibhute 0:30537dec6e0b 54
akashvibhute 0:30537dec6e0b 55 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 56 {
akashvibhute 0:30537dec6e0b 57 int offset = 0;
akashvibhute 0:30537dec6e0b 58 union {
akashvibhute 0:30537dec6e0b 59 int64_t real;
akashvibhute 0:30537dec6e0b 60 uint64_t base;
akashvibhute 0:30537dec6e0b 61 } u_a;
akashvibhute 0:30537dec6e0b 62 u_a.base = 0;
akashvibhute 0:30537dec6e0b 63 u_a.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 64 u_a.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 65 u_a.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 66 u_a.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 67 u_a.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
akashvibhute 0:30537dec6e0b 68 u_a.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
akashvibhute 0:30537dec6e0b 69 u_a.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
akashvibhute 0:30537dec6e0b 70 u_a.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
akashvibhute 0:30537dec6e0b 71 this->a = u_a.real;
akashvibhute 0:30537dec6e0b 72 offset += sizeof(this->a);
akashvibhute 0:30537dec6e0b 73 union {
akashvibhute 0:30537dec6e0b 74 int32_t real;
akashvibhute 0:30537dec6e0b 75 uint32_t base;
akashvibhute 0:30537dec6e0b 76 } u_b;
akashvibhute 0:30537dec6e0b 77 u_b.base = 0;
akashvibhute 0:30537dec6e0b 78 u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 79 u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 80 u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 81 u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 82 this->b = u_b.real;
akashvibhute 0:30537dec6e0b 83 offset += sizeof(this->b);
akashvibhute 0:30537dec6e0b 84 return offset;
akashvibhute 0:30537dec6e0b 85 }
akashvibhute 0:30537dec6e0b 86
akashvibhute 0:30537dec6e0b 87 const char * getType(){ return BADTWOINTS; };
akashvibhute 0:30537dec6e0b 88 const char * getMD5(){ return "29bb5c7dea8bf822f53e94b0ee5a3a56"; };
akashvibhute 0:30537dec6e0b 89
akashvibhute 0:30537dec6e0b 90 };
akashvibhute 0:30537dec6e0b 91
akashvibhute 0:30537dec6e0b 92 class BadTwoIntsResponse : public ros::Msg
akashvibhute 0:30537dec6e0b 93 {
akashvibhute 0:30537dec6e0b 94 public:
akashvibhute 0:30537dec6e0b 95 int32_t sum;
akashvibhute 0:30537dec6e0b 96
akashvibhute 0:30537dec6e0b 97 BadTwoIntsResponse():
akashvibhute 0:30537dec6e0b 98 sum(0)
akashvibhute 0:30537dec6e0b 99 {
akashvibhute 0:30537dec6e0b 100 }
akashvibhute 0:30537dec6e0b 101
akashvibhute 0:30537dec6e0b 102 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 103 {
akashvibhute 0:30537dec6e0b 104 int offset = 0;
akashvibhute 0:30537dec6e0b 105 union {
akashvibhute 0:30537dec6e0b 106 int32_t real;
akashvibhute 0:30537dec6e0b 107 uint32_t base;
akashvibhute 0:30537dec6e0b 108 } u_sum;
akashvibhute 0:30537dec6e0b 109 u_sum.real = this->sum;
akashvibhute 0:30537dec6e0b 110 *(outbuffer + offset + 0) = (u_sum.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 111 *(outbuffer + offset + 1) = (u_sum.base >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 112 *(outbuffer + offset + 2) = (u_sum.base >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 113 *(outbuffer + offset + 3) = (u_sum.base >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 114 offset += sizeof(this->sum);
akashvibhute 0:30537dec6e0b 115 return offset;
akashvibhute 0:30537dec6e0b 116 }
akashvibhute 0:30537dec6e0b 117
akashvibhute 0:30537dec6e0b 118 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 119 {
akashvibhute 0:30537dec6e0b 120 int offset = 0;
akashvibhute 0:30537dec6e0b 121 union {
akashvibhute 0:30537dec6e0b 122 int32_t real;
akashvibhute 0:30537dec6e0b 123 uint32_t base;
akashvibhute 0:30537dec6e0b 124 } u_sum;
akashvibhute 0:30537dec6e0b 125 u_sum.base = 0;
akashvibhute 0:30537dec6e0b 126 u_sum.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 127 u_sum.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 128 u_sum.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 129 u_sum.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 130 this->sum = u_sum.real;
akashvibhute 0:30537dec6e0b 131 offset += sizeof(this->sum);
akashvibhute 0:30537dec6e0b 132 return offset;
akashvibhute 0:30537dec6e0b 133 }
akashvibhute 0:30537dec6e0b 134
akashvibhute 0:30537dec6e0b 135 const char * getType(){ return BADTWOINTS; };
akashvibhute 0:30537dec6e0b 136 const char * getMD5(){ return "0ba699c25c9418c0366f3595c0c8e8ec"; };
akashvibhute 0:30537dec6e0b 137
akashvibhute 0:30537dec6e0b 138 };
akashvibhute 0:30537dec6e0b 139
akashvibhute 0:30537dec6e0b 140 class BadTwoInts {
akashvibhute 0:30537dec6e0b 141 public:
akashvibhute 0:30537dec6e0b 142 typedef BadTwoIntsRequest Request;
akashvibhute 0:30537dec6e0b 143 typedef BadTwoIntsResponse Response;
akashvibhute 0:30537dec6e0b 144 };
akashvibhute 0:30537dec6e0b 145
akashvibhute 0:30537dec6e0b 146 }
akashvibhute 0:30537dec6e0b 147 #endif
akashvibhute 0:30537dec6e0b 148