mavlink_msg_gps_raw_int.h
Go to the documentation of this file.
00001 // MESSAGE GPS_RAW_INT PACKING
00002 
00003 #define MAVLINK_MSG_ID_GPS_RAW_INT 24
00004 
00005 typedef struct __mavlink_gps_raw_int_t
00006 {
00007  uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
00008  int32_t lat; /*< Latitude (WGS84), in degrees * 1E7*/
00009  int32_t lon; /*< Longitude (WGS84), in degrees * 1E7*/
00010  int32_t alt; /*< Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude.*/
00011  uint16_t eph; /*< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
00012  uint16_t epv; /*< GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX*/
00013  uint16_t vel; /*< GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX*/
00014  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*/
00015  uint8_t fix_type; /*< 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.*/
00016  uint8_t satellites_visible; /*< Number of satellites visible. If unknown, set to 255*/
00017 } mavlink_gps_raw_int_t;
00018 
00019 #define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 30
00020 #define MAVLINK_MSG_ID_24_LEN 30
00021 
00022 #define MAVLINK_MSG_ID_GPS_RAW_INT_CRC 24
00023 #define MAVLINK_MSG_ID_24_CRC 24
00024 
00025 
00026 
00027 #define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
00028         "GPS_RAW_INT", \
00029         10, \
00030         {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, time_usec) }, \
00031          { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_raw_int_t, lat) }, \
00032          { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_gps_raw_int_t, lon) }, \
00033          { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_gps_raw_int_t, alt) }, \
00034          { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_gps_raw_int_t, eph) }, \
00035          { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_gps_raw_int_t, epv) }, \
00036          { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_gps_raw_int_t, vel) }, \
00037          { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_gps_raw_int_t, cog) }, \
00038          { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
00039          { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_gps_raw_int_t, satellites_visible) }, \
00040          } \
00041 }
00042 
00043 
00062 static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00063                                                        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)
00064 {
00065 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00066         char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
00067         _mav_put_uint64_t(buf, 0, time_usec);
00068         _mav_put_int32_t(buf, 8, lat);
00069         _mav_put_int32_t(buf, 12, lon);
00070         _mav_put_int32_t(buf, 16, alt);
00071         _mav_put_uint16_t(buf, 20, eph);
00072         _mav_put_uint16_t(buf, 22, epv);
00073         _mav_put_uint16_t(buf, 24, vel);
00074         _mav_put_uint16_t(buf, 26, cog);
00075         _mav_put_uint8_t(buf, 28, fix_type);
00076         _mav_put_uint8_t(buf, 29, satellites_visible);
00077 
00078         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00079 #else
00080         mavlink_gps_raw_int_t packet;
00081         packet.time_usec = time_usec;
00082         packet.lat = lat;
00083         packet.lon = lon;
00084         packet.alt = alt;
00085         packet.eph = eph;
00086         packet.epv = epv;
00087         packet.vel = vel;
00088         packet.cog = cog;
00089         packet.fix_type = fix_type;
00090         packet.satellites_visible = satellites_visible;
00091 
00092         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00093 #endif
00094 
00095         msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
00096 #if MAVLINK_CRC_EXTRA
00097     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00098 #else
00099     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00100 #endif
00101 }
00102 
00121 static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00122                                                            mavlink_message_t* msg,
00123                                                            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)
00124 {
00125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00126         char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
00127         _mav_put_uint64_t(buf, 0, time_usec);
00128         _mav_put_int32_t(buf, 8, lat);
00129         _mav_put_int32_t(buf, 12, lon);
00130         _mav_put_int32_t(buf, 16, alt);
00131         _mav_put_uint16_t(buf, 20, eph);
00132         _mav_put_uint16_t(buf, 22, epv);
00133         _mav_put_uint16_t(buf, 24, vel);
00134         _mav_put_uint16_t(buf, 26, cog);
00135         _mav_put_uint8_t(buf, 28, fix_type);
00136         _mav_put_uint8_t(buf, 29, satellites_visible);
00137 
00138         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00139 #else
00140         mavlink_gps_raw_int_t packet;
00141         packet.time_usec = time_usec;
00142         packet.lat = lat;
00143         packet.lon = lon;
00144         packet.alt = alt;
00145         packet.eph = eph;
00146         packet.epv = epv;
00147         packet.vel = vel;
00148         packet.cog = cog;
00149         packet.fix_type = fix_type;
00150         packet.satellites_visible = satellites_visible;
00151 
00152         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00153 #endif
00154 
00155         msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
00156 #if MAVLINK_CRC_EXTRA
00157     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00158 #else
00159     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00160 #endif
00161 }
00162 
00171 static inline uint16_t mavlink_msg_gps_raw_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
00172 {
00173         return mavlink_msg_gps_raw_int_pack(system_id, component_id, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
00174 }
00175 
00185 static inline uint16_t mavlink_msg_gps_raw_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
00186 {
00187         return mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, chan, msg, gps_raw_int->time_usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->vel, gps_raw_int->cog, gps_raw_int->satellites_visible);
00188 }
00189 
00205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00206 
00207 static inline void mavlink_msg_gps_raw_int_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)
00208 {
00209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00210         char buf[MAVLINK_MSG_ID_GPS_RAW_INT_LEN];
00211         _mav_put_uint64_t(buf, 0, time_usec);
00212         _mav_put_int32_t(buf, 8, lat);
00213         _mav_put_int32_t(buf, 12, lon);
00214         _mav_put_int32_t(buf, 16, alt);
00215         _mav_put_uint16_t(buf, 20, eph);
00216         _mav_put_uint16_t(buf, 22, epv);
00217         _mav_put_uint16_t(buf, 24, vel);
00218         _mav_put_uint16_t(buf, 26, cog);
00219         _mav_put_uint8_t(buf, 28, fix_type);
00220         _mav_put_uint8_t(buf, 29, satellites_visible);
00221 
00222 #if MAVLINK_CRC_EXTRA
00223     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00224 #else
00225     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00226 #endif
00227 #else
00228         mavlink_gps_raw_int_t packet;
00229         packet.time_usec = time_usec;
00230         packet.lat = lat;
00231         packet.lon = lon;
00232         packet.alt = alt;
00233         packet.eph = eph;
00234         packet.epv = epv;
00235         packet.vel = vel;
00236         packet.cog = cog;
00237         packet.fix_type = fix_type;
00238         packet.satellites_visible = satellites_visible;
00239 
00240 #if MAVLINK_CRC_EXTRA
00241     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00242 #else
00243     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00244 #endif
00245 #endif
00246 }
00247 
00248 #if MAVLINK_MSG_ID_GPS_RAW_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00249 /*
00250   This varient of _send() can be used to save stack space by re-using
00251   memory from the receive buffer.  The caller provides a
00252   mavlink_message_t which is the size of a full mavlink message. This
00253   is usually the receive buffer for the channel, and allows a reply to an
00254   incoming message with minimum stack space usage.
00255  */
00256 static inline void mavlink_msg_gps_raw_int_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)
00257 {
00258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00259         char *buf = (char *)msgbuf;
00260         _mav_put_uint64_t(buf, 0, time_usec);
00261         _mav_put_int32_t(buf, 8, lat);
00262         _mav_put_int32_t(buf, 12, lon);
00263         _mav_put_int32_t(buf, 16, alt);
00264         _mav_put_uint16_t(buf, 20, eph);
00265         _mav_put_uint16_t(buf, 22, epv);
00266         _mav_put_uint16_t(buf, 24, vel);
00267         _mav_put_uint16_t(buf, 26, cog);
00268         _mav_put_uint8_t(buf, 28, fix_type);
00269         _mav_put_uint8_t(buf, 29, satellites_visible);
00270 
00271 #if MAVLINK_CRC_EXTRA
00272     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00273 #else
00274     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00275 #endif
00276 #else
00277         mavlink_gps_raw_int_t *packet = (mavlink_gps_raw_int_t *)msgbuf;
00278         packet->time_usec = time_usec;
00279         packet->lat = lat;
00280         packet->lon = lon;
00281         packet->alt = alt;
00282         packet->eph = eph;
00283         packet->epv = epv;
00284         packet->vel = vel;
00285         packet->cog = cog;
00286         packet->fix_type = fix_type;
00287         packet->satellites_visible = satellites_visible;
00288 
00289 #if MAVLINK_CRC_EXTRA
00290     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN, MAVLINK_MSG_ID_GPS_RAW_INT_CRC);
00291 #else
00292     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)packet, MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00293 #endif
00294 #endif
00295 }
00296 #endif
00297 
00298 #endif
00299 
00300 // MESSAGE GPS_RAW_INT UNPACKING
00301 
00302 
00308 static inline uint64_t mavlink_msg_gps_raw_int_get_time_usec(const mavlink_message_t* msg)
00309 {
00310         return _MAV_RETURN_uint64_t(msg,  0);
00311 }
00312 
00318 static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t* msg)
00319 {
00320         return _MAV_RETURN_uint8_t(msg,  28);
00321 }
00322 
00328 static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t* msg)
00329 {
00330         return _MAV_RETURN_int32_t(msg,  8);
00331 }
00332 
00338 static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t* msg)
00339 {
00340         return _MAV_RETURN_int32_t(msg,  12);
00341 }
00342 
00348 static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* msg)
00349 {
00350         return _MAV_RETURN_int32_t(msg,  16);
00351 }
00352 
00358 static inline uint16_t mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg)
00359 {
00360         return _MAV_RETURN_uint16_t(msg,  20);
00361 }
00362 
00368 static inline uint16_t mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg)
00369 {
00370         return _MAV_RETURN_uint16_t(msg,  22);
00371 }
00372 
00378 static inline uint16_t mavlink_msg_gps_raw_int_get_vel(const mavlink_message_t* msg)
00379 {
00380         return _MAV_RETURN_uint16_t(msg,  24);
00381 }
00382 
00388 static inline uint16_t mavlink_msg_gps_raw_int_get_cog(const mavlink_message_t* msg)
00389 {
00390         return _MAV_RETURN_uint16_t(msg,  26);
00391 }
00392 
00398 static inline uint8_t mavlink_msg_gps_raw_int_get_satellites_visible(const mavlink_message_t* msg)
00399 {
00400         return _MAV_RETURN_uint8_t(msg,  29);
00401 }
00402 
00409 static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t* msg, mavlink_gps_raw_int_t* gps_raw_int)
00410 {
00411 #if MAVLINK_NEED_BYTE_SWAP
00412         gps_raw_int->time_usec = mavlink_msg_gps_raw_int_get_time_usec(msg);
00413         gps_raw_int->lat = mavlink_msg_gps_raw_int_get_lat(msg);
00414         gps_raw_int->lon = mavlink_msg_gps_raw_int_get_lon(msg);
00415         gps_raw_int->alt = mavlink_msg_gps_raw_int_get_alt(msg);
00416         gps_raw_int->eph = mavlink_msg_gps_raw_int_get_eph(msg);
00417         gps_raw_int->epv = mavlink_msg_gps_raw_int_get_epv(msg);
00418         gps_raw_int->vel = mavlink_msg_gps_raw_int_get_vel(msg);
00419         gps_raw_int->cog = mavlink_msg_gps_raw_int_get_cog(msg);
00420         gps_raw_int->fix_type = mavlink_msg_gps_raw_int_get_fix_type(msg);
00421         gps_raw_int->satellites_visible = mavlink_msg_gps_raw_int_get_satellites_visible(msg);
00422 #else
00423         memcpy(gps_raw_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GPS_RAW_INT_LEN);
00424 #endif
00425 }


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:35