Qt Positioning Gypsy 插件

概述

该插件是Gypsy 守护进程的接口。它需要在系统中安装并运行守护进程才能运行。

该插件使用 D-Bus 和 GLib 连接 GPS 设备并提供卫星信息。

目前,该插件提供定位信息。

可使用提供者名称gypsy 加载该插件。

参数

下表列出了传递给 gypsy 插件的参数。

参数说明
设备名称用于提供卫星信息的设备名称(或设备文件路径)。典型值为/dev/ttyUSB0/dev/ttyACM0
gconfKey 密钥用于从 GConf 配置系统中提取设备名称的密钥。

插件支持两种指定设备名称的方式:

  • 使用deviceName插件参数直接指定设备名称。
  • 使用gconfKey插件参数指定配置密钥,然后从 GConf 配置系统中提取设备名称。当设备名称已为其他基于 GConf 的应用程序指定时,这种方法非常有用。

默认情况下,如果没有指定任何参数,插件将尝试使用以下硬编码密钥从 GConf 配置系统中提取设备名称:

/apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice

使用 GConf 设置参数

要为 GConf 配置系统中的键指定值,请使用gconftool-2,如下所示:

gconftool-2 -t string -s /apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice /dev/ttyUSB0

示例

以下示例展示了如何用 C++ 创建一个gypsy卫星信息源。

直接指定设备名称:

QVariantMap parameters;
parameters["deviceName"] = "/dev/ttyACM0";
QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createSource("gypsy", parameters, this);

使用 GConf 密钥:

QVariantMap parameters;
parameters["gconfKey"] = "/apps/myapp/mykey";
QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createSource("gypsy", parameters, this);

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.