Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of rosserial_mbed_lib by
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 uint8_t level; 00016 char * msg; 00017 enum { ROSDEBUG = 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 = strlen( (const char*) this->msg); 00029 memcpy(outbuffer + offset, &length_msg, sizeof(uint32_t)); 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))); 00040 offset += sizeof(this->level); 00041 uint32_t length_msg; 00042 memcpy(&length_msg, (inbuffer + offset), sizeof(uint32_t)); 00043 offset += 4; 00044 for(unsigned int k= offset; k< offset+length_msg; ++k){ 00045 inbuffer[k-1]=inbuffer[k]; 00046 } 00047 inbuffer[offset+length_msg-1]=0; 00048 this->msg = (char *)(inbuffer + offset-1); 00049 offset += length_msg; 00050 return offset; 00051 } 00052 00053 const char * getType(){ return "rosserial_msgs/Log"; }; 00054 const char * getMD5(){ return "11abd731c25933261cd6183bd12d6295"; }; 00055 00056 }; 00057 00058 } 00059 #endif
Generated on Fri Jul 15 2022 11:14:26 by
1.7.2
