rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
turtlesim/SetPen.h@0:30537dec6e0b, 2015-02-15 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_SERVICE_SetPen_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_SERVICE_SetPen_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 turtlesim |
akashvibhute | 0:30537dec6e0b | 9 | { |
akashvibhute | 0:30537dec6e0b | 10 | |
akashvibhute | 0:30537dec6e0b | 11 | static const char SETPEN[] = "turtlesim/SetPen"; |
akashvibhute | 0:30537dec6e0b | 12 | |
akashvibhute | 0:30537dec6e0b | 13 | class SetPenRequest : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 14 | { |
akashvibhute | 0:30537dec6e0b | 15 | public: |
akashvibhute | 0:30537dec6e0b | 16 | uint8_t r; |
akashvibhute | 0:30537dec6e0b | 17 | uint8_t g; |
akashvibhute | 0:30537dec6e0b | 18 | uint8_t b; |
akashvibhute | 0:30537dec6e0b | 19 | uint8_t width; |
akashvibhute | 0:30537dec6e0b | 20 | uint8_t off; |
akashvibhute | 0:30537dec6e0b | 21 | |
akashvibhute | 0:30537dec6e0b | 22 | SetPenRequest(): |
akashvibhute | 0:30537dec6e0b | 23 | r(0), |
akashvibhute | 0:30537dec6e0b | 24 | g(0), |
akashvibhute | 0:30537dec6e0b | 25 | b(0), |
akashvibhute | 0:30537dec6e0b | 26 | width(0), |
akashvibhute | 0:30537dec6e0b | 27 | off(0) |
akashvibhute | 0:30537dec6e0b | 28 | { |
akashvibhute | 0:30537dec6e0b | 29 | } |
akashvibhute | 0:30537dec6e0b | 30 | |
akashvibhute | 0:30537dec6e0b | 31 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 32 | { |
akashvibhute | 0:30537dec6e0b | 33 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 34 | *(outbuffer + offset + 0) = (this->r >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 35 | offset += sizeof(this->r); |
akashvibhute | 0:30537dec6e0b | 36 | *(outbuffer + offset + 0) = (this->g >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 37 | offset += sizeof(this->g); |
akashvibhute | 0:30537dec6e0b | 38 | *(outbuffer + offset + 0) = (this->b >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 39 | offset += sizeof(this->b); |
akashvibhute | 0:30537dec6e0b | 40 | *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 41 | offset += sizeof(this->width); |
akashvibhute | 0:30537dec6e0b | 42 | *(outbuffer + offset + 0) = (this->off >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 43 | offset += sizeof(this->off); |
akashvibhute | 0:30537dec6e0b | 44 | return offset; |
akashvibhute | 0:30537dec6e0b | 45 | } |
akashvibhute | 0:30537dec6e0b | 46 | |
akashvibhute | 0:30537dec6e0b | 47 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 48 | { |
akashvibhute | 0:30537dec6e0b | 49 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 50 | this->r = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 51 | offset += sizeof(this->r); |
akashvibhute | 0:30537dec6e0b | 52 | this->g = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 53 | offset += sizeof(this->g); |
akashvibhute | 0:30537dec6e0b | 54 | this->b = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 55 | offset += sizeof(this->b); |
akashvibhute | 0:30537dec6e0b | 56 | this->width = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 57 | offset += sizeof(this->width); |
akashvibhute | 0:30537dec6e0b | 58 | this->off = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 59 | offset += sizeof(this->off); |
akashvibhute | 0:30537dec6e0b | 60 | return offset; |
akashvibhute | 0:30537dec6e0b | 61 | } |
akashvibhute | 0:30537dec6e0b | 62 | |
akashvibhute | 0:30537dec6e0b | 63 | const char * getType(){ return SETPEN; }; |
akashvibhute | 0:30537dec6e0b | 64 | const char * getMD5(){ return "9f452acce566bf0c0954594f69a8e41b"; }; |
akashvibhute | 0:30537dec6e0b | 65 | |
akashvibhute | 0:30537dec6e0b | 66 | }; |
akashvibhute | 0:30537dec6e0b | 67 | |
akashvibhute | 0:30537dec6e0b | 68 | class SetPenResponse : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 69 | { |
akashvibhute | 0:30537dec6e0b | 70 | public: |
akashvibhute | 0:30537dec6e0b | 71 | |
akashvibhute | 0:30537dec6e0b | 72 | SetPenResponse() |
akashvibhute | 0:30537dec6e0b | 73 | { |
akashvibhute | 0:30537dec6e0b | 74 | } |
akashvibhute | 0:30537dec6e0b | 75 | |
akashvibhute | 0:30537dec6e0b | 76 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 77 | { |
akashvibhute | 0:30537dec6e0b | 78 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 79 | return offset; |
akashvibhute | 0:30537dec6e0b | 80 | } |
akashvibhute | 0:30537dec6e0b | 81 | |
akashvibhute | 0:30537dec6e0b | 82 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 83 | { |
akashvibhute | 0:30537dec6e0b | 84 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 85 | return offset; |
akashvibhute | 0:30537dec6e0b | 86 | } |
akashvibhute | 0:30537dec6e0b | 87 | |
akashvibhute | 0:30537dec6e0b | 88 | const char * getType(){ return SETPEN; }; |
akashvibhute | 0:30537dec6e0b | 89 | const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; |
akashvibhute | 0:30537dec6e0b | 90 | |
akashvibhute | 0:30537dec6e0b | 91 | }; |
akashvibhute | 0:30537dec6e0b | 92 | |
akashvibhute | 0:30537dec6e0b | 93 | class SetPen { |
akashvibhute | 0:30537dec6e0b | 94 | public: |
akashvibhute | 0:30537dec6e0b | 95 | typedef SetPenRequest Request; |
akashvibhute | 0:30537dec6e0b | 96 | typedef SetPenResponse Response; |
akashvibhute | 0:30537dec6e0b | 97 | }; |
akashvibhute | 0:30537dec6e0b | 98 | |
akashvibhute | 0:30537dec6e0b | 99 | } |
akashvibhute | 0:30537dec6e0b | 100 | #endif |
akashvibhute | 0:30537dec6e0b | 101 |