hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_SERVICE_SetPen_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_SERVICE_SetPen_h
garyservin 0:9e9b7db60fd5 3 #include <stdint.h>
garyservin 0:9e9b7db60fd5 4 #include <string.h>
garyservin 0:9e9b7db60fd5 5 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 6 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 7
garyservin 0:9e9b7db60fd5 8 namespace turtlesim
garyservin 0:9e9b7db60fd5 9 {
garyservin 0:9e9b7db60fd5 10
garyservin 0:9e9b7db60fd5 11 static const char SETPEN[] = "turtlesim/SetPen";
garyservin 0:9e9b7db60fd5 12
garyservin 0:9e9b7db60fd5 13 class SetPenRequest : public ros::Msg
garyservin 0:9e9b7db60fd5 14 {
garyservin 0:9e9b7db60fd5 15 public:
garyservin 0:9e9b7db60fd5 16 typedef uint8_t _r_type;
garyservin 0:9e9b7db60fd5 17 _r_type r;
garyservin 0:9e9b7db60fd5 18 typedef uint8_t _g_type;
garyservin 0:9e9b7db60fd5 19 _g_type g;
garyservin 0:9e9b7db60fd5 20 typedef uint8_t _b_type;
garyservin 0:9e9b7db60fd5 21 _b_type b;
garyservin 0:9e9b7db60fd5 22 typedef uint8_t _width_type;
garyservin 0:9e9b7db60fd5 23 _width_type width;
garyservin 0:9e9b7db60fd5 24 typedef uint8_t _off_type;
garyservin 0:9e9b7db60fd5 25 _off_type off;
garyservin 0:9e9b7db60fd5 26
garyservin 0:9e9b7db60fd5 27 SetPenRequest():
garyservin 0:9e9b7db60fd5 28 r(0),
garyservin 0:9e9b7db60fd5 29 g(0),
garyservin 0:9e9b7db60fd5 30 b(0),
garyservin 0:9e9b7db60fd5 31 width(0),
garyservin 0:9e9b7db60fd5 32 off(0)
garyservin 0:9e9b7db60fd5 33 {
garyservin 0:9e9b7db60fd5 34 }
garyservin 0:9e9b7db60fd5 35
garyservin 0:9e9b7db60fd5 36 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 37 {
garyservin 0:9e9b7db60fd5 38 int offset = 0;
garyservin 0:9e9b7db60fd5 39 *(outbuffer + offset + 0) = (this->r >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 40 offset += sizeof(this->r);
garyservin 0:9e9b7db60fd5 41 *(outbuffer + offset + 0) = (this->g >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 42 offset += sizeof(this->g);
garyservin 0:9e9b7db60fd5 43 *(outbuffer + offset + 0) = (this->b >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 44 offset += sizeof(this->b);
garyservin 0:9e9b7db60fd5 45 *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 46 offset += sizeof(this->width);
garyservin 0:9e9b7db60fd5 47 *(outbuffer + offset + 0) = (this->off >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 48 offset += sizeof(this->off);
garyservin 0:9e9b7db60fd5 49 return offset;
garyservin 0:9e9b7db60fd5 50 }
garyservin 0:9e9b7db60fd5 51
garyservin 0:9e9b7db60fd5 52 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 53 {
garyservin 0:9e9b7db60fd5 54 int offset = 0;
garyservin 0:9e9b7db60fd5 55 this->r = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 56 offset += sizeof(this->r);
garyservin 0:9e9b7db60fd5 57 this->g = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 58 offset += sizeof(this->g);
garyservin 0:9e9b7db60fd5 59 this->b = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 60 offset += sizeof(this->b);
garyservin 0:9e9b7db60fd5 61 this->width = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 62 offset += sizeof(this->width);
garyservin 0:9e9b7db60fd5 63 this->off = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 64 offset += sizeof(this->off);
garyservin 0:9e9b7db60fd5 65 return offset;
garyservin 0:9e9b7db60fd5 66 }
garyservin 0:9e9b7db60fd5 67
garyservin 0:9e9b7db60fd5 68 const char * getType(){ return SETPEN; };
garyservin 0:9e9b7db60fd5 69 const char * getMD5(){ return "9f452acce566bf0c0954594f69a8e41b"; };
garyservin 0:9e9b7db60fd5 70
garyservin 0:9e9b7db60fd5 71 };
garyservin 0:9e9b7db60fd5 72
garyservin 0:9e9b7db60fd5 73 class SetPenResponse : public ros::Msg
garyservin 0:9e9b7db60fd5 74 {
garyservin 0:9e9b7db60fd5 75 public:
garyservin 0:9e9b7db60fd5 76
garyservin 0:9e9b7db60fd5 77 SetPenResponse()
garyservin 0:9e9b7db60fd5 78 {
garyservin 0:9e9b7db60fd5 79 }
garyservin 0:9e9b7db60fd5 80
garyservin 0:9e9b7db60fd5 81 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 82 {
garyservin 0:9e9b7db60fd5 83 int offset = 0;
garyservin 0:9e9b7db60fd5 84 return offset;
garyservin 0:9e9b7db60fd5 85 }
garyservin 0:9e9b7db60fd5 86
garyservin 0:9e9b7db60fd5 87 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 88 {
garyservin 0:9e9b7db60fd5 89 int offset = 0;
garyservin 0:9e9b7db60fd5 90 return offset;
garyservin 0:9e9b7db60fd5 91 }
garyservin 0:9e9b7db60fd5 92
garyservin 0:9e9b7db60fd5 93 const char * getType(){ return SETPEN; };
garyservin 0:9e9b7db60fd5 94 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
garyservin 0:9e9b7db60fd5 95
garyservin 0:9e9b7db60fd5 96 };
garyservin 0:9e9b7db60fd5 97
garyservin 0:9e9b7db60fd5 98 class SetPen {
garyservin 0:9e9b7db60fd5 99 public:
garyservin 0:9e9b7db60fd5 100 typedef SetPenRequest Request;
garyservin 0:9e9b7db60fd5 101 typedef SetPenResponse Response;
garyservin 0:9e9b7db60fd5 102 };
garyservin 0:9e9b7db60fd5 103
garyservin 0:9e9b7db60fd5 104 }
garyservin 0:9e9b7db60fd5 105 #endif