2 // MESSAGE GPS_INPUT PACKING
4 #define MAVLINK_MSG_ID_GPS_INPUT 232
7 typedef struct __mavlink_gps_input_t
{
8 uint64_t time_usec
; /*< Timestamp (micros since boot or Unix epoch)*/
9 uint32_t time_week_ms
; /*< GPS time (milliseconds from start of GPS week)*/
10 int32_t lat
; /*< Latitude (WGS84), in degrees * 1E7*/
11 int32_t lon
; /*< Longitude (WGS84), in degrees * 1E7*/
12 float alt
; /*< Altitude (AMSL, not WGS84), in m (positive for up)*/
13 float hdop
; /*< GPS HDOP horizontal dilution of position in m*/
14 float vdop
; /*< GPS VDOP vertical dilution of position in m*/
15 float vn
; /*< GPS velocity in m/s in NORTH direction in earth-fixed NED frame*/
16 float ve
; /*< GPS velocity in m/s in EAST direction in earth-fixed NED frame*/
17 float vd
; /*< GPS velocity in m/s in DOWN direction in earth-fixed NED frame*/
18 float speed_accuracy
; /*< GPS speed accuracy in m/s*/
19 float horiz_accuracy
; /*< GPS horizontal accuracy in m*/
20 float vert_accuracy
; /*< GPS vertical accuracy in m*/
21 uint16_t ignore_flags
; /*< Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided.*/
22 uint16_t time_week
; /*< GPS week number*/
23 uint8_t gps_id
; /*< ID of the GPS for multiple GPS inputs*/
24 uint8_t fix_type
; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK*/
25 uint8_t satellites_visible
; /*< Number of satellites visible.*/
26 }) mavlink_gps_input_t
;
28 #define MAVLINK_MSG_ID_GPS_INPUT_LEN 63
29 #define MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN 63
30 #define MAVLINK_MSG_ID_232_LEN 63
31 #define MAVLINK_MSG_ID_232_MIN_LEN 63
33 #define MAVLINK_MSG_ID_GPS_INPUT_CRC 151
34 #define MAVLINK_MSG_ID_232_CRC 151
38 #if MAVLINK_COMMAND_24BIT
39 #define MAVLINK_MESSAGE_INFO_GPS_INPUT { \
43 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_input_t, time_usec) }, \
44 { "time_week_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gps_input_t, time_week_ms) }, \
45 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_input_t, lat) }, \
46 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_input_t, lon) }, \
47 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gps_input_t, alt) }, \
48 { "hdop", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gps_input_t, hdop) }, \
49 { "vdop", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gps_input_t, vdop) }, \
50 { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gps_input_t, vn) }, \
51 { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gps_input_t, ve) }, \
52 { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gps_input_t, vd) }, \
53 { "speed_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gps_input_t, speed_accuracy) }, \
54 { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_gps_input_t, horiz_accuracy) }, \
55 { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_gps_input_t, vert_accuracy) }, \
56 { "ignore_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_gps_input_t, ignore_flags) }, \
57 { "time_week", NULL, MAVLINK_TYPE_UINT16_T, 0, 58, offsetof(mavlink_gps_input_t, time_week) }, \
58 { "gps_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_gps_input_t, gps_id) }, \
59 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 61, offsetof(mavlink_gps_input_t, fix_type) }, \
60 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_gps_input_t, satellites_visible) }, \
64 #define MAVLINK_MESSAGE_INFO_GPS_INPUT { \
67 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_input_t, time_usec) }, \
68 { "time_week_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gps_input_t, time_week_ms) }, \
69 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_input_t, lat) }, \
70 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_input_t, lon) }, \
71 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gps_input_t, alt) }, \
72 { "hdop", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gps_input_t, hdop) }, \
73 { "vdop", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gps_input_t, vdop) }, \
74 { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_gps_input_t, vn) }, \
75 { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_gps_input_t, ve) }, \
76 { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gps_input_t, vd) }, \
77 { "speed_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gps_input_t, speed_accuracy) }, \
78 { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_gps_input_t, horiz_accuracy) }, \
79 { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_gps_input_t, vert_accuracy) }, \
80 { "ignore_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_gps_input_t, ignore_flags) }, \
81 { "time_week", NULL, MAVLINK_TYPE_UINT16_T, 0, 58, offsetof(mavlink_gps_input_t, time_week) }, \
82 { "gps_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_gps_input_t, gps_id) }, \
83 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 61, offsetof(mavlink_gps_input_t, fix_type) }, \
84 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_gps_input_t, satellites_visible) }, \
90 * @brief Pack a gps_input message
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param msg The MAVLink message to compress the data into
95 * @param time_usec Timestamp (micros since boot or Unix epoch)
96 * @param gps_id ID of the GPS for multiple GPS inputs
97 * @param ignore_flags Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided.
98 * @param time_week_ms GPS time (milliseconds from start of GPS week)
99 * @param time_week GPS week number
100 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK
101 * @param lat Latitude (WGS84), in degrees * 1E7
102 * @param lon Longitude (WGS84), in degrees * 1E7
103 * @param alt Altitude (AMSL, not WGS84), in m (positive for up)
104 * @param hdop GPS HDOP horizontal dilution of position in m
105 * @param vdop GPS VDOP vertical dilution of position in m
106 * @param vn GPS velocity in m/s in NORTH direction in earth-fixed NED frame
107 * @param ve GPS velocity in m/s in EAST direction in earth-fixed NED frame
108 * @param vd GPS velocity in m/s in DOWN direction in earth-fixed NED frame
109 * @param speed_accuracy GPS speed accuracy in m/s
110 * @param horiz_accuracy GPS horizontal accuracy in m
111 * @param vert_accuracy GPS vertical accuracy in m
112 * @param satellites_visible Number of satellites visible.
113 * @return length of the message in bytes (excluding serial stream start sign)
115 static inline uint16_t mavlink_msg_gps_input_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
116 uint64_t time_usec
, uint8_t gps_id
, uint16_t ignore_flags
, uint32_t time_week_ms
, uint16_t time_week
, uint8_t fix_type
, int32_t lat
, int32_t lon
, float alt
, float hdop
, float vdop
, float vn
, float ve
, float vd
, float speed_accuracy
, float horiz_accuracy
, float vert_accuracy
, uint8_t satellites_visible
)
118 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119 char buf
[MAVLINK_MSG_ID_GPS_INPUT_LEN
];
120 _mav_put_uint64_t(buf
, 0, time_usec
);
121 _mav_put_uint32_t(buf
, 8, time_week_ms
);
122 _mav_put_int32_t(buf
, 12, lat
);
123 _mav_put_int32_t(buf
, 16, lon
);
124 _mav_put_float(buf
, 20, alt
);
125 _mav_put_float(buf
, 24, hdop
);
126 _mav_put_float(buf
, 28, vdop
);
127 _mav_put_float(buf
, 32, vn
);
128 _mav_put_float(buf
, 36, ve
);
129 _mav_put_float(buf
, 40, vd
);
130 _mav_put_float(buf
, 44, speed_accuracy
);
131 _mav_put_float(buf
, 48, horiz_accuracy
);
132 _mav_put_float(buf
, 52, vert_accuracy
);
133 _mav_put_uint16_t(buf
, 56, ignore_flags
);
134 _mav_put_uint16_t(buf
, 58, time_week
);
135 _mav_put_uint8_t(buf
, 60, gps_id
);
136 _mav_put_uint8_t(buf
, 61, fix_type
);
137 _mav_put_uint8_t(buf
, 62, satellites_visible
);
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_INPUT_LEN
);
141 mavlink_gps_input_t packet
;
142 packet
.time_usec
= time_usec
;
143 packet
.time_week_ms
= time_week_ms
;
152 packet
.speed_accuracy
= speed_accuracy
;
153 packet
.horiz_accuracy
= horiz_accuracy
;
154 packet
.vert_accuracy
= vert_accuracy
;
155 packet
.ignore_flags
= ignore_flags
;
156 packet
.time_week
= time_week
;
157 packet
.gps_id
= gps_id
;
158 packet
.fix_type
= fix_type
;
159 packet
.satellites_visible
= satellites_visible
;
161 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_INPUT_LEN
);
164 msg
->msgid
= MAVLINK_MSG_ID_GPS_INPUT
;
165 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
169 * @brief Pack a gps_input message on a channel
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param chan The MAVLink channel this message will be sent over
173 * @param msg The MAVLink message to compress the data into
174 * @param time_usec Timestamp (micros since boot or Unix epoch)
175 * @param gps_id ID of the GPS for multiple GPS inputs
176 * @param ignore_flags Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided.
177 * @param time_week_ms GPS time (milliseconds from start of GPS week)
178 * @param time_week GPS week number
179 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK
180 * @param lat Latitude (WGS84), in degrees * 1E7
181 * @param lon Longitude (WGS84), in degrees * 1E7
182 * @param alt Altitude (AMSL, not WGS84), in m (positive for up)
183 * @param hdop GPS HDOP horizontal dilution of position in m
184 * @param vdop GPS VDOP vertical dilution of position in m
185 * @param vn GPS velocity in m/s in NORTH direction in earth-fixed NED frame
186 * @param ve GPS velocity in m/s in EAST direction in earth-fixed NED frame
187 * @param vd GPS velocity in m/s in DOWN direction in earth-fixed NED frame
188 * @param speed_accuracy GPS speed accuracy in m/s
189 * @param horiz_accuracy GPS horizontal accuracy in m
190 * @param vert_accuracy GPS vertical accuracy in m
191 * @param satellites_visible Number of satellites visible.
192 * @return length of the message in bytes (excluding serial stream start sign)
194 static inline uint16_t mavlink_msg_gps_input_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
195 mavlink_message_t
* msg
,
196 uint64_t time_usec
,uint8_t gps_id
,uint16_t ignore_flags
,uint32_t time_week_ms
,uint16_t time_week
,uint8_t fix_type
,int32_t lat
,int32_t lon
,float alt
,float hdop
,float vdop
,float vn
,float ve
,float vd
,float speed_accuracy
,float horiz_accuracy
,float vert_accuracy
,uint8_t satellites_visible
)
198 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199 char buf
[MAVLINK_MSG_ID_GPS_INPUT_LEN
];
200 _mav_put_uint64_t(buf
, 0, time_usec
);
201 _mav_put_uint32_t(buf
, 8, time_week_ms
);
202 _mav_put_int32_t(buf
, 12, lat
);
203 _mav_put_int32_t(buf
, 16, lon
);
204 _mav_put_float(buf
, 20, alt
);
205 _mav_put_float(buf
, 24, hdop
);
206 _mav_put_float(buf
, 28, vdop
);
207 _mav_put_float(buf
, 32, vn
);
208 _mav_put_float(buf
, 36, ve
);
209 _mav_put_float(buf
, 40, vd
);
210 _mav_put_float(buf
, 44, speed_accuracy
);
211 _mav_put_float(buf
, 48, horiz_accuracy
);
212 _mav_put_float(buf
, 52, vert_accuracy
);
213 _mav_put_uint16_t(buf
, 56, ignore_flags
);
214 _mav_put_uint16_t(buf
, 58, time_week
);
215 _mav_put_uint8_t(buf
, 60, gps_id
);
216 _mav_put_uint8_t(buf
, 61, fix_type
);
217 _mav_put_uint8_t(buf
, 62, satellites_visible
);
219 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_INPUT_LEN
);
221 mavlink_gps_input_t packet
;
222 packet
.time_usec
= time_usec
;
223 packet
.time_week_ms
= time_week_ms
;
232 packet
.speed_accuracy
= speed_accuracy
;
233 packet
.horiz_accuracy
= horiz_accuracy
;
234 packet
.vert_accuracy
= vert_accuracy
;
235 packet
.ignore_flags
= ignore_flags
;
236 packet
.time_week
= time_week
;
237 packet
.gps_id
= gps_id
;
238 packet
.fix_type
= fix_type
;
239 packet
.satellites_visible
= satellites_visible
;
241 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_INPUT_LEN
);
244 msg
->msgid
= MAVLINK_MSG_ID_GPS_INPUT
;
245 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
249 * @brief Encode a gps_input struct
251 * @param system_id ID of this system
252 * @param component_id ID of this component (e.g. 200 for IMU)
253 * @param msg The MAVLink message to compress the data into
254 * @param gps_input C-struct to read the message contents from
256 static inline uint16_t mavlink_msg_gps_input_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_gps_input_t
* gps_input
)
258 return mavlink_msg_gps_input_pack(system_id
, component_id
, msg
, gps_input
->time_usec
, gps_input
->gps_id
, gps_input
->ignore_flags
, gps_input
->time_week_ms
, gps_input
->time_week
, gps_input
->fix_type
, gps_input
->lat
, gps_input
->lon
, gps_input
->alt
, gps_input
->hdop
, gps_input
->vdop
, gps_input
->vn
, gps_input
->ve
, gps_input
->vd
, gps_input
->speed_accuracy
, gps_input
->horiz_accuracy
, gps_input
->vert_accuracy
, gps_input
->satellites_visible
);
262 * @brief Encode a gps_input struct on a channel
264 * @param system_id ID of this system
265 * @param component_id ID of this component (e.g. 200 for IMU)
266 * @param chan The MAVLink channel this message will be sent over
267 * @param msg The MAVLink message to compress the data into
268 * @param gps_input C-struct to read the message contents from
270 static inline uint16_t mavlink_msg_gps_input_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_gps_input_t
* gps_input
)
272 return mavlink_msg_gps_input_pack_chan(system_id
, component_id
, chan
, msg
, gps_input
->time_usec
, gps_input
->gps_id
, gps_input
->ignore_flags
, gps_input
->time_week_ms
, gps_input
->time_week
, gps_input
->fix_type
, gps_input
->lat
, gps_input
->lon
, gps_input
->alt
, gps_input
->hdop
, gps_input
->vdop
, gps_input
->vn
, gps_input
->ve
, gps_input
->vd
, gps_input
->speed_accuracy
, gps_input
->horiz_accuracy
, gps_input
->vert_accuracy
, gps_input
->satellites_visible
);
276 * @brief Send a gps_input message
277 * @param chan MAVLink channel to send the message
279 * @param time_usec Timestamp (micros since boot or Unix epoch)
280 * @param gps_id ID of the GPS for multiple GPS inputs
281 * @param ignore_flags Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided.
282 * @param time_week_ms GPS time (milliseconds from start of GPS week)
283 * @param time_week GPS week number
284 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK
285 * @param lat Latitude (WGS84), in degrees * 1E7
286 * @param lon Longitude (WGS84), in degrees * 1E7
287 * @param alt Altitude (AMSL, not WGS84), in m (positive for up)
288 * @param hdop GPS HDOP horizontal dilution of position in m
289 * @param vdop GPS VDOP vertical dilution of position in m
290 * @param vn GPS velocity in m/s in NORTH direction in earth-fixed NED frame
291 * @param ve GPS velocity in m/s in EAST direction in earth-fixed NED frame
292 * @param vd GPS velocity in m/s in DOWN direction in earth-fixed NED frame
293 * @param speed_accuracy GPS speed accuracy in m/s
294 * @param horiz_accuracy GPS horizontal accuracy in m
295 * @param vert_accuracy GPS vertical accuracy in m
296 * @param satellites_visible Number of satellites visible.
298 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
300 static inline void mavlink_msg_gps_input_send(mavlink_channel_t chan
, uint64_t time_usec
, uint8_t gps_id
, uint16_t ignore_flags
, uint32_t time_week_ms
, uint16_t time_week
, uint8_t fix_type
, int32_t lat
, int32_t lon
, float alt
, float hdop
, float vdop
, float vn
, float ve
, float vd
, float speed_accuracy
, float horiz_accuracy
, float vert_accuracy
, uint8_t satellites_visible
)
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303 char buf
[MAVLINK_MSG_ID_GPS_INPUT_LEN
];
304 _mav_put_uint64_t(buf
, 0, time_usec
);
305 _mav_put_uint32_t(buf
, 8, time_week_ms
);
306 _mav_put_int32_t(buf
, 12, lat
);
307 _mav_put_int32_t(buf
, 16, lon
);
308 _mav_put_float(buf
, 20, alt
);
309 _mav_put_float(buf
, 24, hdop
);
310 _mav_put_float(buf
, 28, vdop
);
311 _mav_put_float(buf
, 32, vn
);
312 _mav_put_float(buf
, 36, ve
);
313 _mav_put_float(buf
, 40, vd
);
314 _mav_put_float(buf
, 44, speed_accuracy
);
315 _mav_put_float(buf
, 48, horiz_accuracy
);
316 _mav_put_float(buf
, 52, vert_accuracy
);
317 _mav_put_uint16_t(buf
, 56, ignore_flags
);
318 _mav_put_uint16_t(buf
, 58, time_week
);
319 _mav_put_uint8_t(buf
, 60, gps_id
);
320 _mav_put_uint8_t(buf
, 61, fix_type
);
321 _mav_put_uint8_t(buf
, 62, satellites_visible
);
323 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_INPUT
, buf
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
325 mavlink_gps_input_t packet
;
326 packet
.time_usec
= time_usec
;
327 packet
.time_week_ms
= time_week_ms
;
336 packet
.speed_accuracy
= speed_accuracy
;
337 packet
.horiz_accuracy
= horiz_accuracy
;
338 packet
.vert_accuracy
= vert_accuracy
;
339 packet
.ignore_flags
= ignore_flags
;
340 packet
.time_week
= time_week
;
341 packet
.gps_id
= gps_id
;
342 packet
.fix_type
= fix_type
;
343 packet
.satellites_visible
= satellites_visible
;
345 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_INPUT
, (const char *)&packet
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
350 * @brief Send a gps_input message
351 * @param chan MAVLink channel to send the message
352 * @param struct The MAVLink struct to serialize
354 static inline void mavlink_msg_gps_input_send_struct(mavlink_channel_t chan
, const mavlink_gps_input_t
* gps_input
)
356 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
357 mavlink_msg_gps_input_send(chan
, gps_input
->time_usec
, gps_input
->gps_id
, gps_input
->ignore_flags
, gps_input
->time_week_ms
, gps_input
->time_week
, gps_input
->fix_type
, gps_input
->lat
, gps_input
->lon
, gps_input
->alt
, gps_input
->hdop
, gps_input
->vdop
, gps_input
->vn
, gps_input
->ve
, gps_input
->vd
, gps_input
->speed_accuracy
, gps_input
->horiz_accuracy
, gps_input
->vert_accuracy
, gps_input
->satellites_visible
);
359 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_INPUT
, (const char *)gps_input
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
363 #if MAVLINK_MSG_ID_GPS_INPUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
365 This varient of _send() can be used to save stack space by re-using
366 memory from the receive buffer. The caller provides a
367 mavlink_message_t which is the size of a full mavlink message. This
368 is usually the receive buffer for the channel, and allows a reply to an
369 incoming message with minimum stack space usage.
371 static inline void mavlink_msg_gps_input_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint64_t time_usec
, uint8_t gps_id
, uint16_t ignore_flags
, uint32_t time_week_ms
, uint16_t time_week
, uint8_t fix_type
, int32_t lat
, int32_t lon
, float alt
, float hdop
, float vdop
, float vn
, float ve
, float vd
, float speed_accuracy
, float horiz_accuracy
, float vert_accuracy
, uint8_t satellites_visible
)
373 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
374 char *buf
= (char *)msgbuf
;
375 _mav_put_uint64_t(buf
, 0, time_usec
);
376 _mav_put_uint32_t(buf
, 8, time_week_ms
);
377 _mav_put_int32_t(buf
, 12, lat
);
378 _mav_put_int32_t(buf
, 16, lon
);
379 _mav_put_float(buf
, 20, alt
);
380 _mav_put_float(buf
, 24, hdop
);
381 _mav_put_float(buf
, 28, vdop
);
382 _mav_put_float(buf
, 32, vn
);
383 _mav_put_float(buf
, 36, ve
);
384 _mav_put_float(buf
, 40, vd
);
385 _mav_put_float(buf
, 44, speed_accuracy
);
386 _mav_put_float(buf
, 48, horiz_accuracy
);
387 _mav_put_float(buf
, 52, vert_accuracy
);
388 _mav_put_uint16_t(buf
, 56, ignore_flags
);
389 _mav_put_uint16_t(buf
, 58, time_week
);
390 _mav_put_uint8_t(buf
, 60, gps_id
);
391 _mav_put_uint8_t(buf
, 61, fix_type
);
392 _mav_put_uint8_t(buf
, 62, satellites_visible
);
394 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_INPUT
, buf
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
396 mavlink_gps_input_t
*packet
= (mavlink_gps_input_t
*)msgbuf
;
397 packet
->time_usec
= time_usec
;
398 packet
->time_week_ms
= time_week_ms
;
407 packet
->speed_accuracy
= speed_accuracy
;
408 packet
->horiz_accuracy
= horiz_accuracy
;
409 packet
->vert_accuracy
= vert_accuracy
;
410 packet
->ignore_flags
= ignore_flags
;
411 packet
->time_week
= time_week
;
412 packet
->gps_id
= gps_id
;
413 packet
->fix_type
= fix_type
;
414 packet
->satellites_visible
= satellites_visible
;
416 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_INPUT
, (const char *)packet
, MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN
, MAVLINK_MSG_ID_GPS_INPUT_LEN
, MAVLINK_MSG_ID_GPS_INPUT_CRC
);
423 // MESSAGE GPS_INPUT UNPACKING
427 * @brief Get field time_usec from gps_input message
429 * @return Timestamp (micros since boot or Unix epoch)
431 static inline uint64_t mavlink_msg_gps_input_get_time_usec(const mavlink_message_t
* msg
)
433 return _MAV_RETURN_uint64_t(msg
, 0);
437 * @brief Get field gps_id from gps_input message
439 * @return ID of the GPS for multiple GPS inputs
441 static inline uint8_t mavlink_msg_gps_input_get_gps_id(const mavlink_message_t
* msg
)
443 return _MAV_RETURN_uint8_t(msg
, 60);
447 * @brief Get field ignore_flags from gps_input message
449 * @return Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided.
451 static inline uint16_t mavlink_msg_gps_input_get_ignore_flags(const mavlink_message_t
* msg
)
453 return _MAV_RETURN_uint16_t(msg
, 56);
457 * @brief Get field time_week_ms from gps_input message
459 * @return GPS time (milliseconds from start of GPS week)
461 static inline uint32_t mavlink_msg_gps_input_get_time_week_ms(const mavlink_message_t
* msg
)
463 return _MAV_RETURN_uint32_t(msg
, 8);
467 * @brief Get field time_week from gps_input message
469 * @return GPS week number
471 static inline uint16_t mavlink_msg_gps_input_get_time_week(const mavlink_message_t
* msg
)
473 return _MAV_RETURN_uint16_t(msg
, 58);
477 * @brief Get field fix_type from gps_input message
479 * @return 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK
481 static inline uint8_t mavlink_msg_gps_input_get_fix_type(const mavlink_message_t
* msg
)
483 return _MAV_RETURN_uint8_t(msg
, 61);
487 * @brief Get field lat from gps_input message
489 * @return Latitude (WGS84), in degrees * 1E7
491 static inline int32_t mavlink_msg_gps_input_get_lat(const mavlink_message_t
* msg
)
493 return _MAV_RETURN_int32_t(msg
, 12);
497 * @brief Get field lon from gps_input message
499 * @return Longitude (WGS84), in degrees * 1E7
501 static inline int32_t mavlink_msg_gps_input_get_lon(const mavlink_message_t
* msg
)
503 return _MAV_RETURN_int32_t(msg
, 16);
507 * @brief Get field alt from gps_input message
509 * @return Altitude (AMSL, not WGS84), in m (positive for up)
511 static inline float mavlink_msg_gps_input_get_alt(const mavlink_message_t
* msg
)
513 return _MAV_RETURN_float(msg
, 20);
517 * @brief Get field hdop from gps_input message
519 * @return GPS HDOP horizontal dilution of position in m
521 static inline float mavlink_msg_gps_input_get_hdop(const mavlink_message_t
* msg
)
523 return _MAV_RETURN_float(msg
, 24);
527 * @brief Get field vdop from gps_input message
529 * @return GPS VDOP vertical dilution of position in m
531 static inline float mavlink_msg_gps_input_get_vdop(const mavlink_message_t
* msg
)
533 return _MAV_RETURN_float(msg
, 28);
537 * @brief Get field vn from gps_input message
539 * @return GPS velocity in m/s in NORTH direction in earth-fixed NED frame
541 static inline float mavlink_msg_gps_input_get_vn(const mavlink_message_t
* msg
)
543 return _MAV_RETURN_float(msg
, 32);
547 * @brief Get field ve from gps_input message
549 * @return GPS velocity in m/s in EAST direction in earth-fixed NED frame
551 static inline float mavlink_msg_gps_input_get_ve(const mavlink_message_t
* msg
)
553 return _MAV_RETURN_float(msg
, 36);
557 * @brief Get field vd from gps_input message
559 * @return GPS velocity in m/s in DOWN direction in earth-fixed NED frame
561 static inline float mavlink_msg_gps_input_get_vd(const mavlink_message_t
* msg
)
563 return _MAV_RETURN_float(msg
, 40);
567 * @brief Get field speed_accuracy from gps_input message
569 * @return GPS speed accuracy in m/s
571 static inline float mavlink_msg_gps_input_get_speed_accuracy(const mavlink_message_t
* msg
)
573 return _MAV_RETURN_float(msg
, 44);
577 * @brief Get field horiz_accuracy from gps_input message
579 * @return GPS horizontal accuracy in m
581 static inline float mavlink_msg_gps_input_get_horiz_accuracy(const mavlink_message_t
* msg
)
583 return _MAV_RETURN_float(msg
, 48);
587 * @brief Get field vert_accuracy from gps_input message
589 * @return GPS vertical accuracy in m
591 static inline float mavlink_msg_gps_input_get_vert_accuracy(const mavlink_message_t
* msg
)
593 return _MAV_RETURN_float(msg
, 52);
597 * @brief Get field satellites_visible from gps_input message
599 * @return Number of satellites visible.
601 static inline uint8_t mavlink_msg_gps_input_get_satellites_visible(const mavlink_message_t
* msg
)
603 return _MAV_RETURN_uint8_t(msg
, 62);
607 * @brief Decode a gps_input message into a struct
609 * @param msg The message to decode
610 * @param gps_input C-struct to decode the message contents into
612 static inline void mavlink_msg_gps_input_decode(const mavlink_message_t
* msg
, mavlink_gps_input_t
* gps_input
)
614 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
615 gps_input
->time_usec
= mavlink_msg_gps_input_get_time_usec(msg
);
616 gps_input
->time_week_ms
= mavlink_msg_gps_input_get_time_week_ms(msg
);
617 gps_input
->lat
= mavlink_msg_gps_input_get_lat(msg
);
618 gps_input
->lon
= mavlink_msg_gps_input_get_lon(msg
);
619 gps_input
->alt
= mavlink_msg_gps_input_get_alt(msg
);
620 gps_input
->hdop
= mavlink_msg_gps_input_get_hdop(msg
);
621 gps_input
->vdop
= mavlink_msg_gps_input_get_vdop(msg
);
622 gps_input
->vn
= mavlink_msg_gps_input_get_vn(msg
);
623 gps_input
->ve
= mavlink_msg_gps_input_get_ve(msg
);
624 gps_input
->vd
= mavlink_msg_gps_input_get_vd(msg
);
625 gps_input
->speed_accuracy
= mavlink_msg_gps_input_get_speed_accuracy(msg
);
626 gps_input
->horiz_accuracy
= mavlink_msg_gps_input_get_horiz_accuracy(msg
);
627 gps_input
->vert_accuracy
= mavlink_msg_gps_input_get_vert_accuracy(msg
);
628 gps_input
->ignore_flags
= mavlink_msg_gps_input_get_ignore_flags(msg
);
629 gps_input
->time_week
= mavlink_msg_gps_input_get_time_week(msg
);
630 gps_input
->gps_id
= mavlink_msg_gps_input_get_gps_id(msg
);
631 gps_input
->fix_type
= mavlink_msg_gps_input_get_fix_type(msg
);
632 gps_input
->satellites_visible
= mavlink_msg_gps_input_get_satellites_visible(msg
);
634 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_GPS_INPUT_LEN
? msg
->len
: MAVLINK_MSG_ID_GPS_INPUT_LEN
;
635 memset(gps_input
, 0, MAVLINK_MSG_ID_GPS_INPUT_LEN
);
636 memcpy(gps_input
, _MAV_PAYLOAD(msg
), len
);