Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_time_estimate_to_target.h
blob29d03d594689b66b39e8c175bd4723b665fefdf4
1 #pragma once
2 // MESSAGE TIME_ESTIMATE_TO_TARGET PACKING
4 #define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET 380
7 typedef struct __mavlink_time_estimate_to_target_t {
8 int32_t safe_return; /*< [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available.*/
9 int32_t land; /*< [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available.*/
10 int32_t mission_next_item; /*< [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.*/
11 int32_t mission_end; /*< [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.*/
12 int32_t commanded_action; /*< [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available.*/
13 } mavlink_time_estimate_to_target_t;
15 #define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN 20
16 #define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN 20
17 #define MAVLINK_MSG_ID_380_LEN 20
18 #define MAVLINK_MSG_ID_380_MIN_LEN 20
20 #define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC 232
21 #define MAVLINK_MSG_ID_380_CRC 232
25 #if MAVLINK_COMMAND_24BIT
26 #define MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET { \
27 380, \
28 "TIME_ESTIMATE_TO_TARGET", \
29 5, \
30 { { "safe_return", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_time_estimate_to_target_t, safe_return) }, \
31 { "land", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_time_estimate_to_target_t, land) }, \
32 { "mission_next_item", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_time_estimate_to_target_t, mission_next_item) }, \
33 { "mission_end", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_time_estimate_to_target_t, mission_end) }, \
34 { "commanded_action", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_time_estimate_to_target_t, commanded_action) }, \
35 } \
37 #else
38 #define MAVLINK_MESSAGE_INFO_TIME_ESTIMATE_TO_TARGET { \
39 "TIME_ESTIMATE_TO_TARGET", \
40 5, \
41 { { "safe_return", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_time_estimate_to_target_t, safe_return) }, \
42 { "land", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_time_estimate_to_target_t, land) }, \
43 { "mission_next_item", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_time_estimate_to_target_t, mission_next_item) }, \
44 { "mission_end", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_time_estimate_to_target_t, mission_end) }, \
45 { "commanded_action", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_time_estimate_to_target_t, commanded_action) }, \
46 } \
48 #endif
50 /**
51 * @brief Pack a time_estimate_to_target 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 safe_return [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available.
57 * @param land [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available.
58 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
59 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
60 * @param commanded_action [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available.
61 * @return length of the message in bytes (excluding serial stream start sign)
63 static inline uint16_t mavlink_msg_time_estimate_to_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
64 int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action)
66 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67 char buf[MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN];
68 _mav_put_int32_t(buf, 0, safe_return);
69 _mav_put_int32_t(buf, 4, land);
70 _mav_put_int32_t(buf, 8, mission_next_item);
71 _mav_put_int32_t(buf, 12, mission_end);
72 _mav_put_int32_t(buf, 16, commanded_action);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
75 #else
76 mavlink_time_estimate_to_target_t packet;
77 packet.safe_return = safe_return;
78 packet.land = land;
79 packet.mission_next_item = mission_next_item;
80 packet.mission_end = mission_end;
81 packet.commanded_action = commanded_action;
83 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
84 #endif
86 msg->msgid = MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET;
87 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
90 /**
91 * @brief Pack a time_estimate_to_target 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 safe_return [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available.
97 * @param land [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available.
98 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
99 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
100 * @param commanded_action [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available.
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_time_estimate_to_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104 mavlink_message_t* msg,
105 int32_t safe_return,int32_t land,int32_t mission_next_item,int32_t mission_end,int32_t commanded_action)
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 char buf[MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN];
109 _mav_put_int32_t(buf, 0, safe_return);
110 _mav_put_int32_t(buf, 4, land);
111 _mav_put_int32_t(buf, 8, mission_next_item);
112 _mav_put_int32_t(buf, 12, mission_end);
113 _mav_put_int32_t(buf, 16, commanded_action);
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
116 #else
117 mavlink_time_estimate_to_target_t packet;
118 packet.safe_return = safe_return;
119 packet.land = land;
120 packet.mission_next_item = mission_next_item;
121 packet.mission_end = mission_end;
122 packet.commanded_action = commanded_action;
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
125 #endif
127 msg->msgid = MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET;
128 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
132 * @brief Encode a time_estimate_to_target 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 time_estimate_to_target C-struct to read the message contents from
139 static inline uint16_t mavlink_msg_time_estimate_to_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_time_estimate_to_target_t* time_estimate_to_target)
141 return mavlink_msg_time_estimate_to_target_pack(system_id, component_id, msg, time_estimate_to_target->safe_return, time_estimate_to_target->land, time_estimate_to_target->mission_next_item, time_estimate_to_target->mission_end, time_estimate_to_target->commanded_action);
145 * @brief Encode a time_estimate_to_target 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 time_estimate_to_target C-struct to read the message contents from
153 static inline uint16_t mavlink_msg_time_estimate_to_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_time_estimate_to_target_t* time_estimate_to_target)
155 return mavlink_msg_time_estimate_to_target_pack_chan(system_id, component_id, chan, msg, time_estimate_to_target->safe_return, time_estimate_to_target->land, time_estimate_to_target->mission_next_item, time_estimate_to_target->mission_end, time_estimate_to_target->commanded_action);
159 * @brief Send a time_estimate_to_target message
160 * @param chan MAVLink channel to send the message
162 * @param safe_return [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available.
163 * @param land [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available.
164 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
165 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
166 * @param commanded_action [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available.
168 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
170 static inline void mavlink_msg_time_estimate_to_target_send(mavlink_channel_t chan, int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action)
172 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
173 char buf[MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN];
174 _mav_put_int32_t(buf, 0, safe_return);
175 _mav_put_int32_t(buf, 4, land);
176 _mav_put_int32_t(buf, 8, mission_next_item);
177 _mav_put_int32_t(buf, 12, mission_end);
178 _mav_put_int32_t(buf, 16, commanded_action);
180 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET, buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
181 #else
182 mavlink_time_estimate_to_target_t packet;
183 packet.safe_return = safe_return;
184 packet.land = land;
185 packet.mission_next_item = mission_next_item;
186 packet.mission_end = mission_end;
187 packet.commanded_action = commanded_action;
189 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET, (const char *)&packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
190 #endif
194 * @brief Send a time_estimate_to_target message
195 * @param chan MAVLink channel to send the message
196 * @param struct The MAVLink struct to serialize
198 static inline void mavlink_msg_time_estimate_to_target_send_struct(mavlink_channel_t chan, const mavlink_time_estimate_to_target_t* time_estimate_to_target)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 mavlink_msg_time_estimate_to_target_send(chan, time_estimate_to_target->safe_return, time_estimate_to_target->land, time_estimate_to_target->mission_next_item, time_estimate_to_target->mission_end, time_estimate_to_target->commanded_action);
202 #else
203 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET, (const char *)time_estimate_to_target, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
204 #endif
207 #if MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_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_time_estimate_to_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action)
217 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
218 char *buf = (char *)msgbuf;
219 _mav_put_int32_t(buf, 0, safe_return);
220 _mav_put_int32_t(buf, 4, land);
221 _mav_put_int32_t(buf, 8, mission_next_item);
222 _mav_put_int32_t(buf, 12, mission_end);
223 _mav_put_int32_t(buf, 16, commanded_action);
225 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET, buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
226 #else
227 mavlink_time_estimate_to_target_t *packet = (mavlink_time_estimate_to_target_t *)msgbuf;
228 packet->safe_return = safe_return;
229 packet->land = land;
230 packet->mission_next_item = mission_next_item;
231 packet->mission_end = mission_end;
232 packet->commanded_action = commanded_action;
234 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET, (const char *)packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC);
235 #endif
237 #endif
239 #endif
241 // MESSAGE TIME_ESTIMATE_TO_TARGET UNPACKING
245 * @brief Get field safe_return from time_estimate_to_target message
247 * @return [s] Estimated time to complete the vehicle's configured "safe return" action from its current position (e.g. RTL, Smart RTL, etc.). -1 indicates that the vehicle is landed, or that no time estimate available.
249 static inline int32_t mavlink_msg_time_estimate_to_target_get_safe_return(const mavlink_message_t* msg)
251 return _MAV_RETURN_int32_t(msg, 0);
255 * @brief Get field land from time_estimate_to_target message
257 * @return [s] Estimated time for vehicle to complete the LAND action from its current position. -1 indicates that the vehicle is landed, or that no time estimate available.
259 static inline int32_t mavlink_msg_time_estimate_to_target_get_land(const mavlink_message_t* msg)
261 return _MAV_RETURN_int32_t(msg, 4);
265 * @brief Get field mission_next_item from time_estimate_to_target message
267 * @return [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
269 static inline int32_t mavlink_msg_time_estimate_to_target_get_mission_next_item(const mavlink_message_t* msg)
271 return _MAV_RETURN_int32_t(msg, 8);
275 * @brief Get field mission_end from time_estimate_to_target message
277 * @return [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
279 static inline int32_t mavlink_msg_time_estimate_to_target_get_mission_end(const mavlink_message_t* msg)
281 return _MAV_RETURN_int32_t(msg, 12);
285 * @brief Get field commanded_action from time_estimate_to_target message
287 * @return [s] Estimated time for completing the current commanded action (i.e. Go To, Takeoff, Land, etc.). -1 means no action active and/or no estimate available.
289 static inline int32_t mavlink_msg_time_estimate_to_target_get_commanded_action(const mavlink_message_t* msg)
291 return _MAV_RETURN_int32_t(msg, 16);
295 * @brief Decode a time_estimate_to_target message into a struct
297 * @param msg The message to decode
298 * @param time_estimate_to_target C-struct to decode the message contents into
300 static inline void mavlink_msg_time_estimate_to_target_decode(const mavlink_message_t* msg, mavlink_time_estimate_to_target_t* time_estimate_to_target)
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303 time_estimate_to_target->safe_return = mavlink_msg_time_estimate_to_target_get_safe_return(msg);
304 time_estimate_to_target->land = mavlink_msg_time_estimate_to_target_get_land(msg);
305 time_estimate_to_target->mission_next_item = mavlink_msg_time_estimate_to_target_get_mission_next_item(msg);
306 time_estimate_to_target->mission_end = mavlink_msg_time_estimate_to_target_get_mission_end(msg);
307 time_estimate_to_target->commanded_action = mavlink_msg_time_estimate_to_target_get_commanded_action(msg);
308 #else
309 uint8_t len = msg->len < MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN? msg->len : MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN;
310 memset(time_estimate_to_target, 0, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
311 memcpy(time_estimate_to_target, _MAV_PAYLOAD(msg), len);
312 #endif