Qt Positioning Plugins
Qt定位插件
Qt Positioning provides the majority of its functionality through plugins. This document outlines how to develop a new position plugin.
Qt定位通过插件提供其大部分功能。本文档概述了如何开发新的位置插件。
Default plugins
默认插件
Some plugins already ship with Qt. These are:
Qt已经附带了一些插件。这些是:
android | Wraps Android positioning subsystem. Available only on Android. 封装Android定位子系统。仅在Android上可用。 |
corelocation | Wraps iOS and macOS positioning subsystems. Available only on Apple platforms supporting corelocation. 封装iOS和macOS定位子系统。仅在支持核心定位的苹果平台上可用。 |
geoclue2 | A GeoClue v2 backend that provides an interface to the GeoClue v2 D-Bus service. |
gypsy | A Gypsy backend that provides an interface to the Gypsy daemon. Gypsy后端,为Gypsy守护进程提供接口。 |
winrt | Wraps WinRT positioning subsystem. Available only on WinRT and Windows10. 封装WinRT定位子系统。仅在WinRT和Windows10上可用。 |
nmea | An NMEA backend that parses NMEA streams from a GPS receiver to provide position updates. This plugin can use serial port, socket or file as a source. NMEA后端,解析来自GPS接收器的NMEA流以提供位置更新。此插件可以使用串行端口、套接字或文件作为源。 |
positionpoll | A backend providing only area monitoring functionalities via polling on position updates. 后端仅通过位置更新轮询提供区域监控功能。 |
Plugin Description
插件说明
Each plugin is described by a json file. The json describes the plugins capabilities and version. Below is an example of a json file used by the postionpoll plugin:
每个插件都由一个json文件描述。json描述了插件的功能和版本。以下是postionpoll插件使用的json文件示例:
{
"Keys": ["positionpoll"],
"Provider": "positionpoll",
"Position": false,
"Satellite": false,
"Monitor": true,
"Priority": 1000,
"Testable": true
}
The entries have the following meaning:
这些条目具有以下含义:
Key | Description |
---|---|
Keys | The unique name/key of the plugin. Each position plugin must have a unique name. 插件的唯一名称/密钥。每个位置插件都必须有一个唯一的名称。 |
Provider | The provider name of the services. Multiple plugins may have the same name. In such cases the Version string will be used to further distinguish the plugins. 插件的唯一名称/密钥。每个位置插件都必须有一个唯一的名称。 |
Position | Set to 如果插件实现了QGeoPositionInfoSource,则设置为true。 |
Satellite | Set to |
Monitor | Set to |
Priority | The plugin priority. If multiple plugins have the same provider name, the plugin with the higest priority will be used. 插件优先级。如果多个插件具有相同的提供者名称,则将使用优先级最高的插件。 |
Implementing Plugins
实现插件
A plugin implementer needs to subclass QGeoPositionInfoSourceFactory and override one or more of its functions. If a plugin does not support a specific feature the function should return 0 or utilize the default implementation.
插件实现者需要子类化QGeoPositionInfoSourceFactory并覆盖其一个或多个函数。如果插件不支持特定功能,则函数应返回0或使用默认实现。
- QGeoPositionInfoSourceFactory::areaMonitor()
- QGeoPositionInfoSourceFactory::positionInfoSource()
- QGeoPositionInfoSourceFactory::satelliteInfoSource()
© 2024 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.