mavlink_msg_current_event_sequence.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. #pragma once
  2. // MESSAGE CURRENT_EVENT_SEQUENCE PACKING
  3. #define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE 411
  4. typedef struct __mavlink_current_event_sequence_t {
  5. uint16_t sequence; /*< Sequence number.*/
  6. uint8_t flags; /*< Flag bitset.*/
  7. } mavlink_current_event_sequence_t;
  8. #define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN 3
  9. #define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN 3
  10. #define MAVLINK_MSG_ID_411_LEN 3
  11. #define MAVLINK_MSG_ID_411_MIN_LEN 3
  12. #define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC 106
  13. #define MAVLINK_MSG_ID_411_CRC 106
  14. #if MAVLINK_COMMAND_24BIT
  15. #define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE { \
  16. 411, \
  17. "CURRENT_EVENT_SEQUENCE", \
  18. 2, \
  19. { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) }, \
  20. { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) }, \
  21. } \
  22. }
  23. #else
  24. #define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE { \
  25. "CURRENT_EVENT_SEQUENCE", \
  26. 2, \
  27. { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) }, \
  28. { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) }, \
  29. } \
  30. }
  31. #endif
  32. /**
  33. * @brief Pack a current_event_sequence message
  34. * @param system_id ID of this system
  35. * @param component_id ID of this component (e.g. 200 for IMU)
  36. * @param msg The MAVLink message to compress the data into
  37. *
  38. * @param sequence Sequence number.
  39. * @param flags Flag bitset.
  40. * @return length of the message in bytes (excluding serial stream start sign)
  41. */
  42. MAVLINK_WIP
  43. static inline uint16_t mavlink_msg_current_event_sequence_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  44. uint16_t sequence, uint8_t flags)
  45. {
  46. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  47. char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN];
  48. _mav_put_uint16_t(buf, 0, sequence);
  49. _mav_put_uint8_t(buf, 2, flags);
  50. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  51. #else
  52. mavlink_current_event_sequence_t packet;
  53. packet.sequence = sequence;
  54. packet.flags = flags;
  55. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  56. #endif
  57. msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE;
  58. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  59. }
  60. /**
  61. * @brief Pack a current_event_sequence message
  62. * @param system_id ID of this system
  63. * @param component_id ID of this component (e.g. 200 for IMU)
  64. * @param status MAVLink status structure
  65. * @param msg The MAVLink message to compress the data into
  66. *
  67. * @param sequence Sequence number.
  68. * @param flags Flag bitset.
  69. * @return length of the message in bytes (excluding serial stream start sign)
  70. */
  71. static inline uint16_t mavlink_msg_current_event_sequence_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  72. uint16_t sequence, uint8_t flags)
  73. {
  74. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  75. char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN];
  76. _mav_put_uint16_t(buf, 0, sequence);
  77. _mav_put_uint8_t(buf, 2, flags);
  78. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  79. #else
  80. mavlink_current_event_sequence_t packet;
  81. packet.sequence = sequence;
  82. packet.flags = flags;
  83. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  84. #endif
  85. msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE;
  86. #if MAVLINK_CRC_EXTRA
  87. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  88. #else
  89. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  90. #endif
  91. }
  92. /**
  93. * @brief Pack a current_event_sequence message on a channel
  94. * @param system_id ID of this system
  95. * @param component_id ID of this component (e.g. 200 for IMU)
  96. * @param chan The MAVLink channel this message will be sent over
  97. * @param msg The MAVLink message to compress the data into
  98. * @param sequence Sequence number.
  99. * @param flags Flag bitset.
  100. * @return length of the message in bytes (excluding serial stream start sign)
  101. */
  102. MAVLINK_WIP
  103. static inline uint16_t mavlink_msg_current_event_sequence_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  104. mavlink_message_t* msg,
  105. uint16_t sequence,uint8_t flags)
  106. {
  107. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  108. char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN];
  109. _mav_put_uint16_t(buf, 0, sequence);
  110. _mav_put_uint8_t(buf, 2, flags);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  112. #else
  113. mavlink_current_event_sequence_t packet;
  114. packet.sequence = sequence;
  115. packet.flags = flags;
  116. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  117. #endif
  118. msg->msgid = MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE;
  119. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  120. }
  121. /**
  122. * @brief Encode a current_event_sequence struct
  123. *
  124. * @param system_id ID of this system
  125. * @param component_id ID of this component (e.g. 200 for IMU)
  126. * @param msg The MAVLink message to compress the data into
  127. * @param current_event_sequence C-struct to read the message contents from
  128. */
  129. MAVLINK_WIP
  130. static inline uint16_t mavlink_msg_current_event_sequence_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
  131. {
  132. return mavlink_msg_current_event_sequence_pack(system_id, component_id, msg, current_event_sequence->sequence, current_event_sequence->flags);
  133. }
  134. /**
  135. * @brief Encode a current_event_sequence struct on a channel
  136. *
  137. * @param system_id ID of this system
  138. * @param component_id ID of this component (e.g. 200 for IMU)
  139. * @param chan The MAVLink channel this message will be sent over
  140. * @param msg The MAVLink message to compress the data into
  141. * @param current_event_sequence C-struct to read the message contents from
  142. */
  143. MAVLINK_WIP
  144. static inline uint16_t mavlink_msg_current_event_sequence_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
  145. {
  146. return mavlink_msg_current_event_sequence_pack_chan(system_id, component_id, chan, msg, current_event_sequence->sequence, current_event_sequence->flags);
  147. }
  148. /**
  149. * @brief Encode a current_event_sequence struct with provided status structure
  150. *
  151. * @param system_id ID of this system
  152. * @param component_id ID of this component (e.g. 200 for IMU)
  153. * @param status MAVLink status structure
  154. * @param msg The MAVLink message to compress the data into
  155. * @param current_event_sequence C-struct to read the message contents from
  156. */
  157. static inline uint16_t mavlink_msg_current_event_sequence_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
  158. {
  159. return mavlink_msg_current_event_sequence_pack_status(system_id, component_id, _status, msg, current_event_sequence->sequence, current_event_sequence->flags);
  160. }
  161. /**
  162. * @brief Send a current_event_sequence message
  163. * @param chan MAVLink channel to send the message
  164. *
  165. * @param sequence Sequence number.
  166. * @param flags Flag bitset.
  167. */
  168. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  169. MAVLINK_WIP
  170. static inline void mavlink_msg_current_event_sequence_send(mavlink_channel_t chan, uint16_t sequence, uint8_t flags)
  171. {
  172. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  173. char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN];
  174. _mav_put_uint16_t(buf, 0, sequence);
  175. _mav_put_uint8_t(buf, 2, flags);
  176. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  177. #else
  178. mavlink_current_event_sequence_t packet;
  179. packet.sequence = sequence;
  180. packet.flags = flags;
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)&packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  182. #endif
  183. }
  184. /**
  185. * @brief Send a current_event_sequence message
  186. * @param chan MAVLink channel to send the message
  187. * @param struct The MAVLink struct to serialize
  188. */
  189. MAVLINK_WIP
  190. static inline void mavlink_msg_current_event_sequence_send_struct(mavlink_channel_t chan, const mavlink_current_event_sequence_t* current_event_sequence)
  191. {
  192. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  193. mavlink_msg_current_event_sequence_send(chan, current_event_sequence->sequence, current_event_sequence->flags);
  194. #else
  195. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)current_event_sequence, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  196. #endif
  197. }
  198. #if MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  199. /*
  200. This variant of _send() can be used to save stack space by reusing
  201. memory from the receive buffer. The caller provides a
  202. mavlink_message_t which is the size of a full mavlink message. This
  203. is usually the receive buffer for the channel, and allows a reply to an
  204. incoming message with minimum stack space usage.
  205. */
  206. MAVLINK_WIP
  207. static inline void mavlink_msg_current_event_sequence_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t sequence, uint8_t flags)
  208. {
  209. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  210. char *buf = (char *)msgbuf;
  211. _mav_put_uint16_t(buf, 0, sequence);
  212. _mav_put_uint8_t(buf, 2, flags);
  213. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  214. #else
  215. mavlink_current_event_sequence_t *packet = (mavlink_current_event_sequence_t *)msgbuf;
  216. packet->sequence = sequence;
  217. packet->flags = flags;
  218. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
  219. #endif
  220. }
  221. #endif
  222. #endif
  223. // MESSAGE CURRENT_EVENT_SEQUENCE UNPACKING
  224. /**
  225. * @brief Get field sequence from current_event_sequence message
  226. *
  227. * @return Sequence number.
  228. */
  229. MAVLINK_WIP
  230. static inline uint16_t mavlink_msg_current_event_sequence_get_sequence(const mavlink_message_t* msg)
  231. {
  232. return _MAV_RETURN_uint16_t(msg, 0);
  233. }
  234. /**
  235. * @brief Get field flags from current_event_sequence message
  236. *
  237. * @return Flag bitset.
  238. */
  239. MAVLINK_WIP
  240. static inline uint8_t mavlink_msg_current_event_sequence_get_flags(const mavlink_message_t* msg)
  241. {
  242. return _MAV_RETURN_uint8_t(msg, 2);
  243. }
  244. /**
  245. * @brief Decode a current_event_sequence message into a struct
  246. *
  247. * @param msg The message to decode
  248. * @param current_event_sequence C-struct to decode the message contents into
  249. */
  250. MAVLINK_WIP
  251. static inline void mavlink_msg_current_event_sequence_decode(const mavlink_message_t* msg, mavlink_current_event_sequence_t* current_event_sequence)
  252. {
  253. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  254. current_event_sequence->sequence = mavlink_msg_current_event_sequence_get_sequence(msg);
  255. current_event_sequence->flags = mavlink_msg_current_event_sequence_get_flags(msg);
  256. #else
  257. uint8_t len = msg->len < MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN? msg->len : MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN;
  258. memset(current_event_sequence, 0, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
  259. memcpy(current_event_sequence, _MAV_PAYLOAD(msg), len);
  260. #endif
  261. }