ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
Dependents: mbed-os-example-blinky
dynamic_reconfigure/GroupState.h@2:f2240ad62eaf, 2019-08-01 (annotated)
- Committer:
- fllay
- Date:
- Thu Aug 01 17:08:55 2019 +0000
- Revision:
- 2:f2240ad62eaf
- Parent:
- 0:9e9b7db60fd5
fix time.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_dynamic_reconfigure_GroupState_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_dynamic_reconfigure_GroupState_h |
garyservin | 0:9e9b7db60fd5 | 3 | |
garyservin | 0:9e9b7db60fd5 | 4 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 7 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 8 | |
garyservin | 0:9e9b7db60fd5 | 9 | namespace dynamic_reconfigure |
garyservin | 0:9e9b7db60fd5 | 10 | { |
garyservin | 0:9e9b7db60fd5 | 11 | |
garyservin | 0:9e9b7db60fd5 | 12 | class GroupState : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 13 | { |
garyservin | 0:9e9b7db60fd5 | 14 | public: |
garyservin | 0:9e9b7db60fd5 | 15 | typedef const char* _name_type; |
garyservin | 0:9e9b7db60fd5 | 16 | _name_type name; |
garyservin | 0:9e9b7db60fd5 | 17 | typedef bool _state_type; |
garyservin | 0:9e9b7db60fd5 | 18 | _state_type state; |
garyservin | 0:9e9b7db60fd5 | 19 | typedef int32_t _id_type; |
garyservin | 0:9e9b7db60fd5 | 20 | _id_type id; |
garyservin | 0:9e9b7db60fd5 | 21 | typedef int32_t _parent_type; |
garyservin | 0:9e9b7db60fd5 | 22 | _parent_type parent; |
garyservin | 0:9e9b7db60fd5 | 23 | |
garyservin | 0:9e9b7db60fd5 | 24 | GroupState(): |
garyservin | 0:9e9b7db60fd5 | 25 | name(""), |
garyservin | 0:9e9b7db60fd5 | 26 | state(0), |
garyservin | 0:9e9b7db60fd5 | 27 | id(0), |
garyservin | 0:9e9b7db60fd5 | 28 | parent(0) |
garyservin | 0:9e9b7db60fd5 | 29 | { |
garyservin | 0:9e9b7db60fd5 | 30 | } |
garyservin | 0:9e9b7db60fd5 | 31 | |
garyservin | 0:9e9b7db60fd5 | 32 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 33 | { |
garyservin | 0:9e9b7db60fd5 | 34 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 35 | uint32_t length_name = strlen(this->name); |
garyservin | 0:9e9b7db60fd5 | 36 | varToArr(outbuffer + offset, length_name); |
garyservin | 0:9e9b7db60fd5 | 37 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 38 | memcpy(outbuffer + offset, this->name, length_name); |
garyservin | 0:9e9b7db60fd5 | 39 | offset += length_name; |
garyservin | 0:9e9b7db60fd5 | 40 | union { |
garyservin | 0:9e9b7db60fd5 | 41 | bool real; |
garyservin | 0:9e9b7db60fd5 | 42 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 43 | } u_state; |
garyservin | 0:9e9b7db60fd5 | 44 | u_state.real = this->state; |
garyservin | 0:9e9b7db60fd5 | 45 | *(outbuffer + offset + 0) = (u_state.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 46 | offset += sizeof(this->state); |
garyservin | 0:9e9b7db60fd5 | 47 | union { |
garyservin | 0:9e9b7db60fd5 | 48 | int32_t real; |
garyservin | 0:9e9b7db60fd5 | 49 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 50 | } u_id; |
garyservin | 0:9e9b7db60fd5 | 51 | u_id.real = this->id; |
garyservin | 0:9e9b7db60fd5 | 52 | *(outbuffer + offset + 0) = (u_id.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 53 | *(outbuffer + offset + 1) = (u_id.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 54 | *(outbuffer + offset + 2) = (u_id.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 55 | *(outbuffer + offset + 3) = (u_id.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 56 | offset += sizeof(this->id); |
garyservin | 0:9e9b7db60fd5 | 57 | union { |
garyservin | 0:9e9b7db60fd5 | 58 | int32_t real; |
garyservin | 0:9e9b7db60fd5 | 59 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 60 | } u_parent; |
garyservin | 0:9e9b7db60fd5 | 61 | u_parent.real = this->parent; |
garyservin | 0:9e9b7db60fd5 | 62 | *(outbuffer + offset + 0) = (u_parent.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 63 | *(outbuffer + offset + 1) = (u_parent.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 64 | *(outbuffer + offset + 2) = (u_parent.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 65 | *(outbuffer + offset + 3) = (u_parent.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 66 | offset += sizeof(this->parent); |
garyservin | 0:9e9b7db60fd5 | 67 | return offset; |
garyservin | 0:9e9b7db60fd5 | 68 | } |
garyservin | 0:9e9b7db60fd5 | 69 | |
garyservin | 0:9e9b7db60fd5 | 70 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 71 | { |
garyservin | 0:9e9b7db60fd5 | 72 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 73 | uint32_t length_name; |
garyservin | 0:9e9b7db60fd5 | 74 | arrToVar(length_name, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 75 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 76 | for(unsigned int k= offset; k< offset+length_name; ++k){ |
garyservin | 0:9e9b7db60fd5 | 77 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 78 | } |
garyservin | 0:9e9b7db60fd5 | 79 | inbuffer[offset+length_name-1]=0; |
garyservin | 0:9e9b7db60fd5 | 80 | this->name = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 81 | offset += length_name; |
garyservin | 0:9e9b7db60fd5 | 82 | union { |
garyservin | 0:9e9b7db60fd5 | 83 | bool real; |
garyservin | 0:9e9b7db60fd5 | 84 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 85 | } u_state; |
garyservin | 0:9e9b7db60fd5 | 86 | u_state.base = 0; |
garyservin | 0:9e9b7db60fd5 | 87 | u_state.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 88 | this->state = u_state.real; |
garyservin | 0:9e9b7db60fd5 | 89 | offset += sizeof(this->state); |
garyservin | 0:9e9b7db60fd5 | 90 | union { |
garyservin | 0:9e9b7db60fd5 | 91 | int32_t real; |
garyservin | 0:9e9b7db60fd5 | 92 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 93 | } u_id; |
garyservin | 0:9e9b7db60fd5 | 94 | u_id.base = 0; |
garyservin | 0:9e9b7db60fd5 | 95 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 96 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 97 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 98 | u_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 99 | this->id = u_id.real; |
garyservin | 0:9e9b7db60fd5 | 100 | offset += sizeof(this->id); |
garyservin | 0:9e9b7db60fd5 | 101 | union { |
garyservin | 0:9e9b7db60fd5 | 102 | int32_t real; |
garyservin | 0:9e9b7db60fd5 | 103 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 104 | } u_parent; |
garyservin | 0:9e9b7db60fd5 | 105 | u_parent.base = 0; |
garyservin | 0:9e9b7db60fd5 | 106 | u_parent.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 107 | u_parent.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 108 | u_parent.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 109 | u_parent.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 110 | this->parent = u_parent.real; |
garyservin | 0:9e9b7db60fd5 | 111 | offset += sizeof(this->parent); |
garyservin | 0:9e9b7db60fd5 | 112 | return offset; |
garyservin | 0:9e9b7db60fd5 | 113 | } |
garyservin | 0:9e9b7db60fd5 | 114 | |
garyservin | 0:9e9b7db60fd5 | 115 | const char * getType(){ return "dynamic_reconfigure/GroupState"; }; |
garyservin | 0:9e9b7db60fd5 | 116 | const char * getMD5(){ return "a2d87f51dc22930325041a2f8b1571f8"; }; |
garyservin | 0:9e9b7db60fd5 | 117 | |
garyservin | 0:9e9b7db60fd5 | 118 | }; |
garyservin | 0:9e9b7db60fd5 | 119 | |
garyservin | 0:9e9b7db60fd5 | 120 | } |
garyservin | 0:9e9b7db60fd5 | 121 | #endif |