2 // MESSAGE LOG_ERASE PACKING
4 #define MAVLINK_MSG_ID_LOG_ERASE 121
7 typedef struct __mavlink_log_erase_t
{
8 uint8_t target_system
; /*< System ID*/
9 uint8_t target_component
; /*< Component ID*/
10 } mavlink_log_erase_t
;
12 #define MAVLINK_MSG_ID_LOG_ERASE_LEN 2
13 #define MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN 2
14 #define MAVLINK_MSG_ID_121_LEN 2
15 #define MAVLINK_MSG_ID_121_MIN_LEN 2
17 #define MAVLINK_MSG_ID_LOG_ERASE_CRC 237
18 #define MAVLINK_MSG_ID_121_CRC 237
22 #if MAVLINK_COMMAND_24BIT
23 #define MAVLINK_MESSAGE_INFO_LOG_ERASE { \
27 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_log_erase_t, target_system) }, \
28 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_log_erase_t, target_component) }, \
32 #define MAVLINK_MESSAGE_INFO_LOG_ERASE { \
35 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_log_erase_t, target_system) }, \
36 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_log_erase_t, target_component) }, \
42 * @brief Pack a log_erase 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 target_system System ID
48 * @param target_component Component ID
49 * @return length of the message in bytes (excluding serial stream start sign)
51 static inline uint16_t mavlink_msg_log_erase_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
52 uint8_t target_system
, uint8_t target_component
)
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf
[MAVLINK_MSG_ID_LOG_ERASE_LEN
];
56 _mav_put_uint8_t(buf
, 0, target_system
);
57 _mav_put_uint8_t(buf
, 1, target_component
);
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_LOG_ERASE_LEN
);
61 mavlink_log_erase_t packet
;
62 packet
.target_system
= target_system
;
63 packet
.target_component
= target_component
;
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_LOG_ERASE_LEN
);
68 msg
->msgid
= MAVLINK_MSG_ID_LOG_ERASE
;
69 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
73 * @brief Pack a log_erase 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 target_system System ID
79 * @param target_component Component ID
80 * @return length of the message in bytes (excluding serial stream start sign)
82 static inline uint16_t mavlink_msg_log_erase_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
83 mavlink_message_t
* msg
,
84 uint8_t target_system
,uint8_t target_component
)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf
[MAVLINK_MSG_ID_LOG_ERASE_LEN
];
88 _mav_put_uint8_t(buf
, 0, target_system
);
89 _mav_put_uint8_t(buf
, 1, target_component
);
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_LOG_ERASE_LEN
);
93 mavlink_log_erase_t packet
;
94 packet
.target_system
= target_system
;
95 packet
.target_component
= target_component
;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_LOG_ERASE_LEN
);
100 msg
->msgid
= MAVLINK_MSG_ID_LOG_ERASE
;
101 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
105 * @brief Encode a log_erase 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 log_erase C-struct to read the message contents from
112 static inline uint16_t mavlink_msg_log_erase_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_log_erase_t
* log_erase
)
114 return mavlink_msg_log_erase_pack(system_id
, component_id
, msg
, log_erase
->target_system
, log_erase
->target_component
);
118 * @brief Encode a log_erase 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 log_erase C-struct to read the message contents from
126 static inline uint16_t mavlink_msg_log_erase_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_log_erase_t
* log_erase
)
128 return mavlink_msg_log_erase_pack_chan(system_id
, component_id
, chan
, msg
, log_erase
->target_system
, log_erase
->target_component
);
132 * @brief Send a log_erase message
133 * @param chan MAVLink channel to send the message
135 * @param target_system System ID
136 * @param target_component Component ID
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_log_erase_send(mavlink_channel_t chan
, uint8_t target_system
, uint8_t target_component
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf
[MAVLINK_MSG_ID_LOG_ERASE_LEN
];
144 _mav_put_uint8_t(buf
, 0, target_system
);
145 _mav_put_uint8_t(buf
, 1, target_component
);
147 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_LOG_ERASE
, buf
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
149 mavlink_log_erase_t packet
;
150 packet
.target_system
= target_system
;
151 packet
.target_component
= target_component
;
153 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_LOG_ERASE
, (const char *)&packet
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
158 * @brief Send a log_erase message
159 * @param chan MAVLink channel to send the message
160 * @param struct The MAVLink struct to serialize
162 static inline void mavlink_msg_log_erase_send_struct(mavlink_channel_t chan
, const mavlink_log_erase_t
* log_erase
)
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_log_erase_send(chan
, log_erase
->target_system
, log_erase
->target_component
);
167 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_LOG_ERASE
, (const char *)log_erase
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
171 #if MAVLINK_MSG_ID_LOG_ERASE_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_log_erase_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint8_t target_system
, uint8_t target_component
)
181 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf
= (char *)msgbuf
;
183 _mav_put_uint8_t(buf
, 0, target_system
);
184 _mav_put_uint8_t(buf
, 1, target_component
);
186 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_LOG_ERASE
, buf
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
188 mavlink_log_erase_t
*packet
= (mavlink_log_erase_t
*)msgbuf
;
189 packet
->target_system
= target_system
;
190 packet
->target_component
= target_component
;
192 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_LOG_ERASE
, (const char *)packet
, MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN
, MAVLINK_MSG_ID_LOG_ERASE_LEN
, MAVLINK_MSG_ID_LOG_ERASE_CRC
);
199 // MESSAGE LOG_ERASE UNPACKING
203 * @brief Get field target_system from log_erase message
207 static inline uint8_t mavlink_msg_log_erase_get_target_system(const mavlink_message_t
* msg
)
209 return _MAV_RETURN_uint8_t(msg
, 0);
213 * @brief Get field target_component from log_erase message
215 * @return Component ID
217 static inline uint8_t mavlink_msg_log_erase_get_target_component(const mavlink_message_t
* msg
)
219 return _MAV_RETURN_uint8_t(msg
, 1);
223 * @brief Decode a log_erase message into a struct
225 * @param msg The message to decode
226 * @param log_erase C-struct to decode the message contents into
228 static inline void mavlink_msg_log_erase_decode(const mavlink_message_t
* msg
, mavlink_log_erase_t
* log_erase
)
230 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 log_erase
->target_system
= mavlink_msg_log_erase_get_target_system(msg
);
232 log_erase
->target_component
= mavlink_msg_log_erase_get_target_component(msg
);
234 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_LOG_ERASE_LEN
? msg
->len
: MAVLINK_MSG_ID_LOG_ERASE_LEN
;
235 memset(log_erase
, 0, MAVLINK_MSG_ID_LOG_ERASE_LEN
);
236 memcpy(log_erase
, _MAV_PAYLOAD(msg
), len
);