RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_gopro_set_response.h
1#pragma once
2// MESSAGE GOPRO_SET_RESPONSE PACKING
3
4#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE 219
5
6MAVPACKED(
7typedef struct __mavlink_gopro_set_response_t {
8 uint8_t cmd_id; /*< Command ID*/
9 uint8_t status; /*< Status*/
10}) mavlink_gopro_set_response_t;
11
12#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN 2
13#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN 2
14#define MAVLINK_MSG_ID_219_LEN 2
15#define MAVLINK_MSG_ID_219_MIN_LEN 2
16
17#define MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC 162
18#define MAVLINK_MSG_ID_219_CRC 162
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_GOPRO_SET_RESPONSE { \
24 219, \
25 "GOPRO_SET_RESPONSE", \
26 2, \
27 { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_response_t, cmd_id) }, \
28 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_response_t, status) }, \
29 } \
30}
31#else
32#define MAVLINK_MESSAGE_INFO_GOPRO_SET_RESPONSE { \
33 "GOPRO_SET_RESPONSE", \
34 2, \
35 { { "cmd_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gopro_set_response_t, cmd_id) }, \
36 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gopro_set_response_t, status) }, \
37 } \
38}
39#endif
40
41/**
42 * @brief Pack a gopro_set_response message
43 * @param system_id ID of this system
44 * @param component_id ID of this component (e.g. 200 for IMU)
45 * @param msg The MAVLink message to compress the data into
46 *
47 * @param cmd_id Command ID
48 * @param status Status
49 * @return length of the message in bytes (excluding serial stream start sign)
50 */
51static inline uint16_t mavlink_msg_gopro_set_response_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
52 uint8_t cmd_id, uint8_t status)
53{
54#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN];
56 _mav_put_uint8_t(buf, 0, cmd_id);
57 _mav_put_uint8_t(buf, 1, status);
58
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN);
60#else
61 mavlink_gopro_set_response_t packet;
62 packet.cmd_id = cmd_id;
63 packet.status = status;
64
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN);
66#endif
67
68 msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE;
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
70}
71
72/**
73 * @brief Pack a gopro_set_response message on a channel
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param chan The MAVLink channel this message will be sent over
77 * @param msg The MAVLink message to compress the data into
78 * @param cmd_id Command ID
79 * @param status Status
80 * @return length of the message in bytes (excluding serial stream start sign)
81 */
82static inline uint16_t mavlink_msg_gopro_set_response_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
83 mavlink_message_t* msg,
84 uint8_t cmd_id,uint8_t status)
85{
86#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN];
88 _mav_put_uint8_t(buf, 0, cmd_id);
89 _mav_put_uint8_t(buf, 1, status);
90
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN);
92#else
93 mavlink_gopro_set_response_t packet;
94 packet.cmd_id = cmd_id;
95 packet.status = status;
96
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN);
98#endif
99
100 msg->msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE;
101 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
102}
103
104/**
105 * @brief Encode a gopro_set_response struct
106 *
107 * @param system_id ID of this system
108 * @param component_id ID of this component (e.g. 200 for IMU)
109 * @param msg The MAVLink message to compress the data into
110 * @param gopro_set_response C-struct to read the message contents from
111 */
112static inline uint16_t mavlink_msg_gopro_set_response_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gopro_set_response_t* gopro_set_response)
113{
114 return mavlink_msg_gopro_set_response_pack(system_id, component_id, msg, gopro_set_response->cmd_id, gopro_set_response->status);
115}
116
117/**
118 * @brief Encode a gopro_set_response struct on a channel
119 *
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param chan The MAVLink channel this message will be sent over
123 * @param msg The MAVLink message to compress the data into
124 * @param gopro_set_response C-struct to read the message contents from
125 */
126static inline uint16_t mavlink_msg_gopro_set_response_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gopro_set_response_t* gopro_set_response)
127{
128 return mavlink_msg_gopro_set_response_pack_chan(system_id, component_id, chan, msg, gopro_set_response->cmd_id, gopro_set_response->status);
129}
130
131/**
132 * @brief Send a gopro_set_response message
133 * @param chan MAVLink channel to send the message
134 *
135 * @param cmd_id Command ID
136 * @param status Status
137 */
138#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
139
140static inline void mavlink_msg_gopro_set_response_send(mavlink_channel_t chan, uint8_t cmd_id, uint8_t status)
141{
142#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN];
144 _mav_put_uint8_t(buf, 0, cmd_id);
145 _mav_put_uint8_t(buf, 1, status);
146
147 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
148#else
149 mavlink_gopro_set_response_t packet;
150 packet.cmd_id = cmd_id;
151 packet.status = status;
152
153 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)&packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
154#endif
155}
156
157/**
158 * @brief Send a gopro_set_response message
159 * @param chan MAVLink channel to send the message
160 * @param struct The MAVLink struct to serialize
161 */
162static inline void mavlink_msg_gopro_set_response_send_struct(mavlink_channel_t chan, const mavlink_gopro_set_response_t* gopro_set_response)
163{
164#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_gopro_set_response_send(chan, gopro_set_response->cmd_id, gopro_set_response->status);
166#else
167 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)gopro_set_response, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
168#endif
169}
170
171#if MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
172/*
173 This varient of _send() can be used to save stack space by re-using
174 memory from the receive buffer. The caller provides a
175 mavlink_message_t which is the size of a full mavlink message. This
176 is usually the receive buffer for the channel, and allows a reply to an
177 incoming message with minimum stack space usage.
178 */
179static inline void mavlink_msg_gopro_set_response_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t cmd_id, uint8_t status)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf = (char *)msgbuf;
183 _mav_put_uint8_t(buf, 0, cmd_id);
184 _mav_put_uint8_t(buf, 1, status);
185
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, buf, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
187#else
188 mavlink_gopro_set_response_t *packet = (mavlink_gopro_set_response_t *)msgbuf;
189 packet->cmd_id = cmd_id;
190 packet->status = status;
191
192 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE, (const char *)packet, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_MIN_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_CRC);
193#endif
194}
195#endif
196
197#endif
198
199// MESSAGE GOPRO_SET_RESPONSE UNPACKING
200
201
202/**
203 * @brief Get field cmd_id from gopro_set_response message
204 *
205 * @return Command ID
206 */
207static inline uint8_t mavlink_msg_gopro_set_response_get_cmd_id(const mavlink_message_t* msg)
208{
209 return _MAV_RETURN_uint8_t(msg, 0);
210}
211
212/**
213 * @brief Get field status from gopro_set_response message
214 *
215 * @return Status
216 */
217static inline uint8_t mavlink_msg_gopro_set_response_get_status(const mavlink_message_t* msg)
218{
219 return _MAV_RETURN_uint8_t(msg, 1);
220}
221
222/**
223 * @brief Decode a gopro_set_response message into a struct
224 *
225 * @param msg The message to decode
226 * @param gopro_set_response C-struct to decode the message contents into
227 */
228static inline void mavlink_msg_gopro_set_response_decode(const mavlink_message_t* msg, mavlink_gopro_set_response_t* gopro_set_response)
229{
230#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 gopro_set_response->cmd_id = mavlink_msg_gopro_set_response_get_cmd_id(msg);
232 gopro_set_response->status = mavlink_msg_gopro_set_response_get_status(msg);
233#else
234 uint8_t len = msg->len < MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN? msg->len : MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN;
235 memset(gopro_set_response, 0, MAVLINK_MSG_ID_GOPRO_SET_RESPONSE_LEN);
236 memcpy(gopro_set_response, _MAV_PAYLOAD(msg), len);
237#endif
238}