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