mavlink_msg_onboard_computer_status.h 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. #pragma once
  2. // MESSAGE ONBOARD_COMPUTER_STATUS PACKING
  3. #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS 390
  4. typedef struct __mavlink_onboard_computer_status_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; /*< [ms] Time since system boot.*/
  7. uint32_t ram_usage; /*< [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.*/
  8. uint32_t ram_total; /*< [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.*/
  9. uint32_t storage_type[4]; /*< Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.*/
  10. uint32_t storage_usage[4]; /*< [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.*/
  11. uint32_t storage_total[4]; /*< [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.*/
  12. uint32_t link_type[6]; /*< Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary*/
  13. uint32_t link_tx_rate[6]; /*< [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.*/
  14. uint32_t link_rx_rate[6]; /*< [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.*/
  15. uint32_t link_tx_max[6]; /*< [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.*/
  16. uint32_t link_rx_max[6]; /*< [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.*/
  17. int16_t fan_speed[4]; /*< [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.*/
  18. uint8_t type; /*< Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.*/
  19. uint8_t cpu_cores[8]; /*< CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.*/
  20. uint8_t cpu_combined[10]; /*< Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.*/
  21. uint8_t gpu_cores[4]; /*< GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.*/
  22. uint8_t gpu_combined[10]; /*< Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.*/
  23. int8_t temperature_board; /*< [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.*/
  24. int8_t temperature_core[8]; /*< [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.*/
  25. } mavlink_onboard_computer_status_t;
  26. #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN 238
  27. #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN 238
  28. #define MAVLINK_MSG_ID_390_LEN 238
  29. #define MAVLINK_MSG_ID_390_MIN_LEN 238
  30. #define MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC 156
  31. #define MAVLINK_MSG_ID_390_CRC 156
  32. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_STORAGE_TYPE_LEN 4
  33. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_STORAGE_USAGE_LEN 4
  34. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_STORAGE_TOTAL_LEN 4
  35. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_LINK_TYPE_LEN 6
  36. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_LINK_TX_RATE_LEN 6
  37. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_LINK_RX_RATE_LEN 6
  38. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_LINK_TX_MAX_LEN 6
  39. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_LINK_RX_MAX_LEN 6
  40. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_FAN_SPEED_LEN 4
  41. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_CPU_CORES_LEN 8
  42. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_CPU_COMBINED_LEN 10
  43. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_GPU_CORES_LEN 4
  44. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_GPU_COMBINED_LEN 10
  45. #define MAVLINK_MSG_ONBOARD_COMPUTER_STATUS_FIELD_TEMPERATURE_CORE_LEN 8
  46. #if MAVLINK_COMMAND_24BIT
  47. #define MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS { \
  48. 390, \
  49. "ONBOARD_COMPUTER_STATUS", \
  50. 20, \
  51. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_onboard_computer_status_t, time_usec) }, \
  52. { "uptime", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_onboard_computer_status_t, uptime) }, \
  53. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 196, offsetof(mavlink_onboard_computer_status_t, type) }, \
  54. { "cpu_cores", NULL, MAVLINK_TYPE_UINT8_T, 8, 197, offsetof(mavlink_onboard_computer_status_t, cpu_cores) }, \
  55. { "cpu_combined", NULL, MAVLINK_TYPE_UINT8_T, 10, 205, offsetof(mavlink_onboard_computer_status_t, cpu_combined) }, \
  56. { "gpu_cores", NULL, MAVLINK_TYPE_UINT8_T, 4, 215, offsetof(mavlink_onboard_computer_status_t, gpu_cores) }, \
  57. { "gpu_combined", NULL, MAVLINK_TYPE_UINT8_T, 10, 219, offsetof(mavlink_onboard_computer_status_t, gpu_combined) }, \
  58. { "temperature_board", NULL, MAVLINK_TYPE_INT8_T, 0, 229, offsetof(mavlink_onboard_computer_status_t, temperature_board) }, \
  59. { "temperature_core", NULL, MAVLINK_TYPE_INT8_T, 8, 230, offsetof(mavlink_onboard_computer_status_t, temperature_core) }, \
  60. { "fan_speed", NULL, MAVLINK_TYPE_INT16_T, 4, 188, offsetof(mavlink_onboard_computer_status_t, fan_speed) }, \
  61. { "ram_usage", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_onboard_computer_status_t, ram_usage) }, \
  62. { "ram_total", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_onboard_computer_status_t, ram_total) }, \
  63. { "storage_type", NULL, MAVLINK_TYPE_UINT32_T, 4, 20, offsetof(mavlink_onboard_computer_status_t, storage_type) }, \
  64. { "storage_usage", NULL, MAVLINK_TYPE_UINT32_T, 4, 36, offsetof(mavlink_onboard_computer_status_t, storage_usage) }, \
  65. { "storage_total", NULL, MAVLINK_TYPE_UINT32_T, 4, 52, offsetof(mavlink_onboard_computer_status_t, storage_total) }, \
  66. { "link_type", NULL, MAVLINK_TYPE_UINT32_T, 6, 68, offsetof(mavlink_onboard_computer_status_t, link_type) }, \
  67. { "link_tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 92, offsetof(mavlink_onboard_computer_status_t, link_tx_rate) }, \
  68. { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 116, offsetof(mavlink_onboard_computer_status_t, link_rx_rate) }, \
  69. { "link_tx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 140, offsetof(mavlink_onboard_computer_status_t, link_tx_max) }, \
  70. { "link_rx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 164, offsetof(mavlink_onboard_computer_status_t, link_rx_max) }, \
  71. } \
  72. }
  73. #else
  74. #define MAVLINK_MESSAGE_INFO_ONBOARD_COMPUTER_STATUS { \
  75. "ONBOARD_COMPUTER_STATUS", \
  76. 20, \
  77. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_onboard_computer_status_t, time_usec) }, \
  78. { "uptime", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_onboard_computer_status_t, uptime) }, \
  79. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 196, offsetof(mavlink_onboard_computer_status_t, type) }, \
  80. { "cpu_cores", NULL, MAVLINK_TYPE_UINT8_T, 8, 197, offsetof(mavlink_onboard_computer_status_t, cpu_cores) }, \
  81. { "cpu_combined", NULL, MAVLINK_TYPE_UINT8_T, 10, 205, offsetof(mavlink_onboard_computer_status_t, cpu_combined) }, \
  82. { "gpu_cores", NULL, MAVLINK_TYPE_UINT8_T, 4, 215, offsetof(mavlink_onboard_computer_status_t, gpu_cores) }, \
  83. { "gpu_combined", NULL, MAVLINK_TYPE_UINT8_T, 10, 219, offsetof(mavlink_onboard_computer_status_t, gpu_combined) }, \
  84. { "temperature_board", NULL, MAVLINK_TYPE_INT8_T, 0, 229, offsetof(mavlink_onboard_computer_status_t, temperature_board) }, \
  85. { "temperature_core", NULL, MAVLINK_TYPE_INT8_T, 8, 230, offsetof(mavlink_onboard_computer_status_t, temperature_core) }, \
  86. { "fan_speed", NULL, MAVLINK_TYPE_INT16_T, 4, 188, offsetof(mavlink_onboard_computer_status_t, fan_speed) }, \
  87. { "ram_usage", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_onboard_computer_status_t, ram_usage) }, \
  88. { "ram_total", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_onboard_computer_status_t, ram_total) }, \
  89. { "storage_type", NULL, MAVLINK_TYPE_UINT32_T, 4, 20, offsetof(mavlink_onboard_computer_status_t, storage_type) }, \
  90. { "storage_usage", NULL, MAVLINK_TYPE_UINT32_T, 4, 36, offsetof(mavlink_onboard_computer_status_t, storage_usage) }, \
  91. { "storage_total", NULL, MAVLINK_TYPE_UINT32_T, 4, 52, offsetof(mavlink_onboard_computer_status_t, storage_total) }, \
  92. { "link_type", NULL, MAVLINK_TYPE_UINT32_T, 6, 68, offsetof(mavlink_onboard_computer_status_t, link_type) }, \
  93. { "link_tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 92, offsetof(mavlink_onboard_computer_status_t, link_tx_rate) }, \
  94. { "link_rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 6, 116, offsetof(mavlink_onboard_computer_status_t, link_rx_rate) }, \
  95. { "link_tx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 140, offsetof(mavlink_onboard_computer_status_t, link_tx_max) }, \
  96. { "link_rx_max", NULL, MAVLINK_TYPE_UINT32_T, 6, 164, offsetof(mavlink_onboard_computer_status_t, link_rx_max) }, \
  97. } \
  98. }
  99. #endif
  100. /**
  101. * @brief Pack a onboard_computer_status message
  102. * @param system_id ID of this system
  103. * @param component_id ID of this component (e.g. 200 for IMU)
  104. * @param msg The MAVLink message to compress the data into
  105. *
  106. * @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.
  107. * @param uptime [ms] Time since system boot.
  108. * @param type Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.
  109. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  110. * @param cpu_combined Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  111. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  112. * @param gpu_combined Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  113. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  114. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  115. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  116. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  117. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  118. * @param storage_type Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.
  119. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  120. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  121. * @param link_type Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  122. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  123. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  124. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  125. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  126. * @return length of the message in bytes (excluding serial stream start sign)
  127. */
  128. MAVLINK_WIP
  129. static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  130. uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max)
  131. {
  132. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  133. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  134. _mav_put_uint64_t(buf, 0, time_usec);
  135. _mav_put_uint32_t(buf, 8, uptime);
  136. _mav_put_uint32_t(buf, 12, ram_usage);
  137. _mav_put_uint32_t(buf, 16, ram_total);
  138. _mav_put_uint8_t(buf, 196, type);
  139. _mav_put_int8_t(buf, 229, temperature_board);
  140. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  141. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  142. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  143. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  144. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  145. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  146. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  147. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  148. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  149. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  150. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  151. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  152. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  153. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  154. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  155. #else
  156. mavlink_onboard_computer_status_t packet;
  157. packet.time_usec = time_usec;
  158. packet.uptime = uptime;
  159. packet.ram_usage = ram_usage;
  160. packet.ram_total = ram_total;
  161. packet.type = type;
  162. packet.temperature_board = temperature_board;
  163. mav_array_assign_uint32_t(packet.storage_type, storage_type, 4);
  164. mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4);
  165. mav_array_assign_uint32_t(packet.storage_total, storage_total, 4);
  166. mav_array_assign_uint32_t(packet.link_type, link_type, 6);
  167. mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6);
  168. mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6);
  169. mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6);
  170. mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6);
  171. mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4);
  172. mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8);
  173. mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10);
  174. mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4);
  175. mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10);
  176. mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8);
  177. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  178. #endif
  179. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  180. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  181. }
  182. /**
  183. * @brief Pack a onboard_computer_status message
  184. * @param system_id ID of this system
  185. * @param component_id ID of this component (e.g. 200 for IMU)
  186. * @param status MAVLink status structure
  187. * @param msg The MAVLink message to compress the data into
  188. *
  189. * @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.
  190. * @param uptime [ms] Time since system boot.
  191. * @param type Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.
  192. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  193. * @param cpu_combined Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  194. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  195. * @param gpu_combined Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  196. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  197. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  198. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  199. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  200. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  201. * @param storage_type Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.
  202. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  203. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  204. * @param link_type Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  205. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  206. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  207. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  208. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  209. * @return length of the message in bytes (excluding serial stream start sign)
  210. */
  211. static inline uint16_t mavlink_msg_onboard_computer_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  212. uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max)
  213. {
  214. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  215. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  216. _mav_put_uint64_t(buf, 0, time_usec);
  217. _mav_put_uint32_t(buf, 8, uptime);
  218. _mav_put_uint32_t(buf, 12, ram_usage);
  219. _mav_put_uint32_t(buf, 16, ram_total);
  220. _mav_put_uint8_t(buf, 196, type);
  221. _mav_put_int8_t(buf, 229, temperature_board);
  222. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  223. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  224. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  225. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  226. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  227. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  228. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  229. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  230. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  231. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  232. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  233. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  234. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  235. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  236. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  237. #else
  238. mavlink_onboard_computer_status_t packet;
  239. packet.time_usec = time_usec;
  240. packet.uptime = uptime;
  241. packet.ram_usage = ram_usage;
  242. packet.ram_total = ram_total;
  243. packet.type = type;
  244. packet.temperature_board = temperature_board;
  245. mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4);
  246. mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4);
  247. mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4);
  248. mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6);
  249. mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  250. mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  251. mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  252. mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  253. mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4);
  254. mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  255. mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  256. mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  257. mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  258. mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8);
  259. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  260. #endif
  261. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  262. #if MAVLINK_CRC_EXTRA
  263. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  264. #else
  265. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  266. #endif
  267. }
  268. /**
  269. * @brief Pack a onboard_computer_status message on a channel
  270. * @param system_id ID of this system
  271. * @param component_id ID of this component (e.g. 200 for IMU)
  272. * @param chan The MAVLink channel this message will be sent over
  273. * @param msg The MAVLink message to compress the data into
  274. * @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.
  275. * @param uptime [ms] Time since system boot.
  276. * @param type Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.
  277. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  278. * @param cpu_combined Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  279. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  280. * @param gpu_combined Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  281. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  282. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  283. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  284. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  285. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  286. * @param storage_type Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.
  287. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  288. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  289. * @param link_type Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  290. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  291. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  292. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  293. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  294. * @return length of the message in bytes (excluding serial stream start sign)
  295. */
  296. MAVLINK_WIP
  297. static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  298. mavlink_message_t* msg,
  299. uint64_t time_usec,uint32_t uptime,uint8_t type,const uint8_t *cpu_cores,const uint8_t *cpu_combined,const uint8_t *gpu_cores,const uint8_t *gpu_combined,int8_t temperature_board,const int8_t *temperature_core,const int16_t *fan_speed,uint32_t ram_usage,uint32_t ram_total,const uint32_t *storage_type,const uint32_t *storage_usage,const uint32_t *storage_total,const uint32_t *link_type,const uint32_t *link_tx_rate,const uint32_t *link_rx_rate,const uint32_t *link_tx_max,const uint32_t *link_rx_max)
  300. {
  301. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  302. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  303. _mav_put_uint64_t(buf, 0, time_usec);
  304. _mav_put_uint32_t(buf, 8, uptime);
  305. _mav_put_uint32_t(buf, 12, ram_usage);
  306. _mav_put_uint32_t(buf, 16, ram_total);
  307. _mav_put_uint8_t(buf, 196, type);
  308. _mav_put_int8_t(buf, 229, temperature_board);
  309. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  310. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  311. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  312. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  313. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  314. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  315. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  316. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  317. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  318. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  319. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  320. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  321. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  322. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  323. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  324. #else
  325. mavlink_onboard_computer_status_t packet;
  326. packet.time_usec = time_usec;
  327. packet.uptime = uptime;
  328. packet.ram_usage = ram_usage;
  329. packet.ram_total = ram_total;
  330. packet.type = type;
  331. packet.temperature_board = temperature_board;
  332. mav_array_assign_uint32_t(packet.storage_type, storage_type, 4);
  333. mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4);
  334. mav_array_assign_uint32_t(packet.storage_total, storage_total, 4);
  335. mav_array_assign_uint32_t(packet.link_type, link_type, 6);
  336. mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6);
  337. mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6);
  338. mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6);
  339. mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6);
  340. mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4);
  341. mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8);
  342. mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10);
  343. mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4);
  344. mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10);
  345. mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8);
  346. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  347. #endif
  348. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  349. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  350. }
  351. /**
  352. * @brief Encode a onboard_computer_status struct
  353. *
  354. * @param system_id ID of this system
  355. * @param component_id ID of this component (e.g. 200 for IMU)
  356. * @param msg The MAVLink message to compress the data into
  357. * @param onboard_computer_status C-struct to read the message contents from
  358. */
  359. MAVLINK_WIP
  360. static inline uint16_t mavlink_msg_onboard_computer_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status)
  361. {
  362. return mavlink_msg_onboard_computer_status_pack(system_id, component_id, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max);
  363. }
  364. /**
  365. * @brief Encode a onboard_computer_status struct on a channel
  366. *
  367. * @param system_id ID of this system
  368. * @param component_id ID of this component (e.g. 200 for IMU)
  369. * @param chan The MAVLink channel this message will be sent over
  370. * @param msg The MAVLink message to compress the data into
  371. * @param onboard_computer_status C-struct to read the message contents from
  372. */
  373. MAVLINK_WIP
  374. static inline uint16_t mavlink_msg_onboard_computer_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status)
  375. {
  376. return mavlink_msg_onboard_computer_status_pack_chan(system_id, component_id, chan, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max);
  377. }
  378. /**
  379. * @brief Encode a onboard_computer_status struct with provided status structure
  380. *
  381. * @param system_id ID of this system
  382. * @param component_id ID of this component (e.g. 200 for IMU)
  383. * @param status MAVLink status structure
  384. * @param msg The MAVLink message to compress the data into
  385. * @param onboard_computer_status C-struct to read the message contents from
  386. */
  387. static inline uint16_t mavlink_msg_onboard_computer_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_onboard_computer_status_t* onboard_computer_status)
  388. {
  389. return mavlink_msg_onboard_computer_status_pack_status(system_id, component_id, _status, msg, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max);
  390. }
  391. /**
  392. * @brief Send a onboard_computer_status message
  393. * @param chan MAVLink channel to send the message
  394. *
  395. * @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.
  396. * @param uptime [ms] Time since system boot.
  397. * @param type Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.
  398. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  399. * @param cpu_combined Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  400. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  401. * @param gpu_combined Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  402. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  403. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  404. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  405. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  406. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  407. * @param storage_type Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.
  408. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  409. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  410. * @param link_type Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  411. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  412. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  413. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  414. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  415. */
  416. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  417. MAVLINK_WIP
  418. static inline void mavlink_msg_onboard_computer_status_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max)
  419. {
  420. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  421. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  422. _mav_put_uint64_t(buf, 0, time_usec);
  423. _mav_put_uint32_t(buf, 8, uptime);
  424. _mav_put_uint32_t(buf, 12, ram_usage);
  425. _mav_put_uint32_t(buf, 16, ram_total);
  426. _mav_put_uint8_t(buf, 196, type);
  427. _mav_put_int8_t(buf, 229, temperature_board);
  428. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  429. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  430. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  431. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  432. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  433. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  434. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  435. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  436. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  437. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  438. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  439. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  440. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  441. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  442. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  443. #else
  444. mavlink_onboard_computer_status_t packet;
  445. packet.time_usec = time_usec;
  446. packet.uptime = uptime;
  447. packet.ram_usage = ram_usage;
  448. packet.ram_total = ram_total;
  449. packet.type = type;
  450. packet.temperature_board = temperature_board;
  451. mav_array_assign_uint32_t(packet.storage_type, storage_type, 4);
  452. mav_array_assign_uint32_t(packet.storage_usage, storage_usage, 4);
  453. mav_array_assign_uint32_t(packet.storage_total, storage_total, 4);
  454. mav_array_assign_uint32_t(packet.link_type, link_type, 6);
  455. mav_array_assign_uint32_t(packet.link_tx_rate, link_tx_rate, 6);
  456. mav_array_assign_uint32_t(packet.link_rx_rate, link_rx_rate, 6);
  457. mav_array_assign_uint32_t(packet.link_tx_max, link_tx_max, 6);
  458. mav_array_assign_uint32_t(packet.link_rx_max, link_rx_max, 6);
  459. mav_array_assign_int16_t(packet.fan_speed, fan_speed, 4);
  460. mav_array_assign_uint8_t(packet.cpu_cores, cpu_cores, 8);
  461. mav_array_assign_uint8_t(packet.cpu_combined, cpu_combined, 10);
  462. mav_array_assign_uint8_t(packet.gpu_cores, gpu_cores, 4);
  463. mav_array_assign_uint8_t(packet.gpu_combined, gpu_combined, 10);
  464. mav_array_assign_int8_t(packet.temperature_core, temperature_core, 8);
  465. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)&packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  466. #endif
  467. }
  468. /**
  469. * @brief Send a onboard_computer_status message
  470. * @param chan MAVLink channel to send the message
  471. * @param struct The MAVLink struct to serialize
  472. */
  473. MAVLINK_WIP
  474. static inline void mavlink_msg_onboard_computer_status_send_struct(mavlink_channel_t chan, const mavlink_onboard_computer_status_t* onboard_computer_status)
  475. {
  476. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  477. mavlink_msg_onboard_computer_status_send(chan, onboard_computer_status->time_usec, onboard_computer_status->uptime, onboard_computer_status->type, onboard_computer_status->cpu_cores, onboard_computer_status->cpu_combined, onboard_computer_status->gpu_cores, onboard_computer_status->gpu_combined, onboard_computer_status->temperature_board, onboard_computer_status->temperature_core, onboard_computer_status->fan_speed, onboard_computer_status->ram_usage, onboard_computer_status->ram_total, onboard_computer_status->storage_type, onboard_computer_status->storage_usage, onboard_computer_status->storage_total, onboard_computer_status->link_type, onboard_computer_status->link_tx_rate, onboard_computer_status->link_rx_rate, onboard_computer_status->link_tx_max, onboard_computer_status->link_rx_max);
  478. #else
  479. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)onboard_computer_status, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  480. #endif
  481. }
  482. #if MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  483. /*
  484. This variant of _send() can be used to save stack space by reusing
  485. memory from the receive buffer. The caller provides a
  486. mavlink_message_t which is the size of a full mavlink message. This
  487. is usually the receive buffer for the channel, and allows a reply to an
  488. incoming message with minimum stack space usage.
  489. */
  490. MAVLINK_WIP
  491. static inline void mavlink_msg_onboard_computer_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t uptime, uint8_t type, const uint8_t *cpu_cores, const uint8_t *cpu_combined, const uint8_t *gpu_cores, const uint8_t *gpu_combined, int8_t temperature_board, const int8_t *temperature_core, const int16_t *fan_speed, uint32_t ram_usage, uint32_t ram_total, const uint32_t *storage_type, const uint32_t *storage_usage, const uint32_t *storage_total, const uint32_t *link_type, const uint32_t *link_tx_rate, const uint32_t *link_rx_rate, const uint32_t *link_tx_max, const uint32_t *link_rx_max)
  492. {
  493. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  494. char *buf = (char *)msgbuf;
  495. _mav_put_uint64_t(buf, 0, time_usec);
  496. _mav_put_uint32_t(buf, 8, uptime);
  497. _mav_put_uint32_t(buf, 12, ram_usage);
  498. _mav_put_uint32_t(buf, 16, ram_total);
  499. _mav_put_uint8_t(buf, 196, type);
  500. _mav_put_int8_t(buf, 229, temperature_board);
  501. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  502. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  503. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  504. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  505. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  506. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  507. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  508. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  509. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  510. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  511. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  512. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  513. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  514. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  515. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  516. #else
  517. mavlink_onboard_computer_status_t *packet = (mavlink_onboard_computer_status_t *)msgbuf;
  518. packet->time_usec = time_usec;
  519. packet->uptime = uptime;
  520. packet->ram_usage = ram_usage;
  521. packet->ram_total = ram_total;
  522. packet->type = type;
  523. packet->temperature_board = temperature_board;
  524. mav_array_assign_uint32_t(packet->storage_type, storage_type, 4);
  525. mav_array_assign_uint32_t(packet->storage_usage, storage_usage, 4);
  526. mav_array_assign_uint32_t(packet->storage_total, storage_total, 4);
  527. mav_array_assign_uint32_t(packet->link_type, link_type, 6);
  528. mav_array_assign_uint32_t(packet->link_tx_rate, link_tx_rate, 6);
  529. mav_array_assign_uint32_t(packet->link_rx_rate, link_rx_rate, 6);
  530. mav_array_assign_uint32_t(packet->link_tx_max, link_tx_max, 6);
  531. mav_array_assign_uint32_t(packet->link_rx_max, link_rx_max, 6);
  532. mav_array_assign_int16_t(packet->fan_speed, fan_speed, 4);
  533. mav_array_assign_uint8_t(packet->cpu_cores, cpu_cores, 8);
  534. mav_array_assign_uint8_t(packet->cpu_combined, cpu_combined, 10);
  535. mav_array_assign_uint8_t(packet->gpu_cores, gpu_cores, 4);
  536. mav_array_assign_uint8_t(packet->gpu_combined, gpu_combined, 10);
  537. mav_array_assign_int8_t(packet->temperature_core, temperature_core, 8);
  538. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS, (const char *)packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_MIN_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_CRC);
  539. #endif
  540. }
  541. #endif
  542. #endif
  543. // MESSAGE ONBOARD_COMPUTER_STATUS UNPACKING
  544. /**
  545. * @brief Get field time_usec from onboard_computer_status message
  546. *
  547. * @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.
  548. */
  549. MAVLINK_WIP
  550. static inline uint64_t mavlink_msg_onboard_computer_status_get_time_usec(const mavlink_message_t* msg)
  551. {
  552. return _MAV_RETURN_uint64_t(msg, 0);
  553. }
  554. /**
  555. * @brief Get field uptime from onboard_computer_status message
  556. *
  557. * @return [ms] Time since system boot.
  558. */
  559. MAVLINK_WIP
  560. static inline uint32_t mavlink_msg_onboard_computer_status_get_uptime(const mavlink_message_t* msg)
  561. {
  562. return _MAV_RETURN_uint32_t(msg, 8);
  563. }
  564. /**
  565. * @brief Get field type from onboard_computer_status message
  566. *
  567. * @return Type of the onboard computer: 0: Mission computer primary, 1: Mission computer backup 1, 2: Mission computer backup 2, 3: Compute node, 4-5: Compute spares, 6-9: Payload computers.
  568. */
  569. MAVLINK_WIP
  570. static inline uint8_t mavlink_msg_onboard_computer_status_get_type(const mavlink_message_t* msg)
  571. {
  572. return _MAV_RETURN_uint8_t(msg, 196);
  573. }
  574. /**
  575. * @brief Get field cpu_cores from onboard_computer_status message
  576. *
  577. * @return CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  578. */
  579. MAVLINK_WIP
  580. static inline uint16_t mavlink_msg_onboard_computer_status_get_cpu_cores(const mavlink_message_t* msg, uint8_t *cpu_cores)
  581. {
  582. return _MAV_RETURN_uint8_t_array(msg, cpu_cores, 8, 197);
  583. }
  584. /**
  585. * @brief Get field cpu_combined from onboard_computer_status message
  586. *
  587. * @return Combined CPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  588. */
  589. MAVLINK_WIP
  590. static inline uint16_t mavlink_msg_onboard_computer_status_get_cpu_combined(const mavlink_message_t* msg, uint8_t *cpu_combined)
  591. {
  592. return _MAV_RETURN_uint8_t_array(msg, cpu_combined, 10, 205);
  593. }
  594. /**
  595. * @brief Get field gpu_cores from onboard_computer_status message
  596. *
  597. * @return GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  598. */
  599. MAVLINK_WIP
  600. static inline uint16_t mavlink_msg_onboard_computer_status_get_gpu_cores(const mavlink_message_t* msg, uint8_t *gpu_cores)
  601. {
  602. return _MAV_RETURN_uint8_t_array(msg, gpu_cores, 4, 215);
  603. }
  604. /**
  605. * @brief Get field gpu_combined from onboard_computer_status message
  606. *
  607. * @return Combined GPU usage as the last 10 slices of 100 MS (a histogram). This allows to identify spikes in load that max out the system, but only for a short amount of time. A value of UINT8_MAX implies the field is unused.
  608. */
  609. MAVLINK_WIP
  610. static inline uint16_t mavlink_msg_onboard_computer_status_get_gpu_combined(const mavlink_message_t* msg, uint8_t *gpu_combined)
  611. {
  612. return _MAV_RETURN_uint8_t_array(msg, gpu_combined, 10, 219);
  613. }
  614. /**
  615. * @brief Get field temperature_board from onboard_computer_status message
  616. *
  617. * @return [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  618. */
  619. MAVLINK_WIP
  620. static inline int8_t mavlink_msg_onboard_computer_status_get_temperature_board(const mavlink_message_t* msg)
  621. {
  622. return _MAV_RETURN_int8_t(msg, 229);
  623. }
  624. /**
  625. * @brief Get field temperature_core from onboard_computer_status message
  626. *
  627. * @return [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  628. */
  629. MAVLINK_WIP
  630. static inline uint16_t mavlink_msg_onboard_computer_status_get_temperature_core(const mavlink_message_t* msg, int8_t *temperature_core)
  631. {
  632. return _MAV_RETURN_int8_t_array(msg, temperature_core, 8, 230);
  633. }
  634. /**
  635. * @brief Get field fan_speed from onboard_computer_status message
  636. *
  637. * @return [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  638. */
  639. MAVLINK_WIP
  640. static inline uint16_t mavlink_msg_onboard_computer_status_get_fan_speed(const mavlink_message_t* msg, int16_t *fan_speed)
  641. {
  642. return _MAV_RETURN_int16_t_array(msg, fan_speed, 4, 188);
  643. }
  644. /**
  645. * @brief Get field ram_usage from onboard_computer_status message
  646. *
  647. * @return [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  648. */
  649. MAVLINK_WIP
  650. static inline uint32_t mavlink_msg_onboard_computer_status_get_ram_usage(const mavlink_message_t* msg)
  651. {
  652. return _MAV_RETURN_uint32_t(msg, 12);
  653. }
  654. /**
  655. * @brief Get field ram_total from onboard_computer_status message
  656. *
  657. * @return [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  658. */
  659. MAVLINK_WIP
  660. static inline uint32_t mavlink_msg_onboard_computer_status_get_ram_total(const mavlink_message_t* msg)
  661. {
  662. return _MAV_RETURN_uint32_t(msg, 16);
  663. }
  664. /**
  665. * @brief Get field storage_type from onboard_computer_status message
  666. *
  667. * @return Storage type: 0: HDD, 1: SSD, 2: EMMC, 3: SD card (non-removable), 4: SD card (removable). A value of UINT32_MAX implies the field is unused.
  668. */
  669. MAVLINK_WIP
  670. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_type(const mavlink_message_t* msg, uint32_t *storage_type)
  671. {
  672. return _MAV_RETURN_uint32_t_array(msg, storage_type, 4, 20);
  673. }
  674. /**
  675. * @brief Get field storage_usage from onboard_computer_status message
  676. *
  677. * @return [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  678. */
  679. MAVLINK_WIP
  680. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_usage(const mavlink_message_t* msg, uint32_t *storage_usage)
  681. {
  682. return _MAV_RETURN_uint32_t_array(msg, storage_usage, 4, 36);
  683. }
  684. /**
  685. * @brief Get field storage_total from onboard_computer_status message
  686. *
  687. * @return [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  688. */
  689. MAVLINK_WIP
  690. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_total(const mavlink_message_t* msg, uint32_t *storage_total)
  691. {
  692. return _MAV_RETURN_uint32_t_array(msg, storage_total, 4, 52);
  693. }
  694. /**
  695. * @brief Get field link_type from onboard_computer_status message
  696. *
  697. * @return Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  698. */
  699. MAVLINK_WIP
  700. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_type(const mavlink_message_t* msg, uint32_t *link_type)
  701. {
  702. return _MAV_RETURN_uint32_t_array(msg, link_type, 6, 68);
  703. }
  704. /**
  705. * @brief Get field link_tx_rate from onboard_computer_status message
  706. *
  707. * @return [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  708. */
  709. MAVLINK_WIP
  710. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_tx_rate(const mavlink_message_t* msg, uint32_t *link_tx_rate)
  711. {
  712. return _MAV_RETURN_uint32_t_array(msg, link_tx_rate, 6, 92);
  713. }
  714. /**
  715. * @brief Get field link_rx_rate from onboard_computer_status message
  716. *
  717. * @return [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  718. */
  719. MAVLINK_WIP
  720. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_rx_rate(const mavlink_message_t* msg, uint32_t *link_rx_rate)
  721. {
  722. return _MAV_RETURN_uint32_t_array(msg, link_rx_rate, 6, 116);
  723. }
  724. /**
  725. * @brief Get field link_tx_max from onboard_computer_status message
  726. *
  727. * @return [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  728. */
  729. MAVLINK_WIP
  730. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_tx_max(const mavlink_message_t* msg, uint32_t *link_tx_max)
  731. {
  732. return _MAV_RETURN_uint32_t_array(msg, link_tx_max, 6, 140);
  733. }
  734. /**
  735. * @brief Get field link_rx_max from onboard_computer_status message
  736. *
  737. * @return [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  738. */
  739. MAVLINK_WIP
  740. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_rx_max(const mavlink_message_t* msg, uint32_t *link_rx_max)
  741. {
  742. return _MAV_RETURN_uint32_t_array(msg, link_rx_max, 6, 164);
  743. }
  744. /**
  745. * @brief Decode a onboard_computer_status message into a struct
  746. *
  747. * @param msg The message to decode
  748. * @param onboard_computer_status C-struct to decode the message contents into
  749. */
  750. MAVLINK_WIP
  751. static inline void mavlink_msg_onboard_computer_status_decode(const mavlink_message_t* msg, mavlink_onboard_computer_status_t* onboard_computer_status)
  752. {
  753. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  754. onboard_computer_status->time_usec = mavlink_msg_onboard_computer_status_get_time_usec(msg);
  755. onboard_computer_status->uptime = mavlink_msg_onboard_computer_status_get_uptime(msg);
  756. onboard_computer_status->ram_usage = mavlink_msg_onboard_computer_status_get_ram_usage(msg);
  757. onboard_computer_status->ram_total = mavlink_msg_onboard_computer_status_get_ram_total(msg);
  758. mavlink_msg_onboard_computer_status_get_storage_type(msg, onboard_computer_status->storage_type);
  759. mavlink_msg_onboard_computer_status_get_storage_usage(msg, onboard_computer_status->storage_usage);
  760. mavlink_msg_onboard_computer_status_get_storage_total(msg, onboard_computer_status->storage_total);
  761. mavlink_msg_onboard_computer_status_get_link_type(msg, onboard_computer_status->link_type);
  762. mavlink_msg_onboard_computer_status_get_link_tx_rate(msg, onboard_computer_status->link_tx_rate);
  763. mavlink_msg_onboard_computer_status_get_link_rx_rate(msg, onboard_computer_status->link_rx_rate);
  764. mavlink_msg_onboard_computer_status_get_link_tx_max(msg, onboard_computer_status->link_tx_max);
  765. mavlink_msg_onboard_computer_status_get_link_rx_max(msg, onboard_computer_status->link_rx_max);
  766. mavlink_msg_onboard_computer_status_get_fan_speed(msg, onboard_computer_status->fan_speed);
  767. onboard_computer_status->type = mavlink_msg_onboard_computer_status_get_type(msg);
  768. mavlink_msg_onboard_computer_status_get_cpu_cores(msg, onboard_computer_status->cpu_cores);
  769. mavlink_msg_onboard_computer_status_get_cpu_combined(msg, onboard_computer_status->cpu_combined);
  770. mavlink_msg_onboard_computer_status_get_gpu_cores(msg, onboard_computer_status->gpu_cores);
  771. mavlink_msg_onboard_computer_status_get_gpu_combined(msg, onboard_computer_status->gpu_combined);
  772. onboard_computer_status->temperature_board = mavlink_msg_onboard_computer_status_get_temperature_board(msg);
  773. mavlink_msg_onboard_computer_status_get_temperature_core(msg, onboard_computer_status->temperature_core);
  774. #else
  775. uint8_t len = msg->len < MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN? msg->len : MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN;
  776. memset(onboard_computer_status, 0, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  777. memcpy(onboard_computer_status, _MAV_PAYLOAD(msg), len);
  778. #endif
  779. }