source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_gps2_raw.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 21.0 KB
Line 
1// MESSAGE GPS2_RAW PACKING
2
3#define MAVLINK_MSG_ID_GPS2_RAW 124
4
5typedef struct MAVLINK_PACKED __mavlink_gps2_raw_t
6{
7 uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
8 int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
9 int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
10 int32_t alt; /*< Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)*/
11 uint32_t dgps_age; /*< Age of DGPS info*/
12 uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
13 uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
14 uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
15 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*/
16 uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/
17 uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
18 uint8_t dgps_numch; /*< Number of DGPS satellites*/
19} mavlink_gps2_raw_t;
20
21#define MAVLINK_MSG_ID_GPS2_RAW_LEN 35
22#define MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN 35
23#define MAVLINK_MSG_ID_124_LEN 35
24#define MAVLINK_MSG_ID_124_MIN_LEN 35
25
26#define MAVLINK_MSG_ID_GPS2_RAW_CRC 87
27#define MAVLINK_MSG_ID_124_CRC 87
28
29
30
31#if MAVLINK_COMMAND_24BIT
32#define MAVLINK_MESSAGE_INFO_GPS2_RAW { \
33 124, \
34 "GPS2_RAW", \
35 12, \
36 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \
37 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \
38 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) }, \
39 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) }, \
40 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \
41 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) }, \
42 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) }, \
43 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) }, \
44 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) }, \
45 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \
46 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) }, \
47 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \
48 } \
49}
50#else
51#define MAVLINK_MESSAGE_INFO_GPS2_RAW { \
52 "GPS2_RAW", \
53 12, \
54 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps2_raw_t, time_usec) }, \
55 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps2_raw_t, lat) }, \
56 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps2_raw_t, lon) }, \
57 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps2_raw_t, alt) }, \
58 { "dgps_age", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gps2_raw_t, dgps_age) }, \
59 { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps2_raw_t, eph) }, \
60 { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps2_raw_t, epv) }, \
61 { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_gps2_raw_t, vel) }, \
62 { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_gps2_raw_t, cog) }, \
63 { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_gps2_raw_t, fix_type) }, \
64 { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_gps2_raw_t, satellites_visible) }, \
65 { "dgps_numch", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_gps2_raw_t, dgps_numch) }, \
66 } \
67}
68#endif
69
70/**
71 * @brief Pack a gps2_raw message
72 * @param system_id ID of this system
73 * @param component_id ID of this component (e.g. 200 for IMU)
74 * @param msg The MAVLink message to compress the data into
75 *
76 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
77 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
78 * @param lat Latitude (WGS84), in degrees * 1E7
79 * @param lon Longitude (WGS84), in degrees * 1E7
80 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
81 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
82 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
83 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
84 * @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
85 * @param satellites_visible Number of satellites visible. If unknown, set to 255
86 * @param dgps_numch Number of DGPS satellites
87 * @param dgps_age Age of DGPS info
88 * @return length of the message in bytes (excluding serial stream start sign)
89 */
90static inline uint16_t mavlink_msg_gps2_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
91 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)
92{
93#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
94 char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
95 _mav_put_uint64_t(buf, 0, time_usec);
96 _mav_put_int32_t(buf, 8, lat);
97 _mav_put_int32_t(buf, 12, lon);
98 _mav_put_int32_t(buf, 16, alt);
99 _mav_put_uint32_t(buf, 20, dgps_age);
100 _mav_put_uint16_t(buf, 24, eph);
101 _mav_put_uint16_t(buf, 26, epv);
102 _mav_put_uint16_t(buf, 28, vel);
103 _mav_put_uint16_t(buf, 30, cog);
104 _mav_put_uint8_t(buf, 32, fix_type);
105 _mav_put_uint8_t(buf, 33, satellites_visible);
106 _mav_put_uint8_t(buf, 34, dgps_numch);
107
108 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
109#else
110 mavlink_gps2_raw_t packet;
111 packet.time_usec = time_usec;
112 packet.lat = lat;
113 packet.lon = lon;
114 packet.alt = alt;
115 packet.dgps_age = dgps_age;
116 packet.eph = eph;
117 packet.epv = epv;
118 packet.vel = vel;
119 packet.cog = cog;
120 packet.fix_type = fix_type;
121 packet.satellites_visible = satellites_visible;
122 packet.dgps_numch = dgps_numch;
123
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
125#endif
126
127 msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
128 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);
129}
130
131/**
132 * @brief Pack a gps2_raw message on a channel
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
138 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
139 * @param lat Latitude (WGS84), in degrees * 1E7
140 * @param lon Longitude (WGS84), in degrees * 1E7
141 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
142 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
143 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
144 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
145 * @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
146 * @param satellites_visible Number of satellites visible. If unknown, set to 255
147 * @param dgps_numch Number of DGPS satellites
148 * @param dgps_age Age of DGPS info
149 * @return length of the message in bytes (excluding serial stream start sign)
150 */
151static inline uint16_t mavlink_msg_gps2_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
152 mavlink_message_t* msg,
153 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)
154{
155#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
157 _mav_put_uint64_t(buf, 0, time_usec);
158 _mav_put_int32_t(buf, 8, lat);
159 _mav_put_int32_t(buf, 12, lon);
160 _mav_put_int32_t(buf, 16, alt);
161 _mav_put_uint32_t(buf, 20, dgps_age);
162 _mav_put_uint16_t(buf, 24, eph);
163 _mav_put_uint16_t(buf, 26, epv);
164 _mav_put_uint16_t(buf, 28, vel);
165 _mav_put_uint16_t(buf, 30, cog);
166 _mav_put_uint8_t(buf, 32, fix_type);
167 _mav_put_uint8_t(buf, 33, satellites_visible);
168 _mav_put_uint8_t(buf, 34, dgps_numch);
169
170 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS2_RAW_LEN);
171#else
172 mavlink_gps2_raw_t packet;
173 packet.time_usec = time_usec;
174 packet.lat = lat;
175 packet.lon = lon;
176 packet.alt = alt;
177 packet.dgps_age = dgps_age;
178 packet.eph = eph;
179 packet.epv = epv;
180 packet.vel = vel;
181 packet.cog = cog;
182 packet.fix_type = fix_type;
183 packet.satellites_visible = satellites_visible;
184 packet.dgps_numch = dgps_numch;
185
186 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS2_RAW_LEN);
187#endif
188
189 msg->msgid = MAVLINK_MSG_ID_GPS2_RAW;
190 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);
191}
192
193/**
194 * @brief Encode a gps2_raw struct
195 *
196 * @param system_id ID of this system
197 * @param component_id ID of this component (e.g. 200 for IMU)
198 * @param msg The MAVLink message to compress the data into
199 * @param gps2_raw C-struct to read the message contents from
200 */
201static 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)
202{
203 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);
204}
205
206/**
207 * @brief Encode a gps2_raw struct on a channel
208 *
209 * @param system_id ID of this system
210 * @param component_id ID of this component (e.g. 200 for IMU)
211 * @param chan The MAVLink channel this message will be sent over
212 * @param msg The MAVLink message to compress the data into
213 * @param gps2_raw C-struct to read the message contents from
214 */
215static 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)
216{
217 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);
218}
219
220/**
221 * @brief Send a gps2_raw message
222 * @param chan MAVLink channel to send the message
223 *
224 * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
225 * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
226 * @param lat Latitude (WGS84), in degrees * 1E7
227 * @param lon Longitude (WGS84), in degrees * 1E7
228 * @param alt Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
229 * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
230 * @param epv GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
231 * @param vel GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
232 * @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
233 * @param satellites_visible Number of satellites visible. If unknown, set to 255
234 * @param dgps_numch Number of DGPS satellites
235 * @param dgps_age Age of DGPS info
236 */
237#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
238
239static 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)
240{
241#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char buf[MAVLINK_MSG_ID_GPS2_RAW_LEN];
243 _mav_put_uint64_t(buf, 0, time_usec);
244 _mav_put_int32_t(buf, 8, lat);
245 _mav_put_int32_t(buf, 12, lon);
246 _mav_put_int32_t(buf, 16, alt);
247 _mav_put_uint32_t(buf, 20, dgps_age);
248 _mav_put_uint16_t(buf, 24, eph);
249 _mav_put_uint16_t(buf, 26, epv);
250 _mav_put_uint16_t(buf, 28, vel);
251 _mav_put_uint16_t(buf, 30, cog);
252 _mav_put_uint8_t(buf, 32, fix_type);
253 _mav_put_uint8_t(buf, 33, satellites_visible);
254 _mav_put_uint8_t(buf, 34, dgps_numch);
255
256 _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);
257#else
258 mavlink_gps2_raw_t packet;
259 packet.time_usec = time_usec;
260 packet.lat = lat;
261 packet.lon = lon;
262 packet.alt = alt;
263 packet.dgps_age = dgps_age;
264 packet.eph = eph;
265 packet.epv = epv;
266 packet.vel = vel;
267 packet.cog = cog;
268 packet.fix_type = fix_type;
269 packet.satellites_visible = satellites_visible;
270 packet.dgps_numch = dgps_numch;
271
272 _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);
273#endif
274}
275
276/**
277 * @brief Send a gps2_raw message
278 * @param chan MAVLink channel to send the message
279 * @param struct The MAVLink struct to serialize
280 */
281static inline void mavlink_msg_gps2_raw_send_struct(mavlink_channel_t chan, const mavlink_gps2_raw_t* gps2_raw)
282{
283#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 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);
285#else
286 _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);
287#endif
288}
289
290#if MAVLINK_MSG_ID_GPS2_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
291/*
292 This varient of _send() can be used to save stack space by re-using
293 memory from the receive buffer. The caller provides a
294 mavlink_message_t which is the size of a full mavlink message. This
295 is usually the receive buffer for the channel, and allows a reply to an
296 incoming message with minimum stack space usage.
297 */
298static 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)
299{
300#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
301 char *buf = (char *)msgbuf;
302 _mav_put_uint64_t(buf, 0, time_usec);
303 _mav_put_int32_t(buf, 8, lat);
304 _mav_put_int32_t(buf, 12, lon);
305 _mav_put_int32_t(buf, 16, alt);
306 _mav_put_uint32_t(buf, 20, dgps_age);
307 _mav_put_uint16_t(buf, 24, eph);
308 _mav_put_uint16_t(buf, 26, epv);
309 _mav_put_uint16_t(buf, 28, vel);
310 _mav_put_uint16_t(buf, 30, cog);
311 _mav_put_uint8_t(buf, 32, fix_type);
312 _mav_put_uint8_t(buf, 33, satellites_visible);
313 _mav_put_uint8_t(buf, 34, dgps_numch);
314
315 _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);
316#else
317 mavlink_gps2_raw_t *packet = (mavlink_gps2_raw_t *)msgbuf;
318 packet->time_usec = time_usec;
319 packet->lat = lat;
320 packet->lon = lon;
321 packet->alt = alt;
322 packet->dgps_age = dgps_age;
323 packet->eph = eph;
324 packet->epv = epv;
325 packet->vel = vel;
326 packet->cog = cog;
327 packet->fix_type = fix_type;
328 packet->satellites_visible = satellites_visible;
329 packet->dgps_numch = dgps_numch;
330
331 _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);
332#endif
333}
334#endif
335
336#endif
337
338// MESSAGE GPS2_RAW UNPACKING
339
340
341/**
342 * @brief Get field time_usec from gps2_raw message
343 *
344 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
345 */
346static inline uint64_t mavlink_msg_gps2_raw_get_time_usec(const mavlink_message_t* msg)
347{
348 return _MAV_RETURN_uint64_t(msg, 0);
349}
350
351/**
352 * @brief Get field fix_type from gps2_raw message
353 *
354 * @return 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS fix, 5: RTK Fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
355 */
356static inline uint8_t mavlink_msg_gps2_raw_get_fix_type(const mavlink_message_t* msg)
357{
358 return _MAV_RETURN_uint8_t(msg, 32);
359}
360
361/**
362 * @brief Get field lat from gps2_raw message
363 *
364 * @return Latitude (WGS84), in degrees * 1E7
365 */
366static inline int32_t mavlink_msg_gps2_raw_get_lat(const mavlink_message_t* msg)
367{
368 return _MAV_RETURN_int32_t(msg, 8);
369}
370
371/**
372 * @brief Get field lon from gps2_raw message
373 *
374 * @return Longitude (WGS84), in degrees * 1E7
375 */
376static inline int32_t mavlink_msg_gps2_raw_get_lon(const mavlink_message_t* msg)
377{
378 return _MAV_RETURN_int32_t(msg, 12);
379}
380
381/**
382 * @brief Get field alt from gps2_raw message
383 *
384 * @return Altitude (AMSL, not WGS84), in meters * 1000 (positive for up)
385 */
386static inline int32_t mavlink_msg_gps2_raw_get_alt(const mavlink_message_t* msg)
387{
388 return _MAV_RETURN_int32_t(msg, 16);
389}
390
391/**
392 * @brief Get field eph from gps2_raw message
393 *
394 * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
395 */
396static inline uint16_t mavlink_msg_gps2_raw_get_eph(const mavlink_message_t* msg)
397{
398 return _MAV_RETURN_uint16_t(msg, 24);
399}
400
401/**
402 * @brief Get field epv from gps2_raw message
403 *
404 * @return GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX
405 */
406static inline uint16_t mavlink_msg_gps2_raw_get_epv(const mavlink_message_t* msg)
407{
408 return _MAV_RETURN_uint16_t(msg, 26);
409}
410
411/**
412 * @brief Get field vel from gps2_raw message
413 *
414 * @return GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX
415 */
416static inline uint16_t mavlink_msg_gps2_raw_get_vel(const mavlink_message_t* msg)
417{
418 return _MAV_RETURN_uint16_t(msg, 28);
419}
420
421/**
422 * @brief Get field cog from gps2_raw message
423 *
424 * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX
425 */
426static inline uint16_t mavlink_msg_gps2_raw_get_cog(const mavlink_message_t* msg)
427{
428 return _MAV_RETURN_uint16_t(msg, 30);
429}
430
431/**
432 * @brief Get field satellites_visible from gps2_raw message
433 *
434 * @return Number of satellites visible. If unknown, set to 255
435 */
436static inline uint8_t mavlink_msg_gps2_raw_get_satellites_visible(const mavlink_message_t* msg)
437{
438 return _MAV_RETURN_uint8_t(msg, 33);
439}
440
441/**
442 * @brief Get field dgps_numch from gps2_raw message
443 *
444 * @return Number of DGPS satellites
445 */
446static inline uint8_t mavlink_msg_gps2_raw_get_dgps_numch(const mavlink_message_t* msg)
447{
448 return _MAV_RETURN_uint8_t(msg, 34);
449}
450
451/**
452 * @brief Get field dgps_age from gps2_raw message
453 *
454 * @return Age of DGPS info
455 */
456static inline uint32_t mavlink_msg_gps2_raw_get_dgps_age(const mavlink_message_t* msg)
457{
458 return _MAV_RETURN_uint32_t(msg, 20);
459}
460
461/**
462 * @brief Decode a gps2_raw message into a struct
463 *
464 * @param msg The message to decode
465 * @param gps2_raw C-struct to decode the message contents into
466 */
467static inline void mavlink_msg_gps2_raw_decode(const mavlink_message_t* msg, mavlink_gps2_raw_t* gps2_raw)
468{
469#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
470 gps2_raw->time_usec = mavlink_msg_gps2_raw_get_time_usec(msg);
471 gps2_raw->lat = mavlink_msg_gps2_raw_get_lat(msg);
472 gps2_raw->lon = mavlink_msg_gps2_raw_get_lon(msg);
473 gps2_raw->alt = mavlink_msg_gps2_raw_get_alt(msg);
474 gps2_raw->dgps_age = mavlink_msg_gps2_raw_get_dgps_age(msg);
475 gps2_raw->eph = mavlink_msg_gps2_raw_get_eph(msg);
476 gps2_raw->epv = mavlink_msg_gps2_raw_get_epv(msg);
477 gps2_raw->vel = mavlink_msg_gps2_raw_get_vel(msg);
478 gps2_raw->cog = mavlink_msg_gps2_raw_get_cog(msg);
479 gps2_raw->fix_type = mavlink_msg_gps2_raw_get_fix_type(msg);
480 gps2_raw->satellites_visible = mavlink_msg_gps2_raw_get_satellites_visible(msg);
481 gps2_raw->dgps_numch = mavlink_msg_gps2_raw_get_dgps_numch(msg);
482#else
483 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS2_RAW_LEN? msg->len : MAVLINK_MSG_ID_GPS2_RAW_LEN;
484 memset(gps2_raw, 0, MAVLINK_MSG_ID_GPS2_RAW_LEN);
485 memcpy(gps2_raw, _MAV_PAYLOAD(msg), len);
486#endif
487}
Note: See TracBrowser for help on using the repository browser.