Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ros_lib/mavros_msgs/CommandLong.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_SERVICE_CommandLong_h |
irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_SERVICE_CommandLong_h |
irfantitok | 0:8f3710bfd298 | 3 | #include <stdint.h> |
irfantitok | 0:8f3710bfd298 | 4 | #include <string.h> |
irfantitok | 0:8f3710bfd298 | 5 | #include <stdlib.h> |
irfantitok | 0:8f3710bfd298 | 6 | #include "ros/msg.h" |
irfantitok | 0:8f3710bfd298 | 7 | |
irfantitok | 0:8f3710bfd298 | 8 | namespace mavros_msgs |
irfantitok | 0:8f3710bfd298 | 9 | { |
irfantitok | 0:8f3710bfd298 | 10 | |
irfantitok | 0:8f3710bfd298 | 11 | static const char COMMANDLONG[] = "mavros_msgs/CommandLong"; |
irfantitok | 0:8f3710bfd298 | 12 | |
irfantitok | 0:8f3710bfd298 | 13 | class CommandLongRequest : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 14 | { |
irfantitok | 0:8f3710bfd298 | 15 | public: |
irfantitok | 0:8f3710bfd298 | 16 | typedef bool _broadcast_type; |
irfantitok | 0:8f3710bfd298 | 17 | _broadcast_type broadcast; |
irfantitok | 0:8f3710bfd298 | 18 | typedef uint16_t _command_type; |
irfantitok | 0:8f3710bfd298 | 19 | _command_type command; |
irfantitok | 0:8f3710bfd298 | 20 | typedef uint8_t _confirmation_type; |
irfantitok | 0:8f3710bfd298 | 21 | _confirmation_type confirmation; |
irfantitok | 0:8f3710bfd298 | 22 | typedef float _param1_type; |
irfantitok | 0:8f3710bfd298 | 23 | _param1_type param1; |
irfantitok | 0:8f3710bfd298 | 24 | typedef float _param2_type; |
irfantitok | 0:8f3710bfd298 | 25 | _param2_type param2; |
irfantitok | 0:8f3710bfd298 | 26 | typedef float _param3_type; |
irfantitok | 0:8f3710bfd298 | 27 | _param3_type param3; |
irfantitok | 0:8f3710bfd298 | 28 | typedef float _param4_type; |
irfantitok | 0:8f3710bfd298 | 29 | _param4_type param4; |
irfantitok | 0:8f3710bfd298 | 30 | typedef float _param5_type; |
irfantitok | 0:8f3710bfd298 | 31 | _param5_type param5; |
irfantitok | 0:8f3710bfd298 | 32 | typedef float _param6_type; |
irfantitok | 0:8f3710bfd298 | 33 | _param6_type param6; |
irfantitok | 0:8f3710bfd298 | 34 | typedef float _param7_type; |
irfantitok | 0:8f3710bfd298 | 35 | _param7_type param7; |
irfantitok | 0:8f3710bfd298 | 36 | |
irfantitok | 0:8f3710bfd298 | 37 | CommandLongRequest(): |
irfantitok | 0:8f3710bfd298 | 38 | broadcast(0), |
irfantitok | 0:8f3710bfd298 | 39 | command(0), |
irfantitok | 0:8f3710bfd298 | 40 | confirmation(0), |
irfantitok | 0:8f3710bfd298 | 41 | param1(0), |
irfantitok | 0:8f3710bfd298 | 42 | param2(0), |
irfantitok | 0:8f3710bfd298 | 43 | param3(0), |
irfantitok | 0:8f3710bfd298 | 44 | param4(0), |
irfantitok | 0:8f3710bfd298 | 45 | param5(0), |
irfantitok | 0:8f3710bfd298 | 46 | param6(0), |
irfantitok | 0:8f3710bfd298 | 47 | param7(0) |
irfantitok | 0:8f3710bfd298 | 48 | { |
irfantitok | 0:8f3710bfd298 | 49 | } |
irfantitok | 0:8f3710bfd298 | 50 | |
irfantitok | 0:8f3710bfd298 | 51 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 52 | { |
irfantitok | 0:8f3710bfd298 | 53 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 54 | union { |
irfantitok | 0:8f3710bfd298 | 55 | bool real; |
irfantitok | 0:8f3710bfd298 | 56 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 57 | } u_broadcast; |
irfantitok | 0:8f3710bfd298 | 58 | u_broadcast.real = this->broadcast; |
irfantitok | 0:8f3710bfd298 | 59 | *(outbuffer + offset + 0) = (u_broadcast.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 60 | offset += sizeof(this->broadcast); |
irfantitok | 0:8f3710bfd298 | 61 | *(outbuffer + offset + 0) = (this->command >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 62 | *(outbuffer + offset + 1) = (this->command >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 63 | offset += sizeof(this->command); |
irfantitok | 0:8f3710bfd298 | 64 | *(outbuffer + offset + 0) = (this->confirmation >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 65 | offset += sizeof(this->confirmation); |
irfantitok | 0:8f3710bfd298 | 66 | union { |
irfantitok | 0:8f3710bfd298 | 67 | float real; |
irfantitok | 0:8f3710bfd298 | 68 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 69 | } u_param1; |
irfantitok | 0:8f3710bfd298 | 70 | u_param1.real = this->param1; |
irfantitok | 0:8f3710bfd298 | 71 | *(outbuffer + offset + 0) = (u_param1.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 72 | *(outbuffer + offset + 1) = (u_param1.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 73 | *(outbuffer + offset + 2) = (u_param1.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 74 | *(outbuffer + offset + 3) = (u_param1.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 75 | offset += sizeof(this->param1); |
irfantitok | 0:8f3710bfd298 | 76 | union { |
irfantitok | 0:8f3710bfd298 | 77 | float real; |
irfantitok | 0:8f3710bfd298 | 78 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 79 | } u_param2; |
irfantitok | 0:8f3710bfd298 | 80 | u_param2.real = this->param2; |
irfantitok | 0:8f3710bfd298 | 81 | *(outbuffer + offset + 0) = (u_param2.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 82 | *(outbuffer + offset + 1) = (u_param2.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 83 | *(outbuffer + offset + 2) = (u_param2.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 84 | *(outbuffer + offset + 3) = (u_param2.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 85 | offset += sizeof(this->param2); |
irfantitok | 0:8f3710bfd298 | 86 | union { |
irfantitok | 0:8f3710bfd298 | 87 | float real; |
irfantitok | 0:8f3710bfd298 | 88 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 89 | } u_param3; |
irfantitok | 0:8f3710bfd298 | 90 | u_param3.real = this->param3; |
irfantitok | 0:8f3710bfd298 | 91 | *(outbuffer + offset + 0) = (u_param3.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 92 | *(outbuffer + offset + 1) = (u_param3.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 93 | *(outbuffer + offset + 2) = (u_param3.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 94 | *(outbuffer + offset + 3) = (u_param3.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 95 | offset += sizeof(this->param3); |
irfantitok | 0:8f3710bfd298 | 96 | union { |
irfantitok | 0:8f3710bfd298 | 97 | float real; |
irfantitok | 0:8f3710bfd298 | 98 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 99 | } u_param4; |
irfantitok | 0:8f3710bfd298 | 100 | u_param4.real = this->param4; |
irfantitok | 0:8f3710bfd298 | 101 | *(outbuffer + offset + 0) = (u_param4.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 102 | *(outbuffer + offset + 1) = (u_param4.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 103 | *(outbuffer + offset + 2) = (u_param4.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 104 | *(outbuffer + offset + 3) = (u_param4.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 105 | offset += sizeof(this->param4); |
irfantitok | 0:8f3710bfd298 | 106 | union { |
irfantitok | 0:8f3710bfd298 | 107 | float real; |
irfantitok | 0:8f3710bfd298 | 108 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 109 | } u_param5; |
irfantitok | 0:8f3710bfd298 | 110 | u_param5.real = this->param5; |
irfantitok | 0:8f3710bfd298 | 111 | *(outbuffer + offset + 0) = (u_param5.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 112 | *(outbuffer + offset + 1) = (u_param5.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 113 | *(outbuffer + offset + 2) = (u_param5.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 114 | *(outbuffer + offset + 3) = (u_param5.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 115 | offset += sizeof(this->param5); |
irfantitok | 0:8f3710bfd298 | 116 | union { |
irfantitok | 0:8f3710bfd298 | 117 | float real; |
irfantitok | 0:8f3710bfd298 | 118 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 119 | } u_param6; |
irfantitok | 0:8f3710bfd298 | 120 | u_param6.real = this->param6; |
irfantitok | 0:8f3710bfd298 | 121 | *(outbuffer + offset + 0) = (u_param6.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 122 | *(outbuffer + offset + 1) = (u_param6.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 123 | *(outbuffer + offset + 2) = (u_param6.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 124 | *(outbuffer + offset + 3) = (u_param6.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 125 | offset += sizeof(this->param6); |
irfantitok | 0:8f3710bfd298 | 126 | union { |
irfantitok | 0:8f3710bfd298 | 127 | float real; |
irfantitok | 0:8f3710bfd298 | 128 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 129 | } u_param7; |
irfantitok | 0:8f3710bfd298 | 130 | u_param7.real = this->param7; |
irfantitok | 0:8f3710bfd298 | 131 | *(outbuffer + offset + 0) = (u_param7.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 132 | *(outbuffer + offset + 1) = (u_param7.base >> (8 * 1)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 133 | *(outbuffer + offset + 2) = (u_param7.base >> (8 * 2)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 134 | *(outbuffer + offset + 3) = (u_param7.base >> (8 * 3)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 135 | offset += sizeof(this->param7); |
irfantitok | 0:8f3710bfd298 | 136 | return offset; |
irfantitok | 0:8f3710bfd298 | 137 | } |
irfantitok | 0:8f3710bfd298 | 138 | |
irfantitok | 0:8f3710bfd298 | 139 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 140 | { |
irfantitok | 0:8f3710bfd298 | 141 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 142 | union { |
irfantitok | 0:8f3710bfd298 | 143 | bool real; |
irfantitok | 0:8f3710bfd298 | 144 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 145 | } u_broadcast; |
irfantitok | 0:8f3710bfd298 | 146 | u_broadcast.base = 0; |
irfantitok | 0:8f3710bfd298 | 147 | u_broadcast.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 148 | this->broadcast = u_broadcast.real; |
irfantitok | 0:8f3710bfd298 | 149 | offset += sizeof(this->broadcast); |
irfantitok | 0:8f3710bfd298 | 150 | this->command = ((uint16_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 151 | this->command |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 152 | offset += sizeof(this->command); |
irfantitok | 0:8f3710bfd298 | 153 | this->confirmation = ((uint8_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 154 | offset += sizeof(this->confirmation); |
irfantitok | 0:8f3710bfd298 | 155 | union { |
irfantitok | 0:8f3710bfd298 | 156 | float real; |
irfantitok | 0:8f3710bfd298 | 157 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 158 | } u_param1; |
irfantitok | 0:8f3710bfd298 | 159 | u_param1.base = 0; |
irfantitok | 0:8f3710bfd298 | 160 | u_param1.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 161 | u_param1.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 162 | u_param1.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 163 | u_param1.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 164 | this->param1 = u_param1.real; |
irfantitok | 0:8f3710bfd298 | 165 | offset += sizeof(this->param1); |
irfantitok | 0:8f3710bfd298 | 166 | union { |
irfantitok | 0:8f3710bfd298 | 167 | float real; |
irfantitok | 0:8f3710bfd298 | 168 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 169 | } u_param2; |
irfantitok | 0:8f3710bfd298 | 170 | u_param2.base = 0; |
irfantitok | 0:8f3710bfd298 | 171 | u_param2.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 172 | u_param2.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 173 | u_param2.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 174 | u_param2.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 175 | this->param2 = u_param2.real; |
irfantitok | 0:8f3710bfd298 | 176 | offset += sizeof(this->param2); |
irfantitok | 0:8f3710bfd298 | 177 | union { |
irfantitok | 0:8f3710bfd298 | 178 | float real; |
irfantitok | 0:8f3710bfd298 | 179 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 180 | } u_param3; |
irfantitok | 0:8f3710bfd298 | 181 | u_param3.base = 0; |
irfantitok | 0:8f3710bfd298 | 182 | u_param3.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 183 | u_param3.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 184 | u_param3.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 185 | u_param3.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 186 | this->param3 = u_param3.real; |
irfantitok | 0:8f3710bfd298 | 187 | offset += sizeof(this->param3); |
irfantitok | 0:8f3710bfd298 | 188 | union { |
irfantitok | 0:8f3710bfd298 | 189 | float real; |
irfantitok | 0:8f3710bfd298 | 190 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 191 | } u_param4; |
irfantitok | 0:8f3710bfd298 | 192 | u_param4.base = 0; |
irfantitok | 0:8f3710bfd298 | 193 | u_param4.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 194 | u_param4.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 195 | u_param4.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 196 | u_param4.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 197 | this->param4 = u_param4.real; |
irfantitok | 0:8f3710bfd298 | 198 | offset += sizeof(this->param4); |
irfantitok | 0:8f3710bfd298 | 199 | union { |
irfantitok | 0:8f3710bfd298 | 200 | float real; |
irfantitok | 0:8f3710bfd298 | 201 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 202 | } u_param5; |
irfantitok | 0:8f3710bfd298 | 203 | u_param5.base = 0; |
irfantitok | 0:8f3710bfd298 | 204 | u_param5.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 205 | u_param5.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 206 | u_param5.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 207 | u_param5.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 208 | this->param5 = u_param5.real; |
irfantitok | 0:8f3710bfd298 | 209 | offset += sizeof(this->param5); |
irfantitok | 0:8f3710bfd298 | 210 | union { |
irfantitok | 0:8f3710bfd298 | 211 | float real; |
irfantitok | 0:8f3710bfd298 | 212 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 213 | } u_param6; |
irfantitok | 0:8f3710bfd298 | 214 | u_param6.base = 0; |
irfantitok | 0:8f3710bfd298 | 215 | u_param6.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 216 | u_param6.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 217 | u_param6.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 218 | u_param6.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 219 | this->param6 = u_param6.real; |
irfantitok | 0:8f3710bfd298 | 220 | offset += sizeof(this->param6); |
irfantitok | 0:8f3710bfd298 | 221 | union { |
irfantitok | 0:8f3710bfd298 | 222 | float real; |
irfantitok | 0:8f3710bfd298 | 223 | uint32_t base; |
irfantitok | 0:8f3710bfd298 | 224 | } u_param7; |
irfantitok | 0:8f3710bfd298 | 225 | u_param7.base = 0; |
irfantitok | 0:8f3710bfd298 | 226 | u_param7.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 227 | u_param7.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
irfantitok | 0:8f3710bfd298 | 228 | u_param7.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
irfantitok | 0:8f3710bfd298 | 229 | u_param7.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
irfantitok | 0:8f3710bfd298 | 230 | this->param7 = u_param7.real; |
irfantitok | 0:8f3710bfd298 | 231 | offset += sizeof(this->param7); |
irfantitok | 0:8f3710bfd298 | 232 | return offset; |
irfantitok | 0:8f3710bfd298 | 233 | } |
irfantitok | 0:8f3710bfd298 | 234 | |
irfantitok | 0:8f3710bfd298 | 235 | const char * getType(){ return COMMANDLONG; }; |
irfantitok | 0:8f3710bfd298 | 236 | const char * getMD5(){ return "0ad16dd8ca2c8f209bfc6c32c71c0dd8"; }; |
irfantitok | 0:8f3710bfd298 | 237 | |
irfantitok | 0:8f3710bfd298 | 238 | }; |
irfantitok | 0:8f3710bfd298 | 239 | |
irfantitok | 0:8f3710bfd298 | 240 | class CommandLongResponse : public ros::Msg |
irfantitok | 0:8f3710bfd298 | 241 | { |
irfantitok | 0:8f3710bfd298 | 242 | public: |
irfantitok | 0:8f3710bfd298 | 243 | typedef bool _success_type; |
irfantitok | 0:8f3710bfd298 | 244 | _success_type success; |
irfantitok | 0:8f3710bfd298 | 245 | typedef uint8_t _result_type; |
irfantitok | 0:8f3710bfd298 | 246 | _result_type result; |
irfantitok | 0:8f3710bfd298 | 247 | |
irfantitok | 0:8f3710bfd298 | 248 | CommandLongResponse(): |
irfantitok | 0:8f3710bfd298 | 249 | success(0), |
irfantitok | 0:8f3710bfd298 | 250 | result(0) |
irfantitok | 0:8f3710bfd298 | 251 | { |
irfantitok | 0:8f3710bfd298 | 252 | } |
irfantitok | 0:8f3710bfd298 | 253 | |
irfantitok | 0:8f3710bfd298 | 254 | virtual int serialize(unsigned char *outbuffer) const |
irfantitok | 0:8f3710bfd298 | 255 | { |
irfantitok | 0:8f3710bfd298 | 256 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 257 | union { |
irfantitok | 0:8f3710bfd298 | 258 | bool real; |
irfantitok | 0:8f3710bfd298 | 259 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 260 | } u_success; |
irfantitok | 0:8f3710bfd298 | 261 | u_success.real = this->success; |
irfantitok | 0:8f3710bfd298 | 262 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 263 | offset += sizeof(this->success); |
irfantitok | 0:8f3710bfd298 | 264 | *(outbuffer + offset + 0) = (this->result >> (8 * 0)) & 0xFF; |
irfantitok | 0:8f3710bfd298 | 265 | offset += sizeof(this->result); |
irfantitok | 0:8f3710bfd298 | 266 | return offset; |
irfantitok | 0:8f3710bfd298 | 267 | } |
irfantitok | 0:8f3710bfd298 | 268 | |
irfantitok | 0:8f3710bfd298 | 269 | virtual int deserialize(unsigned char *inbuffer) |
irfantitok | 0:8f3710bfd298 | 270 | { |
irfantitok | 0:8f3710bfd298 | 271 | int offset = 0; |
irfantitok | 0:8f3710bfd298 | 272 | union { |
irfantitok | 0:8f3710bfd298 | 273 | bool real; |
irfantitok | 0:8f3710bfd298 | 274 | uint8_t base; |
irfantitok | 0:8f3710bfd298 | 275 | } u_success; |
irfantitok | 0:8f3710bfd298 | 276 | u_success.base = 0; |
irfantitok | 0:8f3710bfd298 | 277 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
irfantitok | 0:8f3710bfd298 | 278 | this->success = u_success.real; |
irfantitok | 0:8f3710bfd298 | 279 | offset += sizeof(this->success); |
irfantitok | 0:8f3710bfd298 | 280 | this->result = ((uint8_t) (*(inbuffer + offset))); |
irfantitok | 0:8f3710bfd298 | 281 | offset += sizeof(this->result); |
irfantitok | 0:8f3710bfd298 | 282 | return offset; |
irfantitok | 0:8f3710bfd298 | 283 | } |
irfantitok | 0:8f3710bfd298 | 284 | |
irfantitok | 0:8f3710bfd298 | 285 | const char * getType(){ return COMMANDLONG; }; |
irfantitok | 0:8f3710bfd298 | 286 | const char * getMD5(){ return "1cd894375e4e3d2861d2222772894fdb"; }; |
irfantitok | 0:8f3710bfd298 | 287 | |
irfantitok | 0:8f3710bfd298 | 288 | }; |
irfantitok | 0:8f3710bfd298 | 289 | |
irfantitok | 0:8f3710bfd298 | 290 | class CommandLong { |
irfantitok | 0:8f3710bfd298 | 291 | public: |
irfantitok | 0:8f3710bfd298 | 292 | typedef CommandLongRequest Request; |
irfantitok | 0:8f3710bfd298 | 293 | typedef CommandLongResponse Response; |
irfantitok | 0:8f3710bfd298 | 294 | }; |
irfantitok | 0:8f3710bfd298 | 295 | |
irfantitok | 0:8f3710bfd298 | 296 | } |
irfantitok | 0:8f3710bfd298 | 297 | #endif |