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