kitt_platform
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros
Adc.h
Go to the documentation of this file.
1 #ifndef _ROS_rosserial_arduino_Adc_h
2 #define _ROS_rosserial_arduino_Adc_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 
9 namespace rosserial_arduino
10 {
11 
12  class Adc : public ros::Msg
13  {
14  public:
15  uint16_t adc0;
16  uint16_t adc1;
17  uint16_t adc2;
18  uint16_t adc3;
19  uint16_t adc4;
20  uint16_t adc5;
21 
22  Adc():
23  adc0(0),
24  adc1(0),
25  adc2(0),
26  adc3(0),
27  adc4(0),
28  adc5(0)
29  {
30  }
31 
32  virtual int serialize(unsigned char *outbuffer) const
33  {
34  int offset = 0;
35  *(outbuffer + offset + 0) = (this->adc0 >> (8 * 0)) & 0xFF;
36  *(outbuffer + offset + 1) = (this->adc0 >> (8 * 1)) & 0xFF;
37  offset += sizeof(this->adc0);
38  *(outbuffer + offset + 0) = (this->adc1 >> (8 * 0)) & 0xFF;
39  *(outbuffer + offset + 1) = (this->adc1 >> (8 * 1)) & 0xFF;
40  offset += sizeof(this->adc1);
41  *(outbuffer + offset + 0) = (this->adc2 >> (8 * 0)) & 0xFF;
42  *(outbuffer + offset + 1) = (this->adc2 >> (8 * 1)) & 0xFF;
43  offset += sizeof(this->adc2);
44  *(outbuffer + offset + 0) = (this->adc3 >> (8 * 0)) & 0xFF;
45  *(outbuffer + offset + 1) = (this->adc3 >> (8 * 1)) & 0xFF;
46  offset += sizeof(this->adc3);
47  *(outbuffer + offset + 0) = (this->adc4 >> (8 * 0)) & 0xFF;
48  *(outbuffer + offset + 1) = (this->adc4 >> (8 * 1)) & 0xFF;
49  offset += sizeof(this->adc4);
50  *(outbuffer + offset + 0) = (this->adc5 >> (8 * 0)) & 0xFF;
51  *(outbuffer + offset + 1) = (this->adc5 >> (8 * 1)) & 0xFF;
52  offset += sizeof(this->adc5);
53  return offset;
54  }
55 
56  virtual int deserialize(unsigned char *inbuffer)
57  {
58  int offset = 0;
59  this->adc0 = ((uint16_t) (*(inbuffer + offset)));
60  this->adc0 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
61  offset += sizeof(this->adc0);
62  this->adc1 = ((uint16_t) (*(inbuffer + offset)));
63  this->adc1 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
64  offset += sizeof(this->adc1);
65  this->adc2 = ((uint16_t) (*(inbuffer + offset)));
66  this->adc2 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
67  offset += sizeof(this->adc2);
68  this->adc3 = ((uint16_t) (*(inbuffer + offset)));
69  this->adc3 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
70  offset += sizeof(this->adc3);
71  this->adc4 = ((uint16_t) (*(inbuffer + offset)));
72  this->adc4 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
73  offset += sizeof(this->adc4);
74  this->adc5 = ((uint16_t) (*(inbuffer + offset)));
75  this->adc5 |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
76  offset += sizeof(this->adc5);
77  return offset;
78  }
79 
80  const char * getType(){ return "rosserial_arduino/Adc"; };
81  const char * getMD5(){ return "6d7853a614e2e821319068311f2af25b"; };
82 
83  };
84 
85 }
86 #endif
Definition: Adc.h:12
uint16_t adc0
Definition: Adc.h:15
const char * getType()
Definition: Adc.h:80
uint16_t adc1
Definition: Adc.h:16
const char * getMD5()
Definition: Adc.h:81
virtual int serialize(unsigned char *outbuffer) const
Definition: Adc.h:32
virtual int deserialize(unsigned char *inbuffer)
Definition: Adc.h:56
uint16_t adc5
Definition: Adc.h:20
Adc()
Definition: Adc.h:22
uint16_t adc4
Definition: Adc.h:19
Definition: msg.h:43
uint16_t adc3
Definition: Adc.h:18
uint16_t adc2
Definition: Adc.h:17