mavlink_msg_onboard_computer_status.h 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  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. static inline uint16_t mavlink_msg_onboard_computer_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  129. 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)
  130. {
  131. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  132. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  133. _mav_put_uint64_t(buf, 0, time_usec);
  134. _mav_put_uint32_t(buf, 8, uptime);
  135. _mav_put_uint32_t(buf, 12, ram_usage);
  136. _mav_put_uint32_t(buf, 16, ram_total);
  137. _mav_put_uint8_t(buf, 196, type);
  138. _mav_put_int8_t(buf, 229, temperature_board);
  139. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  140. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  141. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  142. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  143. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  144. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  145. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  146. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  147. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  148. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  149. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  150. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  151. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  152. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  153. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  154. #else
  155. mavlink_onboard_computer_status_t packet;
  156. packet.time_usec = time_usec;
  157. packet.uptime = uptime;
  158. packet.ram_usage = ram_usage;
  159. packet.ram_total = ram_total;
  160. packet.type = type;
  161. packet.temperature_board = temperature_board;
  162. mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4);
  163. mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4);
  164. mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4);
  165. mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6);
  166. mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  167. mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  168. mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  169. mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  170. mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4);
  171. mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  172. mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  173. mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  174. mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  175. mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8);
  176. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  177. #endif
  178. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  179. 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);
  180. }
  181. /**
  182. * @brief Pack a onboard_computer_status message
  183. * @param system_id ID of this system
  184. * @param component_id ID of this component (e.g. 200 for IMU)
  185. * @param status MAVLink status structure
  186. * @param msg The MAVLink message to compress the data into
  187. *
  188. * @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.
  189. * @param uptime [ms] Time since system boot.
  190. * @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.
  191. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  192. * @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.
  193. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  194. * @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.
  195. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  196. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  197. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  198. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  199. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  200. * @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.
  201. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  202. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  203. * @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
  204. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  205. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  206. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  207. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  208. * @return length of the message in bytes (excluding serial stream start sign)
  209. */
  210. 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,
  211. 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)
  212. {
  213. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  214. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  215. _mav_put_uint64_t(buf, 0, time_usec);
  216. _mav_put_uint32_t(buf, 8, uptime);
  217. _mav_put_uint32_t(buf, 12, ram_usage);
  218. _mav_put_uint32_t(buf, 16, ram_total);
  219. _mav_put_uint8_t(buf, 196, type);
  220. _mav_put_int8_t(buf, 229, temperature_board);
  221. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  222. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  223. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  224. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  225. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  226. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  227. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  228. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  229. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  230. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  231. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  232. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  233. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  234. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  235. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  236. #else
  237. mavlink_onboard_computer_status_t packet;
  238. packet.time_usec = time_usec;
  239. packet.uptime = uptime;
  240. packet.ram_usage = ram_usage;
  241. packet.ram_total = ram_total;
  242. packet.type = type;
  243. packet.temperature_board = temperature_board;
  244. mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4);
  245. mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4);
  246. mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4);
  247. mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6);
  248. mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  249. mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  250. mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  251. mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  252. mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4);
  253. mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  254. mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  255. mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  256. mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  257. mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8);
  258. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  259. #endif
  260. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  261. #if MAVLINK_CRC_EXTRA
  262. 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);
  263. #else
  264. 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);
  265. #endif
  266. }
  267. /**
  268. * @brief Pack a onboard_computer_status message on a channel
  269. * @param system_id ID of this system
  270. * @param component_id ID of this component (e.g. 200 for IMU)
  271. * @param chan The MAVLink channel this message will be sent over
  272. * @param msg The MAVLink message to compress the data into
  273. * @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.
  274. * @param uptime [ms] Time since system boot.
  275. * @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.
  276. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  277. * @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.
  278. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  279. * @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.
  280. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  281. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  282. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  283. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  284. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  285. * @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.
  286. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  287. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  288. * @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
  289. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  290. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  291. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  292. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  293. * @return length of the message in bytes (excluding serial stream start sign)
  294. */
  295. static inline uint16_t mavlink_msg_onboard_computer_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  296. mavlink_message_t* msg,
  297. 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)
  298. {
  299. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  300. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  301. _mav_put_uint64_t(buf, 0, time_usec);
  302. _mav_put_uint32_t(buf, 8, uptime);
  303. _mav_put_uint32_t(buf, 12, ram_usage);
  304. _mav_put_uint32_t(buf, 16, ram_total);
  305. _mav_put_uint8_t(buf, 196, type);
  306. _mav_put_int8_t(buf, 229, temperature_board);
  307. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  308. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  309. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  310. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  311. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  312. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  313. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  314. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  315. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  316. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  317. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  318. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  319. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  320. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  321. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  322. #else
  323. mavlink_onboard_computer_status_t packet;
  324. packet.time_usec = time_usec;
  325. packet.uptime = uptime;
  326. packet.ram_usage = ram_usage;
  327. packet.ram_total = ram_total;
  328. packet.type = type;
  329. packet.temperature_board = temperature_board;
  330. mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4);
  331. mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4);
  332. mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4);
  333. mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6);
  334. mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  335. mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  336. mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  337. mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  338. mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4);
  339. mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  340. mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  341. mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  342. mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  343. mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8);
  344. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  345. #endif
  346. msg->msgid = MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS;
  347. 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);
  348. }
  349. /**
  350. * @brief Encode a onboard_computer_status struct
  351. *
  352. * @param system_id ID of this system
  353. * @param component_id ID of this component (e.g. 200 for IMU)
  354. * @param msg The MAVLink message to compress the data into
  355. * @param onboard_computer_status C-struct to read the message contents from
  356. */
  357. 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)
  358. {
  359. 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);
  360. }
  361. /**
  362. * @brief Encode a onboard_computer_status struct on a channel
  363. *
  364. * @param system_id ID of this system
  365. * @param component_id ID of this component (e.g. 200 for IMU)
  366. * @param chan The MAVLink channel this message will be sent over
  367. * @param msg The MAVLink message to compress the data into
  368. * @param onboard_computer_status C-struct to read the message contents from
  369. */
  370. 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)
  371. {
  372. 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);
  373. }
  374. /**
  375. * @brief Encode a onboard_computer_status struct with provided status structure
  376. *
  377. * @param system_id ID of this system
  378. * @param component_id ID of this component (e.g. 200 for IMU)
  379. * @param status MAVLink status structure
  380. * @param msg The MAVLink message to compress the data into
  381. * @param onboard_computer_status C-struct to read the message contents from
  382. */
  383. 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)
  384. {
  385. 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);
  386. }
  387. /**
  388. * @brief Send a onboard_computer_status message
  389. * @param chan MAVLink channel to send the message
  390. *
  391. * @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.
  392. * @param uptime [ms] Time since system boot.
  393. * @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.
  394. * @param cpu_cores CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  395. * @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.
  396. * @param gpu_cores GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  397. * @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.
  398. * @param temperature_board [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  399. * @param temperature_core [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  400. * @param fan_speed [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  401. * @param ram_usage [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  402. * @param ram_total [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  403. * @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.
  404. * @param storage_usage [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  405. * @param storage_total [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  406. * @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
  407. * @param link_tx_rate [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  408. * @param link_rx_rate [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  409. * @param link_tx_max [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  410. * @param link_rx_max [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  411. */
  412. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  413. 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)
  414. {
  415. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  416. char buf[MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN];
  417. _mav_put_uint64_t(buf, 0, time_usec);
  418. _mav_put_uint32_t(buf, 8, uptime);
  419. _mav_put_uint32_t(buf, 12, ram_usage);
  420. _mav_put_uint32_t(buf, 16, ram_total);
  421. _mav_put_uint8_t(buf, 196, type);
  422. _mav_put_int8_t(buf, 229, temperature_board);
  423. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  424. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  425. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  426. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  427. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  428. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  429. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  430. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  431. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  432. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  433. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  434. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  435. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  436. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  437. _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);
  438. #else
  439. mavlink_onboard_computer_status_t packet;
  440. packet.time_usec = time_usec;
  441. packet.uptime = uptime;
  442. packet.ram_usage = ram_usage;
  443. packet.ram_total = ram_total;
  444. packet.type = type;
  445. packet.temperature_board = temperature_board;
  446. mav_array_memcpy(packet.storage_type, storage_type, sizeof(uint32_t)*4);
  447. mav_array_memcpy(packet.storage_usage, storage_usage, sizeof(uint32_t)*4);
  448. mav_array_memcpy(packet.storage_total, storage_total, sizeof(uint32_t)*4);
  449. mav_array_memcpy(packet.link_type, link_type, sizeof(uint32_t)*6);
  450. mav_array_memcpy(packet.link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  451. mav_array_memcpy(packet.link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  452. mav_array_memcpy(packet.link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  453. mav_array_memcpy(packet.link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  454. mav_array_memcpy(packet.fan_speed, fan_speed, sizeof(int16_t)*4);
  455. mav_array_memcpy(packet.cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  456. mav_array_memcpy(packet.cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  457. mav_array_memcpy(packet.gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  458. mav_array_memcpy(packet.gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  459. mav_array_memcpy(packet.temperature_core, temperature_core, sizeof(int8_t)*8);
  460. _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);
  461. #endif
  462. }
  463. /**
  464. * @brief Send a onboard_computer_status message
  465. * @param chan MAVLink channel to send the message
  466. * @param struct The MAVLink struct to serialize
  467. */
  468. static inline void mavlink_msg_onboard_computer_status_send_struct(mavlink_channel_t chan, const mavlink_onboard_computer_status_t* onboard_computer_status)
  469. {
  470. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  471. 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);
  472. #else
  473. _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);
  474. #endif
  475. }
  476. #if MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  477. /*
  478. This variant of _send() can be used to save stack space by re-using
  479. memory from the receive buffer. The caller provides a
  480. mavlink_message_t which is the size of a full mavlink message. This
  481. is usually the receive buffer for the channel, and allows a reply to an
  482. incoming message with minimum stack space usage.
  483. */
  484. 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)
  485. {
  486. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  487. char *buf = (char *)msgbuf;
  488. _mav_put_uint64_t(buf, 0, time_usec);
  489. _mav_put_uint32_t(buf, 8, uptime);
  490. _mav_put_uint32_t(buf, 12, ram_usage);
  491. _mav_put_uint32_t(buf, 16, ram_total);
  492. _mav_put_uint8_t(buf, 196, type);
  493. _mav_put_int8_t(buf, 229, temperature_board);
  494. _mav_put_uint32_t_array(buf, 20, storage_type, 4);
  495. _mav_put_uint32_t_array(buf, 36, storage_usage, 4);
  496. _mav_put_uint32_t_array(buf, 52, storage_total, 4);
  497. _mav_put_uint32_t_array(buf, 68, link_type, 6);
  498. _mav_put_uint32_t_array(buf, 92, link_tx_rate, 6);
  499. _mav_put_uint32_t_array(buf, 116, link_rx_rate, 6);
  500. _mav_put_uint32_t_array(buf, 140, link_tx_max, 6);
  501. _mav_put_uint32_t_array(buf, 164, link_rx_max, 6);
  502. _mav_put_int16_t_array(buf, 188, fan_speed, 4);
  503. _mav_put_uint8_t_array(buf, 197, cpu_cores, 8);
  504. _mav_put_uint8_t_array(buf, 205, cpu_combined, 10);
  505. _mav_put_uint8_t_array(buf, 215, gpu_cores, 4);
  506. _mav_put_uint8_t_array(buf, 219, gpu_combined, 10);
  507. _mav_put_int8_t_array(buf, 230, temperature_core, 8);
  508. _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);
  509. #else
  510. mavlink_onboard_computer_status_t *packet = (mavlink_onboard_computer_status_t *)msgbuf;
  511. packet->time_usec = time_usec;
  512. packet->uptime = uptime;
  513. packet->ram_usage = ram_usage;
  514. packet->ram_total = ram_total;
  515. packet->type = type;
  516. packet->temperature_board = temperature_board;
  517. mav_array_memcpy(packet->storage_type, storage_type, sizeof(uint32_t)*4);
  518. mav_array_memcpy(packet->storage_usage, storage_usage, sizeof(uint32_t)*4);
  519. mav_array_memcpy(packet->storage_total, storage_total, sizeof(uint32_t)*4);
  520. mav_array_memcpy(packet->link_type, link_type, sizeof(uint32_t)*6);
  521. mav_array_memcpy(packet->link_tx_rate, link_tx_rate, sizeof(uint32_t)*6);
  522. mav_array_memcpy(packet->link_rx_rate, link_rx_rate, sizeof(uint32_t)*6);
  523. mav_array_memcpy(packet->link_tx_max, link_tx_max, sizeof(uint32_t)*6);
  524. mav_array_memcpy(packet->link_rx_max, link_rx_max, sizeof(uint32_t)*6);
  525. mav_array_memcpy(packet->fan_speed, fan_speed, sizeof(int16_t)*4);
  526. mav_array_memcpy(packet->cpu_cores, cpu_cores, sizeof(uint8_t)*8);
  527. mav_array_memcpy(packet->cpu_combined, cpu_combined, sizeof(uint8_t)*10);
  528. mav_array_memcpy(packet->gpu_cores, gpu_cores, sizeof(uint8_t)*4);
  529. mav_array_memcpy(packet->gpu_combined, gpu_combined, sizeof(uint8_t)*10);
  530. mav_array_memcpy(packet->temperature_core, temperature_core, sizeof(int8_t)*8);
  531. _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);
  532. #endif
  533. }
  534. #endif
  535. #endif
  536. // MESSAGE ONBOARD_COMPUTER_STATUS UNPACKING
  537. /**
  538. * @brief Get field time_usec from onboard_computer_status message
  539. *
  540. * @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.
  541. */
  542. static inline uint64_t mavlink_msg_onboard_computer_status_get_time_usec(const mavlink_message_t* msg)
  543. {
  544. return _MAV_RETURN_uint64_t(msg, 0);
  545. }
  546. /**
  547. * @brief Get field uptime from onboard_computer_status message
  548. *
  549. * @return [ms] Time since system boot.
  550. */
  551. static inline uint32_t mavlink_msg_onboard_computer_status_get_uptime(const mavlink_message_t* msg)
  552. {
  553. return _MAV_RETURN_uint32_t(msg, 8);
  554. }
  555. /**
  556. * @brief Get field type from onboard_computer_status message
  557. *
  558. * @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.
  559. */
  560. static inline uint8_t mavlink_msg_onboard_computer_status_get_type(const mavlink_message_t* msg)
  561. {
  562. return _MAV_RETURN_uint8_t(msg, 196);
  563. }
  564. /**
  565. * @brief Get field cpu_cores from onboard_computer_status message
  566. *
  567. * @return CPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  568. */
  569. static inline uint16_t mavlink_msg_onboard_computer_status_get_cpu_cores(const mavlink_message_t* msg, uint8_t *cpu_cores)
  570. {
  571. return _MAV_RETURN_uint8_t_array(msg, cpu_cores, 8, 197);
  572. }
  573. /**
  574. * @brief Get field cpu_combined from onboard_computer_status message
  575. *
  576. * @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.
  577. */
  578. static inline uint16_t mavlink_msg_onboard_computer_status_get_cpu_combined(const mavlink_message_t* msg, uint8_t *cpu_combined)
  579. {
  580. return _MAV_RETURN_uint8_t_array(msg, cpu_combined, 10, 205);
  581. }
  582. /**
  583. * @brief Get field gpu_cores from onboard_computer_status message
  584. *
  585. * @return GPU usage on the component in percent (100 - idle). A value of UINT8_MAX implies the field is unused.
  586. */
  587. static inline uint16_t mavlink_msg_onboard_computer_status_get_gpu_cores(const mavlink_message_t* msg, uint8_t *gpu_cores)
  588. {
  589. return _MAV_RETURN_uint8_t_array(msg, gpu_cores, 4, 215);
  590. }
  591. /**
  592. * @brief Get field gpu_combined from onboard_computer_status message
  593. *
  594. * @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.
  595. */
  596. static inline uint16_t mavlink_msg_onboard_computer_status_get_gpu_combined(const mavlink_message_t* msg, uint8_t *gpu_combined)
  597. {
  598. return _MAV_RETURN_uint8_t_array(msg, gpu_combined, 10, 219);
  599. }
  600. /**
  601. * @brief Get field temperature_board from onboard_computer_status message
  602. *
  603. * @return [degC] Temperature of the board. A value of INT8_MAX implies the field is unused.
  604. */
  605. static inline int8_t mavlink_msg_onboard_computer_status_get_temperature_board(const mavlink_message_t* msg)
  606. {
  607. return _MAV_RETURN_int8_t(msg, 229);
  608. }
  609. /**
  610. * @brief Get field temperature_core from onboard_computer_status message
  611. *
  612. * @return [degC] Temperature of the CPU core. A value of INT8_MAX implies the field is unused.
  613. */
  614. static inline uint16_t mavlink_msg_onboard_computer_status_get_temperature_core(const mavlink_message_t* msg, int8_t *temperature_core)
  615. {
  616. return _MAV_RETURN_int8_t_array(msg, temperature_core, 8, 230);
  617. }
  618. /**
  619. * @brief Get field fan_speed from onboard_computer_status message
  620. *
  621. * @return [rpm] Fan speeds. A value of INT16_MAX implies the field is unused.
  622. */
  623. static inline uint16_t mavlink_msg_onboard_computer_status_get_fan_speed(const mavlink_message_t* msg, int16_t *fan_speed)
  624. {
  625. return _MAV_RETURN_int16_t_array(msg, fan_speed, 4, 188);
  626. }
  627. /**
  628. * @brief Get field ram_usage from onboard_computer_status message
  629. *
  630. * @return [MiB] Amount of used RAM on the component system. A value of UINT32_MAX implies the field is unused.
  631. */
  632. static inline uint32_t mavlink_msg_onboard_computer_status_get_ram_usage(const mavlink_message_t* msg)
  633. {
  634. return _MAV_RETURN_uint32_t(msg, 12);
  635. }
  636. /**
  637. * @brief Get field ram_total from onboard_computer_status message
  638. *
  639. * @return [MiB] Total amount of RAM on the component system. A value of UINT32_MAX implies the field is unused.
  640. */
  641. static inline uint32_t mavlink_msg_onboard_computer_status_get_ram_total(const mavlink_message_t* msg)
  642. {
  643. return _MAV_RETURN_uint32_t(msg, 16);
  644. }
  645. /**
  646. * @brief Get field storage_type from onboard_computer_status message
  647. *
  648. * @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.
  649. */
  650. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_type(const mavlink_message_t* msg, uint32_t *storage_type)
  651. {
  652. return _MAV_RETURN_uint32_t_array(msg, storage_type, 4, 20);
  653. }
  654. /**
  655. * @brief Get field storage_usage from onboard_computer_status message
  656. *
  657. * @return [MiB] Amount of used storage space on the component system. A value of UINT32_MAX implies the field is unused.
  658. */
  659. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_usage(const mavlink_message_t* msg, uint32_t *storage_usage)
  660. {
  661. return _MAV_RETURN_uint32_t_array(msg, storage_usage, 4, 36);
  662. }
  663. /**
  664. * @brief Get field storage_total from onboard_computer_status message
  665. *
  666. * @return [MiB] Total amount of storage space on the component system. A value of UINT32_MAX implies the field is unused.
  667. */
  668. static inline uint16_t mavlink_msg_onboard_computer_status_get_storage_total(const mavlink_message_t* msg, uint32_t *storage_total)
  669. {
  670. return _MAV_RETURN_uint32_t_array(msg, storage_total, 4, 52);
  671. }
  672. /**
  673. * @brief Get field link_type from onboard_computer_status message
  674. *
  675. * @return Link type: 0-9: UART, 10-19: Wired network, 20-29: Wifi, 30-39: Point-to-point proprietary, 40-49: Mesh proprietary
  676. */
  677. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_type(const mavlink_message_t* msg, uint32_t *link_type)
  678. {
  679. return _MAV_RETURN_uint32_t_array(msg, link_type, 6, 68);
  680. }
  681. /**
  682. * @brief Get field link_tx_rate from onboard_computer_status message
  683. *
  684. * @return [KiB/s] Network traffic from the component system. A value of UINT32_MAX implies the field is unused.
  685. */
  686. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_tx_rate(const mavlink_message_t* msg, uint32_t *link_tx_rate)
  687. {
  688. return _MAV_RETURN_uint32_t_array(msg, link_tx_rate, 6, 92);
  689. }
  690. /**
  691. * @brief Get field link_rx_rate from onboard_computer_status message
  692. *
  693. * @return [KiB/s] Network traffic to the component system. A value of UINT32_MAX implies the field is unused.
  694. */
  695. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_rx_rate(const mavlink_message_t* msg, uint32_t *link_rx_rate)
  696. {
  697. return _MAV_RETURN_uint32_t_array(msg, link_rx_rate, 6, 116);
  698. }
  699. /**
  700. * @brief Get field link_tx_max from onboard_computer_status message
  701. *
  702. * @return [KiB/s] Network capacity from the component system. A value of UINT32_MAX implies the field is unused.
  703. */
  704. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_tx_max(const mavlink_message_t* msg, uint32_t *link_tx_max)
  705. {
  706. return _MAV_RETURN_uint32_t_array(msg, link_tx_max, 6, 140);
  707. }
  708. /**
  709. * @brief Get field link_rx_max from onboard_computer_status message
  710. *
  711. * @return [KiB/s] Network capacity to the component system. A value of UINT32_MAX implies the field is unused.
  712. */
  713. static inline uint16_t mavlink_msg_onboard_computer_status_get_link_rx_max(const mavlink_message_t* msg, uint32_t *link_rx_max)
  714. {
  715. return _MAV_RETURN_uint32_t_array(msg, link_rx_max, 6, 164);
  716. }
  717. /**
  718. * @brief Decode a onboard_computer_status message into a struct
  719. *
  720. * @param msg The message to decode
  721. * @param onboard_computer_status C-struct to decode the message contents into
  722. */
  723. static inline void mavlink_msg_onboard_computer_status_decode(const mavlink_message_t* msg, mavlink_onboard_computer_status_t* onboard_computer_status)
  724. {
  725. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  726. onboard_computer_status->time_usec = mavlink_msg_onboard_computer_status_get_time_usec(msg);
  727. onboard_computer_status->uptime = mavlink_msg_onboard_computer_status_get_uptime(msg);
  728. onboard_computer_status->ram_usage = mavlink_msg_onboard_computer_status_get_ram_usage(msg);
  729. onboard_computer_status->ram_total = mavlink_msg_onboard_computer_status_get_ram_total(msg);
  730. mavlink_msg_onboard_computer_status_get_storage_type(msg, onboard_computer_status->storage_type);
  731. mavlink_msg_onboard_computer_status_get_storage_usage(msg, onboard_computer_status->storage_usage);
  732. mavlink_msg_onboard_computer_status_get_storage_total(msg, onboard_computer_status->storage_total);
  733. mavlink_msg_onboard_computer_status_get_link_type(msg, onboard_computer_status->link_type);
  734. mavlink_msg_onboard_computer_status_get_link_tx_rate(msg, onboard_computer_status->link_tx_rate);
  735. mavlink_msg_onboard_computer_status_get_link_rx_rate(msg, onboard_computer_status->link_rx_rate);
  736. mavlink_msg_onboard_computer_status_get_link_tx_max(msg, onboard_computer_status->link_tx_max);
  737. mavlink_msg_onboard_computer_status_get_link_rx_max(msg, onboard_computer_status->link_rx_max);
  738. mavlink_msg_onboard_computer_status_get_fan_speed(msg, onboard_computer_status->fan_speed);
  739. onboard_computer_status->type = mavlink_msg_onboard_computer_status_get_type(msg);
  740. mavlink_msg_onboard_computer_status_get_cpu_cores(msg, onboard_computer_status->cpu_cores);
  741. mavlink_msg_onboard_computer_status_get_cpu_combined(msg, onboard_computer_status->cpu_combined);
  742. mavlink_msg_onboard_computer_status_get_gpu_cores(msg, onboard_computer_status->gpu_cores);
  743. mavlink_msg_onboard_computer_status_get_gpu_combined(msg, onboard_computer_status->gpu_combined);
  744. onboard_computer_status->temperature_board = mavlink_msg_onboard_computer_status_get_temperature_board(msg);
  745. mavlink_msg_onboard_computer_status_get_temperature_core(msg, onboard_computer_status->temperature_core);
  746. #else
  747. uint8_t len = msg->len < MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN? msg->len : MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN;
  748. memset(onboard_computer_status, 0, MAVLINK_MSG_ID_ONBOARD_COMPUTER_STATUS_LEN);
  749. memcpy(onboard_computer_status, _MAV_PAYLOAD(msg), len);
  750. #endif
  751. }