Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / sensor_msgs / JoyFeedbackArray.h @ c1426757

History | View | Annotate | Download (1.5 KB)

1
#ifndef _ROS_sensor_msgs_JoyFeedbackArray_h
2
#define _ROS_sensor_msgs_JoyFeedbackArray_h
3

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

    
10
namespace sensor_msgs
11
{
12

    
13
  class JoyFeedbackArray : public ros::Msg
14
  {
15
    public:
16
      uint8_t array_length;
17
      sensor_msgs::JoyFeedback st_array;
18
      sensor_msgs::JoyFeedback * array;
19

    
20
    virtual int serialize(unsigned char *outbuffer) const
21
    {
22
      int offset = 0;
23
      *(outbuffer + offset++) = array_length;
24
      *(outbuffer + offset++) = 0;
25
      *(outbuffer + offset++) = 0;
26
      *(outbuffer + offset++) = 0;
27
      for( uint8_t i = 0; i < array_length; i++){
28
      offset += this->array[i].serialize(outbuffer + offset);
29
      }
30
      return offset;
31
    }
32

    
33
    virtual int deserialize(unsigned char *inbuffer)
34
    {
35
      int offset = 0;
36
      uint8_t array_lengthT = *(inbuffer + offset++);
37
      if(array_lengthT > array_length)
38
        this->array = (sensor_msgs::JoyFeedback*)realloc(this->array, array_lengthT * sizeof(sensor_msgs::JoyFeedback));
39
      offset += 3;
40
      array_length = array_lengthT;
41
      for( uint8_t i = 0; i < array_length; i++){
42
      offset += this->st_array.deserialize(inbuffer + offset);
43
        memcpy( &(this->array[i]), &(this->st_array), sizeof(sensor_msgs::JoyFeedback));
44
      }
45
     return offset;
46
    }
47

    
48
    const char * getType(){ return "sensor_msgs/JoyFeedbackArray"; };
49
    const char * getMD5(){ return "cde5730a895b1fc4dee6f91b754b213d"; };
50

    
51
  };
52

    
53
}
54
#endif