[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/geoclue-providers-hybris.git</param>
<param name="branch">master</param>
- <param name="revision">29ec9933d09beefcc7ef24b83ef046f0150ec31e</param>
+ <param name="revision">e4e42b54cfc5888051dde71ac1cf064cd05f797c</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:geoclue-provider-hybris-0.2.11.tar.gz/com.jollamobile.gps.Device.xml
^
|
@@ -1,10 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="com.jollamobile.gps.Device">
- <property name="Powered" type="b" access="readwrite"/>
- <signal name="PropertyChanged">
- <arg name="name" type="s" direction="out"/>
- <arg name="value" type="v" direction="out"/>
- </signal>
- </interface>
-</node>
|
[-]
[+]
|
Deleted |
_service:tar_git:geoclue-provider-hybris-0.2.11.tar.gz/devicecontrol.cpp
^
|
@@ -1,38 +0,0 @@
-/*
- Copyright (C) 2015 Jolla Ltd.
- Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-
- This file is part of geoclue-hybris.
-
- Geoclue-hybris is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License.
-*/
-
-#include "devicecontrol.h"
-
-#include "device_adaptor.h"
-
-#include <QtDBus/QDBusVariant>
-
-DeviceControl::DeviceControl(QObject *parent)
-: QObject(parent), m_powered(false)
-{
- new DeviceAdaptor(this);
-}
-
-bool DeviceControl::powered() const
-{
- return m_powered;
-}
-
-void DeviceControl::setPowered(bool powered)
-{
- if (m_powered == powered)
- return;
-
- m_powered = powered;
- emit poweredChanged();
- emit PropertyChanged(QStringLiteral("Powered"), QDBusVariant(powered));
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:geoclue-provider-hybris-0.2.11.tar.gz/devicecontrol.h
^
|
@@ -1,40 +0,0 @@
-/*
- Copyright (C) 2015 Jolla Ltd.
- Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-
- This file is part of geoclue-hybris.
-
- Geoclue-hybris is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License.
-*/
-
-#ifndef DEVICECONTROL_H
-#define DEVICECONTROL_H
-
-#include <QtCore/QObject>
-
-QT_FORWARD_DECLARE_CLASS(QDBusVariant)
-
-class DeviceControl : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(bool Powered READ powered WRITE setPowered NOTIFY poweredChanged)
-
-public:
- explicit DeviceControl(QObject *parent = 0);
-
- bool powered() const;
- void setPowered(bool powered);
-
-signals:
- void PropertyChanged(const QString &name, const QDBusVariant &value);
- void poweredChanged();
-
-private:
- bool m_powered;
-};
-
-#endif // DEVICECONTROL_H
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.13.tar.gz/geoclue-providers-hybris.pro
^
|
@@ -8,14 +8,10 @@
QT = core dbus network
CONFIG += link_pkgconfig
-PKGCONFIG += libhardware android-headers connman-qt5 qofono-qt5 qofonoext
+PKGCONFIG += libhardware android-headers connman-qt5 qofono-qt5 qofonoext systemsettings
LIBS += -lrt
-dbus_power_control.files = com.jollamobile.gps.Device.xml
-dbus_power_control.header_flags = "-l DeviceControl -i devicecontrol.h"
-dbus_power_control.source_flags = "-l DeviceControl"
-
dbus_geoclue.files = \
org.freedesktop.Geoclue.xml \
org.freedesktop.Geoclue.Position.xml \
@@ -25,7 +21,6 @@
dbus_geoclue.source_flags = "-l HybrisProvider"
DBUS_ADAPTORS = \
- dbus_power_control \
dbus_geoclue
DBUS_INTERFACES = \
@@ -43,13 +38,11 @@
HEADERS += \
hybrisprovider.h \
- locationtypes.h \
- devicecontrol.h
+ locationtypes.h
SOURCES += \
main.cpp \
- hybrisprovider.cpp \
- devicecontrol.cpp
+ hybrisprovider.cpp
OTHER_FILES = \
$${session_dbus_service.files} \
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.13.tar.gz/hybrisprovider.cpp
^
|
@@ -11,7 +11,6 @@
*/
#include "hybrisprovider.h"
-#include "devicecontrol.h"
#include "geoclue_adaptor.h"
#include "position_adaptor.h"
@@ -430,7 +429,7 @@
HybrisProvider::HybrisProvider(QObject *parent)
: QObject(parent), m_gps(0), m_agps(0), m_agpsril(0), m_gpsni(0), m_xtra(0),
m_status(StatusUnavailable), m_positionInjectionConnected(false), m_xtraDownloadReply(0),
- m_requestedConnect(false), m_gpsStarted(false), m_deviceControl(0),
+ m_requestedConnect(false), m_gpsStarted(false), m_locationSettings(0),
m_networkManager(new NetworkManager(this)), m_cellularTechnology(0),
m_ofonoExtModemManager(new QOfonoExtModemManager(this)),
m_connectionManager(new QOfonoConnectionManager(this)), m_connectionContext(0), m_ntpSocket(0),
@@ -447,14 +446,6 @@
staticProvider = this;
- m_locationSettings = new QFileSystemWatcher(this);
- connect(m_locationSettings, SIGNAL(fileChanged(QString)),
- this, SLOT(locationEnabledChanged()));
- connect(m_locationSettings, SIGNAL(directoryChanged(QString)),
- this, SLOT(locationEnabledChanged()));
- m_locationSettings->addPath(LocationSettingsDir);
- m_locationSettings->addPath(LocationSettingsFile);
-
new GeoclueAdaptor(this);
new PositionAdaptor(this);
new VelocityAdaptor(this);
@@ -565,20 +556,23 @@
staticProvider = 0;
}
-void HybrisProvider::setDeviceController(DeviceControl *control)
+void HybrisProvider::setLocationSettings(LocationSettings *settings)
{
- if (m_deviceControl == control)
- return;
-
- if (m_deviceControl) {
- disconnect(m_deviceControl, SIGNAL(poweredChanged()),
- this, SLOT(locationEnabledChanged()));
+ if (!m_locationSettings) {
+ m_locationSettings = settings;
+ connect(m_locationSettings, &LocationSettings::locationEnabledChanged,
+ this, &HybrisProvider::locationEnabledChanged);
+ connect(m_locationSettings, &LocationSettings::gpsEnabledChanged,
+ this, &HybrisProvider::locationEnabledChanged);
+ connect(m_locationSettings, &LocationSettings::gpsFlightModeChanged,
+ this, &HybrisProvider::locationEnabledChanged);
+ connect(m_locationSettings, &LocationSettings::hereStateChanged,
+ this, &HybrisProvider::locationEnabledChanged);
+ connect(m_locationSettings, &LocationSettings::mlsEnabledChanged,
+ this, &HybrisProvider::locationEnabledChanged);
+ connect(m_locationSettings, &LocationSettings::mlsOnlineStateChanged,
+ this, &HybrisProvider::locationEnabledChanged);
}
-
- m_deviceControl = control;
-
- if (m_deviceControl)
- connect(m_deviceControl, SIGNAL(poweredChanged()), this, SLOT(locationEnabledChanged()));
}
void HybrisProvider::AddReference()
@@ -1361,37 +1355,20 @@
/*
Returns true if positioning is enabled, otherwise returns false.
-
- Currently checks the state of the Location enabled setting and flight mode.
*/
bool HybrisProvider::positioningEnabled()
{
- QSettings settings(LocationSettingsFile, QSettings::IniFormat);
-
- // check the keys related to agps enablement. We can have multiple agps providers.
- bool agpsAgreementAccepted = false;
- bool agpsEnabled = false;
- bool agpsOnlineEnabled = false;
- QString agpsProviders = settings.value(LocationSettingsAgpsProvidersKey, QStringLiteral("here")).toString();
- Q_FOREACH (const QString &agpsProvider, agpsProviders.split(',', QString::SkipEmptyParts)) {
- agpsAgreementAccepted = settings.value(LocationSettingsAgpsAgreementAcceptedKey.arg(agpsProvider), false).toBool();
- agpsEnabled = settings.value(LocationSettingsAgpsEnabledKey.arg(agpsProvider), false).toBool();
- agpsOnlineEnabled = settings.value(LocationSettingsAgpsOnlineEnabledKey.arg(agpsProvider), false).toBool();
- if (agpsAgreementAccepted && agpsEnabled && agpsOnlineEnabled) {
- break;
- }
- }
- // check the deprecated keys, also:
- bool oldAgpsAgreementAccepted = settings.value(LocationSettingsOldAgpsAgreementAcceptedKey, false).toBool();
- bool oldAgpsEnabled = settings.value(LocationSettingsOldAgpsEnabledKey, false).toBool();
- m_agpsEnabled = (agpsAgreementAccepted || oldAgpsAgreementAccepted) && (agpsEnabled || oldAgpsEnabled);
- m_agpsOnlineEnabled = agpsOnlineEnabled || (oldAgpsAgreementAccepted && oldAgpsEnabled);
-
- // check the keys related to the location and gps enablement, plus gps power state
- bool locationEnabled = settings.value(LocationSettingsEnabledKey, false).toBool();
- bool gpsEnabled = settings.value(LocationSettingsGpsEnabledKey, true).toBool(); // defaults to true if no key exists but location is enabled.
- bool powered = m_deviceControl->powered();
- return locationEnabled && gpsEnabled && powered;
+ // update our AGPS enablement states, used for position injection and mode capability.
+ m_agpsEnabled = (m_locationSettings->hereAvailable() && m_locationSettings->hereState() == LocationSettings::OnlineAGpsEnabled)
+ || (m_locationSettings->mlsAvailable() && m_locationSettings->mlsEnabled());
+ m_agpsOnlineEnabled = (m_locationSettings->hereAvailable() && m_locationSettings->hereState() == LocationSettings::OnlineAGpsEnabled)
+ || (m_locationSettings->mlsAvailable() && m_locationSettings->mlsOnlineState() == LocationSettings::OnlineAGpsEnabled);
+
+ // enable GPS positioning if location and the GPS are enabled, and the GPS is not in flight mode.
+ return m_locationSettings->locationEnabled()
+ && m_locationSettings->gpsAvailable()
+ && m_locationSettings->gpsEnabled()
+ && !m_locationSettings->gpsFlightMode();
}
quint32 HybrisProvider::minimumRequestedUpdateInterval() const
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.13.tar.gz/hybrisprovider.h
^
|
@@ -23,10 +23,12 @@
#include <android-version.h>
#include <hardware/gps.h>
+#include <locationsettings.h>
+
#include "locationtypes.h"
// Define versions of the Android GPS interface supported.
-#if (ANDROID_VERSION_MAJOR == 5 && ANDROID_VERSION_MINOR >= 1) || (ANDROID_VERSION_MAJOR == 6 && ANDROID_VERSION_MINOR >= 0)
+#if ANDROID_VERSION_MAJOR >= 5
#define GEOCLUE_ANDROID_GPS_INTERFACE 2
#elif ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR >= 2
#define GEOCLUE_ANDROID_GPS_INTERFACE 1
@@ -59,7 +61,7 @@
explicit HybrisProvider(QObject *parent = 0);
~HybrisProvider();
- void setDeviceController(DeviceControl *control);
+ void setLocationSettings(LocationSettings *settings);
// org.freedesktop.Geoclue
void AddReference();
@@ -211,8 +213,6 @@
Status m_status;
- QFileSystemWatcher *m_locationSettings;
-
bool m_positionInjectionConnected;
QNetworkAccessManager *m_manager;
@@ -229,7 +229,7 @@
bool m_gpsStarted;
- DeviceControl *m_deviceControl;
+ LocationSettings *m_locationSettings;
NetworkManager *m_networkManager;
NetworkTechnology *m_cellularTechnology;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.13.tar.gz/main.cpp
^
|
@@ -15,7 +15,8 @@
#include <QtDBus/QDBusConnection>
#include "hybrisprovider.h"
-#include "devicecontrol.h"
+
+#include <locationsettings.h>
#include <unistd.h>
#include <sys/types.h>
@@ -68,14 +69,6 @@
if (numberGroups == -1)
qFatal("Failed to set supplementary groups, %s", strerror(errno));
- // Register service on DBus system bus prior to dropping privileges.
- QDBusConnection system = QDBusConnection::systemBus();
- DeviceControl control;
- if (!system.registerObject(QStringLiteral("/com/jollamobile/gps/Device"), &control))
- qFatal("Failed to register object /com/jollamobile/gps/Device");
- if (!system.registerService(QStringLiteral("com.jollamobile.gps")))
- qFatal("Failed to register service com.jollamobile.gps");
-
#if GEOCLUE_ANDROID_GPS_INTERFACE != 2
// Drop privileges.
result = setuid(realUid);
@@ -84,12 +77,13 @@
#endif
QDBusConnection session = QDBusConnection::sessionBus();
+ LocationSettings settings;
HybrisProvider provider;
+ provider.setLocationSettings(&settings);
if (!session.registerObject(QStringLiteral("/org/freedesktop/Geoclue/Providers/Hybris"), &provider))
qFatal("Failed to register object /org/freedesktop/Geoclue/Providers/Hybris");
if (!session.registerService(QStringLiteral("org.freedesktop.Geoclue.Providers.Hybris")))
qFatal("Failed to register service org.freedesktop.Geoclue.Providers.Hybris");
- provider.setDeviceController(&control);
return a.exec();
}
|