mavlink_msg_component_information.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. #pragma once
  2. // MESSAGE COMPONENT_INFORMATION PACKING
  3. #define MAVLINK_MSG_ID_COMPONENT_INFORMATION 395
  4. typedef struct __mavlink_component_information_t {
  5. uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
  6. uint32_t general_metadata_file_crc; /*< CRC32 of the general metadata file (general_metadata_uri).*/
  7. uint32_t peripherals_metadata_file_crc; /*< CRC32 of peripherals metadata file (peripherals_metadata_uri).*/
  8. char general_metadata_uri[100]; /*< MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.*/
  9. char peripherals_metadata_uri[100]; /*< (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.*/
  10. } mavlink_component_information_t;
  11. #define MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN 212
  12. #define MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN 212
  13. #define MAVLINK_MSG_ID_395_LEN 212
  14. #define MAVLINK_MSG_ID_395_MIN_LEN 212
  15. #define MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC 0
  16. #define MAVLINK_MSG_ID_395_CRC 0
  17. #define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_GENERAL_METADATA_URI_LEN 100
  18. #define MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_PERIPHERALS_METADATA_URI_LEN 100
  19. #if MAVLINK_COMMAND_24BIT
  20. #define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION { \
  21. 395, \
  22. "COMPONENT_INFORMATION", \
  23. 5, \
  24. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_information_t, time_boot_ms) }, \
  25. { "general_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, general_metadata_file_crc) }, \
  26. { "general_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 12, offsetof(mavlink_component_information_t, general_metadata_uri) }, \
  27. { "peripherals_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, peripherals_metadata_file_crc) }, \
  28. { "peripherals_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 112, offsetof(mavlink_component_information_t, peripherals_metadata_uri) }, \
  29. } \
  30. }
  31. #else
  32. #define MAVLINK_MESSAGE_INFO_COMPONENT_INFORMATION { \
  33. "COMPONENT_INFORMATION", \
  34. 5, \
  35. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_component_information_t, time_boot_ms) }, \
  36. { "general_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_component_information_t, general_metadata_file_crc) }, \
  37. { "general_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 12, offsetof(mavlink_component_information_t, general_metadata_uri) }, \
  38. { "peripherals_metadata_file_crc", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_component_information_t, peripherals_metadata_file_crc) }, \
  39. { "peripherals_metadata_uri", NULL, MAVLINK_TYPE_CHAR, 100, 112, offsetof(mavlink_component_information_t, peripherals_metadata_uri) }, \
  40. } \
  41. }
  42. #endif
  43. /**
  44. * @brief Pack a component_information message
  45. * @param system_id ID of this system
  46. * @param component_id ID of this component (e.g. 200 for IMU)
  47. * @param msg The MAVLink message to compress the data into
  48. *
  49. * @param time_boot_ms [ms] Timestamp (time since system boot).
  50. * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri).
  51. * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.
  52. * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri).
  53. * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.
  54. * @return length of the message in bytes (excluding serial stream start sign)
  55. */
  56. static inline uint16_t mavlink_msg_component_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  57. uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri)
  58. {
  59. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  60. char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN];
  61. _mav_put_uint32_t(buf, 0, time_boot_ms);
  62. _mav_put_uint32_t(buf, 4, general_metadata_file_crc);
  63. _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc);
  64. _mav_put_char_array(buf, 12, general_metadata_uri, 100);
  65. _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100);
  66. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN);
  67. #else
  68. mavlink_component_information_t packet;
  69. packet.time_boot_ms = time_boot_ms;
  70. packet.general_metadata_file_crc = general_metadata_file_crc;
  71. packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc;
  72. mav_array_memcpy(packet.general_metadata_uri, general_metadata_uri, sizeof(char)*100);
  73. mav_array_memcpy(packet.peripherals_metadata_uri, peripherals_metadata_uri, sizeof(char)*100);
  74. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN);
  75. #endif
  76. msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION;
  77. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  78. }
  79. /**
  80. * @brief Pack a component_information message on a channel
  81. * @param system_id ID of this system
  82. * @param component_id ID of this component (e.g. 200 for IMU)
  83. * @param chan The MAVLink channel this message will be sent over
  84. * @param msg The MAVLink message to compress the data into
  85. * @param time_boot_ms [ms] Timestamp (time since system boot).
  86. * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri).
  87. * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.
  88. * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri).
  89. * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.
  90. * @return length of the message in bytes (excluding serial stream start sign)
  91. */
  92. static inline uint16_t mavlink_msg_component_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  93. mavlink_message_t* msg,
  94. uint32_t time_boot_ms,uint32_t general_metadata_file_crc,const char *general_metadata_uri,uint32_t peripherals_metadata_file_crc,const char *peripherals_metadata_uri)
  95. {
  96. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  97. char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN];
  98. _mav_put_uint32_t(buf, 0, time_boot_ms);
  99. _mav_put_uint32_t(buf, 4, general_metadata_file_crc);
  100. _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc);
  101. _mav_put_char_array(buf, 12, general_metadata_uri, 100);
  102. _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100);
  103. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN);
  104. #else
  105. mavlink_component_information_t packet;
  106. packet.time_boot_ms = time_boot_ms;
  107. packet.general_metadata_file_crc = general_metadata_file_crc;
  108. packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc;
  109. mav_array_memcpy(packet.general_metadata_uri, general_metadata_uri, sizeof(char)*100);
  110. mav_array_memcpy(packet.peripherals_metadata_uri, peripherals_metadata_uri, sizeof(char)*100);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN);
  112. #endif
  113. msg->msgid = MAVLINK_MSG_ID_COMPONENT_INFORMATION;
  114. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  115. }
  116. /**
  117. * @brief Encode a component_information struct
  118. *
  119. * @param system_id ID of this system
  120. * @param component_id ID of this component (e.g. 200 for IMU)
  121. * @param msg The MAVLink message to compress the data into
  122. * @param component_information C-struct to read the message contents from
  123. */
  124. static inline uint16_t mavlink_msg_component_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_component_information_t* component_information)
  125. {
  126. return mavlink_msg_component_information_pack(system_id, component_id, msg, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri);
  127. }
  128. /**
  129. * @brief Encode a component_information struct on a channel
  130. *
  131. * @param system_id ID of this system
  132. * @param component_id ID of this component (e.g. 200 for IMU)
  133. * @param chan The MAVLink channel this message will be sent over
  134. * @param msg The MAVLink message to compress the data into
  135. * @param component_information C-struct to read the message contents from
  136. */
  137. static inline uint16_t mavlink_msg_component_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_component_information_t* component_information)
  138. {
  139. return mavlink_msg_component_information_pack_chan(system_id, component_id, chan, msg, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri);
  140. }
  141. /**
  142. * @brief Send a component_information message
  143. * @param chan MAVLink channel to send the message
  144. *
  145. * @param time_boot_ms [ms] Timestamp (time since system boot).
  146. * @param general_metadata_file_crc CRC32 of the general metadata file (general_metadata_uri).
  147. * @param general_metadata_uri MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.
  148. * @param peripherals_metadata_file_crc CRC32 of peripherals metadata file (peripherals_metadata_uri).
  149. * @param peripherals_metadata_uri (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.
  150. */
  151. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  152. static inline void mavlink_msg_component_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri)
  153. {
  154. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  155. char buf[MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN];
  156. _mav_put_uint32_t(buf, 0, time_boot_ms);
  157. _mav_put_uint32_t(buf, 4, general_metadata_file_crc);
  158. _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc);
  159. _mav_put_char_array(buf, 12, general_metadata_uri, 100);
  160. _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100);
  161. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  162. #else
  163. mavlink_component_information_t packet;
  164. packet.time_boot_ms = time_boot_ms;
  165. packet.general_metadata_file_crc = general_metadata_file_crc;
  166. packet.peripherals_metadata_file_crc = peripherals_metadata_file_crc;
  167. mav_array_memcpy(packet.general_metadata_uri, general_metadata_uri, sizeof(char)*100);
  168. mav_array_memcpy(packet.peripherals_metadata_uri, peripherals_metadata_uri, sizeof(char)*100);
  169. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  170. #endif
  171. }
  172. /**
  173. * @brief Send a component_information message
  174. * @param chan MAVLink channel to send the message
  175. * @param struct The MAVLink struct to serialize
  176. */
  177. static inline void mavlink_msg_component_information_send_struct(mavlink_channel_t chan, const mavlink_component_information_t* component_information)
  178. {
  179. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  180. mavlink_msg_component_information_send(chan, component_information->time_boot_ms, component_information->general_metadata_file_crc, component_information->general_metadata_uri, component_information->peripherals_metadata_file_crc, component_information->peripherals_metadata_uri);
  181. #else
  182. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)component_information, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  183. #endif
  184. }
  185. #if MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  186. /*
  187. This variant of _send() can be used to save stack space by re-using
  188. memory from the receive buffer. The caller provides a
  189. mavlink_message_t which is the size of a full mavlink message. This
  190. is usually the receive buffer for the channel, and allows a reply to an
  191. incoming message with minimum stack space usage.
  192. */
  193. static inline void mavlink_msg_component_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t general_metadata_file_crc, const char *general_metadata_uri, uint32_t peripherals_metadata_file_crc, const char *peripherals_metadata_uri)
  194. {
  195. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  196. char *buf = (char *)msgbuf;
  197. _mav_put_uint32_t(buf, 0, time_boot_ms);
  198. _mav_put_uint32_t(buf, 4, general_metadata_file_crc);
  199. _mav_put_uint32_t(buf, 8, peripherals_metadata_file_crc);
  200. _mav_put_char_array(buf, 12, general_metadata_uri, 100);
  201. _mav_put_char_array(buf, 112, peripherals_metadata_uri, 100);
  202. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, buf, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  203. #else
  204. mavlink_component_information_t *packet = (mavlink_component_information_t *)msgbuf;
  205. packet->time_boot_ms = time_boot_ms;
  206. packet->general_metadata_file_crc = general_metadata_file_crc;
  207. packet->peripherals_metadata_file_crc = peripherals_metadata_file_crc;
  208. mav_array_memcpy(packet->general_metadata_uri, general_metadata_uri, sizeof(char)*100);
  209. mav_array_memcpy(packet->peripherals_metadata_uri, peripherals_metadata_uri, sizeof(char)*100);
  210. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMPONENT_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_COMPONENT_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN, MAVLINK_MSG_ID_COMPONENT_INFORMATION_CRC);
  211. #endif
  212. }
  213. #endif
  214. #endif
  215. // MESSAGE COMPONENT_INFORMATION UNPACKING
  216. /**
  217. * @brief Get field time_boot_ms from component_information message
  218. *
  219. * @return [ms] Timestamp (time since system boot).
  220. */
  221. static inline uint32_t mavlink_msg_component_information_get_time_boot_ms(const mavlink_message_t* msg)
  222. {
  223. return _MAV_RETURN_uint32_t(msg, 0);
  224. }
  225. /**
  226. * @brief Get field general_metadata_file_crc from component_information message
  227. *
  228. * @return CRC32 of the general metadata file (general_metadata_uri).
  229. */
  230. static inline uint32_t mavlink_msg_component_information_get_general_metadata_file_crc(const mavlink_message_t* msg)
  231. {
  232. return _MAV_RETURN_uint32_t(msg, 4);
  233. }
  234. /**
  235. * @brief Get field general_metadata_uri from component_information message
  236. *
  237. * @return MAVLink FTP URI for the general metadata file (COMP_METADATA_TYPE_GENERAL), which may be compressed with xz. The file contains general component metadata, and may contain URI links for additional metadata (see COMP_METADATA_TYPE). The information is static from boot, and may be generated at compile time. The string needs to be zero terminated.
  238. */
  239. static inline uint16_t mavlink_msg_component_information_get_general_metadata_uri(const mavlink_message_t* msg, char *general_metadata_uri)
  240. {
  241. return _MAV_RETURN_char_array(msg, general_metadata_uri, 100, 12);
  242. }
  243. /**
  244. * @brief Get field peripherals_metadata_file_crc from component_information message
  245. *
  246. * @return CRC32 of peripherals metadata file (peripherals_metadata_uri).
  247. */
  248. static inline uint32_t mavlink_msg_component_information_get_peripherals_metadata_file_crc(const mavlink_message_t* msg)
  249. {
  250. return _MAV_RETURN_uint32_t(msg, 8);
  251. }
  252. /**
  253. * @brief Get field peripherals_metadata_uri from component_information message
  254. *
  255. * @return (Optional) MAVLink FTP URI for the peripherals metadata file (COMP_METADATA_TYPE_PERIPHERALS), which may be compressed with xz. This contains data about "attached components" such as UAVCAN nodes. The peripherals are in a separate file because the information must be generated dynamically at runtime. The string needs to be zero terminated.
  256. */
  257. static inline uint16_t mavlink_msg_component_information_get_peripherals_metadata_uri(const mavlink_message_t* msg, char *peripherals_metadata_uri)
  258. {
  259. return _MAV_RETURN_char_array(msg, peripherals_metadata_uri, 100, 112);
  260. }
  261. /**
  262. * @brief Decode a component_information message into a struct
  263. *
  264. * @param msg The message to decode
  265. * @param component_information C-struct to decode the message contents into
  266. */
  267. static inline void mavlink_msg_component_information_decode(const mavlink_message_t* msg, mavlink_component_information_t* component_information)
  268. {
  269. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  270. component_information->time_boot_ms = mavlink_msg_component_information_get_time_boot_ms(msg);
  271. component_information->general_metadata_file_crc = mavlink_msg_component_information_get_general_metadata_file_crc(msg);
  272. component_information->peripherals_metadata_file_crc = mavlink_msg_component_information_get_peripherals_metadata_file_crc(msg);
  273. mavlink_msg_component_information_get_general_metadata_uri(msg, component_information->general_metadata_uri);
  274. mavlink_msg_component_information_get_peripherals_metadata_uri(msg, component_information->peripherals_metadata_uri);
  275. #else
  276. uint8_t len = msg->len < MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN;
  277. memset(component_information, 0, MAVLINK_MSG_ID_COMPONENT_INFORMATION_LEN);
  278. memcpy(component_information, _MAV_PAYLOAD(msg), len);
  279. #endif
  280. }