Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_mission_changed.h
blob28f75098e4667ee0f96781daf29c1f5ec88d0a29
1 #pragma once
2 // MESSAGE MISSION_CHANGED PACKING
4 #define MAVLINK_MSG_ID_MISSION_CHANGED 52
7 typedef struct __mavlink_mission_changed_t {
8 int16_t start_index; /*< Start index for partial mission change (-1 for all items).*/
9 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.*/
10 uint8_t origin_sysid; /*< System ID of the author of the new mission.*/
11 uint8_t origin_compid; /*< Compnent ID of the author of the new mission.*/
12 uint8_t mission_type; /*< Mission type.*/
13 } mavlink_mission_changed_t;
15 #define MAVLINK_MSG_ID_MISSION_CHANGED_LEN 7
16 #define MAVLINK_MSG_ID_MISSION_CHANGED_MIN_LEN 7
17 #define MAVLINK_MSG_ID_52_LEN 7
18 #define MAVLINK_MSG_ID_52_MIN_LEN 7
20 #define MAVLINK_MSG_ID_MISSION_CHANGED_CRC 132
21 #define MAVLINK_MSG_ID_52_CRC 132
25 #if MAVLINK_COMMAND_24BIT
26 #define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \
27 52, \
28 "MISSION_CHANGED", \
29 5, \
30 { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \
31 { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \
32 { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \
33 { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \
34 { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \
35 } \
37 #else
38 #define MAVLINK_MESSAGE_INFO_MISSION_CHANGED { \
39 "MISSION_CHANGED", \
40 5, \
41 { { "start_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_mission_changed_t, start_index) }, \
42 { "end_index", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_mission_changed_t, end_index) }, \
43 { "origin_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mission_changed_t, origin_sysid) }, \
44 { "origin_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mission_changed_t, origin_compid) }, \
45 { "mission_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_mission_changed_t, mission_type) }, \
46 } \
48 #endif
50 /**
51 * @brief Pack a mission_changed message
52 * @param system_id ID of this system
53 * @param component_id ID of this component (e.g. 200 for IMU)
54 * @param msg The MAVLink message to compress the data into
56 * @param start_index Start index for partial mission change (-1 for all items).
57 * @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.
58 * @param origin_sysid System ID of the author of the new mission.
59 * @param origin_compid Compnent ID of the author of the new mission.
60 * @param mission_type Mission type.
61 * @return length of the message in bytes (excluding serial stream start sign)
63 static inline uint16_t mavlink_msg_mission_changed_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
64 int16_t start_index, int16_t end_index, uint8_t origin_sysid, uint8_t origin_compid, uint8_t mission_type)
66 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67 char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
68 _mav_put_int16_t(buf, 0, start_index);
69 _mav_put_int16_t(buf, 2, end_index);
70 _mav_put_uint8_t(buf, 4, origin_sysid);
71 _mav_put_uint8_t(buf, 5, origin_compid);
72 _mav_put_uint8_t(buf, 6, mission_type);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
75 #else
76 mavlink_mission_changed_t packet;
77 packet.start_index = start_index;
78 packet.end_index = end_index;
79 packet.origin_sysid = origin_sysid;
80 packet.origin_compid = origin_compid;
81 packet.mission_type = mission_type;
83 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
84 #endif
86 msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED;
87 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);
90 /**
91 * @brief Pack a mission_changed message on a channel
92 * @param system_id ID of this system
93 * @param component_id ID of this component (e.g. 200 for IMU)
94 * @param chan The MAVLink channel this message will be sent over
95 * @param msg The MAVLink message to compress the data into
96 * @param start_index Start index for partial mission change (-1 for all items).
97 * @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.
98 * @param origin_sysid System ID of the author of the new mission.
99 * @param origin_compid Compnent ID of the author of the new mission.
100 * @param mission_type Mission type.
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_mission_changed_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104 mavlink_message_t* msg,
105 int16_t start_index,int16_t end_index,uint8_t origin_sysid,uint8_t origin_compid,uint8_t mission_type)
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
109 _mav_put_int16_t(buf, 0, start_index);
110 _mav_put_int16_t(buf, 2, end_index);
111 _mav_put_uint8_t(buf, 4, origin_sysid);
112 _mav_put_uint8_t(buf, 5, origin_compid);
113 _mav_put_uint8_t(buf, 6, mission_type);
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
116 #else
117 mavlink_mission_changed_t packet;
118 packet.start_index = start_index;
119 packet.end_index = end_index;
120 packet.origin_sysid = origin_sysid;
121 packet.origin_compid = origin_compid;
122 packet.mission_type = mission_type;
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
125 #endif
127 msg->msgid = MAVLINK_MSG_ID_MISSION_CHANGED;
128 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);
132 * @brief Encode a mission_changed struct
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param msg The MAVLink message to compress the data into
137 * @param mission_changed C-struct to read the message contents from
139 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)
141 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);
145 * @brief Encode a mission_changed struct on a channel
147 * @param system_id ID of this system
148 * @param component_id ID of this component (e.g. 200 for IMU)
149 * @param chan The MAVLink channel this message will be sent over
150 * @param msg The MAVLink message to compress the data into
151 * @param mission_changed C-struct to read the message contents from
153 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)
155 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);
159 * @brief Send a mission_changed message
160 * @param chan MAVLink channel to send the message
162 * @param start_index Start index for partial mission change (-1 for all items).
163 * @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.
164 * @param origin_sysid System ID of the author of the new mission.
165 * @param origin_compid Compnent ID of the author of the new mission.
166 * @param mission_type Mission type.
168 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
170 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)
172 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
173 char buf[MAVLINK_MSG_ID_MISSION_CHANGED_LEN];
174 _mav_put_int16_t(buf, 0, start_index);
175 _mav_put_int16_t(buf, 2, end_index);
176 _mav_put_uint8_t(buf, 4, origin_sysid);
177 _mav_put_uint8_t(buf, 5, origin_compid);
178 _mav_put_uint8_t(buf, 6, mission_type);
180 _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);
181 #else
182 mavlink_mission_changed_t packet;
183 packet.start_index = start_index;
184 packet.end_index = end_index;
185 packet.origin_sysid = origin_sysid;
186 packet.origin_compid = origin_compid;
187 packet.mission_type = mission_type;
189 _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);
190 #endif
194 * @brief Send a mission_changed message
195 * @param chan MAVLink channel to send the message
196 * @param struct The MAVLink struct to serialize
198 static inline void mavlink_msg_mission_changed_send_struct(mavlink_channel_t chan, const mavlink_mission_changed_t* mission_changed)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 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);
202 #else
203 _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);
204 #endif
207 #if MAVLINK_MSG_ID_MISSION_CHANGED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
209 This varient of _send() can be used to save stack space by re-using
210 memory from the receive buffer. The caller provides a
211 mavlink_message_t which is the size of a full mavlink message. This
212 is usually the receive buffer for the channel, and allows a reply to an
213 incoming message with minimum stack space usage.
215 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)
217 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
218 char *buf = (char *)msgbuf;
219 _mav_put_int16_t(buf, 0, start_index);
220 _mav_put_int16_t(buf, 2, end_index);
221 _mav_put_uint8_t(buf, 4, origin_sysid);
222 _mav_put_uint8_t(buf, 5, origin_compid);
223 _mav_put_uint8_t(buf, 6, mission_type);
225 _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);
226 #else
227 mavlink_mission_changed_t *packet = (mavlink_mission_changed_t *)msgbuf;
228 packet->start_index = start_index;
229 packet->end_index = end_index;
230 packet->origin_sysid = origin_sysid;
231 packet->origin_compid = origin_compid;
232 packet->mission_type = mission_type;
234 _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);
235 #endif
237 #endif
239 #endif
241 // MESSAGE MISSION_CHANGED UNPACKING
245 * @brief Get field start_index from mission_changed message
247 * @return Start index for partial mission change (-1 for all items).
249 static inline int16_t mavlink_msg_mission_changed_get_start_index(const mavlink_message_t* msg)
251 return _MAV_RETURN_int16_t(msg, 0);
255 * @brief Get field end_index from mission_changed message
257 * @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.
259 static inline int16_t mavlink_msg_mission_changed_get_end_index(const mavlink_message_t* msg)
261 return _MAV_RETURN_int16_t(msg, 2);
265 * @brief Get field origin_sysid from mission_changed message
267 * @return System ID of the author of the new mission.
269 static inline uint8_t mavlink_msg_mission_changed_get_origin_sysid(const mavlink_message_t* msg)
271 return _MAV_RETURN_uint8_t(msg, 4);
275 * @brief Get field origin_compid from mission_changed message
277 * @return Compnent ID of the author of the new mission.
279 static inline uint8_t mavlink_msg_mission_changed_get_origin_compid(const mavlink_message_t* msg)
281 return _MAV_RETURN_uint8_t(msg, 5);
285 * @brief Get field mission_type from mission_changed message
287 * @return Mission type.
289 static inline uint8_t mavlink_msg_mission_changed_get_mission_type(const mavlink_message_t* msg)
291 return _MAV_RETURN_uint8_t(msg, 6);
295 * @brief Decode a mission_changed message into a struct
297 * @param msg The message to decode
298 * @param mission_changed C-struct to decode the message contents into
300 static inline void mavlink_msg_mission_changed_decode(const mavlink_message_t* msg, mavlink_mission_changed_t* mission_changed)
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303 mission_changed->start_index = mavlink_msg_mission_changed_get_start_index(msg);
304 mission_changed->end_index = mavlink_msg_mission_changed_get_end_index(msg);
305 mission_changed->origin_sysid = mavlink_msg_mission_changed_get_origin_sysid(msg);
306 mission_changed->origin_compid = mavlink_msg_mission_changed_get_origin_compid(msg);
307 mission_changed->mission_type = mavlink_msg_mission_changed_get_mission_type(msg);
308 #else
309 uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CHANGED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CHANGED_LEN;
310 memset(mission_changed, 0, MAVLINK_MSG_ID_MISSION_CHANGED_LEN);
311 memcpy(mission_changed, _MAV_PAYLOAD(msg), len);
312 #endif