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 uint8_t level; 00016 char * msg; 00017 enum { DEBUG = 0 }; 00018 enum { INFO = 1 }; 00019 enum { WARN = 2 }; 00020 enum { ERROR = 3 }; 00021 enum { FATAL = 4 }; 00022 00023 virtual int serialize(unsigned char *outbuffer) const 00024 { 00025 int offset = 0; 00026 *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF; 00027 offset += sizeof(this->level); 00028 uint32_t * length_msg = (uint32_t *)(outbuffer + offset); 00029 *length_msg = strlen( (const char*) this->msg); 00030 offset += 4; 00031 memcpy(outbuffer + offset, this->msg, *length_msg); 00032 offset += *length_msg; 00033 return offset; 00034 } 00035 00036 virtual int deserialize(unsigned char *inbuffer) 00037 { 00038 int offset = 0; 00039 this->level |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00040 offset += sizeof(this->level); 00041 uint32_t length_msg = *(uint32_t *)(inbuffer + offset); 00042 offset += 4; 00043 for(unsigned int k= offset; k< offset+length_msg; ++k){ 00044 inbuffer[k-1]=inbuffer[k]; 00045 } 00046 inbuffer[offset+length_msg-1]=0; 00047 this->msg = (char *)(inbuffer + offset-1); 00048 offset += length_msg; 00049 return offset; 00050 } 00051 00052 const char * getType(){ return "rosserial_msgs/Log"; }; 00053 const char * getMD5(){ return "7170d5aec999754ba0d9f762bf49b913"; }; 00054 00055 }; 00056 00057 } 00058 #endif