1 | // MESSAGE TERRAIN_REQUEST PACKING
|
---|
2 |
|
---|
3 | #define MAVLINK_MSG_ID_TERRAIN_REQUEST 133
|
---|
4 |
|
---|
5 | typedef struct MAVLINK_PACKED __mavlink_terrain_request_t
|
---|
6 | {
|
---|
7 | uint64_t mask; /*< Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)*/
|
---|
8 | int32_t lat; /*< Latitude of SW corner of first grid (degrees *10^7)*/
|
---|
9 | int32_t lon; /*< Longitude of SW corner of first grid (in degrees *10^7)*/
|
---|
10 | uint16_t grid_spacing; /*< Grid spacing in meters*/
|
---|
11 | } mavlink_terrain_request_t;
|
---|
12 |
|
---|
13 | #define MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN 18
|
---|
14 | #define MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN 18
|
---|
15 | #define MAVLINK_MSG_ID_133_LEN 18
|
---|
16 | #define MAVLINK_MSG_ID_133_MIN_LEN 18
|
---|
17 |
|
---|
18 | #define MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC 6
|
---|
19 | #define MAVLINK_MSG_ID_133_CRC 6
|
---|
20 |
|
---|
21 |
|
---|
22 |
|
---|
23 | #if MAVLINK_COMMAND_24BIT
|
---|
24 | #define MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST { \
|
---|
25 | 133, \
|
---|
26 | "TERRAIN_REQUEST", \
|
---|
27 | 4, \
|
---|
28 | { { "mask", "0x%07x", MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_terrain_request_t, mask) }, \
|
---|
29 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_terrain_request_t, lat) }, \
|
---|
30 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_terrain_request_t, lon) }, \
|
---|
31 | { "grid_spacing", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_terrain_request_t, grid_spacing) }, \
|
---|
32 | } \
|
---|
33 | }
|
---|
34 | #else
|
---|
35 | #define MAVLINK_MESSAGE_INFO_TERRAIN_REQUEST { \
|
---|
36 | "TERRAIN_REQUEST", \
|
---|
37 | 4, \
|
---|
38 | { { "mask", "0x%07x", MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_terrain_request_t, mask) }, \
|
---|
39 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_terrain_request_t, lat) }, \
|
---|
40 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_terrain_request_t, lon) }, \
|
---|
41 | { "grid_spacing", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_terrain_request_t, grid_spacing) }, \
|
---|
42 | } \
|
---|
43 | }
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * @brief Pack a terrain_request message
|
---|
48 | * @param system_id ID of this system
|
---|
49 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
50 | * @param msg The MAVLink message to compress the data into
|
---|
51 | *
|
---|
52 | * @param lat Latitude of SW corner of first grid (degrees *10^7)
|
---|
53 | * @param lon Longitude of SW corner of first grid (in degrees *10^7)
|
---|
54 | * @param grid_spacing Grid spacing in meters
|
---|
55 | * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
|
---|
56 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
57 | */
|
---|
58 | static inline uint16_t mavlink_msg_terrain_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
59 | int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
|
---|
60 | {
|
---|
61 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
62 | char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
|
---|
63 | _mav_put_uint64_t(buf, 0, mask);
|
---|
64 | _mav_put_int32_t(buf, 8, lat);
|
---|
65 | _mav_put_int32_t(buf, 12, lon);
|
---|
66 | _mav_put_uint16_t(buf, 16, grid_spacing);
|
---|
67 |
|
---|
68 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
|
---|
69 | #else
|
---|
70 | mavlink_terrain_request_t packet;
|
---|
71 | packet.mask = mask;
|
---|
72 | packet.lat = lat;
|
---|
73 | packet.lon = lon;
|
---|
74 | packet.grid_spacing = grid_spacing;
|
---|
75 |
|
---|
76 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | msg->msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST;
|
---|
80 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
81 | }
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * @brief Pack a terrain_request message on a channel
|
---|
85 | * @param system_id ID of this system
|
---|
86 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
87 | * @param chan The MAVLink channel this message will be sent over
|
---|
88 | * @param msg The MAVLink message to compress the data into
|
---|
89 | * @param lat Latitude of SW corner of first grid (degrees *10^7)
|
---|
90 | * @param lon Longitude of SW corner of first grid (in degrees *10^7)
|
---|
91 | * @param grid_spacing Grid spacing in meters
|
---|
92 | * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
|
---|
93 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
94 | */
|
---|
95 | static inline uint16_t mavlink_msg_terrain_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
96 | mavlink_message_t* msg,
|
---|
97 | int32_t lat,int32_t lon,uint16_t grid_spacing,uint64_t mask)
|
---|
98 | {
|
---|
99 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
100 | char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
|
---|
101 | _mav_put_uint64_t(buf, 0, mask);
|
---|
102 | _mav_put_int32_t(buf, 8, lat);
|
---|
103 | _mav_put_int32_t(buf, 12, lon);
|
---|
104 | _mav_put_uint16_t(buf, 16, grid_spacing);
|
---|
105 |
|
---|
106 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
|
---|
107 | #else
|
---|
108 | mavlink_terrain_request_t packet;
|
---|
109 | packet.mask = mask;
|
---|
110 | packet.lat = lat;
|
---|
111 | packet.lon = lon;
|
---|
112 | packet.grid_spacing = grid_spacing;
|
---|
113 |
|
---|
114 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | msg->msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST;
|
---|
118 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
119 | }
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * @brief Encode a terrain_request struct
|
---|
123 | *
|
---|
124 | * @param system_id ID of this system
|
---|
125 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
126 | * @param msg The MAVLink message to compress the data into
|
---|
127 | * @param terrain_request C-struct to read the message contents from
|
---|
128 | */
|
---|
129 | static inline uint16_t mavlink_msg_terrain_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_terrain_request_t* terrain_request)
|
---|
130 | {
|
---|
131 | return mavlink_msg_terrain_request_pack(system_id, component_id, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask);
|
---|
132 | }
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * @brief Encode a terrain_request struct on a channel
|
---|
136 | *
|
---|
137 | * @param system_id ID of this system
|
---|
138 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
139 | * @param chan The MAVLink channel this message will be sent over
|
---|
140 | * @param msg The MAVLink message to compress the data into
|
---|
141 | * @param terrain_request C-struct to read the message contents from
|
---|
142 | */
|
---|
143 | static inline uint16_t mavlink_msg_terrain_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_terrain_request_t* terrain_request)
|
---|
144 | {
|
---|
145 | return mavlink_msg_terrain_request_pack_chan(system_id, component_id, chan, msg, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask);
|
---|
146 | }
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * @brief Send a terrain_request message
|
---|
150 | * @param chan MAVLink channel to send the message
|
---|
151 | *
|
---|
152 | * @param lat Latitude of SW corner of first grid (degrees *10^7)
|
---|
153 | * @param lon Longitude of SW corner of first grid (in degrees *10^7)
|
---|
154 | * @param grid_spacing Grid spacing in meters
|
---|
155 | * @param mask Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
|
---|
156 | */
|
---|
157 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
158 |
|
---|
159 | static inline void mavlink_msg_terrain_request_send(mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
|
---|
160 | {
|
---|
161 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
162 | char buf[MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN];
|
---|
163 | _mav_put_uint64_t(buf, 0, mask);
|
---|
164 | _mav_put_int32_t(buf, 8, lat);
|
---|
165 | _mav_put_int32_t(buf, 12, lon);
|
---|
166 | _mav_put_uint16_t(buf, 16, grid_spacing);
|
---|
167 |
|
---|
168 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
169 | #else
|
---|
170 | mavlink_terrain_request_t packet;
|
---|
171 | packet.mask = mask;
|
---|
172 | packet.lat = lat;
|
---|
173 | packet.lon = lon;
|
---|
174 | packet.grid_spacing = grid_spacing;
|
---|
175 |
|
---|
176 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
177 | #endif
|
---|
178 | }
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * @brief Send a terrain_request message
|
---|
182 | * @param chan MAVLink channel to send the message
|
---|
183 | * @param struct The MAVLink struct to serialize
|
---|
184 | */
|
---|
185 | static inline void mavlink_msg_terrain_request_send_struct(mavlink_channel_t chan, const mavlink_terrain_request_t* terrain_request)
|
---|
186 | {
|
---|
187 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
188 | mavlink_msg_terrain_request_send(chan, terrain_request->lat, terrain_request->lon, terrain_request->grid_spacing, terrain_request->mask);
|
---|
189 | #else
|
---|
190 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)terrain_request, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
191 | #endif
|
---|
192 | }
|
---|
193 |
|
---|
194 | #if MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
195 | /*
|
---|
196 | This varient of _send() can be used to save stack space by re-using
|
---|
197 | memory from the receive buffer. The caller provides a
|
---|
198 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
199 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
200 | incoming message with minimum stack space usage.
|
---|
201 | */
|
---|
202 | static inline void mavlink_msg_terrain_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t lat, int32_t lon, uint16_t grid_spacing, uint64_t mask)
|
---|
203 | {
|
---|
204 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
205 | char *buf = (char *)msgbuf;
|
---|
206 | _mav_put_uint64_t(buf, 0, mask);
|
---|
207 | _mav_put_int32_t(buf, 8, lat);
|
---|
208 | _mav_put_int32_t(buf, 12, lon);
|
---|
209 | _mav_put_uint16_t(buf, 16, grid_spacing);
|
---|
210 |
|
---|
211 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, buf, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
212 | #else
|
---|
213 | mavlink_terrain_request_t *packet = (mavlink_terrain_request_t *)msgbuf;
|
---|
214 | packet->mask = mask;
|
---|
215 | packet->lat = lat;
|
---|
216 | packet->lon = lon;
|
---|
217 | packet->grid_spacing = grid_spacing;
|
---|
218 |
|
---|
219 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_REQUEST, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN, MAVLINK_MSG_ID_TERRAIN_REQUEST_CRC);
|
---|
220 | #endif
|
---|
221 | }
|
---|
222 | #endif
|
---|
223 |
|
---|
224 | #endif
|
---|
225 |
|
---|
226 | // MESSAGE TERRAIN_REQUEST UNPACKING
|
---|
227 |
|
---|
228 |
|
---|
229 | /**
|
---|
230 | * @brief Get field lat from terrain_request message
|
---|
231 | *
|
---|
232 | * @return Latitude of SW corner of first grid (degrees *10^7)
|
---|
233 | */
|
---|
234 | static inline int32_t mavlink_msg_terrain_request_get_lat(const mavlink_message_t* msg)
|
---|
235 | {
|
---|
236 | return _MAV_RETURN_int32_t(msg, 8);
|
---|
237 | }
|
---|
238 |
|
---|
239 | /**
|
---|
240 | * @brief Get field lon from terrain_request message
|
---|
241 | *
|
---|
242 | * @return Longitude of SW corner of first grid (in degrees *10^7)
|
---|
243 | */
|
---|
244 | static inline int32_t mavlink_msg_terrain_request_get_lon(const mavlink_message_t* msg)
|
---|
245 | {
|
---|
246 | return _MAV_RETURN_int32_t(msg, 12);
|
---|
247 | }
|
---|
248 |
|
---|
249 | /**
|
---|
250 | * @brief Get field grid_spacing from terrain_request message
|
---|
251 | *
|
---|
252 | * @return Grid spacing in meters
|
---|
253 | */
|
---|
254 | static inline uint16_t mavlink_msg_terrain_request_get_grid_spacing(const mavlink_message_t* msg)
|
---|
255 | {
|
---|
256 | return _MAV_RETURN_uint16_t(msg, 16);
|
---|
257 | }
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * @brief Get field mask from terrain_request message
|
---|
261 | *
|
---|
262 | * @return Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits)
|
---|
263 | */
|
---|
264 | static inline uint64_t mavlink_msg_terrain_request_get_mask(const mavlink_message_t* msg)
|
---|
265 | {
|
---|
266 | return _MAV_RETURN_uint64_t(msg, 0);
|
---|
267 | }
|
---|
268 |
|
---|
269 | /**
|
---|
270 | * @brief Decode a terrain_request message into a struct
|
---|
271 | *
|
---|
272 | * @param msg The message to decode
|
---|
273 | * @param terrain_request C-struct to decode the message contents into
|
---|
274 | */
|
---|
275 | static inline void mavlink_msg_terrain_request_decode(const mavlink_message_t* msg, mavlink_terrain_request_t* terrain_request)
|
---|
276 | {
|
---|
277 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
278 | terrain_request->mask = mavlink_msg_terrain_request_get_mask(msg);
|
---|
279 | terrain_request->lat = mavlink_msg_terrain_request_get_lat(msg);
|
---|
280 | terrain_request->lon = mavlink_msg_terrain_request_get_lon(msg);
|
---|
281 | terrain_request->grid_spacing = mavlink_msg_terrain_request_get_grid_spacing(msg);
|
---|
282 | #else
|
---|
283 | uint8_t len = msg->len < MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN;
|
---|
284 | memset(terrain_request, 0, MAVLINK_MSG_ID_TERRAIN_REQUEST_LEN);
|
---|
285 | memcpy(terrain_request, _MAV_PAYLOAD(msg), len);
|
---|
286 | #endif
|
---|
287 | }
|
---|