Project

General

Profile

Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / rosserial_msgs / Log.h @ c1426757

History | View | Annotate | Download (1.47 KB)

1 c1426757 Tom Mullins
#ifndef _ROS_rosserial_msgs_Log_h
2
#define _ROS_rosserial_msgs_Log_h
3
4
#include <stdint.h>
5
#include <string.h>
6
#include <stdlib.h>
7
#include "ros/msg.h"
8
9
namespace rosserial_msgs
10
{
11
12
  class Log : public ros::Msg
13
  {
14
    public:
15
      uint8_t level;
16
      char * msg;
17
      enum { DEBUG = 0 };
18
      enum { INFO = 1 };
19
      enum { WARN = 2 };
20
      enum { ERROR = 3 };
21
      enum { FATAL = 4 };
22
23
    virtual int serialize(unsigned char *outbuffer) const
24
    {
25
      int offset = 0;
26
      *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
27
      offset += sizeof(this->level);
28
      uint32_t * length_msg = (uint32_t *)(outbuffer + offset);
29
      *length_msg = strlen( (const char*) this->msg);
30
      offset += 4;
31
      memcpy(outbuffer + offset, this->msg, *length_msg);
32
      offset += *length_msg;
33
      return offset;
34
    }
35
36
    virtual int deserialize(unsigned char *inbuffer)
37
    {
38
      int offset = 0;
39
      this->level |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
40
      offset += sizeof(this->level);
41
      uint32_t length_msg = *(uint32_t *)(inbuffer + offset);
42
      offset += 4;
43
      for(unsigned int k= offset; k< offset+length_msg; ++k){
44
          inbuffer[k-1]=inbuffer[k];
45
      }
46
      inbuffer[offset+length_msg-1]=0;
47
      this->msg = (char *)(inbuffer + offset-1);
48
      offset += length_msg;
49
     return offset;
50
    }
51
52
    const char * getType(){ return "rosserial_msgs/Log"; };
53
    const char * getMD5(){ return "7170d5aec999754ba0d9f762bf49b913"; };
54
55
  };
56
57
}
58
#endif