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.

313 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE MISSION_CHANGED PACKING
  3. #define MAVLINK_MSG_ID_MISSION_CHANGED 52
  4. MAVPACKED(
  5. typedef struct __mavlink_mission_changed_t {
  6. int16_t start_index; /*< Start index for partial mission change (-1 for all items).*/
  7. int16_t end_index; /*< End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.*/
  8. uint8_t origin_sysid; /*< System ID of the author of the new mission.*/
  9. uint8_t origin_compid; /*< Compnent ID of the author of the new mission.*/
  10. uint8_t mission_type; /*< Mission type.*/
  11. }) mavlink_mission_changed_t;
  12. #define MAVLINK_MSG_ID_MISSION_CHANGED_LEN 7
  13. #define MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN 7
  14. #define MAVLINK_MSG_ID_52_LEN 7
  15. #define MAVLINK_MSG_ID_52_MIN_LEN 7
  16. #define MAVLINK_MSG_ID_MISSION_CHANGED_CRC 132
  17. #define MAVLINK_MSG_ID_52_CRC 132
  18. #if MAVLINK_COMMAND_24BIT
  19. #define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \
  20. 52, \
  21. "MISSION_CHANGED", \
  22. 5, \
  23. { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \
  24. { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \
  25. { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \
  26. { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \
  27. { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \
  28. } \
  29. }
  30. #else
  31. #define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \
  32. "MISSION_CHANGED", \
  33. 5, \
  34. { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \
  35. { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \
  36. { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \
  37. { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \
  38. { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \
  39. } \
  40. }
  41. #endif
  42. /**
  43. * @brief Pack a mission_changed message
  44. * @param system_id ID of this system
  45. * @param component_id ID of this component (e.g. 200 for IMU)
  46. * @param msg The MAVLink message to compress the data into
  47. *
  48. * @param start_index Start index for partial mission change (-1 for all items).
  49. * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.
  50. * @param origin_sysid System ID of the author of the new mission.
  51. * @param origin_compid Compnent ID of the author of the new mission.
  52. * @param mission_type Mission type.
  53. * @return length of the message in bytes (excluding serial stream start sign)
  54. */
  55. static inline uint16_t mavlink_msg_mission_changed_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  56. int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type)
  57. {
  58. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  59. char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
  60. _mav_put_int16_t(buf, 0, start_index);
  61. _mav_put_int16_t(buf, 2, end_index);
  62. _mav_put_uint8_t(buf, 4, origin_sysid);
  63. _mav_put_uint8_t(buf, 5, origin_compid);
  64. _mav_put_uint8_t(buf, 6, mission_type);
  65. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
  66. #else
  67. mavlink_mission_changed_t packet;
  68. packet.start_index = start_index;
  69. packet.end_index = end_index;
  70. packet.origin_sysid = origin_sysid;
  71. packet.origin_compid = origin_compid;
  72. packet.mission_type = mission_type;
  73. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
  74. #endif
  75. msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED;
  76. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  77. }
  78. /**
  79. * @brief Pack a mission_changed message on a channel
  80. * @param system_id ID of this system
  81. * @param component_id ID of this component (e.g. 200 for IMU)
  82. * @param chan The MAVLink channel this message will be sent over
  83. * @param msg The MAVLink message to compress the data into
  84. * @param start_index Start index for partial mission change (-1 for all items).
  85. * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.
  86. * @param origin_sysid System ID of the author of the new mission.
  87. * @param origin_compid Compnent ID of the author of the new mission.
  88. * @param mission_type Mission type.
  89. * @return length of the message in bytes (excluding serial stream start sign)
  90. */
  91. static inline uint16_t mavlink_msg_mission_changed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  92. mavlink_message_t* msg,
  93. int16_t start_index,int16_t end_index,uint8_t origin_sysid,uint8_t origin_compid,uint8_t mission_type)
  94. {
  95. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  96. char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
  97. _mav_put_int16_t(buf, 0, start_index);
  98. _mav_put_int16_t(buf, 2, end_index);
  99. _mav_put_uint8_t(buf, 4, origin_sysid);
  100. _mav_put_uint8_t(buf, 5, origin_compid);
  101. _mav_put_uint8_t(buf, 6, mission_type);
  102. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
  103. #else
  104. mavlink_mission_changed_t packet;
  105. packet.start_index = start_index;
  106. packet.end_index = end_index;
  107. packet.origin_sysid = origin_sysid;
  108. packet.origin_compid = origin_compid;
  109. packet.mission_type = mission_type;
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
  111. #endif
  112. msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED;
  113. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  114. }
  115. /**
  116. * @brief Encode a mission_changed struct
  117. *
  118. * @param system_id ID of this system
  119. * @param component_id ID of this component (e.g. 200 for IMU)
  120. * @param msg The MAVLink message to compress the data into
  121. * @param mission_changed C-struct to read the message contents from
  122. */
  123. static inline uint16_t mavlink_msg_mission_changed_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_changed_t* mission_changed)
  124. {
  125. return mavlink_msg_mission_changed_pack(system_id, component_id, msg, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type);
  126. }
  127. /**
  128. * @brief Encode a mission_changed struct on a channel
  129. *
  130. * @param system_id ID of this system
  131. * @param component_id ID of this component (e.g. 200 for IMU)
  132. * @param chan The MAVLink channel this message will be sent over
  133. * @param msg The MAVLink message to compress the data into
  134. * @param mission_changed C-struct to read the message contents from
  135. */
  136. static inline uint16_t mavlink_msg_mission_changed_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_changed_t* mission_changed)
  137. {
  138. return mavlink_msg_mission_changed_pack_chan(system_id, component_id, chan, msg, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type);
  139. }
  140. /**
  141. * @brief Send a mission_changed message
  142. * @param chan MAVLink channel to send the message
  143. *
  144. * @param start_index Start index for partial mission change (-1 for all items).
  145. * @param end_index End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.
  146. * @param origin_sysid System ID of the author of the new mission.
  147. * @param origin_compid Compnent ID of the author of the new mission.
  148. * @param mission_type Mission type.
  149. */
  150. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  151. static inline void mavlink_msg_mission_changed_send(mavlink_channel_t chan, int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type)
  152. {
  153. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  154. char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
  155. _mav_put_int16_t(buf, 0, start_index);
  156. _mav_put_int16_t(buf, 2, end_index);
  157. _mav_put_uint8_t(buf, 4, origin_sysid);
  158. _mav_put_uint8_t(buf, 5, origin_compid);
  159. _mav_put_uint8_t(buf, 6, mission_type);
  160. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, buf, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  161. #else
  162. mavlink_mission_changed_t packet;
  163. packet.start_index = start_index;
  164. packet.end_index = end_index;
  165. packet.origin_sysid = origin_sysid;
  166. packet.origin_compid = origin_compid;
  167. packet.mission_type = mission_type;
  168. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  169. #endif
  170. }
  171. /**
  172. * @brief Send a mission_changed message
  173. * @param chan MAVLink channel to send the message
  174. * @param struct The MAVLink struct to serialize
  175. */
  176. static inline void mavlink_msg_mission_changed_send_struct(mavlink_channel_t chan, const mavlink_mission_changed_t* mission_changed)
  177. {
  178. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  179. mavlink_msg_mission_changed_send(chan, mission_changed->start_index, mission_changed->end_index, mission_changed->origin_sysid, mission_changed->origin_compid, mission_changed->mission_type);
  180. #else
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)mission_changed, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  182. #endif
  183. }
  184. #if MAVLINK_MSG_ID_MISSION_CHANGED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  185. /*
  186. This varient of _send() can be used to save stack space by re-using
  187. memory from the receive buffer. The caller provides a
  188. mavlink_message_t which is the size of a full mavlink message. This
  189. is usually the receive buffer for the channel, and allows a reply to an
  190. incoming message with minimum stack space usage.
  191. */
  192. static inline void mavlink_msg_mission_changed_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type)
  193. {
  194. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  195. char *buf = (char *)msgbuf;
  196. _mav_put_int16_t(buf, 0, start_index);
  197. _mav_put_int16_t(buf, 2, end_index);
  198. _mav_put_uint8_t(buf, 4, origin_sysid);
  199. _mav_put_uint8_t(buf, 5, origin_compid);
  200. _mav_put_uint8_t(buf, 6, mission_type);
  201. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, buf, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  202. #else
  203. mavlink_mission_changed_t *packet = (mavlink_mission_changed_t *)msgbuf;
  204. packet->start_index = start_index;
  205. packet->end_index = end_index;
  206. packet->origin_sysid = origin_sysid;
  207. packet->origin_compid = origin_compid;
  208. packet->mission_type = mission_type;
  209. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CHANGED, (const char *)packet, MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_LEN, MAVLINK_MSG_ID_MISSION_CHANGED_CRC);
  210. #endif
  211. }
  212. #endif
  213. #endif
  214. // MESSAGE MISSION_CHANGED UNPACKING
  215. /**
  216. * @brief Get field start_index from mission_changed message
  217. *
  218. * @return Start index for partial mission change (-1 for all items).
  219. */
  220. static inline int16_t mavlink_msg_mission_changed_get_start_index(const mavlink_message_t* msg)
  221. {
  222. return _MAV_RETURN_int16_t(msg, 0);
  223. }
  224. /**
  225. * @brief Get field end_index from mission_changed message
  226. *
  227. * @return End index of a partial mission change. -1 is a synonym for the last mission item (i.e. selects all items from start_index). Ignore field if start_index=-1.
  228. */
  229. static inline int16_t mavlink_msg_mission_changed_get_end_index(const mavlink_message_t* msg)
  230. {
  231. return _MAV_RETURN_int16_t(msg, 2);
  232. }
  233. /**
  234. * @brief Get field origin_sysid from mission_changed message
  235. *
  236. * @return System ID of the author of the new mission.
  237. */
  238. static inline uint8_t mavlink_msg_mission_changed_get_origin_sysid(const mavlink_message_t* msg)
  239. {
  240. return _MAV_RETURN_uint8_t(msg, 4);
  241. }
  242. /**
  243. * @brief Get field origin_compid from mission_changed message
  244. *
  245. * @return Compnent ID of the author of the new mission.
  246. */
  247. static inline uint8_t mavlink_msg_mission_changed_get_origin_compid(const mavlink_message_t* msg)
  248. {
  249. return _MAV_RETURN_uint8_t(msg, 5);
  250. }
  251. /**
  252. * @brief Get field mission_type from mission_changed message
  253. *
  254. * @return Mission type.
  255. */
  256. static inline uint8_t mavlink_msg_mission_changed_get_mission_type(const mavlink_message_t* msg)
  257. {
  258. return _MAV_RETURN_uint8_t(msg, 6);
  259. }
  260. /**
  261. * @brief Decode a mission_changed message into a struct
  262. *
  263. * @param msg The message to decode
  264. * @param mission_changed C-struct to decode the message contents into
  265. */
  266. static inline void mavlink_msg_mission_changed_decode(const mavlink_message_t* msg, mavlink_mission_changed_t* mission_changed)
  267. {
  268. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  269. mission_changed->start_index = mavlink_msg_mission_changed_get_start_index(msg);
  270. mission_changed->end_index = mavlink_msg_mission_changed_get_end_index(msg);
  271. mission_changed->origin_sysid = mavlink_msg_mission_changed_get_origin_sysid(msg);
  272. mission_changed->origin_compid = mavlink_msg_mission_changed_get_origin_compid(msg);
  273. mission_changed->mission_type = mavlink_msg_mission_changed_get_mission_type(msg);
  274. #else
  275. uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CHANGED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CHANGED_LEN;
  276. memset(mission_changed, 0, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
  277. memcpy(mission_changed, _MAV_PAYLOAD(msg), len);
  278. #endif
  279. }