Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Log.h Source File

Log.h

00001 #ifndef _ROS_rosserial_msgs_Log_h
00002 #define _ROS_rosserial_msgs_Log_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace rosserial_msgs
00010 {
00011 
00012   class Log : public ros::Msg
00013   {
00014     public:
00015       typedef uint8_t _level_type;
00016       _level_type level;
00017       typedef const char* _msg_type;
00018       _msg_type msg;
00019       enum { ROSDEBUG = 0 };
00020       enum { INFO = 1 };
00021       enum { WARN = 2 };
00022       enum { ERROR = 3 };
00023       enum { FATAL = 4 };
00024 
00025     Log():
00026       level(0),
00027       msg("")
00028     {
00029     }
00030 
00031     virtual int serialize(unsigned char *outbuffer) const
00032     {
00033       int offset = 0;
00034       *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
00035       offset += sizeof(this->level);
00036       uint32_t length_msg = strlen(this->msg);
00037       varToArr(outbuffer + offset, length_msg);
00038       offset += 4;
00039       memcpy(outbuffer + offset, this->msg, length_msg);
00040       offset += length_msg;
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       this->level =  ((uint8_t) (*(inbuffer + offset)));
00048       offset += sizeof(this->level);
00049       uint32_t length_msg;
00050       arrToVar(length_msg, (inbuffer + offset));
00051       offset += 4;
00052       for(unsigned int k= offset; k< offset+length_msg; ++k){
00053           inbuffer[k-1]=inbuffer[k];
00054       }
00055       inbuffer[offset+length_msg-1]=0;
00056       this->msg = (char *)(inbuffer + offset-1);
00057       offset += length_msg;
00058      return offset;
00059     }
00060 
00061     const char * getType(){ return "rosserial_msgs/Log"; };
00062     const char * getMD5(){ return "11abd731c25933261cd6183bd12d6295"; };
00063 
00064   };
00065 
00066 }
00067 #endif