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.
ros_lib/rosserial_msgs/Log.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_rosserial_msgs_Log_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_rosserial_msgs_Log_h |
irfantitok | 0:8f3710bfd298 | 3 | |
irfantitok | 0:8f3710bfd298 | 4 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 7 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 8 | |
irfantitok | 0:8f3710bfd298 | 9 | namespace rosserial_msgs |
irfantitok | 0:8f3710bfd298 | 10 | { |
irfantitok | 0:8f3710bfd298 | 11 | |
irfantitok | 0:8f3710bfd298 | 12 | class Log : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 13 | { |
irfantitok | 0:8f3710bfd298 | 14 | public: |
irfantitok | 0:8f3710bfd298 | 15 | typedef uint8_t _level_type; |
irfantitok | 0:8f3710bfd298 | 16 | _level_type level; |
irfantitok | 0:8f3710bfd298 | 17 | typedef const char* _msg_type; |
irfantitok | 0:8f3710bfd298 | 18 | _msg_type msg; |
irfantitok | 0:8f3710bfd298 | 19 | enum { ROSDEBUG = 0 }; |
irfantitok | 0:8f3710bfd298 | 20 | enum { INFO = 1 }; |
irfantitok | 0:8f3710bfd298 | 21 | enum { WARN = 2 }; |
irfantitok | 0:8f3710bfd298 | 22 | enum { ERROR = 3 }; |
irfantitok | 0:8f3710bfd298 | 23 | enum { FATAL = 4 }; |
irfantitok | 0:8f3710bfd298 | 24 | |
irfantitok | 0:8f3710bfd298 | 25 | Log(): |
irfantitok | 0:8f3710bfd298 | 26 | level(0), |
irfantitok | 0:8f3710bfd298 | 27 | msg("") |
irfantitok | 0:8f3710bfd298 | 28 | { |
irfantitok | 0:8f3710bfd298 | 29 | } |
irfantitok | 0:8f3710bfd298 | 30 | |
irfantitok | 0:8f3710bfd298 | 31 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 32 | { |
irfantitok | 0:8f3710bfd298 | 33 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 34 | *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 35 | offset += sizeof(this->level); |
irfantitok | 0:8f3710bfd298 | 36 | uint32_t length_msg = strlen(this->msg); |
irfantitok | 0:8f3710bfd298 | 37 | varToArr(outbuffer + offset, length_msg); |
irfantitok | 0:8f3710bfd298 | 38 | offset += 4; |
irfantitok | 0:8f3710bfd298 | 39 | memcpy(outbuffer + offset, this->msg, length_msg); |
irfantitok | 0:8f3710bfd298 | 40 | offset += length_msg; |
irfantitok | 0:8f3710bfd298 | 41 | return offset; |
irfantitok | 0:8f3710bfd298 | 42 | } |
irfantitok | 0:8f3710bfd298 | 43 | |
irfantitok | 0:8f3710bfd298 | 44 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 45 | { |
irfantitok | 0:8f3710bfd298 | 46 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 47 | this->level = ((uint8_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 48 | offset += sizeof(this->level); |
irfantitok | 0:8f3710bfd298 | 49 | uint32_t length_msg; |
irfantitok | 0:8f3710bfd298 | 50 | arrToVar(length_msg, (inbuffer + offset)); |
irfantitok | 0:8f3710bfd298 | 51 | offset += 4; |
irfantitok | 0:8f3710bfd298 | 52 | for(unsigned int k= offset; k< offset+length_msg; ++k){ |
irfantitok | 0:8f3710bfd298 | 53 | inbuffer[k-1]=inbuffer[k]; |
irfantitok | 0:8f3710bfd298 | 54 | } |
irfantitok | 0:8f3710bfd298 | 55 | inbuffer[offset+length_msg-1]=0; |
irfantitok | 0:8f3710bfd298 | 56 | this->msg = (char *)(inbuffer + offset-1); |
irfantitok | 0:8f3710bfd298 | 57 | offset += length_msg; |
irfantitok | 0:8f3710bfd298 | 58 | return offset; |
irfantitok | 0:8f3710bfd298 | 59 | } |
irfantitok | 0:8f3710bfd298 | 60 | |
irfantitok | 0:8f3710bfd298 | 61 | const char * getType(){ return "rosserial_msgs/Log"; }; |
irfantitok | 0:8f3710bfd298 | 62 | const char * getMD5(){ return "11abd731c25933261cd6183bd12d6295"; }; |
irfantitok | 0:8f3710bfd298 | 63 | |
irfantitok | 0:8f3710bfd298 | 64 | }; |
irfantitok | 0:8f3710bfd298 | 65 | |
irfantitok | 0:8f3710bfd298 | 66 | } |
irfantitok | 0:8f3710bfd298 | 67 | #endif |