Руслан Бредун / Mbed 2 deprecated STM32-MC_node

Dependencies:   mbed Watchdog stm32-sensor-base2

Committer:
ommpy
Date:
Tue Jul 07 15:19:06 2020 +0530
Revision:
2:b7fdc74e5c5d
new board files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ommpy 2:b7fdc74e5c5d 1 #ifndef _ROS_SERVICE_NodeletLoad_h
ommpy 2:b7fdc74e5c5d 2 #define _ROS_SERVICE_NodeletLoad_h
ommpy 2:b7fdc74e5c5d 3 #include <stdint.h>
ommpy 2:b7fdc74e5c5d 4 #include <string.h>
ommpy 2:b7fdc74e5c5d 5 #include <stdlib.h>
ommpy 2:b7fdc74e5c5d 6 #include "ros/msg.h"
ommpy 2:b7fdc74e5c5d 7
ommpy 2:b7fdc74e5c5d 8 namespace nodelet
ommpy 2:b7fdc74e5c5d 9 {
ommpy 2:b7fdc74e5c5d 10
ommpy 2:b7fdc74e5c5d 11 static const char NODELETLOAD[] = "nodelet/NodeletLoad";
ommpy 2:b7fdc74e5c5d 12
ommpy 2:b7fdc74e5c5d 13 class NodeletLoadRequest : public ros::Msg
ommpy 2:b7fdc74e5c5d 14 {
ommpy 2:b7fdc74e5c5d 15 public:
ommpy 2:b7fdc74e5c5d 16 typedef const char* _name_type;
ommpy 2:b7fdc74e5c5d 17 _name_type name;
ommpy 2:b7fdc74e5c5d 18 typedef const char* _type_type;
ommpy 2:b7fdc74e5c5d 19 _type_type type;
ommpy 2:b7fdc74e5c5d 20 uint32_t remap_source_args_length;
ommpy 2:b7fdc74e5c5d 21 typedef char* _remap_source_args_type;
ommpy 2:b7fdc74e5c5d 22 _remap_source_args_type st_remap_source_args;
ommpy 2:b7fdc74e5c5d 23 _remap_source_args_type * remap_source_args;
ommpy 2:b7fdc74e5c5d 24 uint32_t remap_target_args_length;
ommpy 2:b7fdc74e5c5d 25 typedef char* _remap_target_args_type;
ommpy 2:b7fdc74e5c5d 26 _remap_target_args_type st_remap_target_args;
ommpy 2:b7fdc74e5c5d 27 _remap_target_args_type * remap_target_args;
ommpy 2:b7fdc74e5c5d 28 uint32_t my_argv_length;
ommpy 2:b7fdc74e5c5d 29 typedef char* _my_argv_type;
ommpy 2:b7fdc74e5c5d 30 _my_argv_type st_my_argv;
ommpy 2:b7fdc74e5c5d 31 _my_argv_type * my_argv;
ommpy 2:b7fdc74e5c5d 32 typedef const char* _bond_id_type;
ommpy 2:b7fdc74e5c5d 33 _bond_id_type bond_id;
ommpy 2:b7fdc74e5c5d 34
ommpy 2:b7fdc74e5c5d 35 NodeletLoadRequest():
ommpy 2:b7fdc74e5c5d 36 name(""),
ommpy 2:b7fdc74e5c5d 37 type(""),
ommpy 2:b7fdc74e5c5d 38 remap_source_args_length(0), remap_source_args(NULL),
ommpy 2:b7fdc74e5c5d 39 remap_target_args_length(0), remap_target_args(NULL),
ommpy 2:b7fdc74e5c5d 40 my_argv_length(0), my_argv(NULL),
ommpy 2:b7fdc74e5c5d 41 bond_id("")
ommpy 2:b7fdc74e5c5d 42 {
ommpy 2:b7fdc74e5c5d 43 }
ommpy 2:b7fdc74e5c5d 44
ommpy 2:b7fdc74e5c5d 45 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 46 {
ommpy 2:b7fdc74e5c5d 47 int offset = 0;
ommpy 2:b7fdc74e5c5d 48 uint32_t length_name = strlen(this->name);
ommpy 2:b7fdc74e5c5d 49 varToArr(outbuffer + offset, length_name);
ommpy 2:b7fdc74e5c5d 50 offset += 4;
ommpy 2:b7fdc74e5c5d 51 memcpy(outbuffer + offset, this->name, length_name);
ommpy 2:b7fdc74e5c5d 52 offset += length_name;
ommpy 2:b7fdc74e5c5d 53 uint32_t length_type = strlen(this->type);
ommpy 2:b7fdc74e5c5d 54 varToArr(outbuffer + offset, length_type);
ommpy 2:b7fdc74e5c5d 55 offset += 4;
ommpy 2:b7fdc74e5c5d 56 memcpy(outbuffer + offset, this->type, length_type);
ommpy 2:b7fdc74e5c5d 57 offset += length_type;
ommpy 2:b7fdc74e5c5d 58 *(outbuffer + offset + 0) = (this->remap_source_args_length >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 59 *(outbuffer + offset + 1) = (this->remap_source_args_length >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 60 *(outbuffer + offset + 2) = (this->remap_source_args_length >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 61 *(outbuffer + offset + 3) = (this->remap_source_args_length >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 62 offset += sizeof(this->remap_source_args_length);
ommpy 2:b7fdc74e5c5d 63 for( uint32_t i = 0; i < remap_source_args_length; i++){
ommpy 2:b7fdc74e5c5d 64 uint32_t length_remap_source_argsi = strlen(this->remap_source_args[i]);
ommpy 2:b7fdc74e5c5d 65 varToArr(outbuffer + offset, length_remap_source_argsi);
ommpy 2:b7fdc74e5c5d 66 offset += 4;
ommpy 2:b7fdc74e5c5d 67 memcpy(outbuffer + offset, this->remap_source_args[i], length_remap_source_argsi);
ommpy 2:b7fdc74e5c5d 68 offset += length_remap_source_argsi;
ommpy 2:b7fdc74e5c5d 69 }
ommpy 2:b7fdc74e5c5d 70 *(outbuffer + offset + 0) = (this->remap_target_args_length >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 71 *(outbuffer + offset + 1) = (this->remap_target_args_length >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 72 *(outbuffer + offset + 2) = (this->remap_target_args_length >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 73 *(outbuffer + offset + 3) = (this->remap_target_args_length >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 74 offset += sizeof(this->remap_target_args_length);
ommpy 2:b7fdc74e5c5d 75 for( uint32_t i = 0; i < remap_target_args_length; i++){
ommpy 2:b7fdc74e5c5d 76 uint32_t length_remap_target_argsi = strlen(this->remap_target_args[i]);
ommpy 2:b7fdc74e5c5d 77 varToArr(outbuffer + offset, length_remap_target_argsi);
ommpy 2:b7fdc74e5c5d 78 offset += 4;
ommpy 2:b7fdc74e5c5d 79 memcpy(outbuffer + offset, this->remap_target_args[i], length_remap_target_argsi);
ommpy 2:b7fdc74e5c5d 80 offset += length_remap_target_argsi;
ommpy 2:b7fdc74e5c5d 81 }
ommpy 2:b7fdc74e5c5d 82 *(outbuffer + offset + 0) = (this->my_argv_length >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 83 *(outbuffer + offset + 1) = (this->my_argv_length >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 84 *(outbuffer + offset + 2) = (this->my_argv_length >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 85 *(outbuffer + offset + 3) = (this->my_argv_length >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 86 offset += sizeof(this->my_argv_length);
ommpy 2:b7fdc74e5c5d 87 for( uint32_t i = 0; i < my_argv_length; i++){
ommpy 2:b7fdc74e5c5d 88 uint32_t length_my_argvi = strlen(this->my_argv[i]);
ommpy 2:b7fdc74e5c5d 89 varToArr(outbuffer + offset, length_my_argvi);
ommpy 2:b7fdc74e5c5d 90 offset += 4;
ommpy 2:b7fdc74e5c5d 91 memcpy(outbuffer + offset, this->my_argv[i], length_my_argvi);
ommpy 2:b7fdc74e5c5d 92 offset += length_my_argvi;
ommpy 2:b7fdc74e5c5d 93 }
ommpy 2:b7fdc74e5c5d 94 uint32_t length_bond_id = strlen(this->bond_id);
ommpy 2:b7fdc74e5c5d 95 varToArr(outbuffer + offset, length_bond_id);
ommpy 2:b7fdc74e5c5d 96 offset += 4;
ommpy 2:b7fdc74e5c5d 97 memcpy(outbuffer + offset, this->bond_id, length_bond_id);
ommpy 2:b7fdc74e5c5d 98 offset += length_bond_id;
ommpy 2:b7fdc74e5c5d 99 return offset;
ommpy 2:b7fdc74e5c5d 100 }
ommpy 2:b7fdc74e5c5d 101
ommpy 2:b7fdc74e5c5d 102 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 103 {
ommpy 2:b7fdc74e5c5d 104 int offset = 0;
ommpy 2:b7fdc74e5c5d 105 uint32_t length_name;
ommpy 2:b7fdc74e5c5d 106 arrToVar(length_name, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 107 offset += 4;
ommpy 2:b7fdc74e5c5d 108 for(unsigned int k= offset; k< offset+length_name; ++k){
ommpy 2:b7fdc74e5c5d 109 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 110 }
ommpy 2:b7fdc74e5c5d 111 inbuffer[offset+length_name-1]=0;
ommpy 2:b7fdc74e5c5d 112 this->name = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 113 offset += length_name;
ommpy 2:b7fdc74e5c5d 114 uint32_t length_type;
ommpy 2:b7fdc74e5c5d 115 arrToVar(length_type, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 116 offset += 4;
ommpy 2:b7fdc74e5c5d 117 for(unsigned int k= offset; k< offset+length_type; ++k){
ommpy 2:b7fdc74e5c5d 118 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 119 }
ommpy 2:b7fdc74e5c5d 120 inbuffer[offset+length_type-1]=0;
ommpy 2:b7fdc74e5c5d 121 this->type = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 122 offset += length_type;
ommpy 2:b7fdc74e5c5d 123 uint32_t remap_source_args_lengthT = ((uint32_t) (*(inbuffer + offset)));
ommpy 2:b7fdc74e5c5d 124 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 125 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 126 remap_source_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 127 offset += sizeof(this->remap_source_args_length);
ommpy 2:b7fdc74e5c5d 128 if(remap_source_args_lengthT > remap_source_args_length)
ommpy 2:b7fdc74e5c5d 129 this->remap_source_args = (char**)realloc(this->remap_source_args, remap_source_args_lengthT * sizeof(char*));
ommpy 2:b7fdc74e5c5d 130 remap_source_args_length = remap_source_args_lengthT;
ommpy 2:b7fdc74e5c5d 131 for( uint32_t i = 0; i < remap_source_args_length; i++){
ommpy 2:b7fdc74e5c5d 132 uint32_t length_st_remap_source_args;
ommpy 2:b7fdc74e5c5d 133 arrToVar(length_st_remap_source_args, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 134 offset += 4;
ommpy 2:b7fdc74e5c5d 135 for(unsigned int k= offset; k< offset+length_st_remap_source_args; ++k){
ommpy 2:b7fdc74e5c5d 136 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 137 }
ommpy 2:b7fdc74e5c5d 138 inbuffer[offset+length_st_remap_source_args-1]=0;
ommpy 2:b7fdc74e5c5d 139 this->st_remap_source_args = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 140 offset += length_st_remap_source_args;
ommpy 2:b7fdc74e5c5d 141 memcpy( &(this->remap_source_args[i]), &(this->st_remap_source_args), sizeof(char*));
ommpy 2:b7fdc74e5c5d 142 }
ommpy 2:b7fdc74e5c5d 143 uint32_t remap_target_args_lengthT = ((uint32_t) (*(inbuffer + offset)));
ommpy 2:b7fdc74e5c5d 144 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 145 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 146 remap_target_args_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 147 offset += sizeof(this->remap_target_args_length);
ommpy 2:b7fdc74e5c5d 148 if(remap_target_args_lengthT > remap_target_args_length)
ommpy 2:b7fdc74e5c5d 149 this->remap_target_args = (char**)realloc(this->remap_target_args, remap_target_args_lengthT * sizeof(char*));
ommpy 2:b7fdc74e5c5d 150 remap_target_args_length = remap_target_args_lengthT;
ommpy 2:b7fdc74e5c5d 151 for( uint32_t i = 0; i < remap_target_args_length; i++){
ommpy 2:b7fdc74e5c5d 152 uint32_t length_st_remap_target_args;
ommpy 2:b7fdc74e5c5d 153 arrToVar(length_st_remap_target_args, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 154 offset += 4;
ommpy 2:b7fdc74e5c5d 155 for(unsigned int k= offset; k< offset+length_st_remap_target_args; ++k){
ommpy 2:b7fdc74e5c5d 156 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 157 }
ommpy 2:b7fdc74e5c5d 158 inbuffer[offset+length_st_remap_target_args-1]=0;
ommpy 2:b7fdc74e5c5d 159 this->st_remap_target_args = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 160 offset += length_st_remap_target_args;
ommpy 2:b7fdc74e5c5d 161 memcpy( &(this->remap_target_args[i]), &(this->st_remap_target_args), sizeof(char*));
ommpy 2:b7fdc74e5c5d 162 }
ommpy 2:b7fdc74e5c5d 163 uint32_t my_argv_lengthT = ((uint32_t) (*(inbuffer + offset)));
ommpy 2:b7fdc74e5c5d 164 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 165 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 166 my_argv_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 167 offset += sizeof(this->my_argv_length);
ommpy 2:b7fdc74e5c5d 168 if(my_argv_lengthT > my_argv_length)
ommpy 2:b7fdc74e5c5d 169 this->my_argv = (char**)realloc(this->my_argv, my_argv_lengthT * sizeof(char*));
ommpy 2:b7fdc74e5c5d 170 my_argv_length = my_argv_lengthT;
ommpy 2:b7fdc74e5c5d 171 for( uint32_t i = 0; i < my_argv_length; i++){
ommpy 2:b7fdc74e5c5d 172 uint32_t length_st_my_argv;
ommpy 2:b7fdc74e5c5d 173 arrToVar(length_st_my_argv, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 174 offset += 4;
ommpy 2:b7fdc74e5c5d 175 for(unsigned int k= offset; k< offset+length_st_my_argv; ++k){
ommpy 2:b7fdc74e5c5d 176 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 177 }
ommpy 2:b7fdc74e5c5d 178 inbuffer[offset+length_st_my_argv-1]=0;
ommpy 2:b7fdc74e5c5d 179 this->st_my_argv = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 180 offset += length_st_my_argv;
ommpy 2:b7fdc74e5c5d 181 memcpy( &(this->my_argv[i]), &(this->st_my_argv), sizeof(char*));
ommpy 2:b7fdc74e5c5d 182 }
ommpy 2:b7fdc74e5c5d 183 uint32_t length_bond_id;
ommpy 2:b7fdc74e5c5d 184 arrToVar(length_bond_id, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 185 offset += 4;
ommpy 2:b7fdc74e5c5d 186 for(unsigned int k= offset; k< offset+length_bond_id; ++k){
ommpy 2:b7fdc74e5c5d 187 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 188 }
ommpy 2:b7fdc74e5c5d 189 inbuffer[offset+length_bond_id-1]=0;
ommpy 2:b7fdc74e5c5d 190 this->bond_id = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 191 offset += length_bond_id;
ommpy 2:b7fdc74e5c5d 192 return offset;
ommpy 2:b7fdc74e5c5d 193 }
ommpy 2:b7fdc74e5c5d 194
ommpy 2:b7fdc74e5c5d 195 const char * getType(){ return NODELETLOAD; };
ommpy 2:b7fdc74e5c5d 196 const char * getMD5(){ return "c6e28cc4d2e259249d96cfb50658fbec"; };
ommpy 2:b7fdc74e5c5d 197
ommpy 2:b7fdc74e5c5d 198 };
ommpy 2:b7fdc74e5c5d 199
ommpy 2:b7fdc74e5c5d 200 class NodeletLoadResponse : public ros::Msg
ommpy 2:b7fdc74e5c5d 201 {
ommpy 2:b7fdc74e5c5d 202 public:
ommpy 2:b7fdc74e5c5d 203 typedef bool _success_type;
ommpy 2:b7fdc74e5c5d 204 _success_type success;
ommpy 2:b7fdc74e5c5d 205
ommpy 2:b7fdc74e5c5d 206 NodeletLoadResponse():
ommpy 2:b7fdc74e5c5d 207 success(0)
ommpy 2:b7fdc74e5c5d 208 {
ommpy 2:b7fdc74e5c5d 209 }
ommpy 2:b7fdc74e5c5d 210
ommpy 2:b7fdc74e5c5d 211 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 212 {
ommpy 2:b7fdc74e5c5d 213 int offset = 0;
ommpy 2:b7fdc74e5c5d 214 union {
ommpy 2:b7fdc74e5c5d 215 bool real;
ommpy 2:b7fdc74e5c5d 216 uint8_t base;
ommpy 2:b7fdc74e5c5d 217 } u_success;
ommpy 2:b7fdc74e5c5d 218 u_success.real = this->success;
ommpy 2:b7fdc74e5c5d 219 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 220 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 221 return offset;
ommpy 2:b7fdc74e5c5d 222 }
ommpy 2:b7fdc74e5c5d 223
ommpy 2:b7fdc74e5c5d 224 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 225 {
ommpy 2:b7fdc74e5c5d 226 int offset = 0;
ommpy 2:b7fdc74e5c5d 227 union {
ommpy 2:b7fdc74e5c5d 228 bool real;
ommpy 2:b7fdc74e5c5d 229 uint8_t base;
ommpy 2:b7fdc74e5c5d 230 } u_success;
ommpy 2:b7fdc74e5c5d 231 u_success.base = 0;
ommpy 2:b7fdc74e5c5d 232 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
ommpy 2:b7fdc74e5c5d 233 this->success = u_success.real;
ommpy 2:b7fdc74e5c5d 234 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 235 return offset;
ommpy 2:b7fdc74e5c5d 236 }
ommpy 2:b7fdc74e5c5d 237
ommpy 2:b7fdc74e5c5d 238 const char * getType(){ return NODELETLOAD; };
ommpy 2:b7fdc74e5c5d 239 const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
ommpy 2:b7fdc74e5c5d 240
ommpy 2:b7fdc74e5c5d 241 };
ommpy 2:b7fdc74e5c5d 242
ommpy 2:b7fdc74e5c5d 243 class NodeletLoad {
ommpy 2:b7fdc74e5c5d 244 public:
ommpy 2:b7fdc74e5c5d 245 typedef NodeletLoadRequest Request;
ommpy 2:b7fdc74e5c5d 246 typedef NodeletLoadResponse Response;
ommpy 2:b7fdc74e5c5d 247 };
ommpy 2:b7fdc74e5c5d 248
ommpy 2:b7fdc74e5c5d 249 }
ommpy 2:b7fdc74e5c5d 250 #endif