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
Int8MultiArray.h
00001 #ifndef _ROS_std_msgs_Int8MultiArray_h 00002 #define _ROS_std_msgs_Int8MultiArray_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "std_msgs/MultiArrayLayout.h" 00009 00010 namespace std_msgs 00011 { 00012 00013 class Int8MultiArray : public ros::Msg 00014 { 00015 public: 00016 std_msgs::MultiArrayLayout layout; 00017 uint8_t data_length; 00018 int8_t st_data; 00019 int8_t * data; 00020 00021 virtual int serialize(unsigned char *outbuffer) const 00022 { 00023 int offset = 0; 00024 offset += this->layout.serialize(outbuffer + offset); 00025 *(outbuffer + offset++) = data_length; 00026 *(outbuffer + offset++) = 0; 00027 *(outbuffer + offset++) = 0; 00028 *(outbuffer + offset++) = 0; 00029 for( uint8_t i = 0; i < data_length; i++){ 00030 union { 00031 int8_t real; 00032 uint8_t base; 00033 } u_datai; 00034 u_datai.real = this->data[i]; 00035 *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF; 00036 offset += sizeof(this->data[i]); 00037 } 00038 return offset; 00039 } 00040 00041 virtual int deserialize(unsigned char *inbuffer) 00042 { 00043 int offset = 0; 00044 offset += this->layout.deserialize(inbuffer + offset); 00045 uint8_t data_lengthT = *(inbuffer + offset++); 00046 if(data_lengthT > data_length) 00047 this->data = (int8_t*)realloc(this->data, data_lengthT * sizeof(int8_t)); 00048 offset += 3; 00049 data_length = data_lengthT; 00050 for( uint8_t i = 0; i < data_length; i++){ 00051 union { 00052 int8_t real; 00053 uint8_t base; 00054 } u_st_data; 00055 u_st_data.base = 0; 00056 u_st_data.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00057 this->st_data = u_st_data.real; 00058 offset += sizeof(this->st_data); 00059 memcpy( &(this->data[i]), &(this->st_data), sizeof(int8_t)); 00060 } 00061 return offset; 00062 } 00063 00064 virtual const char * getType(){ return "std_msgs/Int8MultiArray"; }; 00065 virtual const char * getMD5(){ return "d7c1af35a1b4781bbe79e03dd94b7c13"; }; 00066 00067 }; 00068 00069 } 00070 #endif
Generated on Tue Jul 12 2022 19:53:57 by
1.7.2
