[Interest] Geoposition and Ubuntu 18.04

roland at logikalsolutions.com roland at logikalsolutions.com
Sun Dec 9 20:23:04 CET 2018


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,
-- 
Roland Hughes, President
Logikal Solutions
(630) 205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us




More information about the Interest mailing list