2 // MESSAGE TERRAIN_CHECK PACKING
4 #define MAVLINK_MSG_ID_TERRAIN_CHECK 135
7 typedef struct __mavlink_terrain_check_t
{
8 int32_t lat
; /*< [degE7] Latitude*/
9 int32_t lon
; /*< [degE7] Longitude*/
10 } mavlink_terrain_check_t
;
12 #define MAVLINK_MSG_ID_TERRAIN_CHECK_LEN 8
13 #define MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN 8
14 #define MAVLINK_MSG_ID_135_LEN 8
15 #define MAVLINK_MSG_ID_135_MIN_LEN 8
17 #define MAVLINK_MSG_ID_TERRAIN_CHECK_CRC 203
18 #define MAVLINK_MSG_ID_135_CRC 203
22 #if MAVLINK_COMMAND_24BIT
23 #define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \
27 { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_terrain_check_t, lat) }, \
28 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_terrain_check_t, lon) }, \
32 #define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \
35 { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_terrain_check_t, lat) }, \
36 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_terrain_check_t, lon) }, \
42 * @brief Pack a terrain_check 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 lat [degE7] Latitude
48 * @param lon [degE7] Longitude
49 * @return length of the message in bytes (excluding serial stream start sign)
51 static inline uint16_t mavlink_msg_terrain_check_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
52 int32_t lat
, int32_t lon
)
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf
[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
];
56 _mav_put_int32_t(buf
, 0, lat
);
57 _mav_put_int32_t(buf
, 4, lon
);
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
);
61 mavlink_terrain_check_t packet
;
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
);
68 msg
->msgid
= MAVLINK_MSG_ID_TERRAIN_CHECK
;
69 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
73 * @brief Pack a terrain_check 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 lat [degE7] Latitude
79 * @param lon [degE7] Longitude
80 * @return length of the message in bytes (excluding serial stream start sign)
82 static inline uint16_t mavlink_msg_terrain_check_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
83 mavlink_message_t
* msg
,
84 int32_t lat
,int32_t lon
)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf
[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
];
88 _mav_put_int32_t(buf
, 0, lat
);
89 _mav_put_int32_t(buf
, 4, lon
);
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
);
93 mavlink_terrain_check_t packet
;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
);
100 msg
->msgid
= MAVLINK_MSG_ID_TERRAIN_CHECK
;
101 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
105 * @brief Encode a terrain_check 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 terrain_check C-struct to read the message contents from
112 static inline uint16_t mavlink_msg_terrain_check_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_terrain_check_t
* terrain_check
)
114 return mavlink_msg_terrain_check_pack(system_id
, component_id
, msg
, terrain_check
->lat
, terrain_check
->lon
);
118 * @brief Encode a terrain_check 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 terrain_check C-struct to read the message contents from
126 static inline uint16_t mavlink_msg_terrain_check_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_terrain_check_t
* terrain_check
)
128 return mavlink_msg_terrain_check_pack_chan(system_id
, component_id
, chan
, msg
, terrain_check
->lat
, terrain_check
->lon
);
132 * @brief Send a terrain_check message
133 * @param chan MAVLink channel to send the message
135 * @param lat [degE7] Latitude
136 * @param lon [degE7] Longitude
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_terrain_check_send(mavlink_channel_t chan
, int32_t lat
, int32_t lon
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf
[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
];
144 _mav_put_int32_t(buf
, 0, lat
);
145 _mav_put_int32_t(buf
, 4, lon
);
147 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_TERRAIN_CHECK
, buf
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
149 mavlink_terrain_check_t packet
;
153 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_TERRAIN_CHECK
, (const char *)&packet
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
158 * @brief Send a terrain_check message
159 * @param chan MAVLink channel to send the message
160 * @param struct The MAVLink struct to serialize
162 static inline void mavlink_msg_terrain_check_send_struct(mavlink_channel_t chan
, const mavlink_terrain_check_t
* terrain_check
)
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_terrain_check_send(chan
, terrain_check
->lat
, terrain_check
->lon
);
167 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_TERRAIN_CHECK
, (const char *)terrain_check
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
171 #if MAVLINK_MSG_ID_TERRAIN_CHECK_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_terrain_check_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, int32_t lat
, int32_t lon
)
181 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf
= (char *)msgbuf
;
183 _mav_put_int32_t(buf
, 0, lat
);
184 _mav_put_int32_t(buf
, 4, lon
);
186 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_TERRAIN_CHECK
, buf
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
188 mavlink_terrain_check_t
*packet
= (mavlink_terrain_check_t
*)msgbuf
;
192 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_TERRAIN_CHECK
, (const char *)packet
, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC
);
199 // MESSAGE TERRAIN_CHECK UNPACKING
203 * @brief Get field lat from terrain_check message
205 * @return [degE7] Latitude
207 static inline int32_t mavlink_msg_terrain_check_get_lat(const mavlink_message_t
* msg
)
209 return _MAV_RETURN_int32_t(msg
, 0);
213 * @brief Get field lon from terrain_check message
215 * @return [degE7] Longitude
217 static inline int32_t mavlink_msg_terrain_check_get_lon(const mavlink_message_t
* msg
)
219 return _MAV_RETURN_int32_t(msg
, 4);
223 * @brief Decode a terrain_check message into a struct
225 * @param msg The message to decode
226 * @param terrain_check C-struct to decode the message contents into
228 static inline void mavlink_msg_terrain_check_decode(const mavlink_message_t
* msg
, mavlink_terrain_check_t
* terrain_check
)
230 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 terrain_check
->lat
= mavlink_msg_terrain_check_get_lat(msg
);
232 terrain_check
->lon
= mavlink_msg_terrain_check_get_lon(msg
);
234 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
? msg
->len
: MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
;
235 memset(terrain_check
, 0, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN
);
236 memcpy(terrain_check
, _MAV_PAYLOAD(msg
), len
);