[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris-binder.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/binder/binderlocationbackend.cpp
^
|
@@ -148,7 +148,7 @@
return HYBRIS_APN_IP_INVALID;
}
-static const void *geoclue_binder_gnss_decode_struct1(
+const void *geoclue_binder_gnss_decode_struct1(
GBinderReader *in,
guint size)
{
@@ -226,7 +226,7 @@
const double MpsToKnots = 1.943844;
-static GBinderLocalReply *geoclue_binder_gnss_callback(
+GBinderLocalReply *geoclue_binder_gnss_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -376,7 +376,7 @@
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_gnss_xtra_callback(
+GBinderLocalReply *geoclue_binder_gnss_xtra_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -409,7 +409,7 @@
return Q_NULLPTR;
}
-static GBinderLocalReply *geoclue_binder_agnss_callback(
+GBinderLocalReply *geoclue_binder_agnss_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -476,7 +476,7 @@
}
-static GBinderLocalReply *geoclue_binder_agnss_ril_callback(
+GBinderLocalReply *geoclue_binder_agnss_ril_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -513,7 +513,7 @@
}
-static GBinderLocalReply *geoclue_binder_gnss_ni_callback(
+GBinderLocalReply *geoclue_binder_gnss_ni_callback(
GBinderLocalObject *obj,
GBinderRemoteRequest *req,
guint code,
@@ -546,7 +546,7 @@
return Q_NULLPTR;
}
-static void geoclue_binder_gnss_gnss_died(
+void geoclue_binder_gnss_gnss_died(
GBinderRemoteObject */*obj*/,
void *user_data)
{
@@ -652,10 +652,9 @@
gbinder_servicemanager_unref(m_sm);
m_sm = Q_NULLPTR;
}
- if (m_fqname) {
- g_free(m_fqname);
- m_fqname = Q_NULLPTR;
- }
+
+ g_free(m_fqname);
+ m_fqname = Q_NULLPTR;
}
bool BinderLocationBackend::isReplySuccess(GBinderRemoteReply *reply)
@@ -1149,6 +1148,33 @@
if (!status) {
ret = isReplySuccess(reply);
+ }
+
+ gbinder_local_request_unref(req);
+ gbinder_remote_reply_unref(reply);
+
+ return ret;
+}
+
+int BinderLocationBackend::aGnssSetServer(HybrisAGnssType type, const char* hostname, int port)
+{
+ int status = 0;
+ bool ret = false;
+ GBinderLocalRequest *req;
+ GBinderRemoteReply *reply;
+ GBinderWriter writer;
+
+ req = gbinder_client_new_request(m_clientAGnss);
+
+ gbinder_local_request_init_writer(req, &writer);
+ gbinder_writer_append_int32(&writer, type);
+ gbinder_writer_append_hidl_string(&writer, hostname);
+ gbinder_writer_append_int32(&writer, port);
+ reply = gbinder_client_transact_sync_reply(m_clientAGnss,
+ AGNSS_SET_SERVER, req, &status);
+
+ if (!status) {
+ ret = isReplySuccess(reply);
}
gbinder_local_request_unref(req);
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/binder/binderlocationbackend.h
^
|
@@ -66,6 +66,7 @@
bool aGnssDataConnClosed();
bool aGnssDataConnFailed();
bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol);
+ int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port);
// AGnssRil
void aGnssRilInit();
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/geoclue-providers-hybris.pri
^
|
@@ -33,6 +33,12 @@
system_dbus_conf.files = com.jollamobile.gps.conf
system_dbus_conf.path = /etc/dbus-1/system.d
+systemd_dbus_service.files = geoclue-providers-hybris.service
+systemd_dbus_service.path = /usr/lib/systemd/user
+
+systemd_dbus_service_symlink.path = .
+systemd_dbus_service_symlink.commands = ln -s geoclue-providers-hybris.service ${INSTALL_ROOT}/usr/lib/systemd/user/dbus-org.freedesktop.Geoclue.Providers.Hybris.service
+
geoclue_provider.files = geoclue-hybris.provider
geoclue_provider.path = /usr/share/geoclue-providers
@@ -49,7 +55,8 @@
$${session_dbus_service.files} \
$${system_dbus_service.files} \
$${system_dbus_conf.files} \
+ $${systemd_dbus_service.files} \
$${geoclue_provider.files} \
rpm/geoclue-providers-hybris.spec
-INSTALLS += target session_dbus_service system_dbus_conf geoclue_provider
+INSTALLS += target session_dbus_service system_dbus_conf geoclue_provider systemd_dbus_service systemd_dbus_service_symlink
|
[-]
[+]
|
Added |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/geoclue-providers-hybris.service
^
|
@@ -0,0 +1,16 @@
+[Unit]
+Description=Geoinformation Service Hybris Provider
+
+[Service]
+Type=dbus
+ExecStart=/usr/libexec/geoclue-hybris
+BusName=org.freedesktop.Geoclue.Providers.Hybris
+#Sandboxing
+Capabilities=
+PrivateTmp=yes
+ProtectHome=yes
+ProtectSystem=full
+
+[Install]
+Alias=dbus-org.freedesktop.Geoclue.Providers.Hybris.service
+
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/hal/hallocationbackend.cpp
^
|
@@ -503,7 +503,9 @@
void HalLocationBackend::gnssDeleteAidingData(HybrisGnssAidingData aidingDataFlags)
{
- Q_UNUSED(aidingDataFlags)
+ if (m_gps) {
+ m_gps->delete_aiding_data(aidingDataFlags);
+ }
}
bool HalLocationBackend::gnssSetPositionMode(HybrisGnssPositionMode mode, HybrisGnssPositionRecurrence recurrence,
@@ -614,6 +616,11 @@
return !error;
}
+int HalLocationBackend::aGnssSetServer(HybrisAGnssType type, const char* hostname, int port)
+{
+ return m_agps->set_server(type, hostname, port);
+}
+
// AGnssRil
void HalLocationBackend::aGnssRilInit()
{
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/hal/hallocationbackend.h
^
|
@@ -64,6 +64,7 @@
bool aGnssDataConnClosed();
bool aGnssDataConnFailed();
bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol);
+ int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port);
// AGnssRil
void aGnssRilInit();
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/hybrislocationbackend.h
^
|
@@ -136,6 +136,7 @@
virtual bool aGnssDataConnClosed() = 0;
virtual bool aGnssDataConnFailed() = 0;
virtual bool aGnssDataConnOpen(const QByteArray &apn, const QString &protocol) = 0;
+ virtual int aGnssSetServer(HybrisAGnssType type, const char* hostname, int port) = 0;
// AGnssRil
virtual void aGnssRilInit() = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/hybrisprovider.cpp
^
|
@@ -56,20 +56,6 @@
const quint32 MinimumInterval = 1000;
const quint32 PreferredAccuracy = 0;
const quint32 PreferredInitialFixTime = 0;
-const double KnotsToMps = 0.514444;
-
-const QString LocationSettingsDir = QStringLiteral("/etc/location/");
-const QString LocationSettingsFile = QStringLiteral("/etc/location/location.conf");
-const QString LocationSettingsEnabledKey = QStringLiteral("location/enabled");
-const QString LocationSettingsAllowedDataSourcesGpsKey = QStringLiteral("allowed_data_sources/gps");
-const QString LocationSettingsGpsEnabledKey = QStringLiteral("location/gps/enabled");
-const QString LocationSettingsAgpsEnabledKey = QStringLiteral("location/%1/enabled");
-const QString LocationSettingsAgpsOnlineEnabledKey = QStringLiteral("location/%1/online_enabled");
-const QString LocationSettingsAgpsAgreementAcceptedKey = QStringLiteral("location/%1/agreement_accepted");
-const QString LocationSettingsAgpsProvidersKey = QStringLiteral("location/agps_providers");
-// deprecated keys
-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");
@@ -162,7 +148,8 @@
m_networkManager(new NetworkManager(this)), m_cellularTechnology(Q_NULLPTR),
m_ofonoExtModemManager(new QOfonoExtModemManager(this)),
m_connectionManager(new QOfonoConnectionManager(this)), m_connectionContext(Q_NULLPTR), m_ntpSocket(Q_NULLPTR),
- m_agpsEnabled(false), m_agpsOnlineEnabled(false), m_useForcedXtraInject(false), m_xtraUserAgent("")
+ m_agpsEnabled(false), m_agpsOnlineEnabled(false), m_useForcedNtpInject(false), m_useForcedXtraInject(false),
+ m_suplPort(0)
{
if (staticProvider)
qFatal("Only a single instance of HybrisProvider is supported.");
@@ -213,46 +200,33 @@
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 != "") {
+ QString xtraServer = settings.value(key, QString()).toString();
+ if (!xtraServer.isEmpty()) {
m_xtraServers.enqueue(xtraServer);
}
}
m_useForcedXtraInject = settings.value("xtra/XTRA_FORCE_INJECT", "").toBool();
- xtraUserAgentFileName = settings.value("xtra/XTRA_USERAGENT_FILE", "").toString();
- if (xtraUserAgentFileName != "") {
+ QString xtraUserAgentFileName = settings.value("xtra/XTRA_USERAGENT_FILE", QString()).toString();
+ if (!xtraUserAgentFileName.isEmpty()) {
QFile xtraUserAgentFile(xtraUserAgentFileName);
if (xtraUserAgentFile.open(QIODevice::ReadOnly)) {
m_xtraUserAgent = xtraUserAgentFile.readLine();
}
}
- if (m_xtraServers.isEmpty()) {
- QFile gpsConf(QStringLiteral("/system/etc/gps.conf"));
- if (gpsConf.open(QIODevice::ReadOnly)) {
+ m_useForcedNtpInject = settings.value("ntp/NTP_FORCE_INJECT", "").toBool();
- while (!gpsConf.atEnd()) {
- const QByteArray line = gpsConf.readLine().trimmed();
- if (line.startsWith('#'))
- continue;
-
- const QList<QByteArray> split = line.split('=');
- if (split.length() != 2)
- continue;
-
- const QByteArray key = split.at(0).trimmed();
- if (key == "XTRA_SERVER_1" || key == "XTRA_SERVER_2" || key == "XTRA_SERVER_3")
- m_xtraServers.enqueue(QUrl::fromEncoded(split.at(1).trimmed()));
- }
- }
+ m_suplHost = settings.value("supl/SUPL_HOST", QString()).toString();
+ m_suplPort = settings.value("supl/SUPL_PORT", "").toInt();
+
+ if (m_xtraServers.isEmpty() || m_suplHost.isEmpty() || m_suplPort == 0) {
+ loadDefaultsFromConfigurationFile();
}
m_backend = getLocationBackend();
@@ -267,6 +241,10 @@
m_backend->aGnssRilInit();
m_backend->gnssXtraInit();
m_backend->gnssDebugInit();
+
+ // Set SUPL server if provided
+ if (!m_suplHost.isEmpty() && m_suplPort != 0)
+ m_backend->aGnssSetServer(HYBRIS_AGNSS_TYPE_SUPL, m_suplHost.toLatin1().constData(), m_suplPort);
}
HybrisProvider::~HybrisProvider()
@@ -280,6 +258,49 @@
staticProvider = 0;
}
+void HybrisProvider::loadDefaultsFromConfigurationFile()
+{
+ QFile gpsConf;
+ bool parseXtraServers = false;
+ const char *paths[] = {"/vendor/etc/gps.conf", "/system/etc/gps.conf", NULL};
+ int i = 0;
+ while (paths[i] != NULL) {
+ gpsConf.setFileName(paths[i]);
+ if (gpsConf.open(QIODevice::ReadOnly)) {
+ break;
+ }
+ ++i;
+ }
+ if (!gpsConf.isOpen()) {
+ return;
+ }
+ if (m_xtraServers.isEmpty()) {
+ parseXtraServers = true;
+ }
+
+ while (!gpsConf.atEnd()) {
+ const QByteArray line = gpsConf.readLine().trimmed();
+ if (line.startsWith('#'))
+ continue;
+
+ const QList<QByteArray> split = line.split('=');
+ if (split.length() != 2)
+ continue;
+
+ const QByteArray key = split.at(0).trimmed();
+ if (parseXtraServers) {
+ if (key == "XTRA_SERVER_1" || key == "XTRA_SERVER_2" || key == "XTRA_SERVER_3")
+ m_xtraServers.enqueue(QUrl::fromEncoded(split.at(1).trimmed()));
+ }
+ if (m_suplHost.isEmpty() && key == "SUPL_HOST") {
+ m_suplHost = split.at(1).trimmed();
+ }
+ if (m_suplPort == 0 && key == "SUPL_PORT") {
+ m_suplPort = split.at(1).trimmed().toInt();
+ }
+ }
+}
+
void HybrisProvider::setLocationSettings(LocationSettings *settings)
{
if (!m_locationSettings) {
@@ -374,6 +395,13 @@
HYBRIS_GNSS_POSITION_RECURRENCE_PERIODIC, updateInterval,
PreferredAccuracy, PreferredInitialFixTime);
}
+
+ if (options.contains(QStringLiteral("NoCachedAidingData"))
+ && options.value(QStringLiteral("NoCachedAidingData")).toBool()
+ && m_backend) {
+ //GPS_DELETE_ALL = 0xFFFF (almanac, ephemeris, position, time and other cache data)
+ m_backend->gnssDeleteAidingData(0xFFFF);
+ }
}
int HybrisProvider::GetPosition(int ×tamp, double &latitude, double &longitude,
@@ -685,7 +713,7 @@
qCDebug(lcGeoclueHybris) << m_xtraServers;
QNetworkRequest network_request(m_xtraServers[m_xtraServerIndex]);
- if (m_xtraUserAgent != "") {
+ if (!m_xtraUserAgent.isEmpty()) {
network_request.setRawHeader("User-Agent", m_xtraUserAgent.toUtf8());
}
m_xtraDownloadReply = m_manager->get(network_request);
@@ -868,10 +896,13 @@
void HybrisProvider::stateChanged(const QString &state)
{
- if (state == "online") {
- if (m_gpsStarted && m_useForcedXtraInject) {
+ if (state == "online" && m_gpsStarted) {
+ if (m_useForcedXtraInject) {
gnssXtraDownloadRequest();
}
+ if (m_useForcedNtpInject) {
+ injectUtcTime();
+ }
}
}
@@ -1002,8 +1033,13 @@
m_gpsStarted = true;
- if (m_useForcedXtraInject && m_networkManager->state() == "online") {
- gnssXtraDownloadRequest();
+ if (m_networkManager->state() == "online") {
+ if (m_useForcedXtraInject) {
+ gnssXtraDownloadRequest();
+ }
+ if (m_useForcedNtpInject) {
+ injectUtcTime();
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/hybrisprovider.h
^
|
@@ -156,6 +156,8 @@
void cellularConnected(bool connected);
private:
+ void loadDefaultsFromConfigurationFile();
+
void emitLocationChanged();
void emitSatelliteChanged();
void startPositioningIfNeeded();
@@ -236,9 +238,13 @@
bool m_agpsEnabled;
bool m_agpsOnlineEnabled;
+ bool m_useForcedNtpInject;
bool m_useForcedXtraInject;
QString m_xtraUserAgent;
double m_magneticVariation;
+
+ QString m_suplHost;
+ int m_suplPort;
};
extern HybrisProvider *staticProvider;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/main.cpp
^
|
@@ -55,8 +55,8 @@
supplementaryGroups[numberGroups++] = group->gr_gid;
- // remove audio, radio and bluetooth groups to avoid confusion in BSP
- char *groups_to_remove[] = {"bluetooth", "radio", "audio", NULL};
+ // remove nfc, audio, radio and bluetooth groups to avoid confusion in BSP
+ char *groups_to_remove[] = {"bluetooth", "radio", "audio", "nfc", NULL};
int idx = 0;
while (groups_to_remove[idx]) {
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-binder-0.2.28.tar.gz/org.freedesktop.Geoclue.Providers.Hybris.service
^
|
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.Geoclue.Providers.Hybris
-Exec=/usr/libexec/geoclue-hybris
+Exec=/bin/false
+SystemdService=dbus-org.freedesktop.Geoclue.Providers.Hybris.service
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.inc
^
|
@@ -1,7 +1,6 @@
Summary: Geoinformation Service Hybris Provider
-Group: System/Libraries
-URL: https://bitbucket.org/jolla/base-geoclue-providers-hybris
-License: LGPLv2.1
+URL: https://github.com/mer-hybris/geoclue-providers-hybris
+License: LGPLv2
Source: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5DBus)
@@ -37,4 +36,5 @@
%{_sysconfdir}/dbus-1
%{_datadir}/dbus-1
%{_datadir}/geoclue-providers/geoclue-hybris.provider
-
+%{_libdir}/systemd/user/geoclue-providers-hybris.service
+%{_libdir}/systemd/user/dbus-org.freedesktop.Geoclue.Providers.Hybris.service
|