You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
7.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE MISSION_CURRENT PACKING
  3. #define MAVLINK_MSG_ID_MISSION_CURRENT 42
  4. MAVPACKED(
  5. typedef struct __mavlink_mission_current_t {
  6. uint16_t seq; /*< Sequence*/
  7. }) mavlink_mission_current_t;
  8. #define MAVLINK_MSG_ID_MISSION_CURRENT_LEN 2
  9. #define MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN 2
  10. #define MAVLINK_MSG_ID_42_LEN 2
  11. #define MAVLINK_MSG_ID_42_MIN_LEN 2
  12. #define MAVLINK_MSG_ID_MISSION_CURRENT_CRC 28
  13. #define MAVLINK_MSG_ID_42_CRC 28
  14. #if MAVLINK_COMMAND_24BIT
  15. #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \
  16. 42, \
  17. "MISSION_CURRENT", \
  18. 1, \
  19. { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \
  20. } \
  21. }
  22. #else
  23. #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \
  24. "MISSION_CURRENT", \
  25. 1, \
  26. { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \
  27. } \
  28. }
  29. #endif
  30. /**
  31. * @brief Pack a mission_current message
  32. * @param system_id ID of this system
  33. * @param component_id ID of this component (e.g. 200 for IMU)
  34. * @param msg The MAVLink message to compress the data into
  35. *
  36. * @param seq Sequence
  37. * @return length of the message in bytes (excluding serial stream start sign)
  38. */
  39. static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  40. uint16_t seq)
  41. {
  42. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  43. char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
  44. _mav_put_uint16_t(buf, 0, seq);
  45. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
  46. #else
  47. mavlink_mission_current_t packet;
  48. packet.seq = seq;
  49. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
  50. #endif
  51. msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT;
  52. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  53. }
  54. /**
  55. * @brief Pack a mission_current message on a channel
  56. * @param system_id ID of this system
  57. * @param component_id ID of this component (e.g. 200 for IMU)
  58. * @param chan The MAVLink channel this message will be sent over
  59. * @param msg The MAVLink message to compress the data into
  60. * @param seq Sequence
  61. * @return length of the message in bytes (excluding serial stream start sign)
  62. */
  63. static inline uint16_t mavlink_msg_mission_current_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  64. mavlink_message_t* msg,
  65. uint16_t seq)
  66. {
  67. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  68. char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
  69. _mav_put_uint16_t(buf, 0, seq);
  70. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
  71. #else
  72. mavlink_mission_current_t packet;
  73. packet.seq = seq;
  74. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
  75. #endif
  76. msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT;
  77. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  78. }
  79. /**
  80. * @brief Encode a mission_current struct
  81. *
  82. * @param system_id ID of this system
  83. * @param component_id ID of this component (e.g. 200 for IMU)
  84. * @param msg The MAVLink message to compress the data into
  85. * @param mission_current C-struct to read the message contents from
  86. */
  87. static inline uint16_t mavlink_msg_mission_current_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current)
  88. {
  89. return mavlink_msg_mission_current_pack(system_id, component_id, msg, mission_current->seq);
  90. }
  91. /**
  92. * @brief Encode a mission_current struct on a channel
  93. *
  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 mission_current C-struct to read the message contents from
  99. */
  100. static inline uint16_t mavlink_msg_mission_current_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current)
  101. {
  102. return mavlink_msg_mission_current_pack_chan(system_id, component_id, chan, msg, mission_current->seq);
  103. }
  104. /**
  105. * @brief Send a mission_current message
  106. * @param chan MAVLink channel to send the message
  107. *
  108. * @param seq Sequence
  109. */
  110. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  111. static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq)
  112. {
  113. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  114. char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN];
  115. _mav_put_uint16_t(buf, 0, seq);
  116. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  117. #else
  118. mavlink_mission_current_t packet;
  119. packet.seq = seq;
  120. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  121. #endif
  122. }
  123. /**
  124. * @brief Send a mission_current message
  125. * @param chan MAVLink channel to send the message
  126. * @param struct The MAVLink struct to serialize
  127. */
  128. static inline void mavlink_msg_mission_current_send_struct(mavlink_channel_t chan, const mavlink_mission_current_t* mission_current)
  129. {
  130. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  131. mavlink_msg_mission_current_send(chan, mission_current->seq);
  132. #else
  133. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)mission_current, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  134. #endif
  135. }
  136. #if MAVLINK_MSG_ID_MISSION_CURRENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  137. /*
  138. This varient of _send() can be used to save stack space by re-using
  139. memory from the receive buffer. The caller provides a
  140. mavlink_message_t which is the size of a full mavlink message. This
  141. is usually the receive buffer for the channel, and allows a reply to an
  142. incoming message with minimum stack space usage.
  143. */
  144. static inline void mavlink_msg_mission_current_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq)
  145. {
  146. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  147. char *buf = (char *)msgbuf;
  148. _mav_put_uint16_t(buf, 0, seq);
  149. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  150. #else
  151. mavlink_mission_current_t *packet = (mavlink_mission_current_t *)msgbuf;
  152. packet->seq = seq;
  153. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC);
  154. #endif
  155. }
  156. #endif
  157. #endif
  158. // MESSAGE MISSION_CURRENT UNPACKING
  159. /**
  160. * @brief Get field seq from mission_current message
  161. *
  162. * @return Sequence
  163. */
  164. static inline uint16_t mavlink_msg_mission_current_get_seq(const mavlink_message_t* msg)
  165. {
  166. return _MAV_RETURN_uint16_t(msg, 0);
  167. }
  168. /**
  169. * @brief Decode a mission_current message into a struct
  170. *
  171. * @param msg The message to decode
  172. * @param mission_current C-struct to decode the message contents into
  173. */
  174. static inline void mavlink_msg_mission_current_decode(const mavlink_message_t* msg, mavlink_mission_current_t* mission_current)
  175. {
  176. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  177. mission_current->seq = mavlink_msg_mission_current_get_seq(msg);
  178. #else
  179. uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CURRENT_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CURRENT_LEN;
  180. memset(mission_current, 0, MAVLINK_MSG_ID_MISSION_CURRENT_LEN);
  181. memcpy(mission_current, _MAV_PAYLOAD(msg), len);
  182. #endif
  183. }