[Interest] Geoposition and Ubuntu 18.04
Denis Shienkov
denis.shienkov at gmail.com
Sun Dec 9 21:02:41 CET 2018
Hi,
That patch adds the support for Geoclue v2 only, which should be
available since Qt 5.12 (but not since Qt 5.9.7, AFAIK).
You can try to check it with lookup the 'qtposition_geoclue2.so' file in
the installed Qt's plugins path.
* Also, make sure that your distro has geoclue2 installed.
* Also it is unnecessary to use the QT_GEOCLUE_APP_DESKTOP_ID variable,
it is enough to specify the
QCoreApplication::applicationName() property instead.
* Besides, I'm not sure that this
QGeoPositionInfoSource::createDefaultSource(this) will work, because it
may be not 'default' plugin.
Just try to use availableSources() && createSource() instead.
Denis.
09.12.2018 22:23, roland at logikalsolutions.com пишет:
>
> All,
>
> I've just started poking around with the GeopositionInfo stuff now
> that Ubuntu 18.04 has location services. Can't find good C++ examples.
> Everyone seems to focus on worthless QML.
>
> First off: Huge serious kudos to Denis Shienkov for
> https://codereview.qt-project.org/#/c/229911/
> That bug report was better than any of the documentation. Well worth a
> read.
>
>
> For purposes of this discussion we will call the application Fred to
> protect the guilty.
>
> The application has the following snippet of code.
>
> syslog( LOG_MAKEPRI(LOG_USER, LOG_INFO), "%s", "Trying to create
> default GeoPositionInfoSource");
> qDebug() << "Trying to create default GeoPositionInfoSource";
>
> m_geoSource = QGeoPositionInfoSource::createDefaultSource(this);
>
> if (m_geoSource)
> {
> syslog( LOG_MAKEPRI(LOG_USER, LOG_INFO), "%s", "successfully
> created default GeopositionInfoSource");
> qDebug() << "successfully created default GeopositionInfoSource";
> connect(m_geoSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
> this, SLOT(positionUpdated(QGeoPositionInfo)));
> #ifdef QT_DEBUG
> m_geoSource->setUpdateInterval( 1000 * 60 * 2); // 1000ms in
> a second
> #else
> m_geoSource->setUpdateInterval( 1000 * 60 * 45); // 1000ms in
> a second
> #endif
> m_geoSource->startUpdates();
> }
> else
> {
> syslog( LOG_MAKEPRI(LOG_USER, LOG_ERR), "%s", "Unable to
> create default GeopositionInfoSource");
> qDebug() << "Unable to create default GeopositionInfoSource";
> }
>
> I have enabled location services in Ubuntu 18.04 and am debugging
> inside of QtCreator. The .profile for my account contains:
>
> export QT_GEOCLUE_APP_DESKTOP_ID=ipos
>
> and I've added fred to /etc/geoclue/geoclue.conf
>
> [fred]
> allowed=true
> system=false
> users=
>
> When I compiled 5.9.7 from source the following snippet is from the
> configuration summary.
>
> Qt Positioning:
> Gypsy GPS Daemon ....................... no
> WinRT Geolocation API .................. no
> Qt Location:
> Geoservice plugins:
> OpenStreetMap ........................ yes
> HERE ................................. yes
> Esri ................................. yes
> Mapbox ............................... yes
> MapboxGL ............................. no
> Itemsoverlay ......................... yes
>
>
> When I step through in the debugger I see the following:
>
> Debugging starts
> QML debugging is enabled. Only use this in a safe environment.
> Trying to create default GeoPositionInfoSource
> successfully created default GeopositionInfoSource
> Failed to set Geoclue positioning requirements. Geoclue error:
> org.qtproject.QtDBus.Error.InvalidObjectPath
>
> My question here is: Have I skipped something stupid (quite possible
> as there are no good examples, the one C++ example reads from a file
> to emit a signal so is totally worthless) _or_ does the geoposition
> stuff not communicate with Ubuntu 18.04's version of geoclue?
>
> Should I just install
>
> geoclue-examples_0.12.99-4_amd64.deb GeoClue example clients
>
> and roll my own using the dbus interface?
>
> Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181209/b87acfeb/attachment.html>
More information about the Interest
mailing list