added 1 custom message
Fork of ros_lib_kinetic by
roscpp/SetLoggerLevel.h@2:af816ffd33df, 2017-05-19 (annotated)
- Committer:
- randalthor
- Date:
- Fri May 19 08:59:12 2017 +0000
- Revision:
- 2:af816ffd33df
- Parent:
- 0:9e9b7db60fd5
custom message mobile robot added for ITU cyber physical lab
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_SetLoggerLevel_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_SetLoggerLevel_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | |
garyservin | 0:9e9b7db60fd5 | 8 | namespace roscpp |
garyservin | 0:9e9b7db60fd5 | 9 | { |
garyservin | 0:9e9b7db60fd5 | 10 | |
garyservin | 0:9e9b7db60fd5 | 11 | static const char SETLOGGERLEVEL[] = "roscpp/SetLoggerLevel"; |
garyservin | 0:9e9b7db60fd5 | 12 | |
garyservin | 0:9e9b7db60fd5 | 13 | class SetLoggerLevelRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 14 | { |
garyservin | 0:9e9b7db60fd5 | 15 | public: |
garyservin | 0:9e9b7db60fd5 | 16 | typedef const char* _logger_type; |
garyservin | 0:9e9b7db60fd5 | 17 | _logger_type logger; |
garyservin | 0:9e9b7db60fd5 | 18 | typedef const char* _level_type; |
garyservin | 0:9e9b7db60fd5 | 19 | _level_type level; |
garyservin | 0:9e9b7db60fd5 | 20 | |
garyservin | 0:9e9b7db60fd5 | 21 | SetLoggerLevelRequest(): |
garyservin | 0:9e9b7db60fd5 | 22 | logger(""), |
garyservin | 0:9e9b7db60fd5 | 23 | level("") |
garyservin | 0:9e9b7db60fd5 | 24 | { |
garyservin | 0:9e9b7db60fd5 | 25 | } |
garyservin | 0:9e9b7db60fd5 | 26 | |
garyservin | 0:9e9b7db60fd5 | 27 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 28 | { |
garyservin | 0:9e9b7db60fd5 | 29 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 30 | uint32_t length_logger = strlen(this->logger); |
garyservin | 0:9e9b7db60fd5 | 31 | varToArr(outbuffer + offset, length_logger); |
garyservin | 0:9e9b7db60fd5 | 32 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 33 | memcpy(outbuffer + offset, this->logger, length_logger); |
garyservin | 0:9e9b7db60fd5 | 34 | offset += length_logger; |
garyservin | 0:9e9b7db60fd5 | 35 | uint32_t length_level = strlen(this->level); |
garyservin | 0:9e9b7db60fd5 | 36 | varToArr(outbuffer + offset, length_level); |
garyservin | 0:9e9b7db60fd5 | 37 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 38 | memcpy(outbuffer + offset, this->level, length_level); |
garyservin | 0:9e9b7db60fd5 | 39 | offset += length_level; |
garyservin | 0:9e9b7db60fd5 | 40 | return offset; |
garyservin | 0:9e9b7db60fd5 | 41 | } |
garyservin | 0:9e9b7db60fd5 | 42 | |
garyservin | 0:9e9b7db60fd5 | 43 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 44 | { |
garyservin | 0:9e9b7db60fd5 | 45 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 46 | uint32_t length_logger; |
garyservin | 0:9e9b7db60fd5 | 47 | arrToVar(length_logger, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 48 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 49 | for(unsigned int k= offset; k< offset+length_logger; ++k){ |
garyservin | 0:9e9b7db60fd5 | 50 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 51 | } |
garyservin | 0:9e9b7db60fd5 | 52 | inbuffer[offset+length_logger-1]=0; |
garyservin | 0:9e9b7db60fd5 | 53 | this->logger = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 54 | offset += length_logger; |
garyservin | 0:9e9b7db60fd5 | 55 | uint32_t length_level; |
garyservin | 0:9e9b7db60fd5 | 56 | arrToVar(length_level, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 57 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 58 | for(unsigned int k= offset; k< offset+length_level; ++k){ |
garyservin | 0:9e9b7db60fd5 | 59 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 60 | } |
garyservin | 0:9e9b7db60fd5 | 61 | inbuffer[offset+length_level-1]=0; |
garyservin | 0:9e9b7db60fd5 | 62 | this->level = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 63 | offset += length_level; |
garyservin | 0:9e9b7db60fd5 | 64 | return offset; |
garyservin | 0:9e9b7db60fd5 | 65 | } |
garyservin | 0:9e9b7db60fd5 | 66 | |
garyservin | 0:9e9b7db60fd5 | 67 | const char * getType(){ return SETLOGGERLEVEL; }; |
garyservin | 0:9e9b7db60fd5 | 68 | const char * getMD5(){ return "51da076440d78ca1684d36c868df61ea"; }; |
garyservin | 0:9e9b7db60fd5 | 69 | |
garyservin | 0:9e9b7db60fd5 | 70 | }; |
garyservin | 0:9e9b7db60fd5 | 71 | |
garyservin | 0:9e9b7db60fd5 | 72 | class SetLoggerLevelResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 73 | { |
garyservin | 0:9e9b7db60fd5 | 74 | public: |
garyservin | 0:9e9b7db60fd5 | 75 | |
garyservin | 0:9e9b7db60fd5 | 76 | SetLoggerLevelResponse() |
garyservin | 0:9e9b7db60fd5 | 77 | { |
garyservin | 0:9e9b7db60fd5 | 78 | } |
garyservin | 0:9e9b7db60fd5 | 79 | |
garyservin | 0:9e9b7db60fd5 | 80 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 81 | { |
garyservin | 0:9e9b7db60fd5 | 82 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 83 | return offset; |
garyservin | 0:9e9b7db60fd5 | 84 | } |
garyservin | 0:9e9b7db60fd5 | 85 | |
garyservin | 0:9e9b7db60fd5 | 86 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 87 | { |
garyservin | 0:9e9b7db60fd5 | 88 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 89 | return offset; |
garyservin | 0:9e9b7db60fd5 | 90 | } |
garyservin | 0:9e9b7db60fd5 | 91 | |
garyservin | 0:9e9b7db60fd5 | 92 | const char * getType(){ return SETLOGGERLEVEL; }; |
garyservin | 0:9e9b7db60fd5 | 93 | const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; |
garyservin | 0:9e9b7db60fd5 | 94 | |
garyservin | 0:9e9b7db60fd5 | 95 | }; |
garyservin | 0:9e9b7db60fd5 | 96 | |
garyservin | 0:9e9b7db60fd5 | 97 | class SetLoggerLevel { |
garyservin | 0:9e9b7db60fd5 | 98 | public: |
garyservin | 0:9e9b7db60fd5 | 99 | typedef SetLoggerLevelRequest Request; |
garyservin | 0:9e9b7db60fd5 | 100 | typedef SetLoggerLevelResponse Response; |
garyservin | 0:9e9b7db60fd5 | 101 | }; |
garyservin | 0:9e9b7db60fd5 | 102 | |
garyservin | 0:9e9b7db60fd5 | 103 | } |
garyservin | 0:9e9b7db60fd5 | 104 | #endif |