Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_time_estimate_to_target.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE TIME_ESTIMATE_TO_TARGET PACKING
3
4#define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET 380
5
6
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;
14
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
19
20#define MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_CRC 232
21#define MAVLINK_MSG_ID_380_CRC 232
22
23
24
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 } \
36}
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 } \
47}
48#endif
49
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
55 *
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)
62 */
63MAVLINK_WIP
64static inline uint16_t mavlink_msg_time_estimate_to_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
65 int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action)
66{
67#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
69 _mav_put_int32_t(buf, 0, safe_return);
70 _mav_put_int32_t(buf, 4, land);
71 _mav_put_int32_t(buf, 8, mission_next_item);
72 _mav_put_int32_t(buf, 12, mission_end);
73 _mav_put_int32_t(buf, 16, commanded_action);
74
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
76#else
77 mavlink_time_estimate_to_target_t packet;
78 packet.safe_return = safe_return;
79 packet.land = land;
80 packet.mission_next_item = mission_next_item;
81 packet.mission_end = mission_end;
82 packet.commanded_action = commanded_action;
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
85#endif
86
89}
90
91/**
92 * @brief Pack a time_estimate_to_target message
93 * @param system_id ID of this system
94 * @param component_id ID of this component (e.g. 200 for IMU)
95 * @param status MAVLink status structure
96 * @param msg The MAVLink message to compress the data into
97 *
98 * @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.
99 * @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.
100 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
101 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
102 * @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.
103 * @return length of the message in bytes (excluding serial stream start sign)
104 */
105static inline uint16_t mavlink_msg_time_estimate_to_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
106 int32_t safe_return, int32_t land, int32_t mission_next_item, int32_t mission_end, int32_t commanded_action)
107{
108#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
110 _mav_put_int32_t(buf, 0, safe_return);
111 _mav_put_int32_t(buf, 4, land);
112 _mav_put_int32_t(buf, 8, mission_next_item);
113 _mav_put_int32_t(buf, 12, mission_end);
114 _mav_put_int32_t(buf, 16, commanded_action);
115
116 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
117#else
118 mavlink_time_estimate_to_target_t packet;
119 packet.safe_return = safe_return;
120 packet.land = land;
121 packet.mission_next_item = mission_next_item;
122 packet.mission_end = mission_end;
123 packet.commanded_action = commanded_action;
124
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
126#endif
127
129#if MAVLINK_CRC_EXTRA
130 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, 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);
131#else
132 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_MIN_LEN, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
133#endif
134}
135
136/**
137 * @brief Pack a time_estimate_to_target message on a channel
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param chan The MAVLink channel this message will be sent over
141 * @param msg The MAVLink message to compress the data into
142 * @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.
143 * @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.
144 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
145 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
146 * @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.
147 * @return length of the message in bytes (excluding serial stream start sign)
148 */
149MAVLINK_WIP
150static inline uint16_t mavlink_msg_time_estimate_to_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
151 mavlink_message_t* msg,
152 int32_t safe_return,int32_t land,int32_t mission_next_item,int32_t mission_end,int32_t commanded_action)
153{
154#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 _mav_put_int32_t(buf, 0, safe_return);
157 _mav_put_int32_t(buf, 4, land);
158 _mav_put_int32_t(buf, 8, mission_next_item);
159 _mav_put_int32_t(buf, 12, mission_end);
160 _mav_put_int32_t(buf, 16, commanded_action);
161
162 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
163#else
164 mavlink_time_estimate_to_target_t packet;
165 packet.safe_return = safe_return;
166 packet.land = land;
167 packet.mission_next_item = mission_next_item;
168 packet.mission_end = mission_end;
169 packet.commanded_action = commanded_action;
170
171 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
172#endif
173
176}
177
178/**
179 * @brief Encode a time_estimate_to_target struct
180 *
181 * @param system_id ID of this system
182 * @param component_id ID of this component (e.g. 200 for IMU)
183 * @param msg The MAVLink message to compress the data into
184 * @param time_estimate_to_target C-struct to read the message contents from
185 */
186MAVLINK_WIP
187static 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)
188{
189 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);
190}
191
192/**
193 * @brief Encode a time_estimate_to_target struct on a channel
194 *
195 * @param system_id ID of this system
196 * @param component_id ID of this component (e.g. 200 for IMU)
197 * @param chan The MAVLink channel this message will be sent over
198 * @param msg The MAVLink message to compress the data into
199 * @param time_estimate_to_target C-struct to read the message contents from
200 */
201MAVLINK_WIP
202static 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)
203{
204 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);
205}
206
207/**
208 * @brief Encode a time_estimate_to_target struct with provided status structure
209 *
210 * @param system_id ID of this system
211 * @param component_id ID of this component (e.g. 200 for IMU)
212 * @param status MAVLink status structure
213 * @param msg The MAVLink message to compress the data into
214 * @param time_estimate_to_target C-struct to read the message contents from
215 */
216static inline uint16_t mavlink_msg_time_estimate_to_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_time_estimate_to_target_t* time_estimate_to_target)
217{
218 return mavlink_msg_time_estimate_to_target_pack_status(system_id, component_id, _status, 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);
219}
220
221/**
222 * @brief Send a time_estimate_to_target message
223 * @param chan MAVLink channel to send the message
224 *
225 * @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.
226 * @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.
227 * @param mission_next_item [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
228 * @param mission_end [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
229 * @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.
230 */
231#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
232
233MAVLINK_WIP
234static 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)
235{
236#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 char buf[MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN];
238 _mav_put_int32_t(buf, 0, safe_return);
239 _mav_put_int32_t(buf, 4, land);
240 _mav_put_int32_t(buf, 8, mission_next_item);
241 _mav_put_int32_t(buf, 12, mission_end);
242 _mav_put_int32_t(buf, 16, commanded_action);
243
244 _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);
245#else
246 mavlink_time_estimate_to_target_t packet;
247 packet.safe_return = safe_return;
248 packet.land = land;
249 packet.mission_next_item = mission_next_item;
250 packet.mission_end = mission_end;
251 packet.commanded_action = commanded_action;
252
253 _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);
254#endif
255}
256
257/**
258 * @brief Send a time_estimate_to_target message
259 * @param chan MAVLink channel to send the message
260 * @param struct The MAVLink struct to serialize
261 */
262MAVLINK_WIP
263static 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)
264{
265#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
266 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);
267#else
268 _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);
269#endif
270}
271
272#if MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
273/*
274 This variant of _send() can be used to save stack space by reusing
275 memory from the receive buffer. The caller provides a
276 mavlink_message_t which is the size of a full mavlink message. This
277 is usually the receive buffer for the channel, and allows a reply to an
278 incoming message with minimum stack space usage.
279 */
280MAVLINK_WIP
281static 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)
282{
283#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 char *buf = (char *)msgbuf;
285 _mav_put_int32_t(buf, 0, safe_return);
286 _mav_put_int32_t(buf, 4, land);
287 _mav_put_int32_t(buf, 8, mission_next_item);
288 _mav_put_int32_t(buf, 12, mission_end);
289 _mav_put_int32_t(buf, 16, commanded_action);
290
291 _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);
292#else
293 mavlink_time_estimate_to_target_t *packet = (mavlink_time_estimate_to_target_t *)msgbuf;
294 packet->safe_return = safe_return;
295 packet->land = land;
296 packet->mission_next_item = mission_next_item;
297 packet->mission_end = mission_end;
298 packet->commanded_action = commanded_action;
299
300 _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);
301#endif
302}
303#endif
304
305#endif
306
307// MESSAGE TIME_ESTIMATE_TO_TARGET UNPACKING
308
309
310/**
311 * @brief Get field safe_return from time_estimate_to_target message
312 *
313 * @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.
314 */
315MAVLINK_WIP
316static inline int32_t mavlink_msg_time_estimate_to_target_get_safe_return(const mavlink_message_t* msg)
317{
318 return _MAV_RETURN_int32_t(msg, 0);
319}
320
321/**
322 * @brief Get field land from time_estimate_to_target message
323 *
324 * @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.
325 */
326MAVLINK_WIP
327static inline int32_t mavlink_msg_time_estimate_to_target_get_land(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_int32_t(msg, 4);
330}
331
332/**
333 * @brief Get field mission_next_item from time_estimate_to_target message
334 *
335 * @return [s] Estimated time for reaching/completing the currently active mission item. -1 means no time estimate available.
336 */
337MAVLINK_WIP
338static inline int32_t mavlink_msg_time_estimate_to_target_get_mission_next_item(const mavlink_message_t* msg)
339{
340 return _MAV_RETURN_int32_t(msg, 8);
341}
342
343/**
344 * @brief Get field mission_end from time_estimate_to_target message
345 *
346 * @return [s] Estimated time for completing the current mission. -1 means no mission active and/or no estimate available.
347 */
348MAVLINK_WIP
349static inline int32_t mavlink_msg_time_estimate_to_target_get_mission_end(const mavlink_message_t* msg)
350{
351 return _MAV_RETURN_int32_t(msg, 12);
352}
353
354/**
355 * @brief Get field commanded_action from time_estimate_to_target message
356 *
357 * @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.
358 */
359MAVLINK_WIP
360static inline int32_t mavlink_msg_time_estimate_to_target_get_commanded_action(const mavlink_message_t* msg)
361{
362 return _MAV_RETURN_int32_t(msg, 16);
363}
364
365/**
366 * @brief Decode a time_estimate_to_target message into a struct
367 *
368 * @param msg The message to decode
369 * @param time_estimate_to_target C-struct to decode the message contents into
370 */
371MAVLINK_WIP
372static inline void mavlink_msg_time_estimate_to_target_decode(const mavlink_message_t* msg, mavlink_time_estimate_to_target_t* time_estimate_to_target)
373{
374#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 time_estimate_to_target->safe_return = mavlink_msg_time_estimate_to_target_get_safe_return(msg);
376 time_estimate_to_target->land = mavlink_msg_time_estimate_to_target_get_land(msg);
377 time_estimate_to_target->mission_next_item = mavlink_msg_time_estimate_to_target_get_mission_next_item(msg);
378 time_estimate_to_target->mission_end = mavlink_msg_time_estimate_to_target_get_mission_end(msg);
379 time_estimate_to_target->commanded_action = mavlink_msg_time_estimate_to_target_get_commanded_action(msg);
380#else
381 uint8_t len = msg->len < MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN? msg->len : MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN;
382 memset(time_estimate_to_target, 0, MAVLINK_MSG_ID_TIME_ESTIMATE_TO_TARGET_LEN);
383 memcpy(time_estimate_to_target, _MAV_PAYLOAD(msg), len);
384#endif
385}