RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_boot.h
1#pragma once
2// MESSAGE BOOT PACKING
3
4#define MAVLINK_MSG_ID_BOOT 197
5
6MAVPACKED(
7typedef struct __mavlink_boot_t {
8 uint32_t version; /*< The onboard software version*/
9}) mavlink_boot_t;
10
11#define MAVLINK_MSG_ID_BOOT_LEN 4
12#define MAVLINK_MSG_ID_BOOT_MIN_LEN 4
13#define MAVLINK_MSG_ID_197_LEN 4
14#define MAVLINK_MSG_ID_197_MIN_LEN 4
15
16#define MAVLINK_MSG_ID_BOOT_CRC 39
17#define MAVLINK_MSG_ID_197_CRC 39
18
19
20
21#if MAVLINK_COMMAND_24BIT
22#define MAVLINK_MESSAGE_INFO_BOOT { \
23 197, \
24 "BOOT", \
25 1, \
26 { { "version", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_boot_t, version) }, \
27 } \
28}
29#else
30#define MAVLINK_MESSAGE_INFO_BOOT { \
31 "BOOT", \
32 1, \
33 { { "version", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_boot_t, version) }, \
34 } \
35}
36#endif
37
47static inline uint16_t mavlink_msg_boot_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48 uint32_t version)
49{
50#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
51 char buf[MAVLINK_MSG_ID_BOOT_LEN];
52 _mav_put_uint32_t(buf, 0, version);
53
54 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOOT_LEN);
55#else
56 mavlink_boot_t packet;
57 packet.version = version;
58
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOOT_LEN);
60#endif
61
62 msg->msgid = MAVLINK_MSG_ID_BOOT;
63 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
64}
65
75static inline uint16_t mavlink_msg_boot_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
76 mavlink_message_t* msg,
77 uint32_t version)
78{
79#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
80 char buf[MAVLINK_MSG_ID_BOOT_LEN];
81 _mav_put_uint32_t(buf, 0, version);
82
83 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_BOOT_LEN);
84#else
85 mavlink_boot_t packet;
86 packet.version = version;
87
88 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_BOOT_LEN);
89#endif
90
91 msg->msgid = MAVLINK_MSG_ID_BOOT;
92 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
93}
94
103static inline uint16_t mavlink_msg_boot_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_boot_t* boot)
104{
105 return mavlink_msg_boot_pack(system_id, component_id, msg, boot->version);
106}
107
117static inline uint16_t mavlink_msg_boot_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_boot_t* boot)
118{
119 return mavlink_msg_boot_pack_chan(system_id, component_id, chan, msg, boot->version);
120}
121
128#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
129
130static inline void mavlink_msg_boot_send(mavlink_channel_t chan, uint32_t version)
131{
132#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
133 char buf[MAVLINK_MSG_ID_BOOT_LEN];
134 _mav_put_uint32_t(buf, 0, version);
135
136 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, buf, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
137#else
138 mavlink_boot_t packet;
139 packet.version = version;
140
141 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, (const char *)&packet, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
142#endif
143}
144
150static inline void mavlink_msg_boot_send_struct(mavlink_channel_t chan, const mavlink_boot_t* boot)
151{
152#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
153 mavlink_msg_boot_send(chan, boot->version);
154#else
155 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, (const char *)boot, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
156#endif
157}
158
159#if MAVLINK_MSG_ID_BOOT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
160/*
161 This varient of _send() can be used to save stack space by re-using
162 memory from the receive buffer. The caller provides a
163 mavlink_message_t which is the size of a full mavlink message. This
164 is usually the receive buffer for the channel, and allows a reply to an
165 incoming message with minimum stack space usage.
166 */
167static inline void mavlink_msg_boot_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t version)
168{
169#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
170 char *buf = (char *)msgbuf;
171 _mav_put_uint32_t(buf, 0, version);
172
173 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, buf, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
174#else
175 mavlink_boot_t *packet = (mavlink_boot_t *)msgbuf;
176 packet->version = version;
177
178 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, (const char *)packet, MAVLINK_MSG_ID_BOOT_MIN_LEN, MAVLINK_MSG_ID_BOOT_LEN, MAVLINK_MSG_ID_BOOT_CRC);
179#endif
180}
181#endif
182
183#endif
184
185// MESSAGE BOOT UNPACKING
186
187
193static inline uint32_t mavlink_msg_boot_get_version(const mavlink_message_t* msg)
194{
195 return _MAV_RETURN_uint32_t(msg, 0);
196}
197
204static inline void mavlink_msg_boot_decode(const mavlink_message_t* msg, mavlink_boot_t* boot)
205{
206#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
207 boot->version = mavlink_msg_boot_get_version(msg);
208#else
209 uint8_t len = msg->len < MAVLINK_MSG_ID_BOOT_LEN? msg->len : MAVLINK_MSG_ID_BOOT_LEN;
210 memset(boot, 0, MAVLINK_MSG_ID_BOOT_LEN);
211 memcpy(boot, _MAV_PAYLOAD(msg), len);
212#endif
213}