ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
Log.h
00001 #ifndef _ROS_rosgraph_msgs_Log_h 00002 #define _ROS_rosgraph_msgs_Log_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "std_msgs/Header.h" 00009 00010 namespace rosgraph_msgs 00011 { 00012 00013 class Log : public ros::Msg 00014 { 00015 public: 00016 std_msgs::Header header; 00017 int8_t level; 00018 const char* name; 00019 const char* msg; 00020 const char* file; 00021 const char* function; 00022 uint32_t line; 00023 uint8_t topics_length; 00024 char* st_topics; 00025 char* * topics; 00026 enum { DEBUG = 1 }; 00027 enum { INFO = 2 }; 00028 enum { WARN = 4 }; 00029 enum { ERROR = 8 }; 00030 enum { FATAL = 16 }; 00031 00032 Log(): 00033 header(), 00034 level(0), 00035 name(""), 00036 msg(""), 00037 file(""), 00038 function(""), 00039 line(0), 00040 topics_length(0), topics(NULL) 00041 { 00042 } 00043 00044 virtual int serialize(unsigned char *outbuffer) const 00045 { 00046 int offset = 0; 00047 offset += this->header.serialize(outbuffer + offset); 00048 union { 00049 int8_t real; 00050 uint8_t base; 00051 } u_level; 00052 u_level.real = this->level; 00053 *(outbuffer + offset + 0) = (u_level.base >> (8 * 0)) & 0xFF; 00054 offset += sizeof(this->level); 00055 uint32_t length_name = strlen(this->name); 00056 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t)); 00057 offset += 4; 00058 memcpy(outbuffer + offset, this->name, length_name); 00059 offset += length_name; 00060 uint32_t length_msg = strlen(this->msg); 00061 memcpy(outbuffer + offset, &length_msg, sizeof(uint32_t)); 00062 offset += 4; 00063 memcpy(outbuffer + offset, this->msg, length_msg); 00064 offset += length_msg; 00065 uint32_t length_file = strlen(this->file); 00066 memcpy(outbuffer + offset, &length_file, sizeof(uint32_t)); 00067 offset += 4; 00068 memcpy(outbuffer + offset, this->file, length_file); 00069 offset += length_file; 00070 uint32_t length_function = strlen(this->function); 00071 memcpy(outbuffer + offset, &length_function, sizeof(uint32_t)); 00072 offset += 4; 00073 memcpy(outbuffer + offset, this->function, length_function); 00074 offset += length_function; 00075 *(outbuffer + offset + 0) = (this->line >> (8 * 0)) & 0xFF; 00076 *(outbuffer + offset + 1) = (this->line >> (8 * 1)) & 0xFF; 00077 *(outbuffer + offset + 2) = (this->line >> (8 * 2)) & 0xFF; 00078 *(outbuffer + offset + 3) = (this->line >> (8 * 3)) & 0xFF; 00079 offset += sizeof(this->line); 00080 *(outbuffer + offset++) = topics_length; 00081 *(outbuffer + offset++) = 0; 00082 *(outbuffer + offset++) = 0; 00083 *(outbuffer + offset++) = 0; 00084 for( uint8_t i = 0; i < topics_length; i++){ 00085 uint32_t length_topicsi = strlen(this->topics[i]); 00086 memcpy(outbuffer + offset, &length_topicsi, sizeof(uint32_t)); 00087 offset += 4; 00088 memcpy(outbuffer + offset, this->topics[i], length_topicsi); 00089 offset += length_topicsi; 00090 } 00091 return offset; 00092 } 00093 00094 virtual int deserialize(unsigned char *inbuffer) 00095 { 00096 int offset = 0; 00097 offset += this->header.deserialize(inbuffer + offset); 00098 union { 00099 int8_t real; 00100 uint8_t base; 00101 } u_level; 00102 u_level.base = 0; 00103 u_level.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00104 this->level = u_level.real; 00105 offset += sizeof(this->level); 00106 uint32_t length_name; 00107 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t)); 00108 offset += 4; 00109 for(unsigned int k= offset; k< offset+length_name; ++k){ 00110 inbuffer[k-1]=inbuffer[k]; 00111 } 00112 inbuffer[offset+length_name-1]=0; 00113 this->name = (char *)(inbuffer + offset-1); 00114 offset += length_name; 00115 uint32_t length_msg; 00116 memcpy(&length_msg, (inbuffer + offset), sizeof(uint32_t)); 00117 offset += 4; 00118 for(unsigned int k= offset; k< offset+length_msg; ++k){ 00119 inbuffer[k-1]=inbuffer[k]; 00120 } 00121 inbuffer[offset+length_msg-1]=0; 00122 this->msg = (char *)(inbuffer + offset-1); 00123 offset += length_msg; 00124 uint32_t length_file; 00125 memcpy(&length_file, (inbuffer + offset), sizeof(uint32_t)); 00126 offset += 4; 00127 for(unsigned int k= offset; k< offset+length_file; ++k){ 00128 inbuffer[k-1]=inbuffer[k]; 00129 } 00130 inbuffer[offset+length_file-1]=0; 00131 this->file = (char *)(inbuffer + offset-1); 00132 offset += length_file; 00133 uint32_t length_function; 00134 memcpy(&length_function, (inbuffer + offset), sizeof(uint32_t)); 00135 offset += 4; 00136 for(unsigned int k= offset; k< offset+length_function; ++k){ 00137 inbuffer[k-1]=inbuffer[k]; 00138 } 00139 inbuffer[offset+length_function-1]=0; 00140 this->function = (char *)(inbuffer + offset-1); 00141 offset += length_function; 00142 this->line = ((uint32_t) (*(inbuffer + offset))); 00143 this->line |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00144 this->line |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00145 this->line |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00146 offset += sizeof(this->line); 00147 uint8_t topics_lengthT = *(inbuffer + offset++); 00148 if(topics_lengthT > topics_length) 00149 this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*)); 00150 offset += 3; 00151 topics_length = topics_lengthT; 00152 for( uint8_t i = 0; i < topics_length; i++){ 00153 uint32_t length_st_topics; 00154 memcpy(&length_st_topics, (inbuffer + offset), sizeof(uint32_t)); 00155 offset += 4; 00156 for(unsigned int k= offset; k< offset+length_st_topics; ++k){ 00157 inbuffer[k-1]=inbuffer[k]; 00158 } 00159 inbuffer[offset+length_st_topics-1]=0; 00160 this->st_topics = (char *)(inbuffer + offset-1); 00161 offset += length_st_topics; 00162 memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*)); 00163 } 00164 return offset; 00165 } 00166 00167 const char * getType(){ return "rosgraph_msgs/Log"; }; 00168 const char * getMD5(){ return "acffd30cd6b6de30f120938c17c593fb"; }; 00169 00170 }; 00171 00172 } 00173 #endif
Generated on Tue Jul 12 2022 18:39:39 by 1.7.2