ROS Serial library for Mbed platforms for ROS Melodic Morenia. Check http://wiki.ros.org/rosserial_mbed/ for more information.

Dependencies:   BufferedSerial

Committer:
krogedal
Date:
Thu May 27 19:25:46 2021 +0000
Revision:
2:fa426560b283
Parent:
0:04ac6be8229a
no change

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_smach_msgs_SmachContainerStatus_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_smach_msgs_SmachContainerStatus_h
Gary Servin 0:04ac6be8229a 3
Gary Servin 0:04ac6be8229a 4 #include <stdint.h>
Gary Servin 0:04ac6be8229a 5 #include <string.h>
Gary Servin 0:04ac6be8229a 6 #include <stdlib.h>
Gary Servin 0:04ac6be8229a 7 #include "ros/msg.h"
Gary Servin 0:04ac6be8229a 8 #include "std_msgs/Header.h"
Gary Servin 0:04ac6be8229a 9
Gary Servin 0:04ac6be8229a 10 namespace smach_msgs
Gary Servin 0:04ac6be8229a 11 {
Gary Servin 0:04ac6be8229a 12
Gary Servin 0:04ac6be8229a 13 class SmachContainerStatus : public ros::Msg
Gary Servin 0:04ac6be8229a 14 {
Gary Servin 0:04ac6be8229a 15 public:
Gary Servin 0:04ac6be8229a 16 typedef std_msgs::Header _header_type;
Gary Servin 0:04ac6be8229a 17 _header_type header;
Gary Servin 0:04ac6be8229a 18 typedef const char* _path_type;
Gary Servin 0:04ac6be8229a 19 _path_type path;
Gary Servin 0:04ac6be8229a 20 uint32_t initial_states_length;
Gary Servin 0:04ac6be8229a 21 typedef char* _initial_states_type;
Gary Servin 0:04ac6be8229a 22 _initial_states_type st_initial_states;
Gary Servin 0:04ac6be8229a 23 _initial_states_type * initial_states;
Gary Servin 0:04ac6be8229a 24 uint32_t active_states_length;
Gary Servin 0:04ac6be8229a 25 typedef char* _active_states_type;
Gary Servin 0:04ac6be8229a 26 _active_states_type st_active_states;
Gary Servin 0:04ac6be8229a 27 _active_states_type * active_states;
Gary Servin 0:04ac6be8229a 28 typedef const char* _local_data_type;
Gary Servin 0:04ac6be8229a 29 _local_data_type local_data;
Gary Servin 0:04ac6be8229a 30 typedef const char* _info_type;
Gary Servin 0:04ac6be8229a 31 _info_type info;
Gary Servin 0:04ac6be8229a 32
Gary Servin 0:04ac6be8229a 33 SmachContainerStatus():
Gary Servin 0:04ac6be8229a 34 header(),
Gary Servin 0:04ac6be8229a 35 path(""),
Gary Servin 0:04ac6be8229a 36 initial_states_length(0), initial_states(NULL),
Gary Servin 0:04ac6be8229a 37 active_states_length(0), active_states(NULL),
Gary Servin 0:04ac6be8229a 38 local_data(""),
Gary Servin 0:04ac6be8229a 39 info("")
Gary Servin 0:04ac6be8229a 40 {
Gary Servin 0:04ac6be8229a 41 }
Gary Servin 0:04ac6be8229a 42
Gary Servin 0:04ac6be8229a 43 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 44 {
Gary Servin 0:04ac6be8229a 45 int offset = 0;
Gary Servin 0:04ac6be8229a 46 offset += this->header.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 47 uint32_t length_path = strlen(this->path);
Gary Servin 0:04ac6be8229a 48 varToArr(outbuffer + offset, length_path);
Gary Servin 0:04ac6be8229a 49 offset += 4;
Gary Servin 0:04ac6be8229a 50 memcpy(outbuffer + offset, this->path, length_path);
Gary Servin 0:04ac6be8229a 51 offset += length_path;
Gary Servin 0:04ac6be8229a 52 *(outbuffer + offset + 0) = (this->initial_states_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 53 *(outbuffer + offset + 1) = (this->initial_states_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 54 *(outbuffer + offset + 2) = (this->initial_states_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 55 *(outbuffer + offset + 3) = (this->initial_states_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 56 offset += sizeof(this->initial_states_length);
Gary Servin 0:04ac6be8229a 57 for( uint32_t i = 0; i < initial_states_length; i++){
Gary Servin 0:04ac6be8229a 58 uint32_t length_initial_statesi = strlen(this->initial_states[i]);
Gary Servin 0:04ac6be8229a 59 varToArr(outbuffer + offset, length_initial_statesi);
Gary Servin 0:04ac6be8229a 60 offset += 4;
Gary Servin 0:04ac6be8229a 61 memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
Gary Servin 0:04ac6be8229a 62 offset += length_initial_statesi;
Gary Servin 0:04ac6be8229a 63 }
Gary Servin 0:04ac6be8229a 64 *(outbuffer + offset + 0) = (this->active_states_length >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 65 *(outbuffer + offset + 1) = (this->active_states_length >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 66 *(outbuffer + offset + 2) = (this->active_states_length >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 67 *(outbuffer + offset + 3) = (this->active_states_length >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 68 offset += sizeof(this->active_states_length);
Gary Servin 0:04ac6be8229a 69 for( uint32_t i = 0; i < active_states_length; i++){
Gary Servin 0:04ac6be8229a 70 uint32_t length_active_statesi = strlen(this->active_states[i]);
Gary Servin 0:04ac6be8229a 71 varToArr(outbuffer + offset, length_active_statesi);
Gary Servin 0:04ac6be8229a 72 offset += 4;
Gary Servin 0:04ac6be8229a 73 memcpy(outbuffer + offset, this->active_states[i], length_active_statesi);
Gary Servin 0:04ac6be8229a 74 offset += length_active_statesi;
Gary Servin 0:04ac6be8229a 75 }
Gary Servin 0:04ac6be8229a 76 uint32_t length_local_data = strlen(this->local_data);
Gary Servin 0:04ac6be8229a 77 varToArr(outbuffer + offset, length_local_data);
Gary Servin 0:04ac6be8229a 78 offset += 4;
Gary Servin 0:04ac6be8229a 79 memcpy(outbuffer + offset, this->local_data, length_local_data);
Gary Servin 0:04ac6be8229a 80 offset += length_local_data;
Gary Servin 0:04ac6be8229a 81 uint32_t length_info = strlen(this->info);
Gary Servin 0:04ac6be8229a 82 varToArr(outbuffer + offset, length_info);
Gary Servin 0:04ac6be8229a 83 offset += 4;
Gary Servin 0:04ac6be8229a 84 memcpy(outbuffer + offset, this->info, length_info);
Gary Servin 0:04ac6be8229a 85 offset += length_info;
Gary Servin 0:04ac6be8229a 86 return offset;
Gary Servin 0:04ac6be8229a 87 }
Gary Servin 0:04ac6be8229a 88
Gary Servin 0:04ac6be8229a 89 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 90 {
Gary Servin 0:04ac6be8229a 91 int offset = 0;
Gary Servin 0:04ac6be8229a 92 offset += this->header.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 93 uint32_t length_path;
Gary Servin 0:04ac6be8229a 94 arrToVar(length_path, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 95 offset += 4;
Gary Servin 0:04ac6be8229a 96 for(unsigned int k= offset; k< offset+length_path; ++k){
Gary Servin 0:04ac6be8229a 97 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 98 }
Gary Servin 0:04ac6be8229a 99 inbuffer[offset+length_path-1]=0;
Gary Servin 0:04ac6be8229a 100 this->path = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 101 offset += length_path;
Gary Servin 0:04ac6be8229a 102 uint32_t initial_states_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 103 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 104 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 105 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 106 offset += sizeof(this->initial_states_length);
Gary Servin 0:04ac6be8229a 107 if(initial_states_lengthT > initial_states_length)
Gary Servin 0:04ac6be8229a 108 this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 109 initial_states_length = initial_states_lengthT;
Gary Servin 0:04ac6be8229a 110 for( uint32_t i = 0; i < initial_states_length; i++){
Gary Servin 0:04ac6be8229a 111 uint32_t length_st_initial_states;
Gary Servin 0:04ac6be8229a 112 arrToVar(length_st_initial_states, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 113 offset += 4;
Gary Servin 0:04ac6be8229a 114 for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
Gary Servin 0:04ac6be8229a 115 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 116 }
Gary Servin 0:04ac6be8229a 117 inbuffer[offset+length_st_initial_states-1]=0;
Gary Servin 0:04ac6be8229a 118 this->st_initial_states = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 119 offset += length_st_initial_states;
Gary Servin 0:04ac6be8229a 120 memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
Gary Servin 0:04ac6be8229a 121 }
Gary Servin 0:04ac6be8229a 122 uint32_t active_states_lengthT = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 123 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 124 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 125 active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 126 offset += sizeof(this->active_states_length);
Gary Servin 0:04ac6be8229a 127 if(active_states_lengthT > active_states_length)
Gary Servin 0:04ac6be8229a 128 this->active_states = (char**)realloc(this->active_states, active_states_lengthT * sizeof(char*));
Gary Servin 0:04ac6be8229a 129 active_states_length = active_states_lengthT;
Gary Servin 0:04ac6be8229a 130 for( uint32_t i = 0; i < active_states_length; i++){
Gary Servin 0:04ac6be8229a 131 uint32_t length_st_active_states;
Gary Servin 0:04ac6be8229a 132 arrToVar(length_st_active_states, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 133 offset += 4;
Gary Servin 0:04ac6be8229a 134 for(unsigned int k= offset; k< offset+length_st_active_states; ++k){
Gary Servin 0:04ac6be8229a 135 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 136 }
Gary Servin 0:04ac6be8229a 137 inbuffer[offset+length_st_active_states-1]=0;
Gary Servin 0:04ac6be8229a 138 this->st_active_states = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 139 offset += length_st_active_states;
Gary Servin 0:04ac6be8229a 140 memcpy( &(this->active_states[i]), &(this->st_active_states), sizeof(char*));
Gary Servin 0:04ac6be8229a 141 }
Gary Servin 0:04ac6be8229a 142 uint32_t length_local_data;
Gary Servin 0:04ac6be8229a 143 arrToVar(length_local_data, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 144 offset += 4;
Gary Servin 0:04ac6be8229a 145 for(unsigned int k= offset; k< offset+length_local_data; ++k){
Gary Servin 0:04ac6be8229a 146 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 147 }
Gary Servin 0:04ac6be8229a 148 inbuffer[offset+length_local_data-1]=0;
Gary Servin 0:04ac6be8229a 149 this->local_data = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 150 offset += length_local_data;
Gary Servin 0:04ac6be8229a 151 uint32_t length_info;
Gary Servin 0:04ac6be8229a 152 arrToVar(length_info, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 153 offset += 4;
Gary Servin 0:04ac6be8229a 154 for(unsigned int k= offset; k< offset+length_info; ++k){
Gary Servin 0:04ac6be8229a 155 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 156 }
Gary Servin 0:04ac6be8229a 157 inbuffer[offset+length_info-1]=0;
Gary Servin 0:04ac6be8229a 158 this->info = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 159 offset += length_info;
Gary Servin 0:04ac6be8229a 160 return offset;
Gary Servin 0:04ac6be8229a 161 }
Gary Servin 0:04ac6be8229a 162
Gary Servin 0:04ac6be8229a 163 const char * getType(){ return "smach_msgs/SmachContainerStatus"; };
Gary Servin 0:04ac6be8229a 164 const char * getMD5(){ return "5ba2bb79ac19e3842d562a191f2a675b"; };
Gary Servin 0:04ac6be8229a 165
Gary Servin 0:04ac6be8229a 166 };
Gary Servin 0:04ac6be8229a 167
Gary Servin 0:04ac6be8229a 168 }
Gary Servin 0:04ac6be8229a 169 #endif