Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / std_msgs / UInt8MultiArray.h @ c1426757

History | View | Annotate | Download (1.64 KB)

1
#ifndef _ROS_std_msgs_UInt8MultiArray_h
2
#define _ROS_std_msgs_UInt8MultiArray_h
3

    
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
#include "std_msgs/MultiArrayLayout.h"
9

    
10
namespace std_msgs
11
{
12

    
13
  class UInt8MultiArray : public ros::Msg
14
  {
15
    public:
16
      std_msgs::MultiArrayLayout layout;
17
      uint8_t data_length;
18
      uint8_t st_data;
19
      uint8_t * data;
20

    
21
    virtual int serialize(unsigned char *outbuffer) const
22
    {
23
      int offset = 0;
24
      offset += this->layout.serialize(outbuffer + offset);
25
      *(outbuffer + offset++) = data_length;
26
      *(outbuffer + offset++) = 0;
27
      *(outbuffer + offset++) = 0;
28
      *(outbuffer + offset++) = 0;
29
      for( uint8_t i = 0; i < data_length; i++){
30
      *(outbuffer + offset + 0) = (this->data[i] >> (8 * 0)) & 0xFF;
31
      offset += sizeof(this->data[i]);
32
      }
33
      return offset;
34
    }
35

    
36
    virtual int deserialize(unsigned char *inbuffer)
37
    {
38
      int offset = 0;
39
      offset += this->layout.deserialize(inbuffer + offset);
40
      uint8_t data_lengthT = *(inbuffer + offset++);
41
      if(data_lengthT > data_length)
42
        this->data = (uint8_t*)realloc(this->data, data_lengthT * sizeof(uint8_t));
43
      offset += 3;
44
      data_length = data_lengthT;
45
      for( uint8_t i = 0; i < data_length; i++){
46
      this->st_data |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
47
      offset += sizeof(this->st_data);
48
        memcpy( &(this->data[i]), &(this->st_data), sizeof(uint8_t));
49
      }
50
     return offset;
51
    }
52

    
53
    const char * getType(){ return "std_msgs/UInt8MultiArray"; };
54
    const char * getMD5(){ return "82373f1612381bb6ee473b5cd6f5d89c"; };
55

    
56
  };
57

    
58
}
59
#endif