test

Dependencies:   mbed Watchdog

Dependents:   STM32-MC_node

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_smach_msgs_SmachContainerInitialStatusCmd_h
ommpy 2:b7fdc74e5c5d 2 #define _ROS_smach_msgs_SmachContainerInitialStatusCmd_h
ommpy 2:b7fdc74e5c5d 3
ommpy 2:b7fdc74e5c5d 4 #include <stdint.h>
ommpy 2:b7fdc74e5c5d 5 #include <string.h>
ommpy 2:b7fdc74e5c5d 6 #include <stdlib.h>
ommpy 2:b7fdc74e5c5d 7 #include "ros/msg.h"
ommpy 2:b7fdc74e5c5d 8
ommpy 2:b7fdc74e5c5d 9 namespace smach_msgs
ommpy 2:b7fdc74e5c5d 10 {
ommpy 2:b7fdc74e5c5d 11
ommpy 2:b7fdc74e5c5d 12 class SmachContainerInitialStatusCmd : public ros::Msg
ommpy 2:b7fdc74e5c5d 13 {
ommpy 2:b7fdc74e5c5d 14 public:
ommpy 2:b7fdc74e5c5d 15 typedef const char* _path_type;
ommpy 2:b7fdc74e5c5d 16 _path_type path;
ommpy 2:b7fdc74e5c5d 17 uint32_t initial_states_length;
ommpy 2:b7fdc74e5c5d 18 typedef char* _initial_states_type;
ommpy 2:b7fdc74e5c5d 19 _initial_states_type st_initial_states;
ommpy 2:b7fdc74e5c5d 20 _initial_states_type * initial_states;
ommpy 2:b7fdc74e5c5d 21 typedef const char* _local_data_type;
ommpy 2:b7fdc74e5c5d 22 _local_data_type local_data;
ommpy 2:b7fdc74e5c5d 23
ommpy 2:b7fdc74e5c5d 24 SmachContainerInitialStatusCmd():
ommpy 2:b7fdc74e5c5d 25 path(""),
ommpy 2:b7fdc74e5c5d 26 initial_states_length(0), initial_states(NULL),
ommpy 2:b7fdc74e5c5d 27 local_data("")
ommpy 2:b7fdc74e5c5d 28 {
ommpy 2:b7fdc74e5c5d 29 }
ommpy 2:b7fdc74e5c5d 30
ommpy 2:b7fdc74e5c5d 31 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 32 {
ommpy 2:b7fdc74e5c5d 33 int offset = 0;
ommpy 2:b7fdc74e5c5d 34 uint32_t length_path = strlen(this->path);
ommpy 2:b7fdc74e5c5d 35 varToArr(outbuffer + offset, length_path);
ommpy 2:b7fdc74e5c5d 36 offset += 4;
ommpy 2:b7fdc74e5c5d 37 memcpy(outbuffer + offset, this->path, length_path);
ommpy 2:b7fdc74e5c5d 38 offset += length_path;
ommpy 2:b7fdc74e5c5d 39 *(outbuffer + offset + 0) = (this->initial_states_length >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 40 *(outbuffer + offset + 1) = (this->initial_states_length >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 41 *(outbuffer + offset + 2) = (this->initial_states_length >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 42 *(outbuffer + offset + 3) = (this->initial_states_length >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 43 offset += sizeof(this->initial_states_length);
ommpy 2:b7fdc74e5c5d 44 for( uint32_t i = 0; i < initial_states_length; i++){
ommpy 2:b7fdc74e5c5d 45 uint32_t length_initial_statesi = strlen(this->initial_states[i]);
ommpy 2:b7fdc74e5c5d 46 varToArr(outbuffer + offset, length_initial_statesi);
ommpy 2:b7fdc74e5c5d 47 offset += 4;
ommpy 2:b7fdc74e5c5d 48 memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
ommpy 2:b7fdc74e5c5d 49 offset += length_initial_statesi;
ommpy 2:b7fdc74e5c5d 50 }
ommpy 2:b7fdc74e5c5d 51 uint32_t length_local_data = strlen(this->local_data);
ommpy 2:b7fdc74e5c5d 52 varToArr(outbuffer + offset, length_local_data);
ommpy 2:b7fdc74e5c5d 53 offset += 4;
ommpy 2:b7fdc74e5c5d 54 memcpy(outbuffer + offset, this->local_data, length_local_data);
ommpy 2:b7fdc74e5c5d 55 offset += length_local_data;
ommpy 2:b7fdc74e5c5d 56 return offset;
ommpy 2:b7fdc74e5c5d 57 }
ommpy 2:b7fdc74e5c5d 58
ommpy 2:b7fdc74e5c5d 59 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 60 {
ommpy 2:b7fdc74e5c5d 61 int offset = 0;
ommpy 2:b7fdc74e5c5d 62 uint32_t length_path;
ommpy 2:b7fdc74e5c5d 63 arrToVar(length_path, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 64 offset += 4;
ommpy 2:b7fdc74e5c5d 65 for(unsigned int k= offset; k< offset+length_path; ++k){
ommpy 2:b7fdc74e5c5d 66 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 67 }
ommpy 2:b7fdc74e5c5d 68 inbuffer[offset+length_path-1]=0;
ommpy 2:b7fdc74e5c5d 69 this->path = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 70 offset += length_path;
ommpy 2:b7fdc74e5c5d 71 uint32_t initial_states_lengthT = ((uint32_t) (*(inbuffer + offset)));
ommpy 2:b7fdc74e5c5d 72 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 73 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 74 initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 75 offset += sizeof(this->initial_states_length);
ommpy 2:b7fdc74e5c5d 76 if(initial_states_lengthT > initial_states_length)
ommpy 2:b7fdc74e5c5d 77 this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
ommpy 2:b7fdc74e5c5d 78 initial_states_length = initial_states_lengthT;
ommpy 2:b7fdc74e5c5d 79 for( uint32_t i = 0; i < initial_states_length; i++){
ommpy 2:b7fdc74e5c5d 80 uint32_t length_st_initial_states;
ommpy 2:b7fdc74e5c5d 81 arrToVar(length_st_initial_states, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 82 offset += 4;
ommpy 2:b7fdc74e5c5d 83 for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
ommpy 2:b7fdc74e5c5d 84 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 85 }
ommpy 2:b7fdc74e5c5d 86 inbuffer[offset+length_st_initial_states-1]=0;
ommpy 2:b7fdc74e5c5d 87 this->st_initial_states = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 88 offset += length_st_initial_states;
ommpy 2:b7fdc74e5c5d 89 memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
ommpy 2:b7fdc74e5c5d 90 }
ommpy 2:b7fdc74e5c5d 91 uint32_t length_local_data;
ommpy 2:b7fdc74e5c5d 92 arrToVar(length_local_data, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 93 offset += 4;
ommpy 2:b7fdc74e5c5d 94 for(unsigned int k= offset; k< offset+length_local_data; ++k){
ommpy 2:b7fdc74e5c5d 95 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 96 }
ommpy 2:b7fdc74e5c5d 97 inbuffer[offset+length_local_data-1]=0;
ommpy 2:b7fdc74e5c5d 98 this->local_data = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 99 offset += length_local_data;
ommpy 2:b7fdc74e5c5d 100 return offset;
ommpy 2:b7fdc74e5c5d 101 }
ommpy 2:b7fdc74e5c5d 102
ommpy 2:b7fdc74e5c5d 103 const char * getType(){ return "smach_msgs/SmachContainerInitialStatusCmd"; };
ommpy 2:b7fdc74e5c5d 104 const char * getMD5(){ return "45f8cf31fc29b829db77f23001f788d6"; };
ommpy 2:b7fdc74e5c5d 105
ommpy 2:b7fdc74e5c5d 106 };
ommpy 2:b7fdc74e5c5d 107
ommpy 2:b7fdc74e5c5d 108 }
ommpy 2:b7fdc74e5c5d 109 #endif