libgps 函数使用

本文介绍了libgps库在Linux下用于与GPS接收器交互的函数使用,包括获取时间、位置、速度和质量参数等。通过示例代码展示了如何使用libgps的`gps_open`、`gps_stream`、`gps_waiting`和`gps_read`等函数来从GPSD获取数据,以及如何解析`SDateTime`和`SGNSSPosition`结构体。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关于GPSD;
GPSD是一个Linux下的一个守护进程,用以侦听来自GPS接收器的位置等信息,并将这些位置信息转换成一种简化的格式。
GPSD支持二十多种不同GPS输出格式的GPS接收机,例如NMEA、Ashtech、AIVDM、iTalk Binary、Trimble TSIP、RTCM、uBlox UBX binary等。将收到的packet解析之后,可以通过D-BUS、共享内存和socket(默认端口为:2947)方式输出。
GPSD packet中同时提供了多种客户端,例如gpsctl、gpsmon、gpspipe等,可以根据需要进行使用。

gpsd is a userland daemon acting as a translator between GPS and AIS receivers and their clients. gpsd listens on port 2947 for clients requesting position/time/velocity information.  The receivers are expected to generate position information in a well-known format -- as NMEA-0183 sentences, SiRF binary, Rockwell binary, Garmin binary
format, or other vendor binary protocols.  gpsd takes this information from the GPS and translates it into something uniform and easier to understand for clients.  The distribution includes sample clients, application interface libraries, and test/profiling tools.

There is a website for GPSD where you can find updates, news, and project mailing lists; look for that URL in the scons recipe, the file SConstruct in this top-level directory.  See that website for a list of GPS units known to be compatible.

See the file INSTALL for installation instructions and some tips on how to troubleshoot your installation.  The file build.txt has instructions for building from source.  The packaging/ directory contains resources and suggestions for packagers and distribution integrators.

以下重点介绍libgps 函数的使用:
typedef enum {
    GNSS_FIX_STATUS_NO,         /**< GNSS has no fix, i.e. position, velocity, time cannot be determined */
    GNSS_FIX_STATUS_TIME,       /**< GNSS can only determine the time, but not position and velocity */
    GNSS_FIX_STATUS_2D,         /**< GNSS has a 2D fix, i.e. the horizontal position can be determined but not the altitude.
                                     This implies that also velocity and time are available. */
    GNSS_FIX_STATUS_3D          /**< GNSS has a 3D fix, i.e. position can be determined including the altitude.
                                     This implies that also velocity and time are available. */
} EGNSSFixStatus;

typedef struct {
    uint64_t timestamp;             /**< Timestamp of the acquisition of the UTC date/time [ms].
                                         All sensor/GNSS timestamps must be based on the same time source. */
    uint16_t year;                  /**< Year fraction of the UTC time. Unit: [year] Number equivalent to the year (4 digits) */
    uint8_t month;                  /**< Month fraction of the UTC time. Unit: [month] Number betweeen 0 and 11 */
    uint8_t day;                    /**< Day of month fraction of the UTC time. Unit: [day]. Number between 1 and 31 */   
    uint8_t hour;                   /**< Hour fraction of the UTC time. Unit: [hour] Number between 0 and 23 */
    uint8_t minute;                 /**< Minute fraction of the UTC time. Unit: [minu
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值