diff options
-rw-r--r-- | config.tests/jsondb/jsondb.pro | 6 | ||||
-rw-r--r-- | config.tests/jsondb/main.cpp | 48 | ||||
-rw-r--r-- | config.tests/mtclient/main.cpp | 46 | ||||
-rw-r--r-- | config.tests/mtclient/mtclient.pro | 8 | ||||
-rw-r--r-- | src/location/location.pro | 9 | ||||
-rw-r--r-- | src/location/qgeopositioninfosource_npe_backend.cpp | 71 | ||||
-rw-r--r-- | src/location/qgeopositioninfosource_npe_backend_p.h | 9 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfosource_npe_backend.cpp | 50 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfosource_npe_backend_p.h | 8 | ||||
-rw-r--r-- | src/plugins/geoservices/geoservices.pro | 4 | ||||
-rw-r--r-- | sync.profile | 2 | ||||
-rw-r--r-- | tests/auto/auto.pro | 4 | ||||
-rw-r--r-- | tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro | 4 |
13 files changed, 83 insertions, 186 deletions
diff --git a/config.tests/jsondb/jsondb.pro b/config.tests/jsondb/jsondb.pro deleted file mode 100644 index a54ef9e5..00000000 --- a/config.tests/jsondb/jsondb.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = app - -DEFINES += QT_ADDON_JSONDB_LIB -QT += jsondb - -SOURCES += main.cpp diff --git a/config.tests/jsondb/main.cpp b/config.tests/jsondb/main.cpp deleted file mode 100644 index c93430e6..00000000 --- a/config.tests/jsondb/main.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtLocation module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <jsondb-error.h> - -int main() -{ - return 0; -} diff --git a/config.tests/mtclient/main.cpp b/config.tests/mtclient/main.cpp deleted file mode 100644 index 1428a04d..00000000 --- a/config.tests/mtclient/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the FOO module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <mt-client/variantstream.h> -int main() -{ - return 0; -} diff --git a/config.tests/mtclient/mtclient.pro b/config.tests/mtclient/mtclient.pro deleted file mode 100644 index 2dc24936..00000000 --- a/config.tests/mtclient/mtclient.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -QT += declarative -unix{ - CONFIG += link_pkgconfig - PKGCONFIG += mt-client - } - -SOURCES += main.cpp diff --git a/src/location/location.pro b/src/location/location.pro index 33673aad..b35b07a8 100644 --- a/src/location/location.pro +++ b/src/location/location.pro @@ -87,18 +87,13 @@ meego { } } -contains(config_test_jsondb, yes):contains(config_test_mtclient, yes):!simulator { +!isEmpty(QT.jsondb.name):!isEmpty(QT.jsonstream.name):!simulator { DEFINES += NPE_BACKEND - QT += jsondb-private + QT += jsondb-private jsonstream SOURCES += qgeopositioninfosource_npe_backend.cpp\ qgeosatelliteinfosource_npe_backend.cpp PRIVATE_HEADERS += qgeopositioninfosource_npe_backend_p.h\ qgeosatelliteinfosource_npe_backend_p.h - - unix{ - CONFIG += link_pkgconfig - PKGCONFIG += mt-client - } } HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS diff --git a/src/location/qgeopositioninfosource_npe_backend.cpp b/src/location/qgeopositioninfosource_npe_backend.cpp index 8c8d972d..782f2d39 100644 --- a/src/location/qgeopositioninfosource_npe_backend.cpp +++ b/src/location/qgeopositioninfosource_npe_backend.cpp @@ -42,6 +42,9 @@ #include "qgeopositioninfosource_npe_backend_p.h" #include <sys/stat.h> +#include <QtAddOnJsonStream/jsonstream.h> + +QT_USE_NAMESPACE_JSONSTREAM // API for socket communication towards locationd const QString kstartUpdates = QLatin1String("startUpdates"); @@ -92,9 +95,9 @@ bool QGeoPositionInfoSourceNpeBackend::init() if (mSocket) { connect(mSocket, SIGNAL(connected()), this, SLOT(onSocketConnected())); connect(mSocket, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); - mStream = new VariantStream(mSocket); + mStream = new JsonStream(mSocket); if (mStream) { - connect(mStream, SIGNAL(receive(const QVariantMap&)), this, SLOT(onStreamReceived(const QVariantMap&)), Qt::QueuedConnection); + connect(mStream, SIGNAL(messageReceived(const QVariantMap&)), this, SLOT(onStreamReceived(const QVariantMap&)), Qt::QueuedConnection); } mSocket->connectToServer((QLatin1String)klocationdSocketName); return(mSocket->waitForConnected(500)); // wait up to 0.5 seconds to get connected, otherwise return false @@ -108,11 +111,11 @@ QGeoPositionInfo QGeoPositionInfoSourceNpeBackend::lastKnownPosition(bool fromSa { QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(lastKnownPositionReceived()), &loop, SLOT(quit())); - QVariantMap action; - QVariantMap object; - action.insert(JsonDbString::kActionStr, kgetLastKnownPosition); - object.insert(ksatelliteOnly, fromSatellitePositioningMethodsOnly); - action.insert(JsonDbString::kDataStr, object); + QJsonObject action; + QJsonObject object; + action[JsonDbString::kActionStr] = kgetLastKnownPosition; + object[ksatelliteOnly] = fromSatellitePositioningMethodsOnly; + action[JsonDbString::kDataStr] = object; mStream->send(action); loop.exec(); // wait for signal lastKnownPositionReceived()sent by slot onStreamReceived return(lastPosition); @@ -123,8 +126,8 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceNpeBackend::sup { QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(supportedPositioningMethodsReceived()), &loop, SLOT(quit())); - QVariantMap action; - action.insert(JsonDbString::kActionStr, kgetSupportedMethods); + QJsonObject action; + action[JsonDbString::kActionStr] = kgetSupportedMethods; mStream->send(action); loop.exec(); // wait for supportedPositioningMethodsReceived() signal sent by slot onStreamReceived switch (supportedMethods){ @@ -140,21 +143,21 @@ QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceNpeBackend::sup void QGeoPositionInfoSourceNpeBackend::setUpdateInterval(int msec) { - QVariantMap action; QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(minimumUpdateIntervalReceived()), &loop, SLOT(quit())); - action.insert(JsonDbString::kActionStr, kgetMinimumUpdateInterval); + QJsonObject action; + action[JsonDbString::kActionStr] = kgetMinimumUpdateInterval; mStream->send(action); loop.exec(); // wait for minimumUpdateIntervalReceived() signal sent by slot onStreamReceived if (msec < minInterval && msec != 0) msec = minInterval; QGeoPositionInfoSource::setUpdateInterval(msec); if (!requestTimer->isActive()) { - QVariantMap actionUpdate; - QVariantMap object; - actionUpdate.insert(JsonDbString::kActionStr, ksetUpdateInterval); - object.insert(kinterval, msec); - actionUpdate.insert(JsonDbString::kDataStr, object); + QJsonObject actionUpdate; + QJsonObject object; + actionUpdate[JsonDbString::kActionStr] = ksetUpdateInterval; + object[kinterval] = msec; + actionUpdate[JsonDbString::kDataStr] = object; mStream->send(actionUpdate); } } @@ -163,21 +166,21 @@ void QGeoPositionInfoSourceNpeBackend::setUpdateInterval(int msec) void QGeoPositionInfoSourceNpeBackend::setPreferredPositioningMethods(PositioningMethods sources) { QGeoPositionInfoSource::setPreferredPositioningMethods(sources); - QVariantMap action; - QVariantMap object; - action.insert(JsonDbString::kActionStr, ksetPreferredMethod); - object.insert(kmethod, (uint)sources); - action.insert(JsonDbString::kDataStr, object); + QJsonObject action; + QJsonObject object; + action[JsonDbString::kActionStr] = ksetPreferredMethod; + object[kmethod] = int(sources); + action[JsonDbString::kDataStr] = object; mStream->send(action); } int QGeoPositionInfoSourceNpeBackend::minimumUpdateInterval() const { - QVariantMap action; + QJsonObject action; QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(minimumUpdateIntervalReceived()), &loop, SLOT(quit())); - action.insert(JsonDbString::kActionStr, kgetMinimumUpdateInterval); + action[JsonDbString::kActionStr] = kgetMinimumUpdateInterval; mStream->send(action); loop.exec(); // wait for minimumUpdateIntervalReceived() signal sent by slot onStreamReceived return(minInterval); @@ -188,8 +191,8 @@ void QGeoPositionInfoSourceNpeBackend::startUpdates() { if (!locationOngoing) { locationOngoing = true; - QVariantMap action; - action.insert(JsonDbString::kActionStr, kstartUpdates); + QJsonObject action; + action[JsonDbString::kActionStr] = kstartUpdates; mStream->send(action); } } @@ -199,8 +202,8 @@ void QGeoPositionInfoSourceNpeBackend::stopUpdates() { if ( locationOngoing && !requestTimer->isActive() ) { locationOngoing = false; - QVariantMap action; - action.insert(JsonDbString::kActionStr, kstopUpdates); + QJsonObject action; + action[JsonDbString::kActionStr] = kstopUpdates; mStream->send(action); } } @@ -222,18 +225,18 @@ void QGeoPositionInfoSourceNpeBackend::requestUpdate(int timeout) // get position as fast as possible in case of ongoing satellite based session if ( locationOngoing ) { if ( QGeoPositionInfoSource::updateInterval() != minimumInterval) { - QVariantMap actionUpdate; - QVariantMap object; - actionUpdate.insert(JsonDbString::kActionStr, ksetUpdateInterval); - object.insert(kinterval, minimumInterval); - actionUpdate.insert(JsonDbString::kDataStr, object); + QJsonObject actionUpdate; + QJsonObject object; + actionUpdate[JsonDbString::kActionStr] = ksetUpdateInterval; + object[kinterval] = minimumInterval; + actionUpdate[JsonDbString::kDataStr] = object; mStream->send(actionUpdate); } } // request the update only if no tracking session is active if ( !locationOngoing) { - QVariantMap action; - action.insert(JsonDbString::kActionStr, krequestUpdate); + QJsonObject action; + action[JsonDbString::kActionStr] = krequestUpdate; mStream->send(action); } requestTimer->start(timeout); diff --git a/src/location/qgeopositioninfosource_npe_backend_p.h b/src/location/qgeopositioninfosource_npe_backend_p.h index 55f2967f..62d5b89f 100644 --- a/src/location/qgeopositioninfosource_npe_backend_p.h +++ b/src/location/qgeopositioninfosource_npe_backend_p.h @@ -54,12 +54,17 @@ // #include <qgeopositioninfosource.h> -#include <mt-client/variantstream.h> #include <private/jsondb-strings_p.h> #include <qlocalsocket.h> #include <qeventloop.h> #include <qtimer.h> +#include <QtAddOnJsonStream/jsonstream-global.h> + +QT_BEGIN_NAMESPACE_JSONSTREAM +class JsonStream; +QT_END_NAMESPACE_JSONSTREAM + Q_USE_JSONDB_NAMESPACE class QGeoPositionInfoSourceNpeBackend : public QGeoPositionInfoSource @@ -82,7 +87,7 @@ public Q_SLOTS: private: QLocalSocket* mSocket; - VariantStream* mStream; + QtAddOn::JsonStream::JsonStream* mStream; int minInterval; uint supportedMethods; QGeoPositionInfo lastPosition; diff --git a/src/location/qgeosatelliteinfosource_npe_backend.cpp b/src/location/qgeosatelliteinfosource_npe_backend.cpp index 1d989bcc..8e343315 100644 --- a/src/location/qgeosatelliteinfosource_npe_backend.cpp +++ b/src/location/qgeosatelliteinfosource_npe_backend.cpp @@ -41,6 +41,12 @@ #include "qgeosatelliteinfosource_npe_backend_p.h" #include <sys/stat.h> + +#include <QtCore/QJsonObject> +#include <QtAddOnJsonStream/jsonstream.h> + +QT_USE_NAMESPACE_JSONSTREAM + // #include <mtlocationd/locationd-strings.h> // API for socket communication towards locationd @@ -87,9 +93,9 @@ bool QGeoSatelliteInfoSourceNpeBackend::init() if (mSocket) { connect(mSocket, SIGNAL(connected()), this, SLOT(onSocketConnected())); connect(mSocket, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); - mStream = new VariantStream(mSocket); + mStream = new JsonStream(mSocket); if (mStream) { - connect(mStream, SIGNAL(receive(const QVariantMap&)), this, SLOT(onStreamReceived(const QVariantMap&)), Qt::QueuedConnection); + connect(mStream, SIGNAL(messageReceived(const QVariantMap&)), this, SLOT(onStreamReceived(const QVariantMap&)), Qt::QueuedConnection); } mSocket->connectToServer((QLatin1String)"/var/run/locationd/locationd.socket"); return(mSocket->waitForConnected(500)); // wait up to 0.5 seconds to get connected, otherwise return false @@ -101,21 +107,21 @@ bool QGeoSatelliteInfoSourceNpeBackend::init() void QGeoSatelliteInfoSourceNpeBackend::setUpdateInterval(int msec) { - QVariantMap action; QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(minimumUpdateIntervalReceived()), &loop, SLOT(quit())); - action.insert(JsonDbString::kActionStr, kgetMinimumUpdateInterval); + QJsonObject action; + action[JsonDbString::kActionStr] = kgetMinimumUpdateInterval; mStream->send(action); loop.exec(); // wait for minimumUpdateIntervalReceived() signal sent by slot onStreamReceived if (msec < minInterval && msec != 0) msec = minInterval; QGeoSatelliteInfoSource::setUpdateInterval(msec); if (!requestTimer->isActive()) { - QVariantMap actionUpdate; - QVariantMap object; - actionUpdate.insert(JsonDbString::kActionStr, ksetUpdateInterval); - object.insert(kinterval, msec); - actionUpdate.insert(JsonDbString::kDataStr, object); + QJsonObject actionUpdate; + QJsonObject object; + actionUpdate[JsonDbString::kActionStr] = ksetUpdateInterval; + object[kinterval] = msec; + actionUpdate[JsonDbString::kDataStr] = object; mStream->send(actionUpdate); } } @@ -123,10 +129,10 @@ void QGeoSatelliteInfoSourceNpeBackend::setUpdateInterval(int msec) int QGeoSatelliteInfoSourceNpeBackend::minimumUpdateInterval() const { - QVariantMap action; QEventLoop loop; // loop to wait for response from locationd (asynchronous socket connection) connect( this, SIGNAL(minimumUpdateIntervalReceived()), &loop, SLOT(quit())); - action.insert(JsonDbString::kActionStr, kgetMinimumUpdateInterval); + QJsonObject action; + action[JsonDbString::kActionStr] = kgetMinimumUpdateInterval; mStream->send(action); loop.exec(); // wait for minimumUpdateIntervalReceived() signal sent by slot onStreamReceived return(minInterval); @@ -137,8 +143,8 @@ void QGeoSatelliteInfoSourceNpeBackend::startUpdates() { if (!satOngoing) { satOngoing = true; - QVariantMap action; - action.insert(JsonDbString::kActionStr, ksatelliteStartUpdates); + QJsonObject action; + action[JsonDbString::kActionStr] = ksatelliteStartUpdates; mStream->send(action); } } @@ -148,8 +154,8 @@ void QGeoSatelliteInfoSourceNpeBackend::stopUpdates() { if (satOngoing && !requestTimer->isActive()) { satOngoing = false; - QVariantMap action; - action.insert(JsonDbString::kActionStr, ksatelliteStopUpdates); + QJsonObject action; + action[JsonDbString::kActionStr] = ksatelliteStopUpdates; mStream->send(action); } } @@ -170,18 +176,18 @@ void QGeoSatelliteInfoSourceNpeBackend::requestUpdate(int timeout) // get satellite update as fast as possible in case of ongoing tracking session if ( satOngoing ) { if ( QGeoSatelliteInfoSource::updateInterval() != minimumInterval) { - QVariantMap actionUpdate; - QVariantMap object; - actionUpdate.insert(JsonDbString::kActionStr, ksetUpdateInterval); - object.insert(kinterval, minimumInterval); - actionUpdate.insert(JsonDbString::kDataStr, object); + QJsonObject actionUpdate; + QJsonObject object; + actionUpdate[JsonDbString::kActionStr] = ksetUpdateInterval; + object[kinterval] = minimumInterval; + actionUpdate[JsonDbString::kDataStr] = object; mStream->send(actionUpdate); } } // request the update only if no tracking session is active if ( !satOngoing) { - QVariantMap action; - action.insert(JsonDbString::kActionStr, ksatelliteRequestUpdate); + QJsonObject action; + action[JsonDbString::kActionStr] = ksatelliteRequestUpdate; mStream->send(action); } requestTimer->start(timeout); diff --git a/src/location/qgeosatelliteinfosource_npe_backend_p.h b/src/location/qgeosatelliteinfosource_npe_backend_p.h index 9b9f8b51..fc2f6012 100644 --- a/src/location/qgeosatelliteinfosource_npe_backend_p.h +++ b/src/location/qgeosatelliteinfosource_npe_backend_p.h @@ -55,12 +55,16 @@ #include "qgeosatelliteinfosource.h" #include "qgeosatelliteinfo.h" -#include <mt-client/variantstream.h> #include <private/jsondb-strings_p.h> #include <qlocalsocket.h> #include <qeventloop.h> #include <qtimer.h> +#include <QtAddOnJsonStream/jsonstream-global.h> + +QT_BEGIN_NAMESPACE_JSONSTREAM +class JsonStream; +QT_END_NAMESPACE_JSONSTREAM Q_USE_JSONDB_NAMESPACE @@ -92,7 +96,7 @@ private Q_SLOTS: private: QLocalSocket* mSocket; - VariantStream* mStream; + QtAddOn::JsonStream::JsonStream* mStream; bool satOngoing; QTimer* requestTimer; int minInterval; diff --git a/src/plugins/geoservices/geoservices.pro b/src/plugins/geoservices/geoservices.pro index a27213d1..abf4c44e 100644 --- a/src/plugins/geoservices/geoservices.pro +++ b/src/plugins/geoservices/geoservices.pro @@ -2,6 +2,4 @@ TEMPLATE = subdirs SUBDIRS = nokia -contains(config_test_jsondb, yes) { - SUBDIRS += nokia_places_jsondb -} +!isEmpty(QT.jsondb.name):SUBDIRS += nokia_places_jsondb diff --git a/sync.profile b/sync.profile index 21ab025f..f775132e 100644 --- a/sync.profile +++ b/sync.profile @@ -32,6 +32,4 @@ # compile tests %configtests = ( - "jsondb" => {}, - "mtclient" => {}, ); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 3b7c032e..50483a40 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -52,6 +52,4 @@ SUBDIRS += geotestplugin \ !mac: SUBDIRS += declarative_ui -contains(config_test_jsondb, yes) { - SUBDIRS += qplacemanager_jsondb -} +!isEmpty(QT.jsondb.name):SUBDIRS += qplacemanager_jsondb diff --git a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro index 4f57582e..93e8880a 100644 --- a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro +++ b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro @@ -11,6 +11,4 @@ HEADERS += testqgeosatelliteinfosource_p.h \ QT += location testlib -contains(config_test_jsondb, yes): contains(config_test_mtclient, yes) { - DEFINES += NPE_BACKEND -} +!isEmpty(QT.jsondb.name):!isEmpty(QT.jsonstream.name):!simulator:DEFINES += NPE_BACKEND |