[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,10 +1,9 @@
<services>
<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="token"/>
- <param name="debian">N</param>
- <param name="dumb">N</param>
- </service>
-</services>
\ No newline at end of file
+ <param name="url">https://github.com/mer-hybris/geoclue-providers-hybris.git</param>
+ <param name="branch">master</param>
+ <param name="revision">9b3e35cd801cdd489b6af64c816233de4e416405</param>
+ <param name="token"/>
+ <param name="debian">N</param>
+ <param name="dumb">N</param>
+</service></services>
|
[-]
[+]
|
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.14.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.14.tar.gz/hybrisprovider.cpp
^
|
@@ -11,7 +11,6 @@
*/
#include "hybrisprovider.h"
-#include "devicecontrol.h"
#include "geoclue_adaptor.h"
#include "position_adaptor.h"
@@ -140,6 +139,31 @@
Q_ARG(QList<int>, usedPrns));
}
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 3
+void gnssSvStatusCallback(GnssSvStatus *svStatus)
+{
+ QList<SatelliteInfo> satellites;
+ QList<int> usedPrns;
+
+ for (int i = 0; i < svStatus->num_svs; ++i) {
+ SatelliteInfo satInfo;
+ GnssSvInfo &svInfo = svStatus->gnss_sv_list[i];
+ satInfo.setPrn(svInfo.svid);
+ satInfo.setSnr(svInfo.c_n0_dbhz);
+ satInfo.setElevation(svInfo.elevation);
+ satInfo.setAzimuth(svInfo.azimuth);
+ satellites.append(satInfo);
+
+ if (svInfo.flags & GNSS_SV_FLAGS_USED_IN_FIX)
+ usedPrns.append(svInfo.svid);
+ }
+
+ QMetaObject::invokeMethod(staticProvider, "setSatellite", Qt::QueuedConnection,
+ Q_ARG(QList<SatelliteInfo>, satellites),
+ Q_ARG(QList<int>, usedPrns));
+}
+#endif
+
bool nmeaChecksumValid(const QByteArray &nmea)
{
unsigned char checksum = 0;
@@ -230,6 +254,14 @@
QMetaObject::invokeMethod(staticProvider, "injectUtcTime", Qt::QueuedConnection);
}
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 3
+void gnssSetSystemInfoCallback(const GnssSystemInfo *info)
+{
+ Q_UNUSED(info)
+ qCDebug(lcGeoclueHybris);
+}
+#endif
+
void agpsStatusCallback(AGpsStatus *status)
{
QHostAddress ipv4;
@@ -237,7 +269,7 @@
QByteArray ssid;
QByteArray password;
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
if (status->addr.ss_family == AF_INET) {
ipv4.setAddress(status->ipaddr);
} else if (status->addr.ss_family == AF_INET6) {
@@ -282,7 +314,7 @@
QMetaObject::invokeMethod(staticProvider, "xtraDownloadRequest", Qt::QueuedConnection);
}
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
ApnIpType fromContextProtocol(const QString &protocol)
{
if (protocol == QLatin1String("ip"))
@@ -321,7 +353,11 @@
acquireWakelockCallback,
releaseWakelockCallback,
createThreadCallback,
- requestUtcTimeCallback
+ requestUtcTimeCallback,
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 3
+ gnssSetSystemInfoCallback,
+ gnssSvStatusCallback,
+#endif
};
AGpsCallbacks agpsCallbacks = {
@@ -430,7 +466,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 +483,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 +593,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()
@@ -1028,7 +1059,7 @@
qCDebug(lcGeoclueHybris) << "type:" << type << "status:" << status;
if (!m_agpsEnabled) {
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2 || GEOCLUE_ANDROID_GPS_INTERFACE == 1
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 1
m_agps->data_conn_failed();
#else
m_agps->data_conn_failed(AGPS_TYPE_SUPL);
@@ -1047,7 +1078,7 @@
break;
case GPS_RELEASE_AGPS_DATA_CONN:
// Immediately inform that connection is closed.
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2 || GEOCLUE_ANDROID_GPS_INTERFACE == 1
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 1
m_agps->data_conn_closed();
#else
m_agps->data_conn_closed(AGPS_TYPE_SUPL);
@@ -1096,7 +1127,7 @@
qCDebug(lcGeoclueHybris) << path << error;
if (path.contains(QStringLiteral("cellular")))
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2 || GEOCLUE_ANDROID_GPS_INTERFACE == 1
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 1
m_agps->data_conn_failed();
#else
m_agps->data_conn_failed(AGPS_TYPE_SUPL);
@@ -1108,7 +1139,7 @@
if (!selected) {
qCDebug(lcGeoclueHybris) << "User aborted mobile data connection";
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2 || GEOCLUE_ANDROID_GPS_INTERFACE == 1
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 1
m_agps->data_conn_failed();
#else
m_agps->data_conn_failed(AGPS_TYPE_SUPL);
@@ -1209,7 +1240,7 @@
m_connectionContext->deleteLater();
m_connectionContext = 0;
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
if (m_agps->data_conn_open_with_apn_ip_type)
m_agps->data_conn_open_with_apn_ip_type(apn.constData(), fromContextProtocol(protocol));
else
@@ -1361,37 +1392,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()
{
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.14.tar.gz/hybrisprovider.h
^
|
@@ -23,10 +23,14 @@
#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 >= 7
+ #define GEOCLUE_ANDROID_GPS_INTERFACE 3
+#elif 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 +63,7 @@
explicit HybrisProvider(QObject *parent = 0);
~HybrisProvider();
- void setDeviceController(DeviceControl *control);
+ void setLocationSettings(LocationSettings *settings);
// org.freedesktop.Geoclue
void AddReference();
@@ -211,8 +215,6 @@
Status m_status;
- QFileSystemWatcher *m_locationSettings;
-
bool m_positionInjectionConnected;
QNetworkAccessManager *m_manager;
@@ -229,7 +231,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.14.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>
@@ -54,7 +55,7 @@
supplementaryGroups[numberGroups++] = group->gr_gid;
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
group = getgrnam("net_raw");
if (group) {
if (numberGroups + 1 > NGROUPS_MAX)
@@ -68,15 +69,7 @@
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
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 1
// Drop privileges.
result = setuid(realUid);
if (result == -1)
@@ -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();
}
|