catchrobo2022 mbed LPC1768 メインプログラム
Dependencies: mbed
SlackMessage.h
00001 #ifndef _ROS_jsk_gui_msgs_SlackMessage_h 00002 #define _ROS_jsk_gui_msgs_SlackMessage_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "sensor_msgs/Image.h" 00009 00010 namespace jsk_gui_msgs 00011 { 00012 00013 class SlackMessage : public ros::Msg 00014 { 00015 public: 00016 typedef const char* _channel_type; 00017 _channel_type channel; 00018 typedef const char* _text_type; 00019 _text_type text; 00020 typedef sensor_msgs::Image _image_type; 00021 _image_type image; 00022 00023 SlackMessage(): 00024 channel(""), 00025 text(""), 00026 image() 00027 { 00028 } 00029 00030 virtual int serialize(unsigned char *outbuffer) const 00031 { 00032 int offset = 0; 00033 uint32_t length_channel = strlen(this->channel); 00034 varToArr(outbuffer + offset, length_channel); 00035 offset += 4; 00036 memcpy(outbuffer + offset, this->channel, length_channel); 00037 offset += length_channel; 00038 uint32_t length_text = strlen(this->text); 00039 varToArr(outbuffer + offset, length_text); 00040 offset += 4; 00041 memcpy(outbuffer + offset, this->text, length_text); 00042 offset += length_text; 00043 offset += this->image.serialize(outbuffer + offset); 00044 return offset; 00045 } 00046 00047 virtual int deserialize(unsigned char *inbuffer) 00048 { 00049 int offset = 0; 00050 uint32_t length_channel; 00051 arrToVar(length_channel, (inbuffer + offset)); 00052 offset += 4; 00053 for(unsigned int k= offset; k< offset+length_channel; ++k){ 00054 inbuffer[k-1]=inbuffer[k]; 00055 } 00056 inbuffer[offset+length_channel-1]=0; 00057 this->channel = (char *)(inbuffer + offset-1); 00058 offset += length_channel; 00059 uint32_t length_text; 00060 arrToVar(length_text, (inbuffer + offset)); 00061 offset += 4; 00062 for(unsigned int k= offset; k< offset+length_text; ++k){ 00063 inbuffer[k-1]=inbuffer[k]; 00064 } 00065 inbuffer[offset+length_text-1]=0; 00066 this->text = (char *)(inbuffer + offset-1); 00067 offset += length_text; 00068 offset += this->image.deserialize(inbuffer + offset); 00069 return offset; 00070 } 00071 00072 virtual const char * getType(){ return "jsk_gui_msgs/SlackMessage"; }; 00073 virtual const char * getMD5(){ return "b68991d3b722980bd0f3eeeeee52635b"; }; 00074 00075 }; 00076 00077 } 00078 #endif
Generated on Mon Sep 26 2022 13:47:03 by
1.7.2