RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_gopro_get_response.h
1#pragma once
2// MESSAGE GOPRO_GET_RESPONSE PACKING
3
4#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE 217
5
6MAVPACKED(
7typedef struct __mavlink_gopro_get_response_t {
8 uint8_t cmd_id; /*< Command ID*/
9 uint8_t status; /*< Status*/
10 uint8_t value[4]; /*< Value*/
11}) mavlink_gopro_get_response_t;
12
13#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN 6
14#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN 6
15#define MAVLINK_MSG_ID_217_LEN 6
16#define MAVLINK_MSG_ID_217_MIN_LEN 6
17
18#define MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC 202
19#define MAVLINK_MSG_ID_217_CRC 202
20
21#define MAVLINK_MSG_GOPRO_GET_RESPONSE_FIELD_VALUE_LEN 4
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_GOPRO_GET_RESPONSE { \
25 217, \
26 "GOPRO_GET_RESPONSE", \
27 3, \
28 { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_response_t, cmd_id) }, \
29 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_response_t, status) }, \
30 { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 2, offsetof(mavlink_gopro_get_response_t, value) }, \
31 } \
32}
33#else
34#define MAVLINK_MESSAGE_INFO_GOPRO_GET_RESPONSE { \
35 "GOPRO_GET_RESPONSE", \
36 3, \
37 { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_get_response_t, cmd_id) }, \
38 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_get_response_t, status) }, \
39 { "value", NULL, MAVLINK_TYPE_UINT8_T, 4, 2, offsetof(mavlink_gopro_get_response_t, value) }, \
40 } \
41}
42#endif
43
55static inline uint16_t mavlink_msg_gopro_get_response_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
56 uint8_t cmd_id, uint8_t status, const uint8_t *value)
57{
58#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
59 char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN];
60 _mav_put_uint8_t(buf, 0, cmd_id);
61 _mav_put_uint8_t(buf, 1, status);
62 _mav_put_uint8_t_array(buf, 2, value, 4);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN);
64#else
65 mavlink_gopro_get_response_t packet;
66 packet.cmd_id = cmd_id;
67 packet.status = status;
68 mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN);
70#endif
71
72 msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE;
73 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
74}
75
87static inline uint16_t mavlink_msg_gopro_get_response_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
88 mavlink_message_t* msg,
89 uint8_t cmd_id,uint8_t status,const uint8_t *value)
90{
91#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN];
93 _mav_put_uint8_t(buf, 0, cmd_id);
94 _mav_put_uint8_t(buf, 1, status);
95 _mav_put_uint8_t_array(buf, 2, value, 4);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN);
97#else
98 mavlink_gopro_get_response_t packet;
99 packet.cmd_id = cmd_id;
100 packet.status = status;
101 mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4);
102 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN);
103#endif
104
105 msg->msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE;
106 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
107}
108
117static inline uint16_t mavlink_msg_gopro_get_response_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_get_response_t* gopro_get_response)
118{
119 return mavlink_msg_gopro_get_response_pack(system_id, component_id, msg, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value);
120}
121
131static inline uint16_t mavlink_msg_gopro_get_response_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_get_response_t* gopro_get_response)
132{
133 return mavlink_msg_gopro_get_response_pack_chan(system_id, component_id, chan, msg, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value);
134}
135
144#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
145
146static inline void mavlink_msg_gopro_get_response_send(mavlink_channel_t chan, uint8_t cmd_id, uint8_t status, const uint8_t *value)
147{
148#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf[MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN];
150 _mav_put_uint8_t(buf, 0, cmd_id);
151 _mav_put_uint8_t(buf, 1, status);
152 _mav_put_uint8_t_array(buf, 2, value, 4);
153 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
154#else
155 mavlink_gopro_get_response_t packet;
156 packet.cmd_id = cmd_id;
157 packet.status = status;
158 mav_array_memcpy(packet.value, value, sizeof(uint8_t)*4);
159 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
160#endif
161}
162
168static inline void mavlink_msg_gopro_get_response_send_struct(mavlink_channel_t chan, const mavlink_gopro_get_response_t* gopro_get_response)
169{
170#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171 mavlink_msg_gopro_get_response_send(chan, gopro_get_response->cmd_id, gopro_get_response->status, gopro_get_response->value);
172#else
173 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)gopro_get_response, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
174#endif
175}
176
177#if MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
178/*
179 This varient of _send() can be used to save stack space by re-using
180 memory from the receive buffer. The caller provides a
181 mavlink_message_t which is the size of a full mavlink message. This
182 is usually the receive buffer for the channel, and allows a reply to an
183 incoming message with minimum stack space usage.
184 */
185static inline void mavlink_msg_gopro_get_response_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t cmd_id, uint8_t status, const uint8_t *value)
186{
187#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
188 char *buf = (char *)msgbuf;
189 _mav_put_uint8_t(buf, 0, cmd_id);
190 _mav_put_uint8_t(buf, 1, status);
191 _mav_put_uint8_t_array(buf, 2, value, 4);
192 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
193#else
194 mavlink_gopro_get_response_t *packet = (mavlink_gopro_get_response_t *)msgbuf;
195 packet->cmd_id = cmd_id;
196 packet->status = status;
197 mav_array_memcpy(packet->value, value, sizeof(uint8_t)*4);
198 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE, (const char *)packet, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_CRC);
199#endif
200}
201#endif
202
203#endif
204
205// MESSAGE GOPRO_GET_RESPONSE UNPACKING
206
207
213static inline uint8_t mavlink_msg_gopro_get_response_get_cmd_id(const mavlink_message_t* msg)
214{
215 return _MAV_RETURN_uint8_t(msg, 0);
216}
217
223static inline uint8_t mavlink_msg_gopro_get_response_get_status(const mavlink_message_t* msg)
224{
225 return _MAV_RETURN_uint8_t(msg, 1);
226}
227
233static inline uint16_t mavlink_msg_gopro_get_response_get_value(const mavlink_message_t* msg, uint8_t *value)
234{
235 return _MAV_RETURN_uint8_t_array(msg, value, 4, 2);
236}
237
244static inline void mavlink_msg_gopro_get_response_decode(const mavlink_message_t* msg, mavlink_gopro_get_response_t* gopro_get_response)
245{
246#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247 gopro_get_response->cmd_id = mavlink_msg_gopro_get_response_get_cmd_id(msg);
248 gopro_get_response->status = mavlink_msg_gopro_get_response_get_status(msg);
249 mavlink_msg_gopro_get_response_get_value(msg, gopro_get_response->value);
250#else
251 uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN;
252 memset(gopro_get_response, 0, MAVLINK_MSG_ID_GOPRO_GET_RESPONSE_LEN);
253 memcpy(gopro_get_response, _MAV_PAYLOAD(msg), len);
254#endif
255}