mavlink_msg_uavcan_node_info.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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
  105. * @param system_id ID of this system
  106. * @param component_id ID of this component (e.g. 200 for IMU)
  107. * @param status MAVLink status structure
  108. * @param msg The MAVLink message to compress the data into
  109. *
  110. * @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.
  111. * @param uptime_sec [s] Time since the start-up of the node.
  112. * @param name Node name string. For example, "sapog.px4.io".
  113. * @param hw_version_major Hardware major version number.
  114. * @param hw_version_minor Hardware minor version number.
  115. * @param hw_unique_id Hardware unique 128-bit ID.
  116. * @param sw_version_major Software major version number.
  117. * @param sw_version_minor Software minor version number.
  118. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  119. * @return length of the message in bytes (excluding serial stream start sign)
  120. */
  121. static inline uint16_t mavlink_msg_uavcan_node_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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. #if MAVLINK_CRC_EXTRA
  151. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_CRC);
  152. #else
  153. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_MIN_LEN, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  154. #endif
  155. }
  156. /**
  157. * @brief Pack a uavcan_node_info message on a channel
  158. * @param system_id ID of this system
  159. * @param component_id ID of this component (e.g. 200 for IMU)
  160. * @param chan The MAVLink channel this message will be sent over
  161. * @param msg The MAVLink message to compress the data into
  162. * @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.
  163. * @param uptime_sec [s] Time since the start-up of the node.
  164. * @param name Node name string. For example, "sapog.px4.io".
  165. * @param hw_version_major Hardware major version number.
  166. * @param hw_version_minor Hardware minor version number.
  167. * @param hw_unique_id Hardware unique 128-bit ID.
  168. * @param sw_version_major Software major version number.
  169. * @param sw_version_minor Software minor version number.
  170. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  171. * @return length of the message in bytes (excluding serial stream start sign)
  172. */
  173. static inline uint16_t mavlink_msg_uavcan_node_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  174. mavlink_message_t* msg,
  175. 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)
  176. {
  177. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  178. char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
  179. _mav_put_uint64_t(buf, 0, time_usec);
  180. _mav_put_uint32_t(buf, 8, uptime_sec);
  181. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  182. _mav_put_uint8_t(buf, 96, hw_version_major);
  183. _mav_put_uint8_t(buf, 97, hw_version_minor);
  184. _mav_put_uint8_t(buf, 114, sw_version_major);
  185. _mav_put_uint8_t(buf, 115, sw_version_minor);
  186. _mav_put_char_array(buf, 16, name, 80);
  187. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  188. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  189. #else
  190. mavlink_uavcan_node_info_t packet;
  191. packet.time_usec = time_usec;
  192. packet.uptime_sec = uptime_sec;
  193. packet.sw_vcs_commit = sw_vcs_commit;
  194. packet.hw_version_major = hw_version_major;
  195. packet.hw_version_minor = hw_version_minor;
  196. packet.sw_version_major = sw_version_major;
  197. packet.sw_version_minor = sw_version_minor;
  198. mav_array_memcpy(packet.name, name, sizeof(char)*80);
  199. mav_array_memcpy(packet.hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  200. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  201. #endif
  202. msg->msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO;
  203. 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);
  204. }
  205. /**
  206. * @brief Encode a uavcan_node_info struct
  207. *
  208. * @param system_id ID of this system
  209. * @param component_id ID of this component (e.g. 200 for IMU)
  210. * @param msg The MAVLink message to compress the data into
  211. * @param uavcan_node_info C-struct to read the message contents from
  212. */
  213. 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)
  214. {
  215. 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);
  216. }
  217. /**
  218. * @brief Encode a uavcan_node_info struct on a channel
  219. *
  220. * @param system_id ID of this system
  221. * @param component_id ID of this component (e.g. 200 for IMU)
  222. * @param chan The MAVLink channel this message will be sent over
  223. * @param msg The MAVLink message to compress the data into
  224. * @param uavcan_node_info C-struct to read the message contents from
  225. */
  226. 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)
  227. {
  228. 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);
  229. }
  230. /**
  231. * @brief Encode a uavcan_node_info struct with provided status structure
  232. *
  233. * @param system_id ID of this system
  234. * @param component_id ID of this component (e.g. 200 for IMU)
  235. * @param status MAVLink status structure
  236. * @param msg The MAVLink message to compress the data into
  237. * @param uavcan_node_info C-struct to read the message contents from
  238. */
  239. static inline uint16_t mavlink_msg_uavcan_node_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_uavcan_node_info_t* uavcan_node_info)
  240. {
  241. return mavlink_msg_uavcan_node_info_pack_status(system_id, component_id, _status, 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);
  242. }
  243. /**
  244. * @brief Send a uavcan_node_info message
  245. * @param chan MAVLink channel to send the message
  246. *
  247. * @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.
  248. * @param uptime_sec [s] Time since the start-up of the node.
  249. * @param name Node name string. For example, "sapog.px4.io".
  250. * @param hw_version_major Hardware major version number.
  251. * @param hw_version_minor Hardware minor version number.
  252. * @param hw_unique_id Hardware unique 128-bit ID.
  253. * @param sw_version_major Software major version number.
  254. * @param sw_version_minor Software minor version number.
  255. * @param sw_vcs_commit Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  256. */
  257. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  258. 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)
  259. {
  260. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  261. char buf[MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN];
  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;
  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. /**
  287. * @brief Send a uavcan_node_info message
  288. * @param chan MAVLink channel to send the message
  289. * @param struct The MAVLink struct to serialize
  290. */
  291. static inline void mavlink_msg_uavcan_node_info_send_struct(mavlink_channel_t chan, const mavlink_uavcan_node_info_t* uavcan_node_info)
  292. {
  293. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  294. 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);
  295. #else
  296. _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);
  297. #endif
  298. }
  299. #if MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  300. /*
  301. This variant of _send() can be used to save stack space by re-using
  302. memory from the receive buffer. The caller provides a
  303. mavlink_message_t which is the size of a full mavlink message. This
  304. is usually the receive buffer for the channel, and allows a reply to an
  305. incoming message with minimum stack space usage.
  306. */
  307. 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)
  308. {
  309. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  310. char *buf = (char *)msgbuf;
  311. _mav_put_uint64_t(buf, 0, time_usec);
  312. _mav_put_uint32_t(buf, 8, uptime_sec);
  313. _mav_put_uint32_t(buf, 12, sw_vcs_commit);
  314. _mav_put_uint8_t(buf, 96, hw_version_major);
  315. _mav_put_uint8_t(buf, 97, hw_version_minor);
  316. _mav_put_uint8_t(buf, 114, sw_version_major);
  317. _mav_put_uint8_t(buf, 115, sw_version_minor);
  318. _mav_put_char_array(buf, 16, name, 80);
  319. _mav_put_uint8_t_array(buf, 98, hw_unique_id, 16);
  320. _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);
  321. #else
  322. mavlink_uavcan_node_info_t *packet = (mavlink_uavcan_node_info_t *)msgbuf;
  323. packet->time_usec = time_usec;
  324. packet->uptime_sec = uptime_sec;
  325. packet->sw_vcs_commit = sw_vcs_commit;
  326. packet->hw_version_major = hw_version_major;
  327. packet->hw_version_minor = hw_version_minor;
  328. packet->sw_version_major = sw_version_major;
  329. packet->sw_version_minor = sw_version_minor;
  330. mav_array_memcpy(packet->name, name, sizeof(char)*80);
  331. mav_array_memcpy(packet->hw_unique_id, hw_unique_id, sizeof(uint8_t)*16);
  332. _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);
  333. #endif
  334. }
  335. #endif
  336. #endif
  337. // MESSAGE UAVCAN_NODE_INFO UNPACKING
  338. /**
  339. * @brief Get field time_usec from uavcan_node_info message
  340. *
  341. * @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.
  342. */
  343. static inline uint64_t mavlink_msg_uavcan_node_info_get_time_usec(const mavlink_message_t* msg)
  344. {
  345. return _MAV_RETURN_uint64_t(msg, 0);
  346. }
  347. /**
  348. * @brief Get field uptime_sec from uavcan_node_info message
  349. *
  350. * @return [s] Time since the start-up of the node.
  351. */
  352. static inline uint32_t mavlink_msg_uavcan_node_info_get_uptime_sec(const mavlink_message_t* msg)
  353. {
  354. return _MAV_RETURN_uint32_t(msg, 8);
  355. }
  356. /**
  357. * @brief Get field name from uavcan_node_info message
  358. *
  359. * @return Node name string. For example, "sapog.px4.io".
  360. */
  361. static inline uint16_t mavlink_msg_uavcan_node_info_get_name(const mavlink_message_t* msg, char *name)
  362. {
  363. return _MAV_RETURN_char_array(msg, name, 80, 16);
  364. }
  365. /**
  366. * @brief Get field hw_version_major from uavcan_node_info message
  367. *
  368. * @return Hardware major version number.
  369. */
  370. static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_major(const mavlink_message_t* msg)
  371. {
  372. return _MAV_RETURN_uint8_t(msg, 96);
  373. }
  374. /**
  375. * @brief Get field hw_version_minor from uavcan_node_info message
  376. *
  377. * @return Hardware minor version number.
  378. */
  379. static inline uint8_t mavlink_msg_uavcan_node_info_get_hw_version_minor(const mavlink_message_t* msg)
  380. {
  381. return _MAV_RETURN_uint8_t(msg, 97);
  382. }
  383. /**
  384. * @brief Get field hw_unique_id from uavcan_node_info message
  385. *
  386. * @return Hardware unique 128-bit ID.
  387. */
  388. static inline uint16_t mavlink_msg_uavcan_node_info_get_hw_unique_id(const mavlink_message_t* msg, uint8_t *hw_unique_id)
  389. {
  390. return _MAV_RETURN_uint8_t_array(msg, hw_unique_id, 16, 98);
  391. }
  392. /**
  393. * @brief Get field sw_version_major from uavcan_node_info message
  394. *
  395. * @return Software major version number.
  396. */
  397. static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_major(const mavlink_message_t* msg)
  398. {
  399. return _MAV_RETURN_uint8_t(msg, 114);
  400. }
  401. /**
  402. * @brief Get field sw_version_minor from uavcan_node_info message
  403. *
  404. * @return Software minor version number.
  405. */
  406. static inline uint8_t mavlink_msg_uavcan_node_info_get_sw_version_minor(const mavlink_message_t* msg)
  407. {
  408. return _MAV_RETURN_uint8_t(msg, 115);
  409. }
  410. /**
  411. * @brief Get field sw_vcs_commit from uavcan_node_info message
  412. *
  413. * @return Version control system (VCS) revision identifier (e.g. git short commit hash). 0 if unknown.
  414. */
  415. static inline uint32_t mavlink_msg_uavcan_node_info_get_sw_vcs_commit(const mavlink_message_t* msg)
  416. {
  417. return _MAV_RETURN_uint32_t(msg, 12);
  418. }
  419. /**
  420. * @brief Decode a uavcan_node_info message into a struct
  421. *
  422. * @param msg The message to decode
  423. * @param uavcan_node_info C-struct to decode the message contents into
  424. */
  425. static inline void mavlink_msg_uavcan_node_info_decode(const mavlink_message_t* msg, mavlink_uavcan_node_info_t* uavcan_node_info)
  426. {
  427. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  428. uavcan_node_info->time_usec = mavlink_msg_uavcan_node_info_get_time_usec(msg);
  429. uavcan_node_info->uptime_sec = mavlink_msg_uavcan_node_info_get_uptime_sec(msg);
  430. uavcan_node_info->sw_vcs_commit = mavlink_msg_uavcan_node_info_get_sw_vcs_commit(msg);
  431. mavlink_msg_uavcan_node_info_get_name(msg, uavcan_node_info->name);
  432. uavcan_node_info->hw_version_major = mavlink_msg_uavcan_node_info_get_hw_version_major(msg);
  433. uavcan_node_info->hw_version_minor = mavlink_msg_uavcan_node_info_get_hw_version_minor(msg);
  434. mavlink_msg_uavcan_node_info_get_hw_unique_id(msg, uavcan_node_info->hw_unique_id);
  435. uavcan_node_info->sw_version_major = mavlink_msg_uavcan_node_info_get_sw_version_major(msg);
  436. uavcan_node_info->sw_version_minor = mavlink_msg_uavcan_node_info_get_sw_version_minor(msg);
  437. #else
  438. uint8_t len = msg->len < MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN? msg->len : MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN;
  439. memset(uavcan_node_info, 0, MAVLINK_MSG_ID_UAVCAN_NODE_INFO_LEN);
  440. memcpy(uavcan_node_info, _MAV_PAYLOAD(msg), len);
  441. #endif
  442. }