mavlink_msg_event.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. #pragma once
  2. // MESSAGE EVENT PACKING
  3. #define MAVLINK_MSG_ID_EVENT 410
  4. typedef struct __mavlink_event_t {
  5. uint32_t id; /*< Event ID (as defined in the component metadata)*/
  6. uint32_t event_time_boot_ms; /*< [ms] Timestamp (time since system boot when the event happened).*/
  7. uint16_t sequence; /*< Sequence number.*/
  8. uint8_t destination_component; /*< Component ID*/
  9. uint8_t destination_system; /*< System ID*/
  10. uint8_t log_levels; /*< Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9*/
  11. uint8_t arguments[40]; /*< Arguments (depend on event ID).*/
  12. } mavlink_event_t;
  13. #define MAVLINK_MSG_ID_EVENT_LEN 53
  14. #define MAVLINK_MSG_ID_EVENT_MIN_LEN 53
  15. #define MAVLINK_MSG_ID_410_LEN 53
  16. #define MAVLINK_MSG_ID_410_MIN_LEN 53
  17. #define MAVLINK_MSG_ID_EVENT_CRC 160
  18. #define MAVLINK_MSG_ID_410_CRC 160
  19. #define MAVLINK_MSG_EVENT_FIELD_ARGUMENTS_LEN 40
  20. #if MAVLINK_COMMAND_24BIT
  21. #define MAVLINK_MESSAGE_INFO_EVENT { \
  22. 410, \
  23. "EVENT", \
  24. 7, \
  25. { { "destination_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_event_t, destination_component) }, \
  26. { "destination_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_event_t, destination_system) }, \
  27. { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_event_t, id) }, \
  28. { "event_time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_event_t, event_time_boot_ms) }, \
  29. { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_event_t, sequence) }, \
  30. { "log_levels", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_event_t, log_levels) }, \
  31. { "arguments", NULL, MAVLINK_TYPE_UINT8_T, 40, 13, offsetof(mavlink_event_t, arguments) }, \
  32. } \
  33. }
  34. #else
  35. #define MAVLINK_MESSAGE_INFO_EVENT { \
  36. "EVENT", \
  37. 7, \
  38. { { "destination_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_event_t, destination_component) }, \
  39. { "destination_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_event_t, destination_system) }, \
  40. { "id", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_event_t, id) }, \
  41. { "event_time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_event_t, event_time_boot_ms) }, \
  42. { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_event_t, sequence) }, \
  43. { "log_levels", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_event_t, log_levels) }, \
  44. { "arguments", NULL, MAVLINK_TYPE_UINT8_T, 40, 13, offsetof(mavlink_event_t, arguments) }, \
  45. } \
  46. }
  47. #endif
  48. /**
  49. * @brief Pack a event message
  50. * @param system_id ID of this system
  51. * @param component_id ID of this component (e.g. 200 for IMU)
  52. * @param msg The MAVLink message to compress the data into
  53. *
  54. * @param destination_component Component ID
  55. * @param destination_system System ID
  56. * @param id Event ID (as defined in the component metadata)
  57. * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened).
  58. * @param sequence Sequence number.
  59. * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9
  60. * @param arguments Arguments (depend on event ID).
  61. * @return length of the message in bytes (excluding serial stream start sign)
  62. */
  63. MAVLINK_WIP
  64. static inline uint16_t mavlink_msg_event_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  65. uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments)
  66. {
  67. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  68. char buf[MAVLINK_MSG_ID_EVENT_LEN];
  69. _mav_put_uint32_t(buf, 0, id);
  70. _mav_put_uint32_t(buf, 4, event_time_boot_ms);
  71. _mav_put_uint16_t(buf, 8, sequence);
  72. _mav_put_uint8_t(buf, 10, destination_component);
  73. _mav_put_uint8_t(buf, 11, destination_system);
  74. _mav_put_uint8_t(buf, 12, log_levels);
  75. _mav_put_uint8_t_array(buf, 13, arguments, 40);
  76. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN);
  77. #else
  78. mavlink_event_t packet;
  79. packet.id = id;
  80. packet.event_time_boot_ms = event_time_boot_ms;
  81. packet.sequence = sequence;
  82. packet.destination_component = destination_component;
  83. packet.destination_system = destination_system;
  84. packet.log_levels = log_levels;
  85. mav_array_assign_uint8_t(packet.arguments, arguments, 40);
  86. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN);
  87. #endif
  88. msg->msgid = MAVLINK_MSG_ID_EVENT;
  89. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  90. }
  91. /**
  92. * @brief Pack a event message
  93. * @param system_id ID of this system
  94. * @param component_id ID of this component (e.g. 200 for IMU)
  95. * @param status MAVLink status structure
  96. * @param msg The MAVLink message to compress the data into
  97. *
  98. * @param destination_component Component ID
  99. * @param destination_system System ID
  100. * @param id Event ID (as defined in the component metadata)
  101. * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened).
  102. * @param sequence Sequence number.
  103. * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9
  104. * @param arguments Arguments (depend on event ID).
  105. * @return length of the message in bytes (excluding serial stream start sign)
  106. */
  107. static inline uint16_t mavlink_msg_event_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  108. uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments)
  109. {
  110. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  111. char buf[MAVLINK_MSG_ID_EVENT_LEN];
  112. _mav_put_uint32_t(buf, 0, id);
  113. _mav_put_uint32_t(buf, 4, event_time_boot_ms);
  114. _mav_put_uint16_t(buf, 8, sequence);
  115. _mav_put_uint8_t(buf, 10, destination_component);
  116. _mav_put_uint8_t(buf, 11, destination_system);
  117. _mav_put_uint8_t(buf, 12, log_levels);
  118. _mav_put_uint8_t_array(buf, 13, arguments, 40);
  119. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN);
  120. #else
  121. mavlink_event_t packet;
  122. packet.id = id;
  123. packet.event_time_boot_ms = event_time_boot_ms;
  124. packet.sequence = sequence;
  125. packet.destination_component = destination_component;
  126. packet.destination_system = destination_system;
  127. packet.log_levels = log_levels;
  128. mav_array_memcpy(packet.arguments, arguments, sizeof(uint8_t)*40);
  129. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN);
  130. #endif
  131. msg->msgid = MAVLINK_MSG_ID_EVENT;
  132. #if MAVLINK_CRC_EXTRA
  133. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  134. #else
  135. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN);
  136. #endif
  137. }
  138. /**
  139. * @brief Pack a event message on a channel
  140. * @param system_id ID of this system
  141. * @param component_id ID of this component (e.g. 200 for IMU)
  142. * @param chan The MAVLink channel this message will be sent over
  143. * @param msg The MAVLink message to compress the data into
  144. * @param destination_component Component ID
  145. * @param destination_system System ID
  146. * @param id Event ID (as defined in the component metadata)
  147. * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened).
  148. * @param sequence Sequence number.
  149. * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9
  150. * @param arguments Arguments (depend on event ID).
  151. * @return length of the message in bytes (excluding serial stream start sign)
  152. */
  153. MAVLINK_WIP
  154. static inline uint16_t mavlink_msg_event_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  155. mavlink_message_t* msg,
  156. uint8_t destination_component,uint8_t destination_system,uint32_t id,uint32_t event_time_boot_ms,uint16_t sequence,uint8_t log_levels,const uint8_t *arguments)
  157. {
  158. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  159. char buf[MAVLINK_MSG_ID_EVENT_LEN];
  160. _mav_put_uint32_t(buf, 0, id);
  161. _mav_put_uint32_t(buf, 4, event_time_boot_ms);
  162. _mav_put_uint16_t(buf, 8, sequence);
  163. _mav_put_uint8_t(buf, 10, destination_component);
  164. _mav_put_uint8_t(buf, 11, destination_system);
  165. _mav_put_uint8_t(buf, 12, log_levels);
  166. _mav_put_uint8_t_array(buf, 13, arguments, 40);
  167. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EVENT_LEN);
  168. #else
  169. mavlink_event_t packet;
  170. packet.id = id;
  171. packet.event_time_boot_ms = event_time_boot_ms;
  172. packet.sequence = sequence;
  173. packet.destination_component = destination_component;
  174. packet.destination_system = destination_system;
  175. packet.log_levels = log_levels;
  176. mav_array_assign_uint8_t(packet.arguments, arguments, 40);
  177. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EVENT_LEN);
  178. #endif
  179. msg->msgid = MAVLINK_MSG_ID_EVENT;
  180. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  181. }
  182. /**
  183. * @brief Encode a event struct
  184. *
  185. * @param system_id ID of this system
  186. * @param component_id ID of this component (e.g. 200 for IMU)
  187. * @param msg The MAVLink message to compress the data into
  188. * @param event C-struct to read the message contents from
  189. */
  190. MAVLINK_WIP
  191. static inline uint16_t mavlink_msg_event_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_event_t* event)
  192. {
  193. return mavlink_msg_event_pack(system_id, component_id, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments);
  194. }
  195. /**
  196. * @brief Encode a event struct on a channel
  197. *
  198. * @param system_id ID of this system
  199. * @param component_id ID of this component (e.g. 200 for IMU)
  200. * @param chan The MAVLink channel this message will be sent over
  201. * @param msg The MAVLink message to compress the data into
  202. * @param event C-struct to read the message contents from
  203. */
  204. MAVLINK_WIP
  205. static inline uint16_t mavlink_msg_event_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_event_t* event)
  206. {
  207. return mavlink_msg_event_pack_chan(system_id, component_id, chan, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments);
  208. }
  209. /**
  210. * @brief Encode a event struct with provided status structure
  211. *
  212. * @param system_id ID of this system
  213. * @param component_id ID of this component (e.g. 200 for IMU)
  214. * @param status MAVLink status structure
  215. * @param msg The MAVLink message to compress the data into
  216. * @param event C-struct to read the message contents from
  217. */
  218. static inline uint16_t mavlink_msg_event_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_event_t* event)
  219. {
  220. return mavlink_msg_event_pack_status(system_id, component_id, _status, msg, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments);
  221. }
  222. /**
  223. * @brief Send a event message
  224. * @param chan MAVLink channel to send the message
  225. *
  226. * @param destination_component Component ID
  227. * @param destination_system System ID
  228. * @param id Event ID (as defined in the component metadata)
  229. * @param event_time_boot_ms [ms] Timestamp (time since system boot when the event happened).
  230. * @param sequence Sequence number.
  231. * @param log_levels Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9
  232. * @param arguments Arguments (depend on event ID).
  233. */
  234. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  235. MAVLINK_WIP
  236. static inline void mavlink_msg_event_send(mavlink_channel_t chan, uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments)
  237. {
  238. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  239. char buf[MAVLINK_MSG_ID_EVENT_LEN];
  240. _mav_put_uint32_t(buf, 0, id);
  241. _mav_put_uint32_t(buf, 4, event_time_boot_ms);
  242. _mav_put_uint16_t(buf, 8, sequence);
  243. _mav_put_uint8_t(buf, 10, destination_component);
  244. _mav_put_uint8_t(buf, 11, destination_system);
  245. _mav_put_uint8_t(buf, 12, log_levels);
  246. _mav_put_uint8_t_array(buf, 13, arguments, 40);
  247. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, buf, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  248. #else
  249. mavlink_event_t packet;
  250. packet.id = id;
  251. packet.event_time_boot_ms = event_time_boot_ms;
  252. packet.sequence = sequence;
  253. packet.destination_component = destination_component;
  254. packet.destination_system = destination_system;
  255. packet.log_levels = log_levels;
  256. mav_array_assign_uint8_t(packet.arguments, arguments, 40);
  257. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)&packet, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  258. #endif
  259. }
  260. /**
  261. * @brief Send a event message
  262. * @param chan MAVLink channel to send the message
  263. * @param struct The MAVLink struct to serialize
  264. */
  265. MAVLINK_WIP
  266. static inline void mavlink_msg_event_send_struct(mavlink_channel_t chan, const mavlink_event_t* event)
  267. {
  268. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  269. mavlink_msg_event_send(chan, event->destination_component, event->destination_system, event->id, event->event_time_boot_ms, event->sequence, event->log_levels, event->arguments);
  270. #else
  271. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)event, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  272. #endif
  273. }
  274. #if MAVLINK_MSG_ID_EVENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  275. /*
  276. This variant of _send() can be used to save stack space by reusing
  277. memory from the receive buffer. The caller provides a
  278. mavlink_message_t which is the size of a full mavlink message. This
  279. is usually the receive buffer for the channel, and allows a reply to an
  280. incoming message with minimum stack space usage.
  281. */
  282. MAVLINK_WIP
  283. static inline void mavlink_msg_event_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t destination_component, uint8_t destination_system, uint32_t id, uint32_t event_time_boot_ms, uint16_t sequence, uint8_t log_levels, const uint8_t *arguments)
  284. {
  285. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  286. char *buf = (char *)msgbuf;
  287. _mav_put_uint32_t(buf, 0, id);
  288. _mav_put_uint32_t(buf, 4, event_time_boot_ms);
  289. _mav_put_uint16_t(buf, 8, sequence);
  290. _mav_put_uint8_t(buf, 10, destination_component);
  291. _mav_put_uint8_t(buf, 11, destination_system);
  292. _mav_put_uint8_t(buf, 12, log_levels);
  293. _mav_put_uint8_t_array(buf, 13, arguments, 40);
  294. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, buf, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  295. #else
  296. mavlink_event_t *packet = (mavlink_event_t *)msgbuf;
  297. packet->id = id;
  298. packet->event_time_boot_ms = event_time_boot_ms;
  299. packet->sequence = sequence;
  300. packet->destination_component = destination_component;
  301. packet->destination_system = destination_system;
  302. packet->log_levels = log_levels;
  303. mav_array_assign_uint8_t(packet->arguments, arguments, 40);
  304. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EVENT, (const char *)packet, MAVLINK_MSG_ID_EVENT_MIN_LEN, MAVLINK_MSG_ID_EVENT_LEN, MAVLINK_MSG_ID_EVENT_CRC);
  305. #endif
  306. }
  307. #endif
  308. #endif
  309. // MESSAGE EVENT UNPACKING
  310. /**
  311. * @brief Get field destination_component from event message
  312. *
  313. * @return Component ID
  314. */
  315. MAVLINK_WIP
  316. static inline uint8_t mavlink_msg_event_get_destination_component(const mavlink_message_t* msg)
  317. {
  318. return _MAV_RETURN_uint8_t(msg, 10);
  319. }
  320. /**
  321. * @brief Get field destination_system from event message
  322. *
  323. * @return System ID
  324. */
  325. MAVLINK_WIP
  326. static inline uint8_t mavlink_msg_event_get_destination_system(const mavlink_message_t* msg)
  327. {
  328. return _MAV_RETURN_uint8_t(msg, 11);
  329. }
  330. /**
  331. * @brief Get field id from event message
  332. *
  333. * @return Event ID (as defined in the component metadata)
  334. */
  335. MAVLINK_WIP
  336. static inline uint32_t mavlink_msg_event_get_id(const mavlink_message_t* msg)
  337. {
  338. return _MAV_RETURN_uint32_t(msg, 0);
  339. }
  340. /**
  341. * @brief Get field event_time_boot_ms from event message
  342. *
  343. * @return [ms] Timestamp (time since system boot when the event happened).
  344. */
  345. MAVLINK_WIP
  346. static inline uint32_t mavlink_msg_event_get_event_time_boot_ms(const mavlink_message_t* msg)
  347. {
  348. return _MAV_RETURN_uint32_t(msg, 4);
  349. }
  350. /**
  351. * @brief Get field sequence from event message
  352. *
  353. * @return Sequence number.
  354. */
  355. MAVLINK_WIP
  356. static inline uint16_t mavlink_msg_event_get_sequence(const mavlink_message_t* msg)
  357. {
  358. return _MAV_RETURN_uint16_t(msg, 8);
  359. }
  360. /**
  361. * @brief Get field log_levels from event message
  362. *
  363. * @return Log levels: 4 bits MSB: internal (for logging purposes), 4 bits LSB: external. Levels: Emergency = 0, Alert = 1, Critical = 2, Error = 3, Warning = 4, Notice = 5, Info = 6, Debug = 7, Protocol = 8, Disabled = 9
  364. */
  365. MAVLINK_WIP
  366. static inline uint8_t mavlink_msg_event_get_log_levels(const mavlink_message_t* msg)
  367. {
  368. return _MAV_RETURN_uint8_t(msg, 12);
  369. }
  370. /**
  371. * @brief Get field arguments from event message
  372. *
  373. * @return Arguments (depend on event ID).
  374. */
  375. MAVLINK_WIP
  376. static inline uint16_t mavlink_msg_event_get_arguments(const mavlink_message_t* msg, uint8_t *arguments)
  377. {
  378. return _MAV_RETURN_uint8_t_array(msg, arguments, 40, 13);
  379. }
  380. /**
  381. * @brief Decode a event message into a struct
  382. *
  383. * @param msg The message to decode
  384. * @param event C-struct to decode the message contents into
  385. */
  386. MAVLINK_WIP
  387. static inline void mavlink_msg_event_decode(const mavlink_message_t* msg, mavlink_event_t* event)
  388. {
  389. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  390. event->id = mavlink_msg_event_get_id(msg);
  391. event->event_time_boot_ms = mavlink_msg_event_get_event_time_boot_ms(msg);
  392. event->sequence = mavlink_msg_event_get_sequence(msg);
  393. event->destination_component = mavlink_msg_event_get_destination_component(msg);
  394. event->destination_system = mavlink_msg_event_get_destination_system(msg);
  395. event->log_levels = mavlink_msg_event_get_log_levels(msg);
  396. mavlink_msg_event_get_arguments(msg, event->arguments);
  397. #else
  398. uint8_t len = msg->len < MAVLINK_MSG_ID_EVENT_LEN? msg->len : MAVLINK_MSG_ID_EVENT_LEN;
  399. memset(event, 0, MAVLINK_MSG_ID_EVENT_LEN);
  400. memcpy(event, _MAV_PAYLOAD(msg), len);
  401. #endif
  402. }