RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_uavcan_node_info.h
1#pragma once
2// MESSAGE UAVCAN_NODE_INFO PACKING
3
4#define MAVLINK_MSG_ID_UAVCAN_NODE_INFO 311
5
6MAVPACKED(
7typedef struct __mavlink_uavcan_node_info_t {
8 uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
9 uint32_t uptime_sec; /*< The number of seconds since the start-up of the node.*/
10 uint32_t sw_vcs_commit; /*< Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown.*/
11 char name[80]; /*< Node name string. For example, "sapog.px4.io".*/
12 uint8_t hw_version_major; /*< Hardware major version number.*/
13 uint8_t hw_version_minor; /*< Hardware minor version number.*/
14 uint8_t hw_unique_id[16]; /*< Hardware unique 128-bit ID.*/
15 uint8_t sw_version_major; /*< Software major version number.*/
16 uint8_t sw_version_minor; /*< Software minor version number.*/
17}) mavlink_uavcan_node_info_t;
18
19#define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN 116
20#define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN 116
21#define MAVLINK_MSG_ID_311_LEN 116
22#define MAVLINK_MSG_ID_311_MIN_LEN 116
23
24#define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC 95
25#define MAVLINK_MSG_ID_311_CRC 95
26
27#define MAVLINK_MSG_UAVCAN_NODE_INFO_FIELD_NAME_LEN 80
28#define MAVLINK_MSG_UAVCAN_NODE_INFO_FIELD_HW_UNIQUE_ID_LEN 16
29
30#if MAVLINK_COMMAND_24BIT
31#define MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO { \
32 311, \
33 "UAVCAN_NODE_INFO", \
34 9, \
35 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_uavcan_node_info_t, time_usec) }, \
36 { "uptime_sec", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_uavcan_node_info_t, uptime_sec) }, \
37 { "name", NULL, MAVLINK_TYPE_CHAR, 80, 16, offsetof(mavlink_uavcan_node_info_t, name) }, \
38 { "hw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_uavcan_node_info_t, hw_version_major) }, \
39 { "hw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_uavcan_node_info_t, hw_version_minor) }, \
40 { "hw_unique_id", NULL, MAVLINK_TYPE_UINT8_T, 16, 98, offsetof(mavlink_uavcan_node_info_t, hw_unique_id) }, \
41 { "sw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 114, offsetof(mavlink_uavcan_node_info_t, sw_version_major) }, \
42 { "sw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 115, offsetof(mavlink_uavcan_node_info_t, sw_version_minor) }, \
43 { "sw_vcs_commit", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_uavcan_node_info_t, sw_vcs_commit) }, \
44 } \
45}
46#else
47#define MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO { \
48 "UAVCAN_NODE_INFO", \
49 9, \
50 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_uavcan_node_info_t, time_usec) }, \
51 { "uptime_sec", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_uavcan_node_info_t, uptime_sec) }, \
52 { "name", NULL, MAVLINK_TYPE_CHAR, 80, 16, offsetof(mavlink_uavcan_node_info_t, name) }, \
53 { "hw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_uavcan_node_info_t, hw_version_major) }, \
54 { "hw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_uavcan_node_info_t, hw_version_minor) }, \
55 { "hw_unique_id", NULL, MAVLINK_TYPE_UINT8_T, 16, 98, offsetof(mavlink_uavcan_node_info_t, hw_unique_id) }, \
56 { "sw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 114, offsetof(mavlink_uavcan_node_info_t, sw_version_major) }, \
57 { "sw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 115, offsetof(mavlink_uavcan_node_info_t, sw_version_minor) }, \
58 { "sw_vcs_commit", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_uavcan_node_info_t, sw_vcs_commit) }, \
59 } \
60}
61#endif
62
80static inline uint16_t mavlink_msg_uavcan_node_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
81 uint64_t time_usec, uint32_t uptime_sec, const char *name, uint8_t hw_version_major, uint8_t hw_version_minor, const uint8_t *hw_unique_id, uint8_t sw_version_major, uint8_t sw_version_minor, uint32_t sw_vcs_commit)
82{
83#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
84 char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
85 _mav_put_uint64_t(buf, 0, time_usec);
86 _mav_put_uint32_t(buf, 8, uptime_sec);
87 _mav_put_uint32_t(buf, 12, sw_vcs_commit);
88 _mav_put_uint8_t(buf, 96, hw_version_major);
89 _mav_put_uint8_t(buf, 97, hw_version_minor);
90 _mav_put_uint8_t(buf, 114, sw_version_major);
91 _mav_put_uint8_t(buf, 115, sw_version_minor);
92 _mav_put_char_array(buf, 16, name, 80);
93 _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
95#else
96 mavlink_uavcan_node_info_t packet;
97 packet.time_usec = time_usec;
98 packet.uptime_sec = uptime_sec;
99 packet.sw_vcs_commit = sw_vcs_commit;
100 packet.hw_version_major = hw_version_major;
101 packet.hw_version_minor = hw_version_minor;
102 packet.sw_version_major = sw_version_major;
103 packet.sw_version_minor = sw_version_minor;
104 mav_array_memcpy(packet.name, name, sizeof(char)*80);
105 mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
106 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
107#endif
108
109 msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO;
110 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
111}
112
130static inline uint16_t mavlink_msg_uavcan_node_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
131 mavlink_message_t* msg,
132 uint64_t time_usec,uint32_t uptime_sec,const char *name,uint8_t hw_version_major,uint8_t hw_version_minor,const uint8_t *hw_unique_id,uint8_t sw_version_major,uint8_t sw_version_minor,uint32_t sw_vcs_commit)
133{
134#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
135 char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
136 _mav_put_uint64_t(buf, 0, time_usec);
137 _mav_put_uint32_t(buf, 8, uptime_sec);
138 _mav_put_uint32_t(buf, 12, sw_vcs_commit);
139 _mav_put_uint8_t(buf, 96, hw_version_major);
140 _mav_put_uint8_t(buf, 97, hw_version_minor);
141 _mav_put_uint8_t(buf, 114, sw_version_major);
142 _mav_put_uint8_t(buf, 115, sw_version_minor);
143 _mav_put_char_array(buf, 16, name, 80);
144 _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
145 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
146#else
147 mavlink_uavcan_node_info_t packet;
148 packet.time_usec = time_usec;
149 packet.uptime_sec = uptime_sec;
150 packet.sw_vcs_commit = sw_vcs_commit;
151 packet.hw_version_major = hw_version_major;
152 packet.hw_version_minor = hw_version_minor;
153 packet.sw_version_major = sw_version_major;
154 packet.sw_version_minor = sw_version_minor;
155 mav_array_memcpy(packet.name, name, sizeof(char)*80);
156 mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
157 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
158#endif
159
160 msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO;
161 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
162}
163
172static inline uint16_t mavlink_msg_uavcan_node_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_uavcan_node_info_t* uavcan_node_info)
173{
174 return mavlink_msg_uavcan_node_info_pack(system_id, component_id, msg, uavcan_node_info->time_usec, uavcan_node_info->uptime_sec, uavcan_node_info->name, uavcan_node_info->hw_version_major, uavcan_node_info->hw_version_minor, uavcan_node_info->hw_unique_id, uavcan_node_info->sw_version_major, uavcan_node_info->sw_version_minor, uavcan_node_info->sw_vcs_commit);
175}
176
186static inline uint16_t mavlink_msg_uavcan_node_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_uavcan_node_info_t* uavcan_node_info)
187{
188 return mavlink_msg_uavcan_node_info_pack_chan(system_id, component_id, chan, msg, uavcan_node_info->time_usec, uavcan_node_info->uptime_sec, uavcan_node_info->name, uavcan_node_info->hw_version_major, uavcan_node_info->hw_version_minor, uavcan_node_info->hw_unique_id, uavcan_node_info->sw_version_major, uavcan_node_info->sw_version_minor, uavcan_node_info->sw_vcs_commit);
189}
190
205#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206
207static inline void mavlink_msg_uavcan_node_info_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime_sec, const char *name, uint8_t hw_version_major, uint8_t hw_version_minor, const uint8_t *hw_unique_id, uint8_t sw_version_major, uint8_t sw_version_minor, uint32_t sw_vcs_commit)
208{
209#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
211 _mav_put_uint64_t(buf, 0, time_usec);
212 _mav_put_uint32_t(buf, 8, uptime_sec);
213 _mav_put_uint32_t(buf, 12, sw_vcs_commit);
214 _mav_put_uint8_t(buf, 96, hw_version_major);
215 _mav_put_uint8_t(buf, 97, hw_version_minor);
216 _mav_put_uint8_t(buf, 114, sw_version_major);
217 _mav_put_uint8_t(buf, 115, sw_version_minor);
218 _mav_put_char_array(buf, 16, name, 80);
219 _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
220 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
221#else
222 mavlink_uavcan_node_info_t packet;
223 packet.time_usec = time_usec;
224 packet.uptime_sec = uptime_sec;
225 packet.sw_vcs_commit = sw_vcs_commit;
226 packet.hw_version_major = hw_version_major;
227 packet.hw_version_minor = hw_version_minor;
228 packet.sw_version_major = sw_version_major;
229 packet.sw_version_minor = sw_version_minor;
230 mav_array_memcpy(packet.name, name, sizeof(char)*80);
231 mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
232 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, (const char *)&packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
233#endif
234}
235
241static inline void mavlink_msg_uavcan_node_info_send_struct(mavlink_channel_t chan, const mavlink_uavcan_node_info_t* uavcan_node_info)
242{
243#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
244 mavlink_msg_uavcan_node_info_send(chan, uavcan_node_info->time_usec, uavcan_node_info->uptime_sec, uavcan_node_info->name, uavcan_node_info->hw_version_major, uavcan_node_info->hw_version_minor, uavcan_node_info->hw_unique_id, uavcan_node_info->sw_version_major, uavcan_node_info->sw_version_minor, uavcan_node_info->sw_vcs_commit);
245#else
246 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, (const char *)uavcan_node_info, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
247#endif
248}
249
250#if MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
251/*
252 This varient of _send() can be used to save stack space by re-using
253 memory from the receive buffer. The caller provides a
254 mavlink_message_t which is the size of a full mavlink message. This
255 is usually the receive buffer for the channel, and allows a reply to an
256 incoming message with minimum stack space usage.
257 */
258static inline void mavlink_msg_uavcan_node_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime_sec, const char *name, uint8_t hw_version_major, uint8_t hw_version_minor, const uint8_t *hw_unique_id, uint8_t sw_version_major, uint8_t sw_version_minor, uint32_t sw_vcs_commit)
259{
260#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
261 char *buf = (char *)msgbuf;
262 _mav_put_uint64_t(buf, 0, time_usec);
263 _mav_put_uint32_t(buf, 8, uptime_sec);
264 _mav_put_uint32_t(buf, 12, sw_vcs_commit);
265 _mav_put_uint8_t(buf, 96, hw_version_major);
266 _mav_put_uint8_t(buf, 97, hw_version_minor);
267 _mav_put_uint8_t(buf, 114, sw_version_major);
268 _mav_put_uint8_t(buf, 115, sw_version_minor);
269 _mav_put_char_array(buf, 16, name, 80);
270 _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
271 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
272#else
273 mavlink_uavcan_node_info_t *packet = (mavlink_uavcan_node_info_t *)msgbuf;
274 packet->time_usec = time_usec;
275 packet->uptime_sec = uptime_sec;
276 packet->sw_vcs_commit = sw_vcs_commit;
277 packet->hw_version_major = hw_version_major;
278 packet->hw_version_minor = hw_version_minor;
279 packet->sw_version_major = sw_version_major;
280 packet->sw_version_minor = sw_version_minor;
281 mav_array_memcpy(packet->name, name, sizeof(char)*80);
282 mav_array_memcpy(packet->hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
283 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_UAVCAN_NODE_INFO, (const char *)packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
284#endif
285}
286#endif
287
288#endif
289
290// MESSAGE UAVCAN_NODE_INFO UNPACKING
291
292
298static inline uint64_t mavlink_msg_uavcan_node_info_get_time_usec(const mavlink_message_t* msg)
299{
300 return _MAV_RETURN_uint64_t(msg, 0);
301}
302
308static inline uint32_t mavlink_msg_uavcan_node_info_get_uptime_sec(const mavlink_message_t* msg)
309{
310 return _MAV_RETURN_uint32_t(msg, 8);
311}
312
318static inline uint16_t mavlink_msg_uavcan_node_info_get_name(const mavlink_message_t* msg, char *name)
319{
320 return _MAV_RETURN_char_array(msg, name, 80, 16);
321}
322
328static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_major(const mavlink_message_t* msg)
329{
330 return _MAV_RETURN_uint8_t(msg, 96);
331}
332
338static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_minor(const mavlink_message_t* msg)
339{
340 return _MAV_RETURN_uint8_t(msg, 97);
341}
342
348static inline uint16_t mavlink_msg_uavcan_node_info_get_hw_unique_id(const mavlink_message_t* msg, uint8_t *hw_unique_id)
349{
350 return _MAV_RETURN_uint8_t_array(msg, hw_unique_id, 16, 98);
351}
352
358static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_major(const mavlink_message_t* msg)
359{
360 return _MAV_RETURN_uint8_t(msg, 114);
361}
362
368static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_minor(const mavlink_message_t* msg)
369{
370 return _MAV_RETURN_uint8_t(msg, 115);
371}
372
378static inline uint32_t mavlink_msg_uavcan_node_info_get_sw_vcs_commit(const mavlink_message_t* msg)
379{
380 return _MAV_RETURN_uint32_t(msg, 12);
381}
382
389static inline void mavlink_msg_uavcan_node_info_decode(const mavlink_message_t* msg, mavlink_uavcan_node_info_t* uavcan_node_info)
390{
391#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
392 uavcan_node_info->time_usec = mavlink_msg_uavcan_node_info_get_time_usec(msg);
393 uavcan_node_info->uptime_sec = mavlink_msg_uavcan_node_info_get_uptime_sec(msg);
394 uavcan_node_info->sw_vcs_commit = mavlink_msg_uavcan_node_info_get_sw_vcs_commit(msg);
395 mavlink_msg_uavcan_node_info_get_name(msg, uavcan_node_info->name);
396 uavcan_node_info->hw_version_major = mavlink_msg_uavcan_node_info_get_hw_version_major(msg);
397 uavcan_node_info->hw_version_minor = mavlink_msg_uavcan_node_info_get_hw_version_minor(msg);
398 mavlink_msg_uavcan_node_info_get_hw_unique_id(msg, uavcan_node_info->hw_unique_id);
399 uavcan_node_info->sw_version_major = mavlink_msg_uavcan_node_info_get_sw_version_major(msg);
400 uavcan_node_info->sw_version_minor = mavlink_msg_uavcan_node_info_get_sw_version_minor(msg);
401#else
402 uint8_t len = msg->len < MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN? msg->len : MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN;
403 memset(uavcan_node_info, 0, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
404 memcpy(uavcan_node_info, _MAV_PAYLOAD(msg), len);
405#endif
406}