RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_terrain_check.h
1#pragma once
2// MESSAGE TERRAIN_CHECK PACKING
3
4#define MAVLINK_MSG_ID_TERRAIN_CHECK 135
5
6MAVPACKED(
7typedef struct __mavlink_terrain_check_t {
8 int32_t lat; /*< Latitude (degrees *10^7)*/
9 int32_t lon; /*< Longitude (degrees *10^7)*/
10}) mavlink_terrain_check_t;
11
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
16
17#define MAVLINK_MSG_ID_TERRAIN_CHECK_CRC 203
18#define MAVLINK_MSG_ID_135_CRC 203
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \
24 135, \
25 "TERRAIN_CHECK", \
26 2, \
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) }, \
29 } \
30}
31#else
32#define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \
33 "TERRAIN_CHECK", \
34 2, \
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) }, \
37 } \
38}
39#endif
40
51static 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)
53{
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);
58
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN);
60#else
61 mavlink_terrain_check_t packet;
62 packet.lat = lat;
63 packet.lon = lon;
64
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN);
66#endif
67
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);
70}
71
82static 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)
85{
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);
90
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN);
92#else
93 mavlink_terrain_check_t packet;
94 packet.lat = lat;
95 packet.lon = lon;
96
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN);
98#endif
99
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);
102}
103
112static 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)
113{
114 return mavlink_msg_terrain_check_pack(system_id, component_id, msg, terrain_check->lat, terrain_check->lon);
115}
116
126static 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)
127{
128 return mavlink_msg_terrain_check_pack_chan(system_id, component_id, chan, msg, terrain_check->lat, terrain_check->lon);
129}
130
138#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
139
140static inline void mavlink_msg_terrain_check_send(mavlink_channel_t chan, int32_t lat, int32_t lon)
141{
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);
146
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);
148#else
149 mavlink_terrain_check_t packet;
150 packet.lat = lat;
151 packet.lon = lon;
152
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);
154#endif
155}
156
162static inline void mavlink_msg_terrain_check_send_struct(mavlink_channel_t chan, const mavlink_terrain_check_t* terrain_check)
163{
164#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_terrain_check_send(chan, terrain_check->lat, terrain_check->lon);
166#else
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);
168#endif
169}
170
171#if MAVLINK_MSG_ID_TERRAIN_CHECK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
172/*
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.
178 */
179static inline void mavlink_msg_terrain_check_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t lat, int32_t lon)
180{
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);
185
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);
187#else
188 mavlink_terrain_check_t *packet = (mavlink_terrain_check_t *)msgbuf;
189 packet->lat = lat;
190 packet->lon = lon;
191
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);
193#endif
194}
195#endif
196
197#endif
198
199// MESSAGE TERRAIN_CHECK UNPACKING
200
201
207static inline int32_t mavlink_msg_terrain_check_get_lat(const mavlink_message_t* msg)
208{
209 return _MAV_RETURN_int32_t(msg, 0);
210}
211
217static inline int32_t mavlink_msg_terrain_check_get_lon(const mavlink_message_t* msg)
218{
219 return _MAV_RETURN_int32_t(msg, 4);
220}
221
228static inline void mavlink_msg_terrain_check_decode(const mavlink_message_t* msg, mavlink_terrain_check_t* terrain_check)
229{
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);
233#else
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);
237#endif
238}