diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-01-22 15:16:09 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2021-01-26 20:40:38 +0100 |
commit | 237998e30b4180fa4de86ef89a5cb7d5e802a57d (patch) | |
tree | 228f4cd99a28706a69a96a28bbfe250cb9a7dc56 | |
parent | 37ff0744c8c5f15606dbc2391b630ea433c3c939 (diff) | |
download | qtlocation-237998e30b4180fa4de86ef89a5cb7d5e802a57d.tar.gz |
QtPositioning: remove simulator plugin
QtSimulator was deprecated long ago.
Task-number: QTBUG-90491
Change-Id: I826f622c42e8e26464d0e521ea69695fc6ce27f7
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
17 files changed, 0 insertions, 1148 deletions
diff --git a/src/plugins/position/CMakeLists.txt b/src/plugins/position/CMakeLists.txt index 1ab375a0..eeeecab3 100644 --- a/src/plugins/position/CMakeLists.txt +++ b/src/plugins/position/CMakeLists.txt @@ -11,9 +11,6 @@ endif() if(QT_FEATURE_winrt_geolocation) add_subdirectory(winrt) endif() -if(TARGET simulator) - add_subdirectory(simulator) -endif() if(IOS OR MACOS OR TVOS) add_subdirectory(corelocation) endif() diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro index 412bafe8..cea4904d 100644 --- a/src/plugins/position/position.pro +++ b/src/plugins/position/position.pro @@ -6,7 +6,6 @@ linux|freebsd|openbsd|netbsd:qtHaveModule(dbus):SUBDIRS += geoclue linux|freebsd|openbsd|netbsd:qtHaveModule(dbus):SUBDIRS += geoclue2 qtConfig(gypsy):SUBDIRS += gypsy qtConfig(winrt_geolocation):SUBDIRS += winrt -qtHaveModule(simulator):SUBDIRS += simulator osx|ios|tvos:SUBDIRS += corelocation android:SUBDIRS += android qtHaveModule(serialport):SUBDIRS += serialnmea diff --git a/src/plugins/position/simulator/CMakeLists.txt b/src/plugins/position/simulator/CMakeLists.txt deleted file mode 100644 index 64095bcf..00000000 --- a/src/plugins/position/simulator/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# Generated from simulator.pro. - -##################################################################### -## QGeoPositionInfoSourceFactorySimulator Plugin: -##################################################################### - -qt_internal_add_plugin(QGeoPositionInfoSourceFactorySimulator - OUTPUT_NAME qtposition_simulator - TYPE position - SOURCES - qgeopositioninfosource_simulator.cpp qgeopositioninfosource_simulator_p.h - qgeopositioninfosourcefactory_simulator.cpp qgeopositioninfosourcefactory_simulator.h - qgeosatelliteinfosource_simulator.cpp qgeosatelliteinfosource_simulator_p.h - qlocationconnection_simulator.cpp qlocationconnection_simulator_p.h - DEFINES - QT_SIMULATOR - INCLUDE_DIRECTORIES - ../../../positioning - PUBLIC_LIBRARIES - Qt::Core - Qt::Network - Qt::Positioning - simulator -) - -#### Keys ignored in scope 1:.:.:simulator.pro:<TRUE>: -# OTHER_FILES = "plugin.json" diff --git a/src/plugins/position/simulator/plugin.json b/src/plugins/position/simulator/plugin.json deleted file mode 100644 index 0935f4dc..00000000 --- a/src/plugins/position/simulator/plugin.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Keys": ["simulator"], - "Provider": "simulator", - "Position": true, - "Satellite": true, - "Monitor" : false, - "Priority": 1000, - "Testable": true -} diff --git a/src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp b/src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp deleted file mode 100644 index c42d921e..00000000 --- a/src/plugins/position/simulator/qgeopositioninfosource_simulator.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosource_simulator_p.h" -#include "qlocationdata_simulator_p.h" -#include "qlocationconnection_simulator_p.h" - -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/QDataStream> - -#include <QtNetwork/QLocalSocket> - -QT_BEGIN_NAMESPACE - -namespace Simulator -{ - QGeoPositionInfo toPositionInfo(const QGeoPositionInfoData &data) - { - QDateTime timestamp; - if (data.dateTime.isValid()) - timestamp = data.dateTime; - else - timestamp = QDateTime::currentDateTime(); - QGeoCoordinate coord(data.latitude, data.longitude, data.altitude); - QGeoPositionInfo info(coord, timestamp); - info.setAttribute(QGeoPositionInfo::Direction, data.direction); - info.setAttribute(QGeoPositionInfo::GroundSpeed, data.groundSpeed); - info.setAttribute(QGeoPositionInfo::VerticalSpeed, data.verticalSpeed); - info.setAttribute(QGeoPositionInfo::MagneticVariation, data.magneticVariation); - info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, data.horizontalAccuracy); - info.setAttribute(QGeoPositionInfo::VerticalAccuracy, data.verticalAccuracy); - return info; - } -} //namespace - -// Location API - -QGeoPositionInfoSourceSimulator::QGeoPositionInfoSourceSimulator(QObject *parent) - : QGeoPositionInfoSource(parent) - , timer(new QTimer(this)) - , requestTimer(new QTimer(this)) - , m_positionError(QGeoPositionInfoSource::NoError) -{ - Simulator::LocationConnection::ensureSimulatorConnection(); - - connect(timer, SIGNAL(timeout()), this, SLOT(updatePosition())); - requestTimer->setSingleShot(true); - connect(requestTimer, SIGNAL(timeout()), this, SLOT(updatePosition())); -} - -QGeoPositionInfoSourceSimulator::~QGeoPositionInfoSourceSimulator() -{ -} - -QGeoPositionInfo QGeoPositionInfoSourceSimulator::lastKnownPosition(bool /*fromSatellitePositioningMethodsOnly*/) const -{ - return lastPosition; -} - -QGeoPositionInfoSource::PositioningMethods QGeoPositionInfoSourceSimulator::supportedPositioningMethods() const -{ - // Is GPS now Satelite or not? Guessing so... - return QGeoPositionInfoSource::SatellitePositioningMethods; -} - -void QGeoPositionInfoSourceSimulator::setUpdateInterval(int msec) -{ - // If msec is 0 we send updates as data becomes available, otherwise we force msec to be equal - // to or larger than the minimum update interval. - if (msec != 0 && msec < minimumUpdateInterval()) - msec = minimumUpdateInterval(); - - QGeoPositionInfoSource::setUpdateInterval(msec); - if (timer->isActive()) { - timer->setInterval(msec); - timer->start(); - } -} - -int QGeoPositionInfoSourceSimulator::minimumUpdateInterval() const -{ - return qtPositionInfo()->minimumInterval; -} - -void QGeoPositionInfoSourceSimulator::startUpdates() -{ - int interval = updateInterval(); - if (interval < minimumUpdateInterval()) - interval = minimumUpdateInterval(); - timer->setInterval(interval); - timer->start(); -} - -void QGeoPositionInfoSourceSimulator::stopUpdates() -{ - timer->stop(); -} - -void QGeoPositionInfoSourceSimulator::requestUpdate(int timeout) -{ - if (!requestTimer->isActive()) { - // Get a single update within timeframe - if (timeout < minimumUpdateInterval() && timeout != 0) - setError(QGeoPositionInfoSource::UpdateTimeoutError); - else { - requestTimer->start(timeout * qreal(0.75)); - } - } -} - -void QGeoPositionInfoSourceSimulator::updatePosition() -{ - if (qtPositionInfo()->enabled) { - lastPosition = Simulator::toPositionInfo(*qtPositionInfo()); - emit positionUpdated(lastPosition); - } else { - setError(QGeoPositionInfoSource::UpdateTimeoutError); - } -} - -QGeoPositionInfoSource::Error QGeoPositionInfoSourceSimulator::error() const -{ - return m_positionError; -} - - -void QGeoPositionInfoSourceSimulator::setError(QGeoPositionInfoSource::Error positionError) -{ - m_positionError = positionError; - emit QGeoPositionInfoSource::errorOccurred(positionError); -} - -QT_END_NAMESPACE diff --git a/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h b/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h deleted file mode 100644 index 8fd33368..00000000 --- a/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCESIMULATOR_H -#define QGEOPOSITIONINFOSOURCESIMULATOR_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 "qgeopositioninfo.h" -#include "qlocationdata_simulator_p.h" - -QT_BEGIN_NAMESPACE - -class QTimer; - -class QGeoPositionInfoSourceSimulator : public QGeoPositionInfoSource -{ - Q_OBJECT -public: - QGeoPositionInfoSourceSimulator(QObject *parent = 0); - ~QGeoPositionInfoSourceSimulator(); - - QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const override; - PositioningMethods supportedPositioningMethods() const override; - - void setUpdateInterval(int msec) override; - int minimumUpdateInterval() const override; - Error error() const override; - -public Q_SLOTS: - void startUpdates() override; - void stopUpdates() override; - - void requestUpdate(int timeout = 0) override; - -private slots: - void updatePosition(); -private: - Q_DISABLE_COPY(QGeoPositionInfoSourceSimulator); - QTimer *timer; - QTimer *requestTimer; - QGeoPositionInfo lastPosition; - QGeoPositionInfoSource::Error m_positionError; - void setError(QGeoPositionInfoSource::Error positionError); -}; - -QT_END_NAMESPACE - -#endif // QGEOPOSITIONINFOSOURCESIMULATOR_H diff --git a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp deleted file mode 100644 index 7c7c8d5a..00000000 --- a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeopositioninfosourcefactory_simulator.h" - -QGeoPositionInfoSource *QGeoPositionInfoSourceFactorySimulator::positionInfoSource(QObject *parent, const QVariantMap ¶meters) -{ - Q_UNUSED(parameters) - return new QGeoPositionInfoSourceSimulator(parent); -} - -QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactorySimulator::satelliteInfoSource(QObject *parent, const QVariantMap ¶meters) -{ - Q_UNUSED(parameters) - QGeoSatelliteInfoSourceSimulator *src = new QGeoSatelliteInfoSourceSimulator(parent); - if (!src->isConnected()) { - delete src; - src = nullptr; - } - return src; -} - -QGeoAreaMonitorSource *QGeoPositionInfoSourceFactorySimulator::areaMonitor(QObject *parent, const QVariantMap ¶meters) -{ - Q_UNUSED(parent) - Q_UNUSED(parameters) - return nullptr; -} diff --git a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h b/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h deleted file mode 100644 index bf17ddf3..00000000 --- a/src/plugins/position/simulator/qgeopositioninfosourcefactory_simulator.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H -#define QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H - -#include <QObject> -#include <QGeoPositionInfoSourceFactory> - -#include "qgeopositioninfosource_simulator_p.h" -#include "qgeosatelliteinfosource_simulator_p.h" - -class QGeoPositionInfoSourceFactorySimulator : public QObject, public QGeoPositionInfoSourceFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/6.0" - FILE "plugin.json") - Q_INTERFACES(QGeoPositionInfoSourceFactory) -public: - QGeoPositionInfoSource *positionInfoSource(QObject *parent, const QVariantMap ¶meters) override; - QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent, const QVariantMap ¶meters) override; - QGeoAreaMonitorSource *areaMonitor(QObject *parent, const QVariantMap ¶meters) override; -}; - -#endif // QGEOPOSITIONINFOSOURCEFACTORY_SIMULATOR_H diff --git a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp deleted file mode 100644 index 25f38424..00000000 --- a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgeosatelliteinfosource_simulator_p.h" -#include "qlocationconnection_simulator_p.h" -#include "qlocationdata_simulator_p.h" - -QT_BEGIN_NAMESPACE - -QGeoSatelliteInfoSourceSimulator::QGeoSatelliteInfoSourceSimulator(QObject *parent) - : QGeoSatelliteInfoSource(parent) - , timer(new QTimer(this)) - , requestTimer(new QTimer(this)) -{ - Simulator::LocationConnection::ensureSimulatorConnection(); - - connect(timer, SIGNAL(timeout()), this, SLOT(updateData())); - requestTimer->setSingleShot(true); - connect(requestTimer, SIGNAL(timeout()), this, SLOT(updateData())); -} - -bool QGeoSatelliteInfoSourceSimulator::isConnected() const -{ - return Simulator::LocationConnection::ensureSimulatorConnection(); -} - -void QGeoSatelliteInfoSourceSimulator::startUpdates() -{ - int interval = updateInterval(); - if (interval < minimumUpdateInterval()) - interval = minimumUpdateInterval(); - timer->setInterval(interval); - timer->start(); -} - -void QGeoSatelliteInfoSourceSimulator::stopUpdates() -{ - timer->stop(); -} - -void QGeoSatelliteInfoSourceSimulator::requestUpdate(int timeout) -{ - if (!requestTimer->isActive()) { - // Get a single update within timeframe - if (timeout == 0) - timeout = minimumUpdateInterval(); - - if (timeout < minimumUpdateInterval()) - emit requestTimeout(); - else - requestTimer->start(timeout); - } -} - -void QGeoSatelliteInfoSourceSimulator::setUpdateInterval(int msec) -{ - // msec should be equal to or larger than the minimum update interval; 0 is a special case - // that currently behaves as if the interval is set to the minimum update interval - if (msec != 0 && msec < minimumUpdateInterval()) - msec = minimumUpdateInterval(); - - QGeoSatelliteInfoSource::setUpdateInterval(msec); - if (timer->isActive()) { - timer->setInterval(msec); - timer->start(); - } -} - -int QGeoSatelliteInfoSourceSimulator::minimumUpdateInterval() const -{ - return qtPositionInfo()->minimumInterval; -} - -void QGeoSatelliteInfoSourceSimulator::updateData() -{ - QList<QGeoSatelliteInfo> satellitesInUse; - QList<QGeoSatelliteInfo> satellitesInView; - - QGeoSatelliteInfoData *data = qtSatelliteInfo(); - for(int i = 0; i < data->satellites.count(); i++) { - QGeoSatelliteInfoData::SatelliteInfo info = data->satellites.at(i); - QGeoSatelliteInfo satInfo; - satInfo.setAttribute(QGeoSatelliteInfo::Azimuth, info.azimuth); - satInfo.setAttribute(QGeoSatelliteInfo::Elevation, info.elevation); - satInfo.setSignalStrength(info.signalStrength); - satInfo.setSatelliteSystem(static_cast<QGeoSatelliteInfo::SatelliteSystem>(info.satelliteSystem)); - satInfo.setSatelliteIdentifier(info.satelliteIdentifier); - satellitesInView.append(satInfo); - if (info.inUse) - satellitesInUse.append(satInfo); - } - emit satellitesInViewUpdated(satellitesInView); - emit satellitesInUseUpdated(satellitesInUse); -} - -QT_END_NAMESPACE diff --git a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h deleted file mode 100644 index ac8293a2..00000000 --- a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOSATELLITEINFOSOURCE_SIMULATOR_H -#define QGEOSATELLITEINFOSOURCE_SIMULATOR_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 <QTimer> -#include "qgeosatelliteinfosource.h" -#include "qgeosatelliteinfo.h" - -#define MINIMUM_UPDATE_INTERVAL 1000 -#define DEFAULT_UPDATE_INTERVAL 5000 - -QT_BEGIN_NAMESPACE - -class QGeoSatelliteInfoSourceSimulator : public QGeoSatelliteInfoSource -{ - Q_OBJECT - -public: - explicit QGeoSatelliteInfoSourceSimulator(QObject *parent = 0); - - bool isConnected() const; - - virtual void setUpdateInterval(int msec) override; - virtual int minimumUpdateInterval() const override; - - // Default implementation for error() - Error error() const override { return QGeoSatelliteInfoSource::NoError; } -public slots: - virtual void startUpdates() override; - virtual void stopUpdates() override; - virtual void requestUpdate(int timeout = 5000) override; - -private slots: - void updateData(); - -private: - Q_DISABLE_COPY(QGeoSatelliteInfoSourceSimulator) - QTimer *timer; - QTimer *requestTimer; -}; - -QT_END_NAMESPACE - -#endif // QGEOSATELLITEINFOSOURCE_SIMULATOR_H - diff --git a/src/plugins/position/simulator/qlocationconnection_simulator.cpp b/src/plugins/position/simulator/qlocationconnection_simulator.cpp deleted file mode 100644 index d5b3e820..00000000 --- a/src/plugins/position/simulator/qlocationconnection_simulator.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qlocationconnection_simulator_p.h" -#include "qgeopositioninfosource_simulator_p.h" -#include "qlocationdata_simulator_p.h" - -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/QDataStream> -#include <QtCore/QEventLoop> - -#include <QtNetwork/QLocalSocket> - -#include <QtSimulator/connection.h> -#include <QtSimulator/version.h> -#include <QtSimulator/connectionworker.h> - -QT_BEGIN_NAMESPACE - -const QString simulatorName(QString::fromLatin1("QtSimulator_Mobility_ServerName1.3.0.0")); -const quint16 simulatorPort = 0xbeef + 1; - -namespace Simulator -{ - LocationConnection::LocationConnection() - : mConnection(new Connection(Connection::Client, simulatorName, simulatorPort, Version(1,3,0,0))) - { - mWorker = mConnection->connectToServer(Connection::simulatorHostName(true), simulatorPort); - if (!mWorker) - return; - - mWorker->addReceiver(this); - - // register for location notifications - mWorker->call("setRequestsLocationInfo"); - } - - LocationConnection::~LocationConnection() - { - delete mWorker; - delete mConnection; - } - - bool LocationConnection::ensureSimulatorConnection() - { - static LocationConnection locationConnection; - return locationConnection.mWorker; - } - - void LocationConnection::initialLocationDataSent() - { - emit initialDataReceived(); - } - - void LocationConnection::setLocationData(const QGeoPositionInfoData &data) - { - *qtPositionInfo() = data; - } - - void LocationConnection::setSatelliteData(const QGeoSatelliteInfoData &data) - { - *qtSatelliteInfo() = data; - } - -} // namespace - -QGeoPositionInfoData *qtPositionInfo() -{ - static QGeoPositionInfoData *positionInfo = 0; - if (!positionInfo) { - positionInfo = new QGeoPositionInfoData; - } - - return positionInfo; -} - -QGeoSatelliteInfoData *qtSatelliteInfo() -{ - static QGeoSatelliteInfoData *satelliteInfo = 0; - if (!satelliteInfo) { - satelliteInfo = new QGeoSatelliteInfoData; - } - - return satelliteInfo; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/position/simulator/qlocationconnection_simulator_p.h b/src/plugins/position/simulator/qlocationconnection_simulator_p.h deleted file mode 100644 index a13c9e89..00000000 --- a/src/plugins/position/simulator/qlocationconnection_simulator_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QLOCATIONCONNECTION_H -#define QLOCATIONCONNECTION_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 "qlocationdata_simulator_p.h" - -#include <QtCore/QObject> - -QT_BEGIN_NAMESPACE - -namespace Simulator -{ - class Connection; - class ConnectionWorker; - - class LocationConnection : public QObject - { - Q_OBJECT - - public: - static bool ensureSimulatorConnection(); - virtual ~LocationConnection(); - - private: - LocationConnection(); - Q_DISABLE_COPY(LocationConnection) - - private slots: - // these will be called by the simulator - void setLocationData(const QGeoPositionInfoData &); - void setSatelliteData(const QGeoSatelliteInfoData &); - void initialLocationDataSent(); - - signals: - void initialDataReceived(); - - private: - Connection *mConnection; - ConnectionWorker *mWorker; - }; -} // end namespace Simulator - -QGeoPositionInfoData *qtPositionInfo(); -QGeoSatelliteInfoData *qtSatelliteInfo(); - -QT_END_NAMESPACE - -#endif // QLOCATIONCONNECTION_H diff --git a/src/plugins/position/simulator/simulator.pro b/src/plugins/position/simulator/simulator.pro deleted file mode 100644 index c3e6ea3c..00000000 --- a/src/plugins/position/simulator/simulator.pro +++ /dev/null @@ -1,22 +0,0 @@ -TARGET = qtposition_simulator - -QT = core network positioning simulator - -INCLUDEPATH += ../../../positioning - -DEFINES += QT_SIMULATOR -SOURCES += qgeopositioninfosource_simulator.cpp \ - qgeosatelliteinfosource_simulator.cpp \ - qlocationconnection_simulator.cpp \ - qgeopositioninfosourcefactory_simulator.cpp -HEADERS += qgeopositioninfosource_simulator_p.h \ - qgeosatelliteinfosource_simulator_p.h \ - qlocationconnection_simulator_p.h \ - qgeopositioninfosourcefactory_simulator.h - -OTHER_FILES += \ - plugin.json - -PLUGIN_TYPE = position -PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactorySimulator -load(qt_plugin) diff --git a/src/positioning/CMakeLists.txt b/src/positioning/CMakeLists.txt index f676ec20..20b10e65 100644 --- a/src/positioning/CMakeLists.txt +++ b/src/positioning/CMakeLists.txt @@ -27,7 +27,6 @@ qt_internal_add_module(Positioning qgeosatelliteinfo.cpp qgeosatelliteinfo.h qgeosatelliteinfo_p.h qgeosatelliteinfosource.cpp qgeosatelliteinfosource.h qgeosatelliteinfosource_p.h qgeoshape.cpp qgeoshape.h qgeoshape_p.h - qlocationdata_simulator.cpp qlocationdata_simulator_p.h qlocationutils.cpp qlocationutils_p.h qnmeapositioninfosource.cpp qnmeapositioninfosource.h qnmeapositioninfosource_p.h qpositioningglobal.h qpositioningglobal_p.h diff --git a/src/positioning/positioning.pro b/src/positioning/positioning.pro index cf4e01c6..64a6cc2e 100644 --- a/src/positioning/positioning.pro +++ b/src/positioning/positioning.pro @@ -55,7 +55,6 @@ PRIVATE_HEADERS += \ qdoublevector3d_p.h \ qwebmercator_p.h \ qpositioningglobal_p.h \ - qlocationdata_simulator_p.h \ qdoublematrix4x4_p.h \ qgeopath_p.h \ qgeopolygon_p.h \ @@ -85,7 +84,6 @@ SOURCES += \ qdoublevector3d.cpp \ qgeopath.cpp \ qgeopolygon.cpp \ - qlocationdata_simulator.cpp \ qwebmercator.cpp \ qdoublematrix4x4.cpp \ qclipperutils.cpp \ diff --git a/src/positioning/qlocationdata_simulator.cpp b/src/positioning/qlocationdata_simulator.cpp deleted file mode 100644 index 245288fe..00000000 --- a/src/positioning/qlocationdata_simulator.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qlocationdata_simulator_p.h" - -#include <QtCore/QDataStream> - -QT_BEGIN_NAMESPACE - -QGeoPositionInfoData::QGeoPositionInfoData() - : latitude(0.0), - longitude(0.0), - altitude(0.0), - direction(0.0), - groundSpeed(0.0), - verticalSpeed(0.0), - magneticVariation(0.0), - horizontalAccuracy(0.0), - verticalAccuracy(0.0), - dateTime(), - minimumInterval(0), - enabled(false) {} - -QGeoSatelliteInfoData::SatelliteInfo::SatelliteInfo() - : azimuth(0.0), - elevation(0.0), - signalStrength(0), - inUse(false), - satelliteSystem(Undefined), - satelliteIdentifier(0) {} - -QDataStream &operator<<(QDataStream &out, const QGeoPositionInfoData &s) -{ - out << s.latitude << s.longitude << s.altitude; - out << s.direction << s.groundSpeed << s.verticalSpeed << s.magneticVariation << s.horizontalAccuracy << s.verticalAccuracy; - out << s.dateTime; - out << s.minimumInterval << s.enabled; - return out; -} - -QDataStream &operator>>(QDataStream &in, QGeoPositionInfoData &s) -{ - in >> s.latitude >> s.longitude >> s.altitude; - in >> s.direction >> s.groundSpeed >> s.verticalSpeed >> s.magneticVariation >> s.horizontalAccuracy >> s.verticalAccuracy; - in >> s.dateTime; - in >> s.minimumInterval >> s.enabled; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QGeoSatelliteInfoData &s) -{ - out << s.satellites; - return out; -} - -QDataStream &operator>>(QDataStream &in, QGeoSatelliteInfoData &s) -{ - in >> s.satellites; - return in; -} - -QDataStream &operator<<(QDataStream &out, const QGeoSatelliteInfoData::SatelliteInfo &s) -{ - out << s.azimuth << s.elevation << s.signalStrength << s.inUse << static_cast<qint32>(s.satelliteSystem) << s.satelliteIdentifier; - return out; -} - -QDataStream &operator>>(QDataStream &in, QGeoSatelliteInfoData::SatelliteInfo &s) -{ - qint32 satelliteSystem; - in >> s.azimuth >> s.elevation >> s.signalStrength >> s.inUse >> satelliteSystem >> s.satelliteIdentifier; - s.satelliteSystem = static_cast<QGeoSatelliteInfoData::SatelliteInfo::SatelliteSystem>(satelliteSystem); - return in; -} - -QT_END_NAMESPACE diff --git a/src/positioning/qlocationdata_simulator_p.h b/src/positioning/qlocationdata_simulator_p.h deleted file mode 100644 index 32d8ce24..00000000 --- a/src/positioning/qlocationdata_simulator_p.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtPositioning 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGEOPOSITIONINFODATA_SIMULATOR_P_H -#define QGEOPOSITIONINFODATA_SIMULATOR_P_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. -// - -// -// DO NOT REMOVE -// ------------- -// -// This header file contains structures used to serialize communication between -// simulator's client and server implementations, it is included by simulator -// positioning plugin. - -#include "qpositioningglobal_p.h" -#include <QtCore/QMetaType> -#include <QtCore/QDateTime> -#include <QtCore/QList> - -QT_BEGIN_NAMESPACE - -struct Q_POSITIONING_PRIVATE_EXPORT QGeoPositionInfoData -{ - QGeoPositionInfoData(); - - // Coordinate information - double latitude; - double longitude; - double altitude; - - // Attributes - // ### transmit whether attributes are set or not - qreal direction; - qreal groundSpeed; - qreal verticalSpeed; - qreal magneticVariation; - qreal horizontalAccuracy; - qreal verticalAccuracy; - - // DateTime info - QDateTime dateTime; - - int minimumInterval; - bool enabled; -}; - -struct Q_POSITIONING_PRIVATE_EXPORT QGeoSatelliteInfoData -{ - struct SatelliteInfo - { - SatelliteInfo(); - - // This enum duplicates the SatelliteSystem enum defined in qgeosatelliteinfo.h, which cannot be - // included as this file must compile with Qt4 (it is used by Qt Simulator) - enum SatelliteSystem - { - Undefined = 0x00, - GPS = 0x01, - GLONASS = 0x02 - }; - - qreal azimuth; - qreal elevation; - int signalStrength; - bool inUse; - SatelliteSystem satelliteSystem; - int satelliteIdentifier; - }; - - QList<SatelliteInfo> satellites; -}; - -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &out, const QGeoPositionInfoData &s); -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &in, QGeoPositionInfoData &s); -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &out, const QGeoSatelliteInfoData &s); -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &in, QGeoSatelliteInfoData &s); -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &out, const QGeoSatelliteInfoData::SatelliteInfo &s); -Q_POSITIONING_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &in, QGeoSatelliteInfoData::SatelliteInfo &s); - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(QGeoPositionInfoData) -Q_DECLARE_METATYPE(QGeoSatelliteInfoData) -Q_DECLARE_METATYPE(QGeoSatelliteInfoData::SatelliteInfo) - -#endif // QGEOPOSITIONINFODATA_SIMULATOR_P_H |