2 // MESSAGE EXTENDED_SYS_STATE PACKING
4 #define MAVLINK_MSG_ID_EXTENDED_SYS_STATE 245
7 typedef struct __mavlink_extended_sys_state_t
{
8 uint8_t vtol_state
; /*< The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.*/
9 uint8_t landed_state
; /*< The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.*/
10 } mavlink_extended_sys_state_t
;
12 #define MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN 2
13 #define MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN 2
14 #define MAVLINK_MSG_ID_245_LEN 2
15 #define MAVLINK_MSG_ID_245_MIN_LEN 2
17 #define MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC 130
18 #define MAVLINK_MSG_ID_245_CRC 130
22 #if MAVLINK_COMMAND_24BIT
23 #define MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE { \
25 "EXTENDED_SYS_STATE", \
27 { { "vtol_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_extended_sys_state_t, vtol_state) }, \
28 { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_extended_sys_state_t, landed_state) }, \
32 #define MAVLINK_MESSAGE_INFO_EXTENDED_SYS_STATE { \
33 "EXTENDED_SYS_STATE", \
35 { { "vtol_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_extended_sys_state_t, vtol_state) }, \
36 { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_extended_sys_state_t, landed_state) }, \
42 * @brief Pack a extended_sys_state message
43 * @param system_id ID of this system
44 * @param component_id ID of this component (e.g. 200 for IMU)
45 * @param msg The MAVLink message to compress the data into
47 * @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
48 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
49 * @return length of the message in bytes (excluding serial stream start sign)
51 static inline uint16_t mavlink_msg_extended_sys_state_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
52 uint8_t vtol_state
, uint8_t landed_state
)
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf
[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
];
56 _mav_put_uint8_t(buf
, 0, vtol_state
);
57 _mav_put_uint8_t(buf
, 1, landed_state
);
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
);
61 mavlink_extended_sys_state_t packet
;
62 packet
.vtol_state
= vtol_state
;
63 packet
.landed_state
= landed_state
;
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
);
68 msg
->msgid
= MAVLINK_MSG_ID_EXTENDED_SYS_STATE
;
69 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
73 * @brief Pack a extended_sys_state message on a channel
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param chan The MAVLink channel this message will be sent over
77 * @param msg The MAVLink message to compress the data into
78 * @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
79 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
80 * @return length of the message in bytes (excluding serial stream start sign)
82 static inline uint16_t mavlink_msg_extended_sys_state_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
83 mavlink_message_t
* msg
,
84 uint8_t vtol_state
,uint8_t landed_state
)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf
[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
];
88 _mav_put_uint8_t(buf
, 0, vtol_state
);
89 _mav_put_uint8_t(buf
, 1, landed_state
);
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
);
93 mavlink_extended_sys_state_t packet
;
94 packet
.vtol_state
= vtol_state
;
95 packet
.landed_state
= landed_state
;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
);
100 msg
->msgid
= MAVLINK_MSG_ID_EXTENDED_SYS_STATE
;
101 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
105 * @brief Encode a extended_sys_state struct
107 * @param system_id ID of this system
108 * @param component_id ID of this component (e.g. 200 for IMU)
109 * @param msg The MAVLink message to compress the data into
110 * @param extended_sys_state C-struct to read the message contents from
112 static inline uint16_t mavlink_msg_extended_sys_state_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_extended_sys_state_t
* extended_sys_state
)
114 return mavlink_msg_extended_sys_state_pack(system_id
, component_id
, msg
, extended_sys_state
->vtol_state
, extended_sys_state
->landed_state
);
118 * @brief Encode a extended_sys_state struct on a channel
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param chan The MAVLink channel this message will be sent over
123 * @param msg The MAVLink message to compress the data into
124 * @param extended_sys_state C-struct to read the message contents from
126 static inline uint16_t mavlink_msg_extended_sys_state_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_extended_sys_state_t
* extended_sys_state
)
128 return mavlink_msg_extended_sys_state_pack_chan(system_id
, component_id
, chan
, msg
, extended_sys_state
->vtol_state
, extended_sys_state
->landed_state
);
132 * @brief Send a extended_sys_state message
133 * @param chan MAVLink channel to send the message
135 * @param vtol_state The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
136 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_extended_sys_state_send(mavlink_channel_t chan
, uint8_t vtol_state
, uint8_t landed_state
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf
[MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
];
144 _mav_put_uint8_t(buf
, 0, vtol_state
);
145 _mav_put_uint8_t(buf
, 1, landed_state
);
147 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE
, buf
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
149 mavlink_extended_sys_state_t packet
;
150 packet
.vtol_state
= vtol_state
;
151 packet
.landed_state
= landed_state
;
153 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE
, (const char *)&packet
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
158 * @brief Send a extended_sys_state message
159 * @param chan MAVLink channel to send the message
160 * @param struct The MAVLink struct to serialize
162 static inline void mavlink_msg_extended_sys_state_send_struct(mavlink_channel_t chan
, const mavlink_extended_sys_state_t
* extended_sys_state
)
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_extended_sys_state_send(chan
, extended_sys_state
->vtol_state
, extended_sys_state
->landed_state
);
167 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE
, (const char *)extended_sys_state
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
171 #if MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
173 This varient of _send() can be used to save stack space by re-using
174 memory from the receive buffer. The caller provides a
175 mavlink_message_t which is the size of a full mavlink message. This
176 is usually the receive buffer for the channel, and allows a reply to an
177 incoming message with minimum stack space usage.
179 static inline void mavlink_msg_extended_sys_state_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint8_t vtol_state
, uint8_t landed_state
)
181 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf
= (char *)msgbuf
;
183 _mav_put_uint8_t(buf
, 0, vtol_state
);
184 _mav_put_uint8_t(buf
, 1, landed_state
);
186 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE
, buf
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
188 mavlink_extended_sys_state_t
*packet
= (mavlink_extended_sys_state_t
*)msgbuf
;
189 packet
->vtol_state
= vtol_state
;
190 packet
->landed_state
= landed_state
;
192 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE
, (const char *)packet
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_CRC
);
199 // MESSAGE EXTENDED_SYS_STATE UNPACKING
203 * @brief Get field vtol_state from extended_sys_state message
205 * @return The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration.
207 static inline uint8_t mavlink_msg_extended_sys_state_get_vtol_state(const mavlink_message_t
* msg
)
209 return _MAV_RETURN_uint8_t(msg
, 0);
213 * @brief Get field landed_state from extended_sys_state message
215 * @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
217 static inline uint8_t mavlink_msg_extended_sys_state_get_landed_state(const mavlink_message_t
* msg
)
219 return _MAV_RETURN_uint8_t(msg
, 1);
223 * @brief Decode a extended_sys_state message into a struct
225 * @param msg The message to decode
226 * @param extended_sys_state C-struct to decode the message contents into
228 static inline void mavlink_msg_extended_sys_state_decode(const mavlink_message_t
* msg
, mavlink_extended_sys_state_t
* extended_sys_state
)
230 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 extended_sys_state
->vtol_state
= mavlink_msg_extended_sys_state_get_vtol_state(msg
);
232 extended_sys_state
->landed_state
= mavlink_msg_extended_sys_state_get_landed_state(msg
);
234 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
? msg
->len
: MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
;
235 memset(extended_sys_state
, 0, MAVLINK_MSG_ID_EXTENDED_SYS_STATE_LEN
);
236 memcpy(extended_sys_state
, _MAV_PAYLOAD(msg
), len
);