diff options
26 files changed, 0 insertions, 2212 deletions
diff --git a/config.tests/locationd/locationd.pro b/config.tests/locationd/locationd.pro deleted file mode 100644 index 3b1793f9..00000000 --- a/config.tests/locationd/locationd.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -INCLUDEPATH += $$[QT_INSTALL_PREFIX]/include/mtlocationd -#unix{ -# CONFIG += link_pkgconfig -# PKGCONFIG += locationd -# } -LIBS += -lmtlocationd -SOURCES += main.cpp diff --git a/config.tests/locationd/main.cpp b/config.tests/locationd/main.cpp deleted file mode 100644 index 88c92bda..00000000 --- a/config.tests/locationd/main.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <locationdaemonconnection.h> - -int main() -{ - LocationDaemonConnection* m_locationdConn = new LocationDaemonConnection(0); - delete (m_locationdConn); - return 0; -} diff --git a/examples/declarative/flickr/qmllocationflickr.cpp b/examples/declarative/flickr/qmllocationflickr.cpp index 2da42a01..8a3a29a3 100644 --- a/examples/declarative/flickr/qmllocationflickr.cpp +++ b/examples/declarative/flickr/qmllocationflickr.cpp @@ -52,11 +52,7 @@ int main(int argc, char *argv[]) // Qt.quit() called in embedded .qml by default only emits // quit() signal, so do this (optionally use Qt.exit()). QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); -#if defined(Q_WS_MAEMO_6) - view.showFullScreen(); -#else view.setGeometry(QRect(100, 100, 360, 640)); view.show(); -#endif return application.exec(); } diff --git a/qtlocation.pro b/qtlocation.pro index 44318227..bb0ecf84 100644 --- a/qtlocation.pro +++ b/qtlocation.pro @@ -1,5 +1,4 @@ load(configure) -qtCompileTest(locationd) qtCompileTest(geoclue) qtCompileTest(gypsy) diff --git a/src/plugins/position/maemo/dbuscomm_maemo.cpp b/src/plugins/position/maemo/dbuscomm_maemo.cpp deleted file mode 100644 index 840957f5..00000000 --- a/src/plugins/position/maemo/dbuscomm_maemo.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "dbuscomm_maemo_p.h" - -#include <iostream> -using namespace std; - -QT_BEGIN_NAMESPACE - -const QString DBusComm::positioningdService = QString("com.nokia.positioningd.client"); -const QString DBusComm::positioningdPath = QString("/com/nokia/positioningd/client"); -const QString DBusComm::positioningdInterface = QString("com.nokia.positioningd.client"); - -DBusComm::DBusComm(QObject *parent) : QObject(parent), - minimumUpdateInterval(1000), - availablePositioningMethods(QGeoPositionInfoSource::AllPositioningMethods) -{ -} - - -int DBusComm::init() -{ - if (!QDBusConnection::sessionBus().isConnected()) { - cerr << "Cannot connect to the D-BUS session bus.\n"; - return -1; - } - - // Application auto-start by dbus may take a while, so try - // connecting a few times. - - int cnt = 10; - positioningdProxy = new QDBusInterface(positioningdService, - positioningdPath, - positioningdInterface, - QDBusConnection::sessionBus()); - - while (cnt && (positioningdProxy->isValid() == false)) { - // cout << "Connecting to positioning daemon..." << endl; - usleep(200000); - positioningdProxy = new QDBusInterface(positioningdService, - positioningdPath, - positioningdInterface, - QDBusConnection::sessionBus()); - cnt--; - } - - if (positioningdProxy->isValid() == false) { - cerr << "DBus connection to positioning daemon failed.\n"; - return -1; - } - serviceDisconnectWatcher = new QDBusServiceWatcher (positioningdService, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForUnregistration, this); - - QObject::connect(serviceDisconnectWatcher, SIGNAL(serviceUnregistered ( const QString &)), - this,SLOT(onServiceDisconnect(const QString &))); - - serviceConnectWatcher = new QDBusServiceWatcher (positioningdService, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForRegistration, this); - - QObject::connect(serviceConnectWatcher, SIGNAL(serviceRegistered ( const QString &)), - this,SLOT(onServiceConnect(const QString &))); - - - if (createUniqueName() == false) { // set myService, myPath - return -1; - } - - dbusServer = new DBusServer(&serverObj, this); - QDBusConnection::sessionBus().registerObject(myPath, &serverObj); - if (!QDBusConnection::sessionBus().registerService(myService)) { - cerr << qPrintable(QDBusConnection::sessionBus().lastError().message()) << endl; - return -1; - } - - sendDBusRegister(); - - return 0; -} - - -void DBusComm::onServiceDisconnect(const QString &name) -{ - Q_UNUSED(name); - emit serviceDisconnected(); -} - - -void DBusComm::onServiceConnect(const QString &name) -{ - Q_UNUSED(name); - sendDBusRegister(); - emit serviceConnected(); -} - - -void DBusComm::receivePositionUpdate(const QGeoPositionInfo &update) -{ - emit receivedPositionUpdate(update); -} - - -void DBusComm::receiveSatellitesInView(const QList<QGeoSatelliteInfo> &info) -{ - emit receivedSatellitesInView(info); -} - - -void DBusComm::receiveSatellitesInUse(const QList<QGeoSatelliteInfo> &info) -{ - emit receivedSatellitesInUse(info); -} - - -void DBusComm::receiveSettings(QGeoPositionInfoSource::PositioningMethod methods, qint32 interval) -{ - availablePositioningMethods = methods; - minimumUpdateInterval = interval; -} - - -bool DBusComm::sendDBusRegister() -{ - QDBusMessage reply = positioningdProxy->call("registerListener", - myService.toLatin1().constData(), - myPath.toLatin1().constData()); - if (reply.type() == QDBusMessage::ReplyMessage) { - QList<QVariant> values = reply.arguments(); - clientId = values.takeFirst().toInt(); - quint32 m = values.takeFirst().toUInt(); - availablePositioningMethods = (QGeoPositionInfoSource::PositioningMethod) m; - minimumUpdateInterval = values.takeFirst().toUInt(); - } else { - cerr << endl << "DBus error:\n"; - cerr << reply.errorName().toLatin1().constData() << endl; - cerr << reply.errorMessage().toLatin1().constData() << endl; - return false; - } - - return true; -} - - -QGeoPositionInfoSource::PositioningMethods DBusComm::availableMethods() const -{ - return availablePositioningMethods; -} - - -int DBusComm::minimumInterval() const -{ - return minimumUpdateInterval; -} - - -bool DBusComm::sendConfigRequest(Command command, QGeoPositionInfoSource::PositioningMethods method, - int interval) const -{ - QDBusReply<int> reply; - reply = positioningdProxy->call("configSession", clientId, command, int(method), interval); - - //cout << "sessionConfigRequest cmd: cmd:" << command << " method: "; - //cout << method << " interval: " << interval << "\n"; - - if (reply.isValid()) { - int n = reply.value(); - } else { - cerr << endl << "DBus error:\n"; - cerr << reply.error().name().toLatin1().constData() << endl; - cerr << reply.error().message().toLatin1().constData() << endl; - return false; - } - - return true; -} - - -QGeoPositionInfo &DBusComm::requestLastKnownPosition(bool satelliteMethodOnly) -{ - QDBusReply<QByteArray> reply; - reply = positioningdProxy->call("latestPosition", satelliteMethodOnly); - static QGeoPositionInfo update; - - if (reply.isValid()) { - // cout << "requestLastKnownPosition(): received update\n"; - QByteArray message = reply.value(); - QDataStream stream(message); - stream >> update; - } else { - cerr << endl << "DBus error:\n"; - cerr << reply.error().name().toLatin1().constData() << endl; - cerr << reply.error().message().toLatin1().constData() << endl; - update = QGeoPositionInfo(); - } - - return update; -} - - -bool DBusComm::createUniqueName() -{ - QFile uuidfile("/proc/sys/kernel/random/uuid"); - if (!uuidfile.open(QIODevice::ReadOnly)) { - cerr << "UUID file failed."; - return false; - } - - QTextStream in(&uuidfile); - QString uuid = 'I' + in.readLine(); - uuid.replace('-', 'I'); - myService = "com.nokia.qlocation." + uuid; - myPath = "/com/nokia/qlocation/" + uuid; - - return true; -} - -#include "moc_dbuscomm_maemo_p.cpp" -QT_END_NAMESPACE - diff --git a/src/plugins/position/maemo/dbuscomm_maemo_p.h b/src/plugins/position/maemo/dbuscomm_maemo_p.h deleted file mode 100644 index b76cf061..00000000 --- a/src/plugins/position/maemo/dbuscomm_maemo_p.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DBUSCOMM_MAEMO_H -#define DBUSCOMM_MAEMO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/QObject> -#include <QtCore/QTimer> -#include <QtDBus/QtDBus> - -#include "qgeopositioninfo.h" -#include "qgeosatelliteinfo.h" -#include "qgeopositioninfosource.h" -#include "qgeosatelliteinfosource.h" -#include "dbusserver_maemo_p.h" - -QT_BEGIN_NAMESPACE - -class DBusComm: public QObject, DBusServerIF -{ - Q_OBJECT - - -public: - enum Command {CommandStart = 1, CommandStop = 2, CommandOneShot = 3, - CommandSetMethods = 4, CommandSetInterval = 8, - CommandSatStart = 16, CommandSatStop = 32, CommandSatOneShot = 48}; - - DBusComm(QObject *parent = 0); - int init(); - bool sendDBusRegister(); - bool sendConfigRequest(Command command, QGeoPositionInfoSource::PositioningMethods method, - int interval) const; - QGeoPositionInfo &requestLastKnownPosition(bool satelliteMethodOnly); - QGeoPositionInfoSource::PositioningMethods availableMethods() const; - int minimumInterval() const; - -Q_SIGNALS: - void receivedPositionUpdate(const QGeoPositionInfo &update); - void receivedSatellitesInView(const QList<QGeoSatelliteInfo> &update); - void receivedSatellitesInUse(const QList<QGeoSatelliteInfo> &update); - - void serviceDisconnected(); - void serviceConnected(); - -private: - static const QString positioningdService; - static const QString positioningdPath; - static const QString positioningdInterface; - - // from DBusServerIF - void receivePositionUpdate(const QGeoPositionInfo &update); - void receiveSatellitesInView(const QList<QGeoSatelliteInfo> &info); - void receiveSatellitesInUse(const QList<QGeoSatelliteInfo> &info); - void receiveSettings(QGeoPositionInfoSource::PositioningMethod methods, qint32 interval); - - QDBusInterface *positioningdProxy; - DBusServer *dbusServer; - QObject serverObj; - QString myService; - QString myPath; - int clientId; - int minimumUpdateInterval; - QGeoPositionInfoSource::PositioningMethods availablePositioningMethods; - QDBusServiceWatcher *serviceDisconnectWatcher; - QDBusServiceWatcher *serviceConnectWatcher; - bool createUniqueName(); - - Q_DISABLE_COPY(DBusComm) - -private Q_SLOTS: - void onServiceDisconnect(const QString &name); - void onServiceConnect(const QString &name); - -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/position/maemo/dbusserver_maemo.cpp b/src/plugins/position/maemo/dbusserver_maemo.cpp deleted file mode 100644 index 44bf7ae9..00000000 --- a/src/plugins/position/maemo/dbusserver_maemo.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "dbusserver_maemo_p.h" - -QT_BEGIN_NAMESPACE - -DBusServer::DBusServer(QObject *obj, DBusServerIF *iface) : QDBusAbstractAdaptor(obj), - interface(iface) -{ -} - - -Q_NOREPLY void DBusServer::positionUpdate(const QByteArray &message) -{ - static QGeoPositionInfo update; - QDataStream stream(message); - stream >> update; - - interface->receivePositionUpdate(update); -} - - -Q_NOREPLY void DBusServer::currentSettings(quint32 methods, quint32 interval) -{ - QGeoPositionInfoSource::PositioningMethod m = (QGeoPositionInfoSource::PositioningMethod) methods; - interface->receiveSettings(m, interval); -} - - -Q_NOREPLY void DBusServer::satellitesInViewUpdate(const QByteArray &message) -{ - static QList<QGeoSatelliteInfo> update; - QDataStream stream(message); - stream >> update; - - interface->receiveSatellitesInView(update); -} - - -Q_NOREPLY void DBusServer::satellitesInUseUpdate(const QByteArray &message) -{ - static QList<QGeoSatelliteInfo> update; - QDataStream stream(message); - stream >> update; - - interface->receiveSatellitesInUse(update); -} - -#include "moc_dbusserver_maemo_p.cpp" -QT_END_NAMESPACE - diff --git a/src/plugins/position/maemo/dbusserver_maemo_p.h b/src/plugins/position/maemo/dbusserver_maemo_p.h deleted file mode 100644 index 886cb3fe..00000000 --- a/src/plugins/position/maemo/dbusserver_maemo_p.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DBUSSERVER_MAEMO_H -#define DBUSSERVER_MAEMO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDBus/QDBusAbstractAdaptor> -#include "qgeopositioninfo.h" -#include "qgeopositioninfosource.h" -#include "qgeosatelliteinfo.h" - -QT_BEGIN_NAMESPACE - -class DBusServerIF { -public: - virtual void receivePositionUpdate(const QGeoPositionInfo &update) = 0; - virtual void receiveSettings(QGeoPositionInfoSource::PositioningMethod methods, qint32 interval) = 0; - virtual void receiveSatellitesInView(const QList<QGeoSatelliteInfo> &update) = 0; - virtual void receiveSatellitesInUse(const QList<QGeoSatelliteInfo> &update) = 0; -}; - - -class DBusServer: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.nokia.qlocation.updates") - -public: - DBusServer(QObject *obj, DBusServerIF *interface); - -public Q_SLOTS: - Q_NOREPLY void positionUpdate(const QByteArray &update); - Q_NOREPLY void satellitesInViewUpdate(const QByteArray &update); - Q_NOREPLY void satellitesInUseUpdate(const QByteArray &update); - Q_NOREPLY void currentSettings(quint32 methods, quint32 interval); - -private: - Q_DISABLE_COPY(DBusServer) - DBusServerIF *interface; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/position/maemo/maemo.pro b/src/plugins/position/maemo/maemo.pro deleted file mode 100644 index c8feffc8..00000000 --- a/src/plugins/position/maemo/maemo.pro +++ /dev/null @@ -1,21 +0,0 @@ -TARGET = qtposition_maemo -QT += location gui dbus - -PLUGIN_TYPE = position -load(qt_plugin) - -INCLUDEPATH += $$QT.location.includes - -SOURCES += qgeopositioninfosource_maemo.cpp \ - qgeosatelliteinfosource_maemo.cpp \ - dbuscomm_maemo.cpp \ - dbusserver_maemo.cpp \ - qgeopositioninfosourcefactory_maemo.cpp -HEADERS += qgeopositioninfosource_maemo_p.h \ - qgeosatelliteinfosource_maemo_p.h \ - dbuscomm_maemo_p.h \ - dbusserver_maemo_p.h \ - qgeopositioninfosourcefactory_maemo.h - -OTHER_FILES += \ - plugin.json diff --git a/src/plugins/position/maemo/plugin.json b/src/plugins/position/maemo/plugin.json deleted file mode 100644 index f6d85747..00000000 --- a/src/plugins/position/maemo/plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Keys": ["maemo"], - "Provider": "maemo", - "Position": true, - "Satellite": true, - "Priority": 1000 -} diff --git a/src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp b/src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp deleted file mode 100644 index f68d67fc..00000000 --- a/src/plugins/position/maemo/qgeopositioninfosource_maemo.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosource_maemo_p.h" -#include <iostream> -#include <QDateTime> - -using namespace std; - -QT_BEGIN_NAMESPACE - -QGeoPositionInfoSourceMaemo::QGeoPositionInfoSourceMaemo(QObject *parent): QGeoPositionInfoSource(parent) -{ - requestTimer = new QTimer(this); - QObject::connect(requestTimer, SIGNAL(timeout()), this, SLOT(requestTimerExpired())); - locationOngoing = false; -} - - -int QGeoPositionInfoSourceMaemo::init() -{ - dbusComm = new DBusComm(this); - int status = dbusComm->init(); - - if (status == 0) { - QObject::connect(dbusComm, SIGNAL(receivedPositionUpdate(const QGeoPositionInfo &)), - this, SLOT(newPositionUpdate(const QGeoPositionInfo &))); - QObject::connect(dbusComm, SIGNAL(serviceConnected()), - this, SLOT(onServiceConnect())); - QObject::connect(dbusComm, SIGNAL(serviceDisconnected()), - this, SLOT(onServiceDisconnect())); - } - return status; -} - -void QGeoPositionInfoSourceMaemo::onServiceDisconnect() -{ - // -} - -void QGeoPositionInfoSourceMaemo::onServiceConnect() -{ - DBusComm::Command command = - (DBusComm::Command) - ( DBusComm::CommandSetInterval | - DBusComm::CommandSetMethods ); - - int interval = QGeoPositionInfoSource::updateInterval(); - QGeoPositionInfoSource::PositioningMethods method; - method = QGeoPositionInfoSource::preferredPositioningMethods(); - - if (locationOngoing) { - command = (DBusComm::Command) ( command | DBusComm::CommandStart ); - dbusComm->sendConfigRequest(command, method, interval); - } else { - dbusComm->sendConfigRequest(command, method, interval); - } -} - -void QGeoPositionInfoSourceMaemo::newPositionUpdate(const QGeoPositionInfo &update) -{ - if(update.isValid()) { - emit positionUpdated(update); - if ( requestTimer->isActive() ) - shutdownRequestSession(); - } else { - if ( !requestTimer->isActive() ) - emit updateTimeout(); - } -} - - -QGeoPositionInfo QGeoPositionInfoSourceMaemo::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const -{ - QGeoPositionInfo update = dbusComm->requestLastKnownPosition(fromSatellitePositioningMethodsOnly); - - return update; -} - - -QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceMaemo::supportedPositioningMethods() const -{ - return dbusComm->availableMethods(); -} - - -void QGeoPositionInfoSourceMaemo::setUpdateInterval(int msec) -{ - qint32 min = dbusComm->minimumInterval(); - msec = (msec < min) ? min : msec; - QGeoPositionInfoSource::setUpdateInterval(msec); - - dbusComm->sendConfigRequest(dbusComm->CommandSetInterval, 0, msec); -} - - -void QGeoPositionInfoSourceMaemo::setPreferredPositioningMethods(PositioningMethods sources) -{ - QGeoPositionInfoSource::setPreferredPositioningMethods(sources); - dbusComm->sendConfigRequest(dbusComm->CommandSetMethods, preferredPositioningMethods(), 0); -} - - -int QGeoPositionInfoSourceMaemo::minimumUpdateInterval() const -{ - return dbusComm->minimumInterval(); -} - -QGeoPositionInfoSource::Error QGeoPositionInfoSourceMaemo::error() const -{ - return UnknownSourceError; -} - -void QGeoPositionInfoSourceMaemo::startUpdates() -{ - locationOngoing = true; - if ( !requestTimer->isActive() ) - dbusComm->sendConfigRequest(DBusComm::CommandStart, 0, 0); -} - - -void QGeoPositionInfoSourceMaemo::stopUpdates() -{ - locationOngoing = false; - if ( !requestTimer->isActive() ) - dbusComm->sendConfigRequest(dbusComm->CommandStop, 0, 0); -} - - -void QGeoPositionInfoSourceMaemo::requestUpdate(int timeout) -{ - if ( QGeoPositionInfoSource::updateInterval() != - dbusComm->minimumInterval() ) - dbusComm->sendConfigRequest(dbusComm->CommandSetInterval, 0, - dbusComm->minimumInterval()); - - if ( !QGeoPositionInfoSource::preferredPositioningMethods().testFlag(QGeoPositionInfoSource::AllPositioningMethods) ) - dbusComm->sendConfigRequest(dbusComm->CommandSetMethods, - QGeoPositionInfoSource::AllPositioningMethods, 0); - - if ( !locationOngoing ) - dbusComm->sendConfigRequest(dbusComm->CommandStart, 0, 0); - - requestTimer->start(timeout); -} - -void QGeoPositionInfoSourceMaemo::requestTimerExpired() -{ - emit updateTimeout(); - shutdownRequestSession(); -} - -void QGeoPositionInfoSourceMaemo::shutdownRequestSession() -{ - requestTimer->stop(); - - if ( !locationOngoing ) - dbusComm->sendConfigRequest(dbusComm->CommandStop, 0, 0); - - if ( QGeoPositionInfoSource::updateInterval() != - dbusComm->minimumInterval() ) - dbusComm->sendConfigRequest(dbusComm->CommandSetInterval, 0, - QGeoPositionInfoSource::updateInterval()); - - if ( !QGeoPositionInfoSource::preferredPositioningMethods().testFlag(QGeoPositionInfoSource::AllPositioningMethods) ) - dbusComm->sendConfigRequest(dbusComm->CommandSetMethods, - QGeoPositionInfoSource::preferredPositioningMethods(), 0); -} - -#include "moc_qgeopositioninfosource_maemo_p.cpp" -QT_END_NAMESPACE - diff --git a/src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h b/src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h deleted file mode 100644 index 076351fc..00000000 --- a/src/plugins/position/maemo/qgeopositioninfosource_maemo_p.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCEMAEMO_H -#define QGEOPOSITIONINFOSOURCEMAEMO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qgeopositioninfosource.h" -#include "dbuscomm_maemo_p.h" - -#ifdef Q_WS_MAEMO_5 -#include "qgeocoordinate.h" - -extern "C" -{ -#include <glib.h> -#include <location/location-gpsd-control.h> -#include <location/location-gps-device.h> -#include <location/location-misc.h> -#include <location/location-distance-utils.h> -} -#endif - -QT_BEGIN_NAMESPACE - -class DBusComm; -class QGeoPositionInfoSourceMaemo : public QGeoPositionInfoSource -{ - Q_OBJECT - -public: - QGeoPositionInfoSourceMaemo(QObject *parent = 0); - int init(); - - virtual void setUpdateInterval(int interval); - virtual void setPreferredPositioningMethods(PositioningMethods sources); - virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; - virtual PositioningMethods supportedPositioningMethods() const; - virtual int minimumUpdateInterval() const; - Error error() const; - -public Q_SLOTS: - void startUpdates(); - void stopUpdates(); - void requestUpdate(int timeout = 5000); - -private: - DBusComm *dbusComm; - QTimer *requestTimer; - bool locationOngoing; - - void shutdownRequestSession(); - -private Q_SLOTS: - void newPositionUpdate(const QGeoPositionInfo &update); - void onServiceConnect(); - void onServiceDisconnect(); - void requestTimerExpired(); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp deleted file mode 100644 index 6127fba8..00000000 --- a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosourcefactory_maemo.h" -#include "qgeopositioninfosource_maemo_p.h" -#include "qgeosatelliteinfosource_maemo_p.h" - -QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryMaemo::positionInfoSource(QObject *parent) -{ - QGeoPositionInfoSourceMaemo *src = new QGeoPositionInfoSourceMaemo(parent); - if (src->init() == -1) { - delete src; - src = 0; - } - return src; -} - -QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryMaemo::satelliteInfoSource(QObject *parent) -{ - QGeoSatelliteInfoSourceMaemo *src = new QGeoSatelliteInfoSourceMaemo(parent); - if (src->init() == -1) { - delete src; - src = 0; - } - return src; -} diff --git a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h b/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h deleted file mode 100644 index a25d9272..00000000 --- a/src/plugins/position/maemo/qgeopositioninfosourcefactory_maemo.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCEFACTORY_MAEMO_H -#define QGEOPOSITIONINFOSOURCEFACTORY_MAEMO_H - -#include <QObject> -#include "qgeopositioninfosource.h" -#include "qgeopositioninfosourcefactory.h" - -class QGeoPositionInfoSourceFactoryMaemo : public QObject, public QGeoPositionInfoSourceFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0" - FILE "plugin.json") - Q_INTERFACES(QGeoPositionInfoSourceFactory) - -public: - QGeoPositionInfoSource *positionInfoSource(QObject *parent); - QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent); -}; - -#endif diff --git a/src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp deleted file mode 100644 index b27443f7..00000000 --- a/src/plugins/position/maemo/qgeosatelliteinfosource_maemo.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeosatelliteinfosource_maemo_p.h" - -QT_BEGIN_NAMESPACE - -QGeoSatelliteInfoSourceMaemo::QGeoSatelliteInfoSourceMaemo(QObject *parent) : QGeoSatelliteInfoSource(parent), - running(false), satInViewSeen(false) -{ - requestTimer = new QTimer(this); - QObject::connect(requestTimer, SIGNAL(timeout()), this, SLOT(requestTimerExpired())); -} - - -int QGeoSatelliteInfoSourceMaemo::init() -{ - dbusComm = new DBusComm(this); - int status = dbusComm->init(); - - if (status == 0) { - QObject::connect(dbusComm, SIGNAL(receivedSatellitesInView(const QList<QGeoSatelliteInfo> &)), - this, SLOT(newSatellitesInView(const QList<QGeoSatelliteInfo> &))); - QObject::connect(dbusComm, SIGNAL(receivedSatellitesInUse(const QList<QGeoSatelliteInfo> &)), - this, SLOT(newSatellitesInUse(const QList<QGeoSatelliteInfo> &))); - QObject::connect(dbusComm, SIGNAL(serviceConnected()), - this, SLOT(onServiceConnect())); - QObject::connect(dbusComm, SIGNAL(serviceDisconnected()), - this, SLOT(onServiceDisconnect())); - } - - return status; -} - -int QGeoSatelliteInfoSourceMaemo::minimumUpdateInterval() const -{ - return 1; -} - -QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceMaemo::error() const -{ - return UnknownSourceError; -} - -void QGeoSatelliteInfoSourceMaemo::startUpdates() -{ - if ( !requestTimer->isActive() ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStart, 0, 0); - running = true; -} - - -void QGeoSatelliteInfoSourceMaemo::stopUpdates() -{ - if ( !requestTimer->isActive() ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStop, 0, 0); - running = false; -} - - -void QGeoSatelliteInfoSourceMaemo::requestUpdate(int timeout) -{ - if ( !running ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStart, 0, 0); - - requestTimer->start(timeout); - satInViewSeen = false; -} - - -void QGeoSatelliteInfoSourceMaemo::newSatellitesInView(const QList<QGeoSatelliteInfo> &update) -{ - if ( requestTimer->isActive() && satInViewSeen ) { - requestTimer->stop(); - if ( !running ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStop, 0, 0); - else - emit satellitesInViewUpdated(update); - } else { - emit satellitesInViewUpdated(update); - } - - satInViewSeen = true; -} - - -void QGeoSatelliteInfoSourceMaemo::newSatellitesInUse(const QList<QGeoSatelliteInfo> &update) -{ - if ( requestTimer->isActive() ) { - requestTimer->stop(); - if ( !running ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStop, 0, 0); - } - - emit satellitesInUseUpdated(update); -} - -void QGeoSatelliteInfoSourceMaemo::requestTimerExpired() -{ - requestTimer->stop(); - - if ( !running ) - dbusComm->sendConfigRequest(DBusComm::CommandSatStop, 0, 0); - - emit requestTimeout(); -} - -void QGeoSatelliteInfoSourceMaemo::onServiceDisconnect() -{ - // -} - - -void QGeoSatelliteInfoSourceMaemo::onServiceConnect() -{ - if (running) { - dbusComm->sendConfigRequest(DBusComm::CommandSatStart, 0, 0); - } -} - - -#include "moc_qgeosatelliteinfosource_maemo_p.cpp" -QT_END_NAMESPACE - diff --git a/src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h b/src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h deleted file mode 100644 index 9a32fc6b..00000000 --- a/src/plugins/position/maemo/qgeosatelliteinfosource_maemo_p.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOSATELLITEINFOSOURCE_MAEMO_H -#define QGEOSATELLITEINFOSOURCE_MAEMO_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qgeosatelliteinfosource.h" -#include "qgeosatelliteinfo.h" -#include "dbuscomm_maemo_p.h" - -QT_BEGIN_NAMESPACE - -class QGeoSatelliteInfoSourceMaemo : public QGeoSatelliteInfoSource -{ - Q_OBJECT -public: - explicit QGeoSatelliteInfoSourceMaemo(QObject *parent = 0); - int init(); - int minimumUpdateInterval() const; - Error error() const; - -public Q_SLOTS: - void startUpdates(); - void stopUpdates(); - void requestUpdate(int timeout = 5000); - -Q_SIGNALS: - void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites); - void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites); - void requestTimeout(); - -private Q_SLOTS: - void newSatellitesInView(const QList<QGeoSatelliteInfo> &update); - void newSatellitesInUse(const QList<QGeoSatelliteInfo> &update); - void onServiceDisconnect(); - void onServiceConnect(); - void requestTimerExpired(); - -private: - DBusComm *dbusComm; - bool running; - bool satInViewSeen; - QTimer *requestTimer; - Q_DISABLE_COPY(QGeoSatelliteInfoSourceMaemo) -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/plugins/position/npe_backend/npe_backend.pro b/src/plugins/position/npe_backend/npe_backend.pro deleted file mode 100644 index 72827e1b..00000000 --- a/src/plugins/position/npe_backend/npe_backend.pro +++ /dev/null @@ -1,24 +0,0 @@ -TARGET = qtposition_npe_backend -QT += location gui - -PLUGIN_TYPE = position -load(qt_plugin) - -INCLUDEPATH += $$QT.location.includes - -DEFINES += NPE_BACKEND -INCLUDEPATH += $$[QT_INSTALL_PREFIX]/include/mtlocationd -#unix { -# CONFIG += link_pkgconfig -# PKGCONFIG += mtlocationd -#} -LIBS += -lmtlocationd -SOURCES += qgeopositioninfosource_npe_backend.cpp \ - qgeosatelliteinfosource_npe_backend.cpp \ - qgeopositioninfosourcefactory_npe_backend.cpp -HEADERS += qgeopositioninfosource_npe_backend_p.h \ - qgeosatelliteinfosource_npe_backend_p.h \ - qgeopositioninfosourcefactory_npe_backend.h - -OTHER_FILES += \ - plugin.json diff --git a/src/plugins/position/npe_backend/plugin.json b/src/plugins/position/npe_backend/plugin.json deleted file mode 100644 index 4fdc1be6..00000000 --- a/src/plugins/position/npe_backend/plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Keys": ["npe_backend"], - "Provider": "npe_backend", - "Position": true, - "Satellite": true, - "Priority": 1000 -} diff --git a/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp deleted file mode 100644 index da46cce0..00000000 --- a/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosource_npe_backend_p.h" - - -QGeoPositionInfoSourceNpeBackend::QGeoPositionInfoSourceNpeBackend(QObject *parent): - QGeoPositionInfoSource(parent), m_locationdConn(0), trackingOngoing(false), timeoutSent(false), - mPositionError(QGeoPositionInfoSource::UnknownSourceError) -{ - requestTimer = new QTimer(this); - QObject::connect(requestTimer, SIGNAL(timeout()), this, SLOT(requestTimerExpired())); -} - - -bool QGeoPositionInfoSourceNpeBackend::init() -{ - m_locationdConn = new LocationDaemonConnection(this); - //check for Error: Could not connect to socket (locationd not started?) - if (!m_locationdConn->connected()) - return(false); - connect(m_locationdConn, SIGNAL(positionUpdate(PositionData)), this, SLOT(onPositionUpdate(PositionData))); - connect(m_locationdConn, SIGNAL(connectionError(LocationDaemonConnection::SocketError)), this, SLOT(onConnectionError(LocationDaemonConnection::SocketError))); - return(true); -} - - -QGeoPositionInfo QGeoPositionInfoSourceNpeBackend::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const -{ - const PositionData &position = m_locationdConn->lastKnownPosition(fromSatellitePositioningMethodsOnly); - QGeoCoordinate coordinate; - QGeoPositionInfo lastPosition; - coordinate.setLatitude(position.latitude); - coordinate.setLongitude(position.longitude); - coordinate.setAltitude(position.altitude); - if (coordinate.isValid()) { - lastPosition.setCoordinate(coordinate); - lastPosition.setAttribute(QGeoPositionInfo::HorizontalAccuracy, position.horizontalAccuracy); - lastPosition.setAttribute(QGeoPositionInfo::VerticalAccuracy, position.verticalAccuracy); - lastPosition.setAttribute(QGeoPositionInfo::GroundSpeed, position.groundSpeed); - lastPosition.setAttribute(QGeoPositionInfo::VerticalSpeed, position.verticalSpeed); - lastPosition.setAttribute(QGeoPositionInfo::MagneticVariation, position.magneticVariation); - lastPosition.setAttribute(QGeoPositionInfo::Direction, position.bearing); - QDateTime timestamp = QDateTime::fromString(position.dateTime, "yyyy-MM-ddThh:mm:ss"); - lastPosition.setTimestamp(timestamp); - } else { - // return null update as no valid lastKnown Position is available - coordinate.setLatitude(0); - coordinate.setLongitude(0); - coordinate.setAltitude(0); - lastPosition.setCoordinate(coordinate); - lastPosition.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 0); - lastPosition.setAttribute(QGeoPositionInfo::VerticalAccuracy, 0); - lastPosition.setAttribute(QGeoPositionInfo::GroundSpeed, 0); - lastPosition.setAttribute(QGeoPositionInfo::VerticalSpeed, 0); - lastPosition.setAttribute(QGeoPositionInfo::MagneticVariation, 0); - lastPosition.setAttribute(QGeoPositionInfo::Direction, 0); - } - return(lastPosition); -} - - -QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceNpeBackend::supportedPositioningMethods() const -{ - switch (m_locationdConn->supportedMethods()) { - case LocationdStrings::PositionInfo::Satellite: - return(QGeoPositionInfoSource::SatellitePositioningMethods); - case LocationdStrings::PositionInfo::NonSatellite: - return(QGeoPositionInfoSource::NonSatellitePositioningMethods); - default: - return(QGeoPositionInfoSource::AllPositioningMethods); - } -} - - -void QGeoPositionInfoSourceNpeBackend::setPreferredPositioningMethods(PositioningMethods sources) -{ - QGeoPositionInfoSource::setPreferredPositioningMethods(sources); - LocationdStrings::PositionInfo::PositioningMethods positioningMethod; - switch (preferredPositioningMethods()){ - case QGeoPositionInfoSource::SatellitePositioningMethods: - positioningMethod = LocationdStrings::PositionInfo::Satellite; - break; - case QGeoPositionInfoSource::NonSatellitePositioningMethods: - positioningMethod = LocationdStrings::PositionInfo::NonSatellite; - break; - default: - positioningMethod = LocationdStrings::PositionInfo::AllMethods; - } - m_locationdConn->setPreferredMethod(positioningMethod); -} - - -void QGeoPositionInfoSourceNpeBackend::setUpdateInterval(int msec) -{ - int minInterval = m_locationdConn->minimumUpdateInterval(); - if (msec < minInterval && msec != 0) - msec = minInterval; - QGeoPositionInfoSource::setUpdateInterval(msec); - if (!requestTimer->isActive()) - m_locationdConn->setUpdateInterval(msec); -} - - -int QGeoPositionInfoSourceNpeBackend::minimumUpdateInterval() const -{ - return(m_locationdConn->minimumUpdateInterval()); -} - - -void QGeoPositionInfoSourceNpeBackend::startUpdates() -{ - if (!trackingOngoing) { - trackingOngoing = true; - m_locationdConn->startPositionUpdates(); - } -} - - -void QGeoPositionInfoSourceNpeBackend::stopUpdates() -{ - if (trackingOngoing) { - trackingOngoing = false; - - // if there's still a pending position request, wait for it to complete before stopping position updates - if (!requestTimer->isActive()) - m_locationdConn->stopPositionUpdates(); - } -} - - -void QGeoPositionInfoSourceNpeBackend::requestUpdate(int timeout) -{ - // ignore if another requestUpdate is still pending - if (!requestTimer->isActive()) { - int minimumInterval = minimumUpdateInterval(); - // set reasonable timeout for the source if timeout is 0 - if (timeout == 0) - timeout = 5*minimumInterval; - // do not start request if timeout can not be fulfilled by the source - if (timeout < minimumInterval) { - emit updateTimeout(); - return; - } - // get position as fast as possible in case of ongoing satellite based session - if ( trackingOngoing ) { - if ( QGeoPositionInfoSource::updateInterval() != minimumInterval) - m_locationdConn->setUpdateInterval(minimumInterval); - } else { // request the update only if no tracking session is active - m_locationdConn->requestPositionUpdate(); - } - requestTimer->start(timeout); - } -} - - -void QGeoPositionInfoSourceNpeBackend::requestTimerExpired() -{ - emit updateTimeout(); - shutdownRequestSession(); -} - - - -void QGeoPositionInfoSourceNpeBackend::shutdownRequestSession() -{ - requestTimer->stop(); - // Restore updateInterval from before Request Session - if (trackingOngoing) { - int minimumInterval = minimumUpdateInterval(); - if ( QGeoPositionInfoSource::updateInterval() != minimumInterval) - setUpdateInterval(QGeoPositionInfoSource::updateInterval()); - } else { - // If our timer expired before we could get a fix, make sure we stop the location daemon position request - // (which would otherwise go on until a fix is obtained). - m_locationdConn->stopPositionUpdates(); - } -} - - -void QGeoPositionInfoSourceNpeBackend::onPositionUpdate(const PositionData &position) -{ - if (position.valid) { - QGeoPositionInfo update; - QGeoCoordinate coordinate; - coordinate.setLatitude(position.latitude); - coordinate.setLongitude(position.longitude); - coordinate.setAltitude(position.altitude); - if (coordinate.isValid()) { - update.setCoordinate(coordinate); - update.setAttribute(QGeoPositionInfo::HorizontalAccuracy, position.horizontalAccuracy); - update.setAttribute(QGeoPositionInfo::VerticalAccuracy, position.verticalAccuracy); - update.setAttribute(QGeoPositionInfo::GroundSpeed, position.groundSpeed); - update.setAttribute(QGeoPositionInfo::VerticalSpeed, position.verticalSpeed); - update.setAttribute(QGeoPositionInfo::MagneticVariation, position.magneticVariation); - update.setAttribute(QGeoPositionInfo::Direction, position.bearing); - QDateTime timestamp = QDateTime::fromString(position.dateTime, "yyyy-MM-ddThh:mm:ss"); - update.setTimestamp(timestamp); - emit positionUpdated(update); - timeoutSent = false; - if ( requestTimer->isActive() ) - shutdownRequestSession(); - } else { - if (!timeoutSent) { - emit updateTimeout(); - timeoutSent = true; - } - } - } -} - - - -QGeoPositionInfoSource::Error QGeoPositionInfoSourceNpeBackend::error() const -{ - return mPositionError; -} - - -void QGeoPositionInfoSourceNpeBackend::setError(QGeoPositionInfoSource::Error positionError) -{ - mPositionError = positionError; - emit QGeoPositionInfoSource::error(positionError); -} - - -void QGeoPositionInfoSourceNpeBackend::onConnectionError(LocationDaemonConnection::SocketError socketError) -{ - switch (socketError) { - case LocationDaemonConnection::ClosedError: - setError(ClosedError); - break; - case LocationDaemonConnection::AccessError: - setError(AccessError); - break; - default: - setError(UnknownSourceError); - } -} diff --git a/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h b/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h deleted file mode 100644 index e92a8879..00000000 --- a/src/plugins/position/npe_backend/qgeopositioninfosource_npe_backend_p.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCE_NPE_BACKEND_H -#define QGEOPOSITIONINFOSOURCE_NPE_BACKEND_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qgeopositioninfosource.h" -#include <qtimer.h> -#include <locationdaemonconnection.h> - - -class QGeoPositionInfoSourceNpeBackend : public QGeoPositionInfoSource -{ - Q_OBJECT - -public: - QGeoPositionInfoSourceNpeBackend(QObject *parent = 0); - bool init(); - void setUpdateInterval(int interval); - void setPreferredPositioningMethods(PositioningMethods sources); - QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; - PositioningMethods supportedPositioningMethods() const; - int minimumUpdateInterval() const; - QGeoPositionInfoSource::Error error() const; - -public Q_SLOTS: - void startUpdates(); - void stopUpdates(); - void requestUpdate(int timeout = 5000); - -private: - void setError(QGeoPositionInfoSource::Error positionError); - void shutdownRequestSession(); - LocationDaemonConnection *m_locationdConn; - bool trackingOngoing; - bool timeoutSent; - QTimer *requestTimer; - QGeoPositionInfoSource::Error mPositionError; - - -private Q_SLOTS: - void onPositionUpdate(const PositionData &position); - void onConnectionError(LocationDaemonConnection::SocketError socketError); - void requestTimerExpired(); -}; - -#endif // QGEOPOSITIONINFOSOURCE_NPE_BACKEND_H diff --git a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp deleted file mode 100644 index 28394db0..00000000 --- a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosourcefactory_npe_backend.h" -#include "qgeopositioninfosource_npe_backend_p.h" -#include "qgeosatelliteinfosource_npe_backend_p.h" - -QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryNpeBackend::positionInfoSource(QObject *parent) -{ - QGeoPositionInfoSourceNpeBackend *src = new QGeoPositionInfoSourceNpeBackend(parent); - if (!src->init()) { - delete src; - src = 0; - } - return src; -} - -QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryNpeBackend::satelliteInfoSource(QObject *parent) -{ - QGeoSatelliteInfoSourceNpeBackend *src = new QGeoSatelliteInfoSourceNpeBackend(parent); - if (!src->init()) { - delete src; - src = 0; - } - return src; -} diff --git a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h b/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h deleted file mode 100644 index 4c574c07..00000000 --- a/src/plugins/position/npe_backend/qgeopositioninfosourcefactory_npe_backend.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCEFACTORY_NPE_BACKEND_H -#define QGEOPOSITIONINFOSOURCEFACTORY_NPE_BACKEND_H - -#include <QObject> -#include "qgeopositioninfosource.h" -#include "qgeopositioninfosourcefactory.h" - -class QGeoPositionInfoSourceFactoryNpeBackend : public QObject, public QGeoPositionInfoSourceFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0" - FILE "plugin.json") - Q_INTERFACES(QGeoPositionInfoSourceFactory) - -public: - QGeoPositionInfoSource *positionInfoSource(QObject *parent); - QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent); -}; - -#endif diff --git a/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp deleted file mode 100644 index f6513040..00000000 --- a/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeosatelliteinfosource_npe_backend_p.h" -#include <qdebug.h> - - -// Bitmask Table for satStatus -// Satellite is above elevation mask -#define SATELLITES_STATUS_VISIBLE 0x0002 // --------------1- -// Satellite used in position calculation -#define SATELLITES_STATUS_USED_POS 0x0004 // -------------1-- - - -QGeoSatelliteInfoSourceNpeBackend::QGeoSatelliteInfoSourceNpeBackend(QObject *parent): - QGeoSatelliteInfoSource(parent),m_locationdConn(0), satOngoing(false), - mSatelliteError(QGeoSatelliteInfoSource::UnknownSourceError) -{ - requestTimer = new QTimer(this); - QObject::connect(requestTimer, SIGNAL(timeout()), this, SLOT(requestTimerExpired())); -} - - -bool QGeoSatelliteInfoSourceNpeBackend::init() -{ - m_locationdConn = new LocationDaemonConnection(this); - //check for Error: Could not connect to socket (locationd not started?) - if (!m_locationdConn->connected()) - return(false); - connect(m_locationdConn, SIGNAL(satelliteUpdate(QList<SatelliteData>)), this, SLOT(onSatelliteUpdate(QList<SatelliteData>))); - connect(m_locationdConn, SIGNAL(connectionError(LocationDaemonConnection::SocketError)), this, SLOT(onConnectionError(LocationDaemonConnection::SocketError))); - return(true); -} - - -void QGeoSatelliteInfoSourceNpeBackend::setUpdateInterval(int msec) -{ - int minInterval = m_locationdConn->minimumUpdateInterval(); - if (msec < minInterval && msec != 0) - msec = minInterval; - QGeoSatelliteInfoSource::setUpdateInterval(msec); - if (!requestTimer->isActive()) - m_locationdConn->setUpdateInterval(msec); -} - - -int QGeoSatelliteInfoSourceNpeBackend::minimumUpdateInterval() const -{ - return(m_locationdConn->minimumUpdateInterval()); -} - - -void QGeoSatelliteInfoSourceNpeBackend::startUpdates() -{ - if (!satOngoing) { - satOngoing = true; - m_locationdConn->startSatelliteUpdates(); - } -} - - -void QGeoSatelliteInfoSourceNpeBackend::stopUpdates() -{ - if (satOngoing) { - satOngoing = false; - - // if there's still a pending sat update request, wait for it to complete before stopping satellite updates - if (!requestTimer->isActive()) - m_locationdConn->stopSatelliteUpdates(); - } -} - - -void QGeoSatelliteInfoSourceNpeBackend::requestUpdate(int timeout) -{ - // ignore if another requestUpdate is still pending - if (!requestTimer->isActive()) { - int minimumInterval = minimumUpdateInterval(); - if (timeout == 0) - timeout = 5*minimumInterval; // set reasonable timeout if provided timeout is 0 - // do not start request if timeout can not be fulfilled by the source - if (timeout < minimumInterval) { - emit requestTimeout(); - return; - } - // get satellite update as fast as possible in case of ongoing tracking session - if ( satOngoing ) { - if ( QGeoSatelliteInfoSource::updateInterval() != minimumInterval) - m_locationdConn->setUpdateInterval(minimumInterval); - } else { // request the update only if no tracking session is active - m_locationdConn->requestSatelliteUpdate(); - } - requestTimer->start(timeout); - } -} - - -void QGeoSatelliteInfoSourceNpeBackend::requestTimerExpired() -{ - emit requestTimeout(); - shutdownRequestSession(); -} - - -void QGeoSatelliteInfoSourceNpeBackend::shutdownRequestSession() -{ - requestTimer->stop(); - // Restore updateInterval from before Request Session in case of ongoing tracking session - if ( satOngoing ) { - int minimumInterval = minimumUpdateInterval(); - if ( QGeoSatelliteInfoSource::updateInterval() != minimumInterval) - setUpdateInterval(QGeoSatelliteInfoSource::updateInterval()); - } else { - // If our timer expired before we could get a sat update, make sure we stop the locationd request - // (which would otherwise go on until a valid satellite update is obtained). - m_locationdConn->stopSatelliteUpdates(); - } -} - - -void QGeoSatelliteInfoSourceNpeBackend::onSatelliteUpdate(const QList<SatelliteData> &satellites) -{ - QList<QGeoSatelliteInfo> inUse; - QList<QGeoSatelliteInfo> inView; - QListIterator<SatelliteData> it(satellites); - - if (!satellites.empty()) { - while (it.hasNext()) - { - QGeoSatelliteInfo satinfo; - const SatelliteData &satellite = it.next(); - satinfo.setAttribute(QGeoSatelliteInfo::Elevation, satellite.elevation); - satinfo.setAttribute(QGeoSatelliteInfo::Azimuth, satellite.azimuth); - satinfo.setSatelliteIdentifier(satellite.id); - satinfo.setSignalStrength(satellite.signalStrength); - if (satellite.satSystem == LocationdStrings::PositionInfo::kGPS) - satinfo.setSatelliteSystem(QGeoSatelliteInfo::GPS); - else if (satellite.satSystem == LocationdStrings::PositionInfo::kGLONASS) - satinfo.setSatelliteSystem(QGeoSatelliteInfo::GLONASS); - else - satinfo.setSatelliteSystem(QGeoSatelliteInfo::Undefined); - if (satellite.status & SATELLITES_STATUS_VISIBLE) { - inView.append(satinfo); - if (satellite.status & SATELLITES_STATUS_USED_POS) - inUse.append(satinfo); - } - } - if (inUse.count() > 0) // emit updated signal if satellite list is not empty - emit satellitesInUseUpdated(inUse); - qDebug() << "emit satelliteUpdated signals: in use count: " << inUse.count() << ", in view count: " <<inView.count(); - if (inView.count() > 0) - emit satellitesInViewUpdated(inView); - if ( requestTimer->isActive() ) - shutdownRequestSession(); - } -} - - -QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceNpeBackend::error() const -{ - return mSatelliteError; -} - - -void QGeoSatelliteInfoSourceNpeBackend::setError(QGeoSatelliteInfoSource::Error satelliteError) -{ - mSatelliteError = satelliteError; - emit QGeoSatelliteInfoSource::error(satelliteError); -} - - -void QGeoSatelliteInfoSourceNpeBackend::onConnectionError(LocationDaemonConnection::SocketError socketError) -{ - switch (socketError) { - case LocationDaemonConnection::ClosedError: - setError(ClosedError); - break; - case LocationDaemonConnection::AccessError: - setError(AccessError); - break; - default: - setError(UnknownSourceError); - } -} diff --git a/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h b/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h deleted file mode 100644 index fac59f48..00000000 --- a/src/plugins/position/npe_backend/qgeosatelliteinfosource_npe_backend_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOSATELLITEINFOSOURCE_NPE_BACKEND_H -#define QGEOSATELLITEINFOSOURCE_NPE_BACKEND_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qgeosatelliteinfosource.h" -#include <qtimer.h> -#include <locationdaemonconnection.h> - - -class QGeoSatelliteInfoSourceNpeBackend: public QGeoSatelliteInfoSource -{ - Q_OBJECT - -public: - QGeoSatelliteInfoSourceNpeBackend(QObject *parent = 0); - bool init(); - void setUpdateInterval(int interval); - int minimumUpdateInterval() const; - QGeoSatelliteInfoSource::Error error() const; - -public Q_SLOTS: - void startUpdates(); - void stopUpdates(); - void requestUpdate(int timeout = 5000); - -private: - void setError(QGeoSatelliteInfoSource::Error satelliteError); - void shutdownRequestSession(); - LocationDaemonConnection *m_locationdConn; - bool satOngoing; - QTimer *requestTimer; - QGeoSatelliteInfoSource::Error mSatelliteError; - - -private Q_SLOTS: - void onSatelliteUpdate(const QList<SatelliteData> &satellites); - void onConnectionError(LocationDaemonConnection::SocketError socketError); - void requestTimerExpired(); -}; - -#endif // QGEOSATELLITEINFOSOURCE_NPE_BACKEND_H diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro index c956019c..d3453910 100644 --- a/src/plugins/position/position.pro +++ b/src/plugins/position/position.pro @@ -1,7 +1,5 @@ TEMPLATE = subdirs -maemo6|meego:SUBDIRS += maemo config_geoclue:SUBDIRS += geoclue config_gypsy:SUBDIRS += gypsy -config_locationd:!simulator:SUBDIRS += npe_backend simulator:SUBDIRS += simulator diff --git a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro index e0f3f233..fe5291b9 100644 --- a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro +++ b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro @@ -13,7 +13,5 @@ QT += location testlib # Define whether a satellite source is available. This must match the logic in # src/location/location.pro or the test will fail on some platforms. -maemo6|meego:DEFINES += SATELLITE_SOURCE_AVAILABLE -config_locationd:!simulator:DEFINES += SATELLITE_SOURCE_AVAILABLE simulator:DEFINES += SATELLITE_SOURCE_AVAILABLE DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 |