[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,9 +2,9 @@
<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">HEAD</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
</service>
-</services>
\ No newline at end of file
+</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.16.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.16.tar.gz/hybrisprovider.cpp
^
|
@@ -11,7 +11,6 @@
*/
#include "hybrisprovider.h"
-#include "devicecontrol.h"
#include "geoclue_adaptor.h"
#include "position_adaptor.h"
@@ -39,6 +38,8 @@
#include <qofonoextmodemmanager.h>
+#include <android-config.h>
+
#include <strings.h>
#include <sys/time.h>
@@ -72,6 +73,9 @@
const QString LocationSettingsOldAgpsEnabledKey = QStringLiteral("location/agreement_accepted");
const QString LocationSettingsOldAgpsAgreementAcceptedKey = QStringLiteral("location/here_agreement_accepted");
+const int MaxXtraServers = 3;
+const QString XtraConfigFile = QStringLiteral("/etc/gps_xtra.ini");
+
void locationCallback(GpsLocation *location)
{
Location loc;
@@ -140,6 +144,53 @@
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
+
+#ifdef USE_GPS_VENDOR_EXTENSION
+void gnssSvStatusCallback_custom(GnssSvStatus *svStatus)
+{
+ QList<SatelliteInfo> satellites;
+ QList<int> usedPrns;
+
+ for (int i = 0; i < svStatus->num_svs; ++i) {
+ SatelliteInfo satInfo;
+ GnssSvInfo &svInfo = svStatus->sv_list[i];
+ satInfo.setPrn(svInfo.prn);
+ satInfo.setSnr(svInfo.snr);
+ satInfo.setElevation(svInfo.elevation);
+ satInfo.setAzimuth(svInfo.azimuth);
+ satellites.append(satInfo);
+ }
+
+ 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 +281,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 +296,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 +341,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"))
@@ -316,12 +375,19 @@
locationCallback,
statusCallback,
svStatusCallback,
+#ifdef USE_GPS_VENDOR_EXTENSION
+ gnssSvStatusCallback_custom,
+#endif
nmeaCallback,
setCapabilitiesCallback,
acquireWakelockCallback,
releaseWakelockCallback,
createThreadCallback,
- requestUtcTimeCallback
+ requestUtcTimeCallback,
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 3
+ gnssSetSystemInfoCallback,
+ gnssSvStatusCallback,
+#endif
};
AGpsCallbacks agpsCallbacks = {
@@ -429,12 +495,12 @@
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_status(StatusUnavailable), m_positionInjectionConnected(false), m_xtraDownloadReply(0), m_xtraServerIndex(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),
- m_agpsEnabled(false), m_agpsOnlineEnabled(false)
+ m_agpsEnabled(false), m_agpsOnlineEnabled(false), m_useForcedXtraInject(false), m_xtraUserAgent("")
{
if (staticProvider)
qFatal("Only a single instance of HybrisProvider is supported.");
@@ -447,14 +513,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);
@@ -463,6 +521,7 @@
m_manager = new QNetworkAccessManager(this);
connect(m_networkManager, SIGNAL(technologiesChanged()), this, SLOT(technologiesChanged()));
+ connect(m_networkManager, SIGNAL(stateChanged(QString)), this, SLOT(stateChanged(QString)));
technologiesChanged();
@@ -492,6 +551,48 @@
m_idleTimer.start(QuitIdleTime, this);
}
+ QString xtraUserAgentFileName;
+ QSettings settings(XtraConfigFile, QSettings::IniFormat);
+ QString xtraServer;
+
+ for (int i = 0; i < MaxXtraServers; i++) {
+ QString key = QString("xtra/XTRA_SERVER_%1").arg(i);
+ xtraServer = settings.value(key, "").toString();
+ if (xtraServer != "") {
+ m_xtraServers.enqueue(xtraServer);
+ }
+ }
+
+ m_useForcedXtraInject = settings.value("xtra/XTRA_FORCE_INJECT", "").toBool();
+
+ xtraUserAgentFileName = settings.value("xtra/XTRA_USERAGENT_FILE", "").toString();
+ if (xtraUserAgentFileName != "") {
+ QFile xtraUserAgentFile(xtraUserAgentFileName);
+ if (xtraUserAgentFile.open(QIODevice::ReadOnly)) {
+ m_xtraUserAgent = xtraUserAgentFile.readLine();
+ }
+ }
+
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.16.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();
@@ -151,6 +155,7 @@
void engineOff();
void technologiesChanged();
+ void stateChanged(const QString &state);
void defaultDataModemChanged(const QString &modem);
void connectionManagerValidChanged();
void connectionContextValidChanged();
@@ -211,13 +216,12 @@
Status m_status;
- QFileSystemWatcher *m_locationSettings;
-
bool m_positionInjectionConnected;
QNetworkAccessManager *m_manager;
QNetworkReply *m_xtraDownloadReply;
QQueue<QUrl> m_xtraServers;
+ int m_xtraServerIndex;
ComJollaConnectiondInterface *m_connectiond;
ComJollaLipstickConnectionSelectorIfInterface *m_connectionSelector;
@@ -229,10 +233,11 @@
bool m_gpsStarted;
- DeviceControl *m_deviceControl;
+ LocationSettings *m_locationSettings;
NetworkManager *m_networkManager;
NetworkTechnology *m_cellularTechnology;
+ NetworkTechnology *m_wifiTechnology;
QOfonoExtModemManager *m_ofonoExtModemManager;
QOfonoConnectionManager *m_connectionManager;
@@ -246,6 +251,8 @@
bool m_agpsEnabled;
bool m_agpsOnlineEnabled;
+ bool m_useForcedXtraInject;
+ QString m_xtraUserAgent;
double m_magneticVariation;
};
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-0.2.16.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,22 @@
supplementaryGroups[numberGroups++] = group->gr_gid;
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 2
+ // remove audio, radio and bluetooth groups to avoid confusion in BSP
+ char *groups_to_remove[] = {"bluetooth", "radio", "audio", NULL};
+
+ int idx = 0;
+ while (groups_to_remove[idx]) {
+ group = getgrnam(groups_to_remove[idx]);
+ idx++;
+
+ if (idx + 1 < numberGroups) {
+ memmove((void*)&supplementaryGroups[idx], (void*)&supplementaryGroups[idx + 1], (numberGroups - idx - 1) * sizeof(gid_t));
+ }
+
+ numberGroups--;
+ }
+
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
group = getgrnam("net_raw");
if (group) {
if (numberGroups + 1 > NGROUPS_MAX)
@@ -68,15 +84,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 +92,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();
}
|