mavlink_msg_uavcan_node_info.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. #pragma once
  2. // MESSAGE UAVCAN_NODE_INFO PACKING
  3. #define MAVLINK_MSG_ID_UAVCAN_NODE_INFO 311
  4. typedef struct __mavlink_uavcan_node_info_t {
  5. uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
  6. uint32_t uptime_sec; /*< [s] Time since the start-up of the node.*/
  7. uint32_t sw_vcs_commit; /*< Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.*/
  8. char name[80]; /*< Node name string. For example, "sapog.px4.io".*/
  9. uint8_t hw_version_major; /*< Hardware major version number.*/
  10. uint8_t hw_version_minor; /*< Hardware minor version number.*/
  11. uint8_t hw_unique_id[16]; /*< Hardware unique 128-bit ID.*/
  12. uint8_t sw_version_major; /*< Software major version number.*/
  13. uint8_t sw_version_minor; /*< Software minor version number.*/
  14. } mavlink_uavcan_node_info_t;
  15. #define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN 116
  16. #define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN 116
  17. #define MAVLINK_MSG_ID_311_LEN 116
  18. #define MAVLINK_MSG_ID_311_MIN_LEN 116
  19. #define MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC 95
  20. #define MAVLINK_MSG_ID_311_CRC 95
  21. #define MAVLINK_MSG_UAVCAN_NODE_INFO_FIELD_NAME_LEN 80
  22. #define MAVLINK_MSG_UAVCAN_NODE_INFO_FIELD_HW_UNIQUE_ID_LEN 16
  23. #if MAVLINK_COMMAND_24BIT
  24. #define MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO { \
  25. 311, \
  26. "UAVCAN_NODE_INFO", \
  27. 9, \
  28. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_uavcan_node_info_t, time_usec) }, \
  29. { "uptime_sec", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_uavcan_node_info_t, uptime_sec) }, \
  30. { "name", NULL, MAVLINK_TYPE_CHAR, 80, 16, offsetof(mavlink_uavcan_node_info_t, name) }, \
  31. { "hw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_uavcan_node_info_t, hw_version_major) }, \
  32. { "hw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_uavcan_node_info_t, hw_version_minor) }, \
  33. { "hw_unique_id", NULL, MAVLINK_TYPE_UINT8_T, 16, 98, offsetof(mavlink_uavcan_node_info_t, hw_unique_id) }, \
  34. { "sw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 114, offsetof(mavlink_uavcan_node_info_t, sw_version_major) }, \
  35. { "sw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 115, offsetof(mavlink_uavcan_node_info_t, sw_version_minor) }, \
  36. { "sw_vcs_commit", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_uavcan_node_info_t, sw_vcs_commit) }, \
  37. } \
  38. }
  39. #else
  40. #define MAVLINK_MESSAGE_INFO_UAVCAN_NODE_INFO { \
  41. "UAVCAN_NODE_INFO", \
  42. 9, \
  43. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_uavcan_node_info_t, time_usec) }, \
  44. { "uptime_sec", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_uavcan_node_info_t, uptime_sec) }, \
  45. { "name", NULL, MAVLINK_TYPE_CHAR, 80, 16, offsetof(mavlink_uavcan_node_info_t, name) }, \
  46. { "hw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 96, offsetof(mavlink_uavcan_node_info_t, hw_version_major) }, \
  47. { "hw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 97, offsetof(mavlink_uavcan_node_info_t, hw_version_minor) }, \
  48. { "hw_unique_id", NULL, MAVLINK_TYPE_UINT8_T, 16, 98, offsetof(mavlink_uavcan_node_info_t, hw_unique_id) }, \
  49. { "sw_version_major", NULL, MAVLINK_TYPE_UINT8_T, 0, 114, offsetof(mavlink_uavcan_node_info_t, sw_version_major) }, \
  50. { "sw_version_minor", NULL, MAVLINK_TYPE_UINT8_T, 0, 115, offsetof(mavlink_uavcan_node_info_t, sw_version_minor) }, \
  51. { "sw_vcs_commit", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_uavcan_node_info_t, sw_vcs_commit) }, \
  52. } \
  53. }
  54. #endif
  55. /**
  56. * @brief Pack a uavcan_node_info message
  57. * @param system_id ID of this system
  58. * @param component_id ID of this component (e.g. 200 for IMU)
  59. * @param msg The MAVLink message to compress the data into
  60. *
  61. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  62. * @param uptime_sec [s] Time since the start-up of the node.
  63. * @param name Node name string. For example, "sapog.px4.io".
  64. * @param hw_version_major Hardware major version number.
  65. * @param hw_version_minor Hardware minor version number.
  66. * @param hw_unique_id Hardware unique 128-bit ID.
  67. * @param sw_version_major Software major version number.
  68. * @param sw_version_minor Software minor version number.
  69. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  70. * @return length of the message in bytes (excluding serial stream start sign)
  71. */
  72. static inline uint16_t mavlink_msg_uavcan_node_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  73. 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)
  74. {
  75. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  76. char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
  77. _mav_put_uint64_t(buf, 0, time_usec);
  78. _mav_put_uint32_t(buf, 8, uptime_sec);
  79. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  80. _mav_put_uint8_t(buf, 96, hw_version_major);
  81. _mav_put_uint8_t(buf, 97, hw_version_minor);
  82. _mav_put_uint8_t(buf, 114, sw_version_major);
  83. _mav_put_uint8_t(buf, 115, sw_version_minor);
  84. _mav_put_char_array(buf, 16, name, 80);
  85. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  86. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  87. #else
  88. mavlink_uavcan_node_info_t packet;
  89. packet.time_usec = time_usec;
  90. packet.uptime_sec = uptime_sec;
  91. packet.sw_vcs_commit = sw_vcs_commit;
  92. packet.hw_version_major = hw_version_major;
  93. packet.hw_version_minor = hw_version_minor;
  94. packet.sw_version_major = sw_version_major;
  95. packet.sw_version_minor = sw_version_minor;
  96. mav_array_memcpy(packet.name, name, sizeof(char)*80);
  97. mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  98. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  99. #endif
  100. msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO;
  101. 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);
  102. }
  103. /**
  104. * @brief Pack a uavcan_node_info message on a channel
  105. * @param system_id ID of this system
  106. * @param component_id ID of this component (e.g. 200 for IMU)
  107. * @param chan The MAVLink channel this message will be sent over
  108. * @param msg The MAVLink message to compress the data into
  109. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  110. * @param uptime_sec [s] Time since the start-up of the node.
  111. * @param name Node name string. For example, "sapog.px4.io".
  112. * @param hw_version_major Hardware major version number.
  113. * @param hw_version_minor Hardware minor version number.
  114. * @param hw_unique_id Hardware unique 128-bit ID.
  115. * @param sw_version_major Software major version number.
  116. * @param sw_version_minor Software minor version number.
  117. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  118. * @return length of the message in bytes (excluding serial stream start sign)
  119. */
  120. static inline uint16_t mavlink_msg_uavcan_node_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  121. mavlink_message_t* msg,
  122. 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)
  123. {
  124. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  125. char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
  126. _mav_put_uint64_t(buf, 0, time_usec);
  127. _mav_put_uint32_t(buf, 8, uptime_sec);
  128. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  129. _mav_put_uint8_t(buf, 96, hw_version_major);
  130. _mav_put_uint8_t(buf, 97, hw_version_minor);
  131. _mav_put_uint8_t(buf, 114, sw_version_major);
  132. _mav_put_uint8_t(buf, 115, sw_version_minor);
  133. _mav_put_char_array(buf, 16, name, 80);
  134. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  135. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  136. #else
  137. mavlink_uavcan_node_info_t packet;
  138. packet.time_usec = time_usec;
  139. packet.uptime_sec = uptime_sec;
  140. packet.sw_vcs_commit = sw_vcs_commit;
  141. packet.hw_version_major = hw_version_major;
  142. packet.hw_version_minor = hw_version_minor;
  143. packet.sw_version_major = sw_version_major;
  144. packet.sw_version_minor = sw_version_minor;
  145. mav_array_memcpy(packet.name, name, sizeof(char)*80);
  146. mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  147. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  148. #endif
  149. msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO;
  150. 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);
  151. }
  152. /**
  153. * @brief Encode a uavcan_node_info struct
  154. *
  155. * @param system_id ID of this system
  156. * @param component_id ID of this component (e.g. 200 for IMU)
  157. * @param msg The MAVLink message to compress the data into
  158. * @param uavcan_node_info C-struct to read the message contents from
  159. */
  160. static 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)
  161. {
  162. 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);
  163. }
  164. /**
  165. * @brief Encode a uavcan_node_info struct on a channel
  166. *
  167. * @param system_id ID of this system
  168. * @param component_id ID of this component (e.g. 200 for IMU)
  169. * @param chan The MAVLink channel this message will be sent over
  170. * @param msg The MAVLink message to compress the data into
  171. * @param uavcan_node_info C-struct to read the message contents from
  172. */
  173. static 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)
  174. {
  175. 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);
  176. }
  177. /**
  178. * @brief Send a uavcan_node_info message
  179. * @param chan MAVLink channel to send the message
  180. *
  181. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  182. * @param uptime_sec [s] Time since the start-up of the node.
  183. * @param name Node name string. For example, "sapog.px4.io".
  184. * @param hw_version_major Hardware major version number.
  185. * @param hw_version_minor Hardware minor version number.
  186. * @param hw_unique_id Hardware unique 128-bit ID.
  187. * @param sw_version_major Software major version number.
  188. * @param sw_version_minor Software minor version number.
  189. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  190. */
  191. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  192. static 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)
  193. {
  194. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  195. char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
  196. _mav_put_uint64_t(buf, 0, time_usec);
  197. _mav_put_uint32_t(buf, 8, uptime_sec);
  198. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  199. _mav_put_uint8_t(buf, 96, hw_version_major);
  200. _mav_put_uint8_t(buf, 97, hw_version_minor);
  201. _mav_put_uint8_t(buf, 114, sw_version_major);
  202. _mav_put_uint8_t(buf, 115, sw_version_minor);
  203. _mav_put_char_array(buf, 16, name, 80);
  204. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  205. _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);
  206. #else
  207. mavlink_uavcan_node_info_t packet;
  208. packet.time_usec = time_usec;
  209. packet.uptime_sec = uptime_sec;
  210. packet.sw_vcs_commit = sw_vcs_commit;
  211. packet.hw_version_major = hw_version_major;
  212. packet.hw_version_minor = hw_version_minor;
  213. packet.sw_version_major = sw_version_major;
  214. packet.sw_version_minor = sw_version_minor;
  215. mav_array_memcpy(packet.name, name, sizeof(char)*80);
  216. mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  217. _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);
  218. #endif
  219. }
  220. /**
  221. * @brief Send a uavcan_node_info message
  222. * @param chan MAVLink channel to send the message
  223. * @param struct The MAVLink struct to serialize
  224. */
  225. static inline void mavlink_msg_uavcan_node_info_send_struct(mavlink_channel_t chan, const mavlink_uavcan_node_info_t* uavcan_node_info)
  226. {
  227. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  228. 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);
  229. #else
  230. _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);
  231. #endif
  232. }
  233. #if MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  234. /*
  235. This variant of _send() can be used to save stack space by re-using
  236. memory from the receive buffer. The caller provides a
  237. mavlink_message_t which is the size of a full mavlink message. This
  238. is usually the receive buffer for the channel, and allows a reply to an
  239. incoming message with minimum stack space usage.
  240. */
  241. static 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)
  242. {
  243. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  244. char *buf = (char *)msgbuf;
  245. _mav_put_uint64_t(buf, 0, time_usec);
  246. _mav_put_uint32_t(buf, 8, uptime_sec);
  247. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  248. _mav_put_uint8_t(buf, 96, hw_version_major);
  249. _mav_put_uint8_t(buf, 97, hw_version_minor);
  250. _mav_put_uint8_t(buf, 114, sw_version_major);
  251. _mav_put_uint8_t(buf, 115, sw_version_minor);
  252. _mav_put_char_array(buf, 16, name, 80);
  253. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  254. _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);
  255. #else
  256. mavlink_uavcan_node_info_t *packet = (mavlink_uavcan_node_info_t *)msgbuf;
  257. packet->time_usec = time_usec;
  258. packet->uptime_sec = uptime_sec;
  259. packet->sw_vcs_commit = sw_vcs_commit;
  260. packet->hw_version_major = hw_version_major;
  261. packet->hw_version_minor = hw_version_minor;
  262. packet->sw_version_major = sw_version_major;
  263. packet->sw_version_minor = sw_version_minor;
  264. mav_array_memcpy(packet->name, name, sizeof(char)*80);
  265. mav_array_memcpy(packet->hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  266. _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);
  267. #endif
  268. }
  269. #endif
  270. #endif
  271. // MESSAGE UAVCAN_NODE_INFO UNPACKING
  272. /**
  273. * @brief Get field time_usec from uavcan_node_info message
  274. *
  275. * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
  276. */
  277. static inline uint64_t mavlink_msg_uavcan_node_info_get_time_usec(const mavlink_message_t* msg)
  278. {
  279. return _MAV_RETURN_uint64_t(msg, 0);
  280. }
  281. /**
  282. * @brief Get field uptime_sec from uavcan_node_info message
  283. *
  284. * @return [s] Time since the start-up of the node.
  285. */
  286. static inline uint32_t mavlink_msg_uavcan_node_info_get_uptime_sec(const mavlink_message_t* msg)
  287. {
  288. return _MAV_RETURN_uint32_t(msg, 8);
  289. }
  290. /**
  291. * @brief Get field name from uavcan_node_info message
  292. *
  293. * @return Node name string. For example, "sapog.px4.io".
  294. */
  295. static inline uint16_t mavlink_msg_uavcan_node_info_get_name(const mavlink_message_t* msg, char *name)
  296. {
  297. return _MAV_RETURN_char_array(msg, name, 80, 16);
  298. }
  299. /**
  300. * @brief Get field hw_version_major from uavcan_node_info message
  301. *
  302. * @return Hardware major version number.
  303. */
  304. static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_major(const mavlink_message_t* msg)
  305. {
  306. return _MAV_RETURN_uint8_t(msg, 96);
  307. }
  308. /**
  309. * @brief Get field hw_version_minor from uavcan_node_info message
  310. *
  311. * @return Hardware minor version number.
  312. */
  313. static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_minor(const mavlink_message_t* msg)
  314. {
  315. return _MAV_RETURN_uint8_t(msg, 97);
  316. }
  317. /**
  318. * @brief Get field hw_unique_id from uavcan_node_info message
  319. *
  320. * @return Hardware unique 128-bit ID.
  321. */
  322. static inline uint16_t mavlink_msg_uavcan_node_info_get_hw_unique_id(const mavlink_message_t* msg, uint8_t *hw_unique_id)
  323. {
  324. return _MAV_RETURN_uint8_t_array(msg, hw_unique_id, 16, 98);
  325. }
  326. /**
  327. * @brief Get field sw_version_major from uavcan_node_info message
  328. *
  329. * @return Software major version number.
  330. */
  331. static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_major(const mavlink_message_t* msg)
  332. {
  333. return _MAV_RETURN_uint8_t(msg, 114);
  334. }
  335. /**
  336. * @brief Get field sw_version_minor from uavcan_node_info message
  337. *
  338. * @return Software minor version number.
  339. */
  340. static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_minor(const mavlink_message_t* msg)
  341. {
  342. return _MAV_RETURN_uint8_t(msg, 115);
  343. }
  344. /**
  345. * @brief Get field sw_vcs_commit from uavcan_node_info message
  346. *
  347. * @return Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  348. */
  349. static inline uint32_t mavlink_msg_uavcan_node_info_get_sw_vcs_commit(const mavlink_message_t* msg)
  350. {
  351. return _MAV_RETURN_uint32_t(msg, 12);
  352. }
  353. /**
  354. * @brief Decode a uavcan_node_info message into a struct
  355. *
  356. * @param msg The message to decode
  357. * @param uavcan_node_info C-struct to decode the message contents into
  358. */
  359. static inline void mavlink_msg_uavcan_node_info_decode(const mavlink_message_t* msg, mavlink_uavcan_node_info_t* uavcan_node_info)
  360. {
  361. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  362. uavcan_node_info->time_usec = mavlink_msg_uavcan_node_info_get_time_usec(msg);
  363. uavcan_node_info->uptime_sec = mavlink_msg_uavcan_node_info_get_uptime_sec(msg);
  364. uavcan_node_info->sw_vcs_commit = mavlink_msg_uavcan_node_info_get_sw_vcs_commit(msg);
  365. mavlink_msg_uavcan_node_info_get_name(msg, uavcan_node_info->name);
  366. uavcan_node_info->hw_version_major = mavlink_msg_uavcan_node_info_get_hw_version_major(msg);
  367. uavcan_node_info->hw_version_minor = mavlink_msg_uavcan_node_info_get_hw_version_minor(msg);
  368. mavlink_msg_uavcan_node_info_get_hw_unique_id(msg, uavcan_node_info->hw_unique_id);
  369. uavcan_node_info->sw_version_major = mavlink_msg_uavcan_node_info_get_sw_version_major(msg);
  370. uavcan_node_info->sw_version_minor = mavlink_msg_uavcan_node_info_get_sw_version_minor(msg);
  371. #else
  372. uint8_t len = msg->len < MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN? msg->len : MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN;
  373. memset(uavcan_node_info, 0, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  374. memcpy(uavcan_node_info, _MAV_PAYLOAD(msg), len);
  375. #endif
  376. }