Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_mission_item_reached.h
blob647176b9cd8cd236918e2af83c8b997ad1863437
1 #pragma once
2 // MESSAGE MISSION_ITEM_REACHED PACKING
4 #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED 46
7 typedef struct __mavlink_mission_item_reached_t {
8 uint16_t seq; /*< Sequence*/
9 } mavlink_mission_item_reached_t;
11 #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN 2
12 #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN 2
13 #define MAVLINK_MSG_ID_46_LEN 2
14 #define MAVLINK_MSG_ID_46_MIN_LEN 2
16 #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC 11
17 #define MAVLINK_MSG_ID_46_CRC 11
21 #if MAVLINK_COMMAND_24BIT
22 #define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \
23 46, \
24 "MISSION_ITEM_REACHED", \
25 1, \
26 { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \
27 } \
29 #else
30 #define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \
31 "MISSION_ITEM_REACHED", \
32 1, \
33 { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \
34 } \
36 #endif
38 /**
39 * @brief Pack a mission_item_reached message
40 * @param system_id ID of this system
41 * @param component_id ID of this component (e.g. 200 for IMU)
42 * @param msg The MAVLink message to compress the data into
44 * @param seq Sequence
45 * @return length of the message in bytes (excluding serial stream start sign)
47 static inline uint16_t mavlink_msg_mission_item_reached_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48 uint16_t seq)
50 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
51 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
52 _mav_put_uint16_t(buf, 0, seq);
54 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
55 #else
56 mavlink_mission_item_reached_t packet;
57 packet.seq = seq;
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
60 #endif
62 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
63 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
66 /**
67 * @brief Pack a mission_item_reached message on a channel
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param chan The MAVLink channel this message will be sent over
71 * @param msg The MAVLink message to compress the data into
72 * @param seq Sequence
73 * @return length of the message in bytes (excluding serial stream start sign)
75 static inline uint16_t mavlink_msg_mission_item_reached_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
76 mavlink_message_t* msg,
77 uint16_t seq)
79 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
80 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
81 _mav_put_uint16_t(buf, 0, seq);
83 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
84 #else
85 mavlink_mission_item_reached_t packet;
86 packet.seq = seq;
88 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
89 #endif
91 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
92 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
95 /**
96 * @brief Encode a mission_item_reached struct
98 * @param system_id ID of this system
99 * @param component_id ID of this component (e.g. 200 for IMU)
100 * @param msg The MAVLink message to compress the data into
101 * @param mission_item_reached C-struct to read the message contents from
103 static inline uint16_t mavlink_msg_mission_item_reached_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached)
105 return mavlink_msg_mission_item_reached_pack(system_id, component_id, msg, mission_item_reached->seq);
109 * @brief Encode a mission_item_reached struct on a channel
111 * @param system_id ID of this system
112 * @param component_id ID of this component (e.g. 200 for IMU)
113 * @param chan The MAVLink channel this message will be sent over
114 * @param msg The MAVLink message to compress the data into
115 * @param mission_item_reached C-struct to read the message contents from
117 static inline uint16_t mavlink_msg_mission_item_reached_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached)
119 return mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, chan, msg, mission_item_reached->seq);
123 * @brief Send a mission_item_reached message
124 * @param chan MAVLink channel to send the message
126 * @param seq Sequence
128 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
130 static inline void mavlink_msg_mission_item_reached_send(mavlink_channel_t chan, uint16_t seq)
132 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
133 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
134 _mav_put_uint16_t(buf, 0, seq);
136 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
137 #else
138 mavlink_mission_item_reached_t packet;
139 packet.seq = seq;
141 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)&packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
142 #endif
146 * @brief Send a mission_item_reached message
147 * @param chan MAVLink channel to send the message
148 * @param struct The MAVLink struct to serialize
150 static inline void mavlink_msg_mission_item_reached_send_struct(mavlink_channel_t chan, const mavlink_mission_item_reached_t* mission_item_reached)
152 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
153 mavlink_msg_mission_item_reached_send(chan, mission_item_reached->seq);
154 #else
155 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)mission_item_reached, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
156 #endif
159 #if MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
161 This varient of _send() can be used to save stack space by re-using
162 memory from the receive buffer. The caller provides a
163 mavlink_message_t which is the size of a full mavlink message. This
164 is usually the receive buffer for the channel, and allows a reply to an
165 incoming message with minimum stack space usage.
167 static inline void mavlink_msg_mission_item_reached_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq)
169 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
170 char *buf = (char *)msgbuf;
171 _mav_put_uint16_t(buf, 0, seq);
173 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
174 #else
175 mavlink_mission_item_reached_t *packet = (mavlink_mission_item_reached_t *)msgbuf;
176 packet->seq = seq;
178 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
179 #endif
181 #endif
183 #endif
185 // MESSAGE MISSION_ITEM_REACHED UNPACKING
189 * @brief Get field seq from mission_item_reached message
191 * @return Sequence
193 static inline uint16_t mavlink_msg_mission_item_reached_get_seq(const mavlink_message_t* msg)
195 return _MAV_RETURN_uint16_t(msg, 0);
199 * @brief Decode a mission_item_reached message into a struct
201 * @param msg The message to decode
202 * @param mission_item_reached C-struct to decode the message contents into
204 static inline void mavlink_msg_mission_item_reached_decode(const mavlink_message_t* msg, mavlink_mission_item_reached_t* mission_item_reached)
206 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
207 mission_item_reached->seq = mavlink_msg_mission_item_reached_get_seq(msg);
208 #else
209 uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN;
210 memset(mission_item_reached, 0, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
211 memcpy(mission_item_reached, _MAV_PAYLOAD(msg), len);
212 #endif