2 // MESSAGE GPS2_RAW PACKING
4 #define MAVLINK_MSG_ID_GPS2_RAW 124
7 typedef struct __mavlink_gps2_raw_t
{
8 uint64_t time_usec
; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
9 int32_t lat
; /*< Latitude (WGS84), in degrees * 1E7*/
10 int32_t lon
; /*< Longitude (WGS84), in degrees * 1E7*/
11 int32_t alt
; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/
12 uint32_t dgps_age
; /*< Age of DGPS info*/
13 uint16_t eph
; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
14 uint16_t epv
; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
15 uint16_t vel
; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
16 uint16_t cog
; /*< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX*/
17 uint8_t fix_type
; /*< See the GPS_FIX_TYPE enum.*/
18 uint8_t satellites_visible
; /*< Number of satellites visible. If unknown, set to 255*/
19 uint8_t dgps_numch
; /*< Number of DGPS satellites*/
20 }) mavlink_gps2_raw_t
;
22 #define MAVLINK_MSG_ID_GPS2_RAW_LEN 35
23 #define MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN 35
24 #define MAVLINK_MSG_ID_124_LEN 35
25 #define MAVLINK_MSG_ID_124_MIN_LEN 35
27 #define MAVLINK_MSG_ID_GPS2_RAW_CRC 87
28 #define MAVLINK_MSG_ID_124_CRC 87
32 #if MAVLINK_COMMAND_24BIT
33 #define MAVLINK_MESSAGE_INFO_GPS2_RAW { \
37 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \
38 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \
39 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) }, \
40 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) }, \
41 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \
42 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) }, \
43 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) }, \
44 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) }, \
45 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) }, \
46 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \
47 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) }, \
48 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \
52 #define MAVLINK_MESSAGE_INFO_GPS2_RAW { \
55 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \
56 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \
57 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) }, \
58 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) }, \
59 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \
60 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) }, \
61 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) }, \
62 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) }, \
63 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) }, \
64 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \
65 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) }, \
66 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \
72 * @brief Pack a gps2_raw message
73 * @param system_id ID of this system
74 * @param component_id ID of this component (e.g. 200 for IMU)
75 * @param msg The MAVLink message to compress the data into
77 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
78 * @param fix_type See the GPS_FIX_TYPE enum.
79 * @param lat Latitude (WGS84), in degrees * 1E7
80 * @param lon Longitude (WGS84), in degrees * 1E7
81 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
82 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
83 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
84 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
85 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
86 * @param satellites_visible Number of satellites visible. If unknown, set to 255
87 * @param dgps_numch Number of DGPS satellites
88 * @param dgps_age Age of DGPS info
89 * @return length of the message in bytes (excluding serial stream start sign)
91 static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
92 uint64_t time_usec
, uint8_t fix_type
, int32_t lat
, int32_t lon
, int32_t alt
, uint16_t eph
, uint16_t epv
, uint16_t vel
, uint16_t cog
, uint8_t satellites_visible
, uint8_t dgps_numch
, uint32_t dgps_age
)
94 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
95 char buf
[MAVLINK_MSG_ID_GPS2_RAW_LEN
];
96 _mav_put_uint64_t(buf
, 0, time_usec
);
97 _mav_put_int32_t(buf
, 8, lat
);
98 _mav_put_int32_t(buf
, 12, lon
);
99 _mav_put_int32_t(buf
, 16, alt
);
100 _mav_put_uint32_t(buf
, 20, dgps_age
);
101 _mav_put_uint16_t(buf
, 24, eph
);
102 _mav_put_uint16_t(buf
, 26, epv
);
103 _mav_put_uint16_t(buf
, 28, vel
);
104 _mav_put_uint16_t(buf
, 30, cog
);
105 _mav_put_uint8_t(buf
, 32, fix_type
);
106 _mav_put_uint8_t(buf
, 33, satellites_visible
);
107 _mav_put_uint8_t(buf
, 34, dgps_numch
);
109 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS2_RAW_LEN
);
111 mavlink_gps2_raw_t packet
;
112 packet
.time_usec
= time_usec
;
116 packet
.dgps_age
= dgps_age
;
121 packet
.fix_type
= fix_type
;
122 packet
.satellites_visible
= satellites_visible
;
123 packet
.dgps_numch
= dgps_numch
;
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS2_RAW_LEN
);
128 msg
->msgid
= MAVLINK_MSG_ID_GPS2_RAW
;
129 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
133 * @brief Pack a gps2_raw message on a channel
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param chan The MAVLink channel this message will be sent over
137 * @param msg The MAVLink message to compress the data into
138 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
139 * @param fix_type See the GPS_FIX_TYPE enum.
140 * @param lat Latitude (WGS84), in degrees * 1E7
141 * @param lon Longitude (WGS84), in degrees * 1E7
142 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
143 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
144 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
145 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
146 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
147 * @param satellites_visible Number of satellites visible. If unknown, set to 255
148 * @param dgps_numch Number of DGPS satellites
149 * @param dgps_age Age of DGPS info
150 * @return length of the message in bytes (excluding serial stream start sign)
152 static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
153 mavlink_message_t
* msg
,
154 uint64_t time_usec
,uint8_t fix_type
,int32_t lat
,int32_t lon
,int32_t alt
,uint16_t eph
,uint16_t epv
,uint16_t vel
,uint16_t cog
,uint8_t satellites_visible
,uint8_t dgps_numch
,uint32_t dgps_age
)
156 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
157 char buf
[MAVLINK_MSG_ID_GPS2_RAW_LEN
];
158 _mav_put_uint64_t(buf
, 0, time_usec
);
159 _mav_put_int32_t(buf
, 8, lat
);
160 _mav_put_int32_t(buf
, 12, lon
);
161 _mav_put_int32_t(buf
, 16, alt
);
162 _mav_put_uint32_t(buf
, 20, dgps_age
);
163 _mav_put_uint16_t(buf
, 24, eph
);
164 _mav_put_uint16_t(buf
, 26, epv
);
165 _mav_put_uint16_t(buf
, 28, vel
);
166 _mav_put_uint16_t(buf
, 30, cog
);
167 _mav_put_uint8_t(buf
, 32, fix_type
);
168 _mav_put_uint8_t(buf
, 33, satellites_visible
);
169 _mav_put_uint8_t(buf
, 34, dgps_numch
);
171 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS2_RAW_LEN
);
173 mavlink_gps2_raw_t packet
;
174 packet
.time_usec
= time_usec
;
178 packet
.dgps_age
= dgps_age
;
183 packet
.fix_type
= fix_type
;
184 packet
.satellites_visible
= satellites_visible
;
185 packet
.dgps_numch
= dgps_numch
;
187 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS2_RAW_LEN
);
190 msg
->msgid
= MAVLINK_MSG_ID_GPS2_RAW
;
191 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
195 * @brief Encode a gps2_raw struct
197 * @param system_id ID of this system
198 * @param component_id ID of this component (e.g. 200 for IMU)
199 * @param msg The MAVLink message to compress the data into
200 * @param gps2_raw C-struct to read the message contents from
202 static inline uint16_t mavlink_msg_gps2_raw_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_gps2_raw_t
* gps2_raw
)
204 return mavlink_msg_gps2_raw_pack(system_id
, component_id
, msg
, gps2_raw
->time_usec
, gps2_raw
->fix_type
, gps2_raw
->lat
, gps2_raw
->lon
, gps2_raw
->alt
, gps2_raw
->eph
, gps2_raw
->epv
, gps2_raw
->vel
, gps2_raw
->cog
, gps2_raw
->satellites_visible
, gps2_raw
->dgps_numch
, gps2_raw
->dgps_age
);
208 * @brief Encode a gps2_raw struct on a channel
210 * @param system_id ID of this system
211 * @param component_id ID of this component (e.g. 200 for IMU)
212 * @param chan The MAVLink channel this message will be sent over
213 * @param msg The MAVLink message to compress the data into
214 * @param gps2_raw C-struct to read the message contents from
216 static inline uint16_t mavlink_msg_gps2_raw_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_gps2_raw_t
* gps2_raw
)
218 return mavlink_msg_gps2_raw_pack_chan(system_id
, component_id
, chan
, msg
, gps2_raw
->time_usec
, gps2_raw
->fix_type
, gps2_raw
->lat
, gps2_raw
->lon
, gps2_raw
->alt
, gps2_raw
->eph
, gps2_raw
->epv
, gps2_raw
->vel
, gps2_raw
->cog
, gps2_raw
->satellites_visible
, gps2_raw
->dgps_numch
, gps2_raw
->dgps_age
);
222 * @brief Send a gps2_raw message
223 * @param chan MAVLink channel to send the message
225 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
226 * @param fix_type See the GPS_FIX_TYPE enum.
227 * @param lat Latitude (WGS84), in degrees * 1E7
228 * @param lon Longitude (WGS84), in degrees * 1E7
229 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
230 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
231 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
232 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
233 * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
234 * @param satellites_visible Number of satellites visible. If unknown, set to 255
235 * @param dgps_numch Number of DGPS satellites
236 * @param dgps_age Age of DGPS info
238 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
240 static inline void mavlink_msg_gps2_raw_send(mavlink_channel_t chan
, uint64_t time_usec
, uint8_t fix_type
, int32_t lat
, int32_t lon
, int32_t alt
, uint16_t eph
, uint16_t epv
, uint16_t vel
, uint16_t cog
, uint8_t satellites_visible
, uint8_t dgps_numch
, uint32_t dgps_age
)
242 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
243 char buf
[MAVLINK_MSG_ID_GPS2_RAW_LEN
];
244 _mav_put_uint64_t(buf
, 0, time_usec
);
245 _mav_put_int32_t(buf
, 8, lat
);
246 _mav_put_int32_t(buf
, 12, lon
);
247 _mav_put_int32_t(buf
, 16, alt
);
248 _mav_put_uint32_t(buf
, 20, dgps_age
);
249 _mav_put_uint16_t(buf
, 24, eph
);
250 _mav_put_uint16_t(buf
, 26, epv
);
251 _mav_put_uint16_t(buf
, 28, vel
);
252 _mav_put_uint16_t(buf
, 30, cog
);
253 _mav_put_uint8_t(buf
, 32, fix_type
);
254 _mav_put_uint8_t(buf
, 33, satellites_visible
);
255 _mav_put_uint8_t(buf
, 34, dgps_numch
);
257 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS2_RAW
, buf
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
259 mavlink_gps2_raw_t packet
;
260 packet
.time_usec
= time_usec
;
264 packet
.dgps_age
= dgps_age
;
269 packet
.fix_type
= fix_type
;
270 packet
.satellites_visible
= satellites_visible
;
271 packet
.dgps_numch
= dgps_numch
;
273 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS2_RAW
, (const char *)&packet
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
278 * @brief Send a gps2_raw message
279 * @param chan MAVLink channel to send the message
280 * @param struct The MAVLink struct to serialize
282 static inline void mavlink_msg_gps2_raw_send_struct(mavlink_channel_t chan
, const mavlink_gps2_raw_t
* gps2_raw
)
284 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
285 mavlink_msg_gps2_raw_send(chan
, gps2_raw
->time_usec
, gps2_raw
->fix_type
, gps2_raw
->lat
, gps2_raw
->lon
, gps2_raw
->alt
, gps2_raw
->eph
, gps2_raw
->epv
, gps2_raw
->vel
, gps2_raw
->cog
, gps2_raw
->satellites_visible
, gps2_raw
->dgps_numch
, gps2_raw
->dgps_age
);
287 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS2_RAW
, (const char *)gps2_raw
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
291 #if MAVLINK_MSG_ID_GPS2_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
293 This varient of _send() can be used to save stack space by re-using
294 memory from the receive buffer. The caller provides a
295 mavlink_message_t which is the size of a full mavlink message. This
296 is usually the receive buffer for the channel, and allows a reply to an
297 incoming message with minimum stack space usage.
299 static inline void mavlink_msg_gps2_raw_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint64_t time_usec
, uint8_t fix_type
, int32_t lat
, int32_t lon
, int32_t alt
, uint16_t eph
, uint16_t epv
, uint16_t vel
, uint16_t cog
, uint8_t satellites_visible
, uint8_t dgps_numch
, uint32_t dgps_age
)
301 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
302 char *buf
= (char *)msgbuf
;
303 _mav_put_uint64_t(buf
, 0, time_usec
);
304 _mav_put_int32_t(buf
, 8, lat
);
305 _mav_put_int32_t(buf
, 12, lon
);
306 _mav_put_int32_t(buf
, 16, alt
);
307 _mav_put_uint32_t(buf
, 20, dgps_age
);
308 _mav_put_uint16_t(buf
, 24, eph
);
309 _mav_put_uint16_t(buf
, 26, epv
);
310 _mav_put_uint16_t(buf
, 28, vel
);
311 _mav_put_uint16_t(buf
, 30, cog
);
312 _mav_put_uint8_t(buf
, 32, fix_type
);
313 _mav_put_uint8_t(buf
, 33, satellites_visible
);
314 _mav_put_uint8_t(buf
, 34, dgps_numch
);
316 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS2_RAW
, buf
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
318 mavlink_gps2_raw_t
*packet
= (mavlink_gps2_raw_t
*)msgbuf
;
319 packet
->time_usec
= time_usec
;
323 packet
->dgps_age
= dgps_age
;
328 packet
->fix_type
= fix_type
;
329 packet
->satellites_visible
= satellites_visible
;
330 packet
->dgps_numch
= dgps_numch
;
332 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS2_RAW
, (const char *)packet
, MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN
, MAVLINK_MSG_ID_GPS2_RAW_LEN
, MAVLINK_MSG_ID_GPS2_RAW_CRC
);
339 // MESSAGE GPS2_RAW UNPACKING
343 * @brief Get field time_usec from gps2_raw message
345 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
347 static inline uint64_t mavlink_msg_gps2_raw_get_time_usec(const mavlink_message_t
* msg
)
349 return _MAV_RETURN_uint64_t(msg
, 0);
353 * @brief Get field fix_type from gps2_raw message
355 * @return See the GPS_FIX_TYPE enum.
357 static inline uint8_t mavlink_msg_gps2_raw_get_fix_type(const mavlink_message_t
* msg
)
359 return _MAV_RETURN_uint8_t(msg
, 32);
363 * @brief Get field lat from gps2_raw message
365 * @return Latitude (WGS84), in degrees * 1E7
367 static inline int32_t mavlink_msg_gps2_raw_get_lat(const mavlink_message_t
* msg
)
369 return _MAV_RETURN_int32_t(msg
, 8);
373 * @brief Get field lon from gps2_raw message
375 * @return Longitude (WGS84), in degrees * 1E7
377 static inline int32_t mavlink_msg_gps2_raw_get_lon(const mavlink_message_t
* msg
)
379 return _MAV_RETURN_int32_t(msg
, 12);
383 * @brief Get field alt from gps2_raw message
385 * @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
387 static inline int32_t mavlink_msg_gps2_raw_get_alt(const mavlink_message_t
* msg
)
389 return _MAV_RETURN_int32_t(msg
, 16);
393 * @brief Get field eph from gps2_raw message
395 * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
397 static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t
* msg
)
399 return _MAV_RETURN_uint16_t(msg
, 24);
403 * @brief Get field epv from gps2_raw message
405 * @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
407 static inline uint16_t mavlink_msg_gps2_raw_get_epv(const mavlink_message_t
* msg
)
409 return _MAV_RETURN_uint16_t(msg
, 26);
413 * @brief Get field vel from gps2_raw message
415 * @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
417 static inline uint16_t mavlink_msg_gps2_raw_get_vel(const mavlink_message_t
* msg
)
419 return _MAV_RETURN_uint16_t(msg
, 28);
423 * @brief Get field cog from gps2_raw message
425 * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
427 static inline uint16_t mavlink_msg_gps2_raw_get_cog(const mavlink_message_t
* msg
)
429 return _MAV_RETURN_uint16_t(msg
, 30);
433 * @brief Get field satellites_visible from gps2_raw message
435 * @return Number of satellites visible. If unknown, set to 255
437 static inline uint8_t mavlink_msg_gps2_raw_get_satellites_visible(const mavlink_message_t
* msg
)
439 return _MAV_RETURN_uint8_t(msg
, 33);
443 * @brief Get field dgps_numch from gps2_raw message
445 * @return Number of DGPS satellites
447 static inline uint8_t mavlink_msg_gps2_raw_get_dgps_numch(const mavlink_message_t
* msg
)
449 return _MAV_RETURN_uint8_t(msg
, 34);
453 * @brief Get field dgps_age from gps2_raw message
455 * @return Age of DGPS info
457 static inline uint32_t mavlink_msg_gps2_raw_get_dgps_age(const mavlink_message_t
* msg
)
459 return _MAV_RETURN_uint32_t(msg
, 20);
463 * @brief Decode a gps2_raw message into a struct
465 * @param msg The message to decode
466 * @param gps2_raw C-struct to decode the message contents into
468 static inline void mavlink_msg_gps2_raw_decode(const mavlink_message_t
* msg
, mavlink_gps2_raw_t
* gps2_raw
)
470 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
471 gps2_raw
->time_usec
= mavlink_msg_gps2_raw_get_time_usec(msg
);
472 gps2_raw
->lat
= mavlink_msg_gps2_raw_get_lat(msg
);
473 gps2_raw
->lon
= mavlink_msg_gps2_raw_get_lon(msg
);
474 gps2_raw
->alt
= mavlink_msg_gps2_raw_get_alt(msg
);
475 gps2_raw
->dgps_age
= mavlink_msg_gps2_raw_get_dgps_age(msg
);
476 gps2_raw
->eph
= mavlink_msg_gps2_raw_get_eph(msg
);
477 gps2_raw
->epv
= mavlink_msg_gps2_raw_get_epv(msg
);
478 gps2_raw
->vel
= mavlink_msg_gps2_raw_get_vel(msg
);
479 gps2_raw
->cog
= mavlink_msg_gps2_raw_get_cog(msg
);
480 gps2_raw
->fix_type
= mavlink_msg_gps2_raw_get_fix_type(msg
);
481 gps2_raw
->satellites_visible
= mavlink_msg_gps2_raw_get_satellites_visible(msg
);
482 gps2_raw
->dgps_numch
= mavlink_msg_gps2_raw_get_dgps_numch(msg
);
484 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_GPS2_RAW_LEN
? msg
->len
: MAVLINK_MSG_ID_GPS2_RAW_LEN
;
485 memset(gps2_raw
, 0, MAVLINK_MSG_ID_GPS2_RAW_LEN
);
486 memcpy(gps2_raw
, _MAV_PAYLOAD(msg
), len
);