diff options
author | Bramastyo Harimukti <bramastyo.harimukti.santoso@pelagicore.com> | 2019-04-23 14:43:16 +0200 |
---|---|---|
committer | Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com> | 2019-05-13 10:57:51 +0000 |
commit | 06749f1c1efd7edd08ea1b7505a9d030eafa4c7a (patch) | |
tree | 2fcde20d3f10dec784d2dc5b97edcea58fd348fd | |
parent | 907d90ea05332a36c07bda01ef98cb9e189afb4d (diff) |
[simulationbackend] refactor and split the interfaces
- rename the general settings into dataprovider temporarily
- split cluster interfaces to drivedata
- rename the control app into companion app
Task-number: AUTOSUITE-948
Change-Id: Ie363c4b1c31cc9d047e83c41ec9b11f8f4658be3
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
70 files changed, 709 insertions, 235 deletions
@@ -102,6 +102,7 @@ QtObject { InstrumentClusterWindow { applicationModel: root.store.applicationModel clusterStore: root.store.clusterStore + uiSettings: root.store.uiSettings performanceOverlayVisible: root.store.systemStore.instrumentClusterPerfOverlayEnabled } } diff --git a/apps/com.luxoft.vehicle/Main.qml b/apps/com.luxoft.vehicle/Main.qml index ce4e14d6..e3def09f 100644 --- a/apps/com.luxoft.vehicle/Main.qml +++ b/apps/com.luxoft.vehicle/Main.qml @@ -34,7 +34,8 @@ import QtQuick 2.2 import QtApplicationManager.Application 2.0 import application.windows 1.0 import shared.utils 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import shared.com.pelagicore.systeminfo 1.0 import shared.Style 1.0 diff --git a/apps/com.luxoft.vehicle/stores/VehicleStore.qml b/apps/com.luxoft.vehicle/stores/VehicleStore.qml index 1c1aa33e..d776e4d6 100644 --- a/apps/com.luxoft.vehicle/stores/VehicleStore.qml +++ b/apps/com.luxoft.vehicle/stores/VehicleStore.qml @@ -31,7 +31,8 @@ ****************************************************************************/ import QtQuick 2.8 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 QtObject { id: root diff --git a/apps/com.pelagicore.apps.settings/store/RootStore.qml b/apps/com.pelagicore.apps.settings/store/RootStore.qml index 4d54bc31..ab8dfcb4 100644 --- a/apps/com.pelagicore.apps.settings/store/RootStore.qml +++ b/apps/com.pelagicore.apps.settings/store/RootStore.qml @@ -33,7 +33,7 @@ import QtQml 2.2 import QtQml.Models 2.3 import shared.utils 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import shared.Style 1.0 import "../helper" diff --git a/apps/com.pelagicore.climate/Main.qml b/apps/com.pelagicore.climate/Main.qml index 16d75282..08a5495e 100644 --- a/apps/com.pelagicore.climate/Main.qml +++ b/apps/com.pelagicore.climate/Main.qml @@ -34,7 +34,7 @@ import QtQuick 2.8 import QtQuick.Controls 2.2 import application.windows 1.0 import shared.utils 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import shared.Style 1.0 import "stores" 1.0 diff --git a/apps/com.pelagicore.hud/Main.qml b/apps/com.pelagicore.hud/Main.qml index f5a10add..03119733 100644 --- a/apps/com.pelagicore.hud/Main.qml +++ b/apps/com.pelagicore.hud/Main.qml @@ -33,7 +33,8 @@ import QtQuick 2.8 import QtQuick.Controls 2.2 import application.windows 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import shared.Style 1.0 import shared.Sizes 1.0 @@ -57,6 +58,7 @@ NeptuneWindow { InstrumentCluster { id: clusterSettings + discoveryMode: InstrumentCluster.LoadOnlySimulationBackends } Item { diff --git a/apps/com.pelagicore.map/Main.qml b/apps/com.pelagicore.map/Main.qml index 81765a38..59eccf60 100644 --- a/apps/com.pelagicore.map/Main.qml +++ b/apps/com.pelagicore.map/Main.qml @@ -34,7 +34,8 @@ import QtQuick 2.9 import application.windows 1.0 import shared.utils 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import shared.com.pelagicore.systeminfo 1.0 import shared.Style 1.0 import shared.com.pelagicore.map 1.0 diff --git a/apps/com.pelagicore.music/Main.qml b/apps/com.pelagicore.music/Main.qml index 3b2a40c7..b167c184 100644 --- a/apps/com.pelagicore.music/Main.qml +++ b/apps/com.pelagicore.music/Main.qml @@ -40,7 +40,8 @@ import QtQuick.Layouts 1.2 import "stores" 1.0 import "views" 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import shared.Style 1.0 import shared.Sizes 1.0 diff --git a/apps/com.pelagicore.music/stores/MusicStore.qml b/apps/com.pelagicore.music/stores/MusicStore.qml index 2c118d3e..4b2764a0 100644 --- a/apps/com.pelagicore.music/stores/MusicStore.qml +++ b/apps/com.pelagicore.music/stores/MusicStore.qml @@ -35,7 +35,7 @@ import QtApplicationManager.Application 2.0 import QtIvi 1.0 import QtIvi.Media 1.0 import shared.utils 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 Store { id: root diff --git a/apps/com.theqtcompany.cluster/Main.qml b/apps/com.theqtcompany.cluster/Main.qml index d628e471..38678b00 100644 --- a/apps/com.theqtcompany.cluster/Main.qml +++ b/apps/com.theqtcompany.cluster/Main.qml @@ -33,7 +33,7 @@ import QtQuick 2.8 import QtQuick.Window 2.2 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import application.windows 1.0 import shared.Sizes 1.0 diff --git a/apps/com.theqtcompany.cluster/stores/RootStore.qml b/apps/com.theqtcompany.cluster/stores/RootStore.qml index 7f0c2609..ff18b34a 100644 --- a/apps/com.theqtcompany.cluster/stores/RootStore.qml +++ b/apps/com.theqtcompany.cluster/stores/RootStore.qml @@ -30,7 +30,8 @@ ****************************************************************************/ import QtQuick 2.8 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import QtApplicationManager.Application 2.0 /*! @@ -41,7 +42,9 @@ import QtApplicationManager.Application 2.0 RootStoreInterface { id: root - readonly property InstrumentCluster clusterDataSource: InstrumentCluster {} + readonly property InstrumentCluster clusterDataSource: InstrumentCluster { + discoveryMode: InstrumentCluster.LoadOnlySimulationBackends + } /*! \qmlproperty UISettings ClusterStore::uiSettings Needed here to get twentyFourHourTimeFormat @@ -79,9 +82,9 @@ RootStoreInterface { behaviourInterface: BehaviourInterface { flatGauges: !ApplicationInterface.systemProperties["qt3DStudioRuntimeExist"] - || clusterDataSource.flatGauges - hideGauges: clusterDataSource.hideGauges - navigationMode: clusterDataSource.navigationMode + || uiSettings.flatGauges + hideGauges: uiSettings.hideGauges + navigationMode: uiSettings.navigationMode } externalDataInterface: ExternalDataInterface { diff --git a/apps/com.theqtcompany.cluster/views/+lucee/ClusterView.qml b/apps/com.theqtcompany.cluster/views/+lucee/ClusterView.qml index 3233024a..5ce341db 100644 --- a/apps/com.theqtcompany.cluster/views/+lucee/ClusterView.qml +++ b/apps/com.theqtcompany.cluster/views/+lucee/ClusterView.qml @@ -31,7 +31,7 @@ import QtQuick 2.8 import QtQuick.Window 2.2 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import application.windows 1.0 import shared.animations 1.0 diff --git a/apps/com.theqtcompany.cluster/views/ClusterView.qml b/apps/com.theqtcompany.cluster/views/ClusterView.qml index f2fd920a..06c4a642 100644 --- a/apps/com.theqtcompany.cluster/views/ClusterView.qml +++ b/apps/com.theqtcompany.cluster/views/ClusterView.qml @@ -33,7 +33,7 @@ import QtQuick 2.8 import QtQuick.Window 2.2 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import application.windows 1.0 import shared.Sizes 1.0 diff --git a/doc/doc.pri b/doc/doc.pri index a603b36e..395aa36a 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -1,7 +1,7 @@ CONFIG += force_qt QT *= quick ivicore -INCLUDEPATH += $$OUT_PWD/../src/remotesettings/frontend +INCLUDEPATH += $$OUT_PWD/../src/dataprovider/frontend build_online_docs: { QMAKE_DOCS = $$PWD/online/neptune3ui.qdocconf diff --git a/doc/neptune3ui-project.qdocconf b/doc/neptune3ui-project.qdocconf index 007e6d42..73553cf9 100644 --- a/doc/neptune3ui-project.qdocconf +++ b/doc/neptune3ui-project.qdocconf @@ -4,9 +4,9 @@ url = http://doc.qt.io/Neptune3UI moduleheader = Neptune3UIDoc -headerdirs += $$BUILDDIR/../src/remotesettings/frontend +headerdirs += $$BUILDDIR/../src/dataprovider/frontend -sourcedirs += src ../ $$BUILDDIR/../src/remotesettings/frontend +sourcedirs += src ../ $$BUILDDIR/../src/dataprovider/frontend imagedirs += src/images diff --git a/doc/src/neptune3ui-remote-settings-server.qdoc b/doc/src/neptune3ui-remote-settings-server.qdoc index 9cc5d92b..2617c4a8 100644 --- a/doc/src/neptune3ui-remote-settings-server.qdoc +++ b/doc/src/neptune3ui-remote-settings-server.qdoc @@ -49,7 +49,7 @@ settings service would not need to be remote, but could be running in-process instead. By default the remote settings server is started automatically by Neptune 3 UI. It may also be - started by running the RemoteSettingsServer executable. The executable is installed or + started by running the dataprovider-server executable. The executable is installed or built during the build of Neptune 3 UI. The server needs a settings file "server.conf" for setting up the connection. This settings file is shipped with Neptune 3 UI and is located in the root directory. The same settings file is also read by the backend plugin instances loaded by diff --git a/doc/src/neptune3ui-testing-squish.qdoc b/doc/src/neptune3ui-testing-squish.qdoc index 2e5dae4d..1a3cf5ec 100644 --- a/doc/src/neptune3ui-testing-squish.qdoc +++ b/doc/src/neptune3ui-testing-squish.qdoc @@ -127,7 +127,7 @@ attachableAUT/app_vehicle = "localhost:7732" are: \list \li D-Bus process - \li RemoteSettingsServer + \li dataprovider-server \endlist Consequently, for Neptune 3 UI you have to force Squish to ignore these processes to run the @@ -142,7 +142,7 @@ attachableAUT/app_vehicle = "localhost:7732" \badcode # ignore the following processes - RemoteSettingsServer + dataprovider-server dbus-daemon \endcode diff --git a/server.conf b/server.conf index 0c302fe6..46961f68 100644 --- a/server.conf +++ b/server.conf @@ -1,2 +1,2 @@ -[settings] +[dataprovider] Registry=tcp://0.0.0.0:9999 diff --git a/settings_app_android.pro b/settings_app_android.pro index 2e2d2f1a..1cf74a20 100644 --- a/settings_app_android.pro +++ b/settings_app_android.pro @@ -5,10 +5,10 @@ TEMPLATE = subdirs include(config.pri) SUBDIRS += \ - src/remotesettings/frontend/frontend.pro \ - src/remotesettings/backend/backend.pro \ - src/remotesettings/qml_plugin/qml_plugin.pro \ - src/remotesettings/app/app.pro + src/dataprovider/frontend/frontend.pro \ + src/dataprovider/backend/backend.pro \ + src/dataprovider/qml_plugin/qml_plugin.pro \ + src/dataprovider/app/app.pro CONFIG += ordered diff --git a/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py b/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py index 9290c938..834af235 100644 --- a/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py +++ b/squishtests/suite_neptune3/shared/scripts/bdd_hooks.py @@ -75,7 +75,7 @@ def start_neptune_ui_app_w_focus(window): # !!! Remember to use ignoredauts.txt feature # otherwise this will cause a lot of trouble, - # with dbus and RemoteSettingsServer !!! + # with dbus and dataprovider-server !!! # Read the documentation: # https://doc.qt.io/Neptune3UI/neptune3ui-testing-squish.html#exclude-disruptive-sub-processes command_line_options = ("-r" diff --git a/squishtests/suite_neptune3/shared/scripts/common/settings.py b/squishtests/suite_neptune3/shared/scripts/common/settings.py index c763b22b..098075cb 100644 --- a/squishtests/suite_neptune3/shared/scripts/common/settings.py +++ b/squishtests/suite_neptune3/shared/scripts/common/settings.py @@ -40,7 +40,7 @@ G_WAIT_SOME_STEPS_SEC = 1 G_WAIT_SWITCH_APP_CONTEXT = 1 G_AUT_MAIN = "neptune3-ui" -G_AUT_REMOTE = "RemoteSettingsServer" +G_AUT_REMOTE = "dataprovider-server" G_AUT_APPMAN = "appman-launcher-qml" G_MULTI_PROCESS = None diff --git a/src/remotesettings/app/ClusterPage.qml b/src/dataprovider/app/ClusterPage.qml index 5a418659..ef719acc 100644 --- a/src/remotesettings/app/ClusterPage.qml +++ b/src/dataprovider/app/ClusterPage.qml @@ -145,8 +145,8 @@ Flickable { text: qsTr("Navigation Mode:") } CheckBox { - checked: instrumentCluster.navigationMode - onClicked: instrumentCluster.navigationMode = checked + checked: uiSettings.navigationMode + onClicked: uiSettings.navigationMode = checked } Label { @@ -161,16 +161,16 @@ Flickable { text: qsTr("Hide Gauges:") } CheckBox { - checked: instrumentCluster.hideGauges - onClicked: instrumentCluster.hideGauges = checked + checked: uiSettings.hideGauges + onClicked: uiSettings.hideGauges = checked } Label { text: qsTr("Flat Gauges:") } CheckBox { - checked: instrumentCluster.flatGauges - onClicked: instrumentCluster.flatGauges = checked + checked: uiSettings.flatGauges + onClicked: uiSettings.flatGauges = checked } /*! diff --git a/src/remotesettings/app/ConnectionDialog.qml b/src/dataprovider/app/ConnectionDialog.qml index a4ca82a1..a4ca82a1 100644 --- a/src/remotesettings/app/ConnectionDialog.qml +++ b/src/dataprovider/app/ConnectionDialog.qml diff --git a/src/remotesettings/app/SettingsPage.qml b/src/dataprovider/app/SettingsPage.qml index 17c82c97..17c82c97 100644 --- a/src/remotesettings/app/SettingsPage.qml +++ b/src/dataprovider/app/SettingsPage.qml diff --git a/src/remotesettings/app/SystemUIPage.qml b/src/dataprovider/app/SystemUIPage.qml index 6353caff..6353caff 100644 --- a/src/remotesettings/app/SystemUIPage.qml +++ b/src/dataprovider/app/SystemUIPage.qml diff --git a/src/remotesettings/app/app.pro b/src/dataprovider/app/app.pro index 3e8077fc..2d472593 100644 --- a/src/remotesettings/app/app.pro +++ b/src/dataprovider/app/app.pro @@ -1,4 +1,4 @@ -TARGET = NeptuneControlApp +TARGET = neptune-companion-app DESTDIR = $$BUILD_DIR QT += quick ivicore CONFIG += c++11 @@ -6,7 +6,7 @@ CONFIG -= app_bundle include($$SOURCE_DIR/config.pri) -LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(RemoteSettings) +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(dataprovider) INCLUDEPATH += $$OUT_PWD/../frontend diff --git a/src/remotesettings/app/app.qrc b/src/dataprovider/app/app.qrc index e257dfd6..e257dfd6 100644 --- a/src/remotesettings/app/app.qrc +++ b/src/dataprovider/app/app.qrc diff --git a/src/remotesettings/app/client.cpp b/src/dataprovider/app/client.cpp index 4a6456a3..8209e245 100644 --- a/src/remotesettings/app/client.cpp +++ b/src/dataprovider/app/client.cpp @@ -31,7 +31,7 @@ ****************************************************************************/ #include "client.h" -Q_LOGGING_CATEGORY(remoteSettingsApp, "remotesettings.App") +Q_LOGGING_CATEGORY(dataProviderApp, "dataProvider.App") const QString Client::settingsLastUrlsPrefix = QStringLiteral("lastUrls"); const QString Client::settingsLastUrlsItem = QStringLiteral("url"); @@ -133,7 +133,7 @@ void Client::updateConnectionStatus() } else { setStatus(tr("Disconnected")); if (m_timedOut) { - qCWarning(remoteSettingsApp) << "Server heartbeat timed out."; + qCWarning(dataProviderApp) << "Server heartbeat timed out."; m_reconnectionTimer.start(reconnectionIntervalMS); } } @@ -165,7 +165,7 @@ void Client::setStatus(const QString &status) if (status==m_status) return; m_status=status; - qCWarning(remoteSettingsApp) << "Client status: " << status; + qCWarning(dataProviderApp) << "Client status: " << status; emit statusChanged(m_status); } diff --git a/src/remotesettings/app/client.h b/src/dataprovider/app/client.h index 83bcda8a..92ac2c1d 100644 --- a/src/remotesettings/app/client.h +++ b/src/dataprovider/app/client.h @@ -39,7 +39,7 @@ #include <QUrl> #include "connectionmonitoring.h" -Q_DECLARE_LOGGING_CATEGORY(remoteSettingsApp) +Q_DECLARE_LOGGING_CATEGORY(dataProviderApp) class Client : public QObject { diff --git a/src/remotesettings/app/main.cpp b/src/dataprovider/app/main.cpp index 367ed72c..367ed72c 100644 --- a/src/remotesettings/app/main.cpp +++ b/src/dataprovider/app/main.cpp diff --git a/src/remotesettings/app/main.qml b/src/dataprovider/app/main.qml index 59b40571..c0edb2dd 100644 --- a/src/remotesettings/app/main.qml +++ b/src/dataprovider/app/main.qml @@ -33,7 +33,8 @@ import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtIvi 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 import QtQuick.Window 2.3 diff --git a/src/remotesettings/app/qml.qrc b/src/dataprovider/app/qml.qrc index ec50876c..ec50876c 100644 --- a/src/remotesettings/app/qml.qrc +++ b/src/dataprovider/app/qml.qrc diff --git a/src/remotesettings/app/qtquickcontrols2.conf b/src/dataprovider/app/qtquickcontrols2.conf index ce3af5ce..ce3af5ce 100644 --- a/src/remotesettings/app/qtquickcontrols2.conf +++ b/src/dataprovider/app/qtquickcontrols2.conf diff --git a/src/remotesettings/app/server.conf b/src/dataprovider/app/server.conf index a1e6baa6..a1e6baa6 100644 --- a/src/remotesettings/app/server.conf +++ b/src/dataprovider/app/server.conf diff --git a/src/dataprovider/backend/backend.pro b/src/dataprovider/backend/backend.pro new file mode 100644 index 00000000..e5166a9f --- /dev/null +++ b/src/dataprovider/backend/backend.pro @@ -0,0 +1,32 @@ +TEMPLATE=lib +TARGET = $$qtLibraryTarget(dataprovider_backend_qtro) +CONFIG += ivigenerator plugin + +QT_FOR_CONFIG += ivicore +!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly") + +include($$SOURCE_DIR/config.pri) + +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(dataprovider) +DESTDIR = $$BUILD_DIR/qtivi + +#needed for the android deployment to work +android: DESTDIR = $$BUILD_DIR/plugins/qtivi + +CONFIG += warn_off +INCLUDEPATH += $$OUT_PWD/../frontend +PLUGIN_TYPE = qtivi +PLUGIN_EXTENDS = qtivi +PLUGIN_CLASS_NAME = IviSettingsBackendInterface + +QT += core ivicore + +QFACE_FORMAT = backend_qtro +QFACE_SOURCES = ../dataprovider.qface + +DEPENDPATH += $$OUT_PWD/../backend + +QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$INSTALL_PREFIX/neptune3/qtivi) + +target.path = $$INSTALL_PREFIX/neptune3/qtivi +INSTALLS += target diff --git a/src/remotesettings/backend_simulation/backend_simulation.pro b/src/dataprovider/backend_simulation/backend_simulation.pro index 747d8ef7..c1a6ce0c 100644 --- a/src/remotesettings/backend_simulation/backend_simulation.pro +++ b/src/dataprovider/backend_simulation/backend_simulation.pro @@ -1,5 +1,5 @@ TEMPLATE=lib -TARGET = $$qtLibraryTarget(RemoteSettings_backend_simulation) +TARGET = $$qtLibraryTarget(dataprovider_backend_simulation) CONFIG += ivigenerator plugin QT_FOR_CONFIG += ivicore @@ -7,7 +7,7 @@ QT_FOR_CONFIG += ivicore include($$SOURCE_DIR/config.pri) -LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(RemoteSettings) +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(dataprovider) DESTDIR = $$BUILD_DIR/qtivi #needed for the android deployment to work @@ -22,7 +22,7 @@ PLUGIN_CLASS_NAME = IviSettingsBackendInterface QT += core ivicore QFACE_FORMAT = backend_simulator -QFACE_SOURCES = ../settings.qface +QFACE_SOURCES = ../dataprovider.qface DEPENDPATH += $$OUT_PWD/../backend diff --git a/src/remotesettings/remotesettings.pro b/src/dataprovider/dataprovider.pro index 0a9646fe..d766253c 100644 --- a/src/remotesettings/remotesettings.pro +++ b/src/dataprovider/dataprovider.pro @@ -17,4 +17,4 @@ server.depends = frontend app.depends = frontend qml_plugin.depends = frontend -OTHER_FILES += settings.qface +OTHER_FILES += dataprovider.qface diff --git a/src/dataprovider/dataprovider.qface b/src/dataprovider/dataprovider.qface new file mode 100644 index 00000000..aae44027 --- /dev/null +++ b/src/dataprovider/dataprovider.qface @@ -0,0 +1,57 @@ +module DataProvider 1.0 + +@config: {id: "UISettings"} +interface UISettings { + string language; + list<string> languages; + + bool twentyFourHourTimeFormat; + + /** + * 0 is muted and 1.0 is max + */ + real volume; + bool muted; + /* + * -1.0 left and +1.0 right and 0 is centered + */ + real balance; + + int theme; + string accentColor; + + bool rtlMode; + + bool door1Open; + bool door2Open; + + /* + * Whether the instrument cluster should be in navigation mode + * in this mode its gauges etc will be reshaped to give more room + * for the maps navigation content being displayed behind it + */ + bool navigationMode; + + /** Whether both gauges should be hidden or not */ + bool hideGauges; + bool flatGauges; +} + +@config: {id: "SystemUI"} +interface SystemUI { + /* + * Incrementing this value will make sysui switch to display the next + * available application instrument cluster window. + * + * This is a hack. What we really need here is just a plain signal that + * could be emitted on demand. So that's not really storing a setting + * but serving as plain RPC. + */ + int applicationICWindowSwitchCount +} + +@config: {id: "ConnectionMonitoring"} +interface ConnectionMonitoring { + int intervalMS; + int counter; +} diff --git a/src/remotesettings/frontend/frontend.pro b/src/dataprovider/frontend/frontend.pro index 71f779aa..2bfc0f9b 100644 --- a/src/remotesettings/frontend/frontend.pro +++ b/src/dataprovider/frontend/frontend.pro @@ -1,4 +1,4 @@ -TARGET = $$qtLibraryTarget(RemoteSettings) +TARGET = $$qtLibraryTarget(dataprovider) TEMPLATE = lib CONFIG += ivigenerator DESTDIR = $$LIB_DESTDIR @@ -13,7 +13,7 @@ include($$SOURCE_DIR/config.pri) DEFINES += QT_BUILD_SETTINGS_LIB QT += ivicore ivicore-private qml -QFACE_SOURCES = ../settings.qface +QFACE_SOURCES = ../dataprovider.qface DEPENDPATH += $$OUT_PWD/../frontend diff --git a/src/dataprovider/qml_plugin/plugin.cpp b/src/dataprovider/qml_plugin/plugin.cpp new file mode 100644 index 00000000..e605f9f8 --- /dev/null +++ b/src/dataprovider/qml_plugin/plugin.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ +#include <QtQml/qqmlextensionplugin.h> +#include <qqml.h> + +#include "dataprovidermodule.h" + +QT_BEGIN_NAMESPACE + +class DataProviderPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) +public: + virtual void registerTypes(const char *uri) override + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("shared.com.pelagicore.dataprovider")); + + DataProviderModule::registerQmlTypes(uri, 1, 0); + } +}; + +QT_END_NAMESPACE + +#include "plugin.moc" diff --git a/src/remotesettings/qml_plugin/qml_plugin.pro b/src/dataprovider/qml_plugin/qml_plugin.pro index 5f60e61c..89ae6928 100644 --- a/src/remotesettings/qml_plugin/qml_plugin.pro +++ b/src/dataprovider/qml_plugin/qml_plugin.pro @@ -1,8 +1,8 @@ TEMPLATE = lib CONFIG += plugin -TARGET = remotesettingsplugin +TARGET = dataproviderplugin QT += qml -LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(RemoteSettings) +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(dataprovider) INCLUDEPATH += $$OUT_PWD/../frontend include($$SOURCE_DIR/config.pri) @@ -10,7 +10,7 @@ include($$SOURCE_DIR/config.pri) SOURCES += \ plugin.cpp -uri = com.pelagicore.settings +uri = com.pelagicore.dataprovider load(qmlplugin) QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$installPath) diff --git a/src/dataprovider/qml_plugin/qmldir b/src/dataprovider/qml_plugin/qmldir new file mode 100644 index 00000000..8742be8c --- /dev/null +++ b/src/dataprovider/qml_plugin/qmldir @@ -0,0 +1,3 @@ +module shared.com.pelagicore.dataprovider +plugin dataproviderplugin +classname DataProviderPlugin diff --git a/src/remotesettings/server/main.cpp b/src/dataprovider/server/main.cpp index fc88014b..75c2e9f6 100644 --- a/src/remotesettings/server/main.cpp +++ b/src/dataprovider/server/main.cpp @@ -40,9 +40,9 @@ int main(int argc, char *argv[]) QCoreApplication a(argc, argv); // single instance guard - QLockFile lockFile(QStringLiteral("%1/NeptuneRemoteSettingsServer.lock").arg(QDir::tempPath())); + QLockFile lockFile(QStringLiteral("%1/NeptuneDataProviderServer.lock").arg(QDir::tempPath())); if (!lockFile.tryLock(100)) { - qCritical("Neptune RemoteSettingsServer already running, aborting..."); + qCritical("Neptune DataProviderServer already running, aborting..."); return EXIT_FAILURE; } diff --git a/src/remotesettings/server/server.cpp b/src/dataprovider/server/server.cpp index 92121df6..6a726704 100644 --- a/src/remotesettings/server/server.cpp +++ b/src/dataprovider/server/server.cpp @@ -32,7 +32,7 @@ #include "server.h" #include <QCoreApplication> -Q_LOGGING_CATEGORY(remoteSettingsServer, "remotesettings.server") +Q_LOGGING_CATEGORY(dataProviderServer, "dataProvider.server") Server::Server(QObject *parent) : QObject(parent) { @@ -44,28 +44,23 @@ Server::Server(QObject *parent) : QObject(parent) void Server::start() { m_UISettingsService.reset(new UISettingsSimpleSource()); - Core::instance()->host()->enableRemoting(m_UISettingsService.data(), "Settings.UISettings"); - qCDebug(remoteSettingsServer) << "register service at: Settings.UISettings"; - - m_instrumentClusterService.reset(new InstrumentClusterSimpleSource()); - Core::instance()->host()->enableRemoting(m_instrumentClusterService.data(), "Settings.InstrumentCluster"); - qCDebug(remoteSettingsServer) << "register service at: Settings.InstrumentCluster"; + Core::instance()->host()->enableRemoting(m_UISettingsService.data(), "DataProvider.UISettings"); + qCDebug(dataProviderServer) << "register service at: DataProvider.UISettings"; m_systemUIService.reset(new SystemUISimpleSource()); - Core::instance()->host()->enableRemoting(m_systemUIService.data(), "Settings.SystemUI"); - qCDebug(remoteSettingsServer) << "register service at: Settings.SystemUI"; + Core::instance()->host()->enableRemoting(m_systemUIService.data(), "DataProvider.SystemUI"); + qCDebug(dataProviderServer) << "register service at: DataProvider.SystemUI"; m_connectionMonitoringService.reset(new ConnectionMonitoringSimpleSource()); - Core::instance()->host()->enableRemoting(m_connectionMonitoringService.data(), "Settings.ConnectionMonitoring"); - qCDebug(remoteSettingsServer) << "register service at: Settings.ConnectionMonitoring"; + Core::instance()->host()->enableRemoting(m_connectionMonitoringService.data(), "DataProvider.ConnectionMonitoring"); + qCDebug(dataProviderServer) << "register service at: DataProvider.ConnectionMonitoring"; - setInstrumentClusterDefaultValues(); initConnectionMonitoring(); } void Server::onROError(QRemoteObjectNode::ErrorCode code) { - qCWarning(remoteSettingsServer) << "Remote objects error, code:" << code; + qCWarning(dataProviderServer) << "Remote objects error, code:" << code; } void Server::onAboutToQuit() @@ -78,19 +73,6 @@ void Server::onTimeout() m_connectionMonitoringService->counter() + 1); } -void Server::setInstrumentClusterDefaultValues() -{ - // Make it look like the car is cruising along a highway instead of - // having everything zeroed or turned off. - - m_instrumentClusterService->setSpeed(102); - m_instrumentClusterService->setSpeedLimit(120); - m_instrumentClusterService->setSpeedCruise(100); - m_instrumentClusterService->setEPower(41); - m_instrumentClusterService->setDriveTrainState(2); // 2 == D (drive) - m_instrumentClusterService->setLowBeamHeadlight(true); -} - void Server::initConnectionMonitoring() { m_connectionMonitoringService->setIntervalMS(2000); diff --git a/src/remotesettings/server/server.h b/src/dataprovider/server/server.h index 375458ec..dab0b8df 100644 --- a/src/remotesettings/server/server.h +++ b/src/dataprovider/server/server.h @@ -38,11 +38,10 @@ #include "core.h" #include "rep_uisettings_source.h" -#include "rep_instrumentcluster_source.h" #include "rep_systemui_source.h" #include "rep_connectionmonitoring_source.h" -Q_DECLARE_LOGGING_CATEGORY(remoteSettingsServer) +Q_DECLARE_LOGGING_CATEGORY(dataProviderServer) class Server : public QObject { @@ -61,11 +60,9 @@ protected slots: protected: QScopedPointer<UISettingsSimpleSource> m_UISettingsService; - QScopedPointer<InstrumentClusterSimpleSource> m_instrumentClusterService; QScopedPointer<SystemUISimpleSource> m_systemUIService; QScopedPointer<ConnectionMonitoringSimpleSource> m_connectionMonitoringService; - void setInstrumentClusterDefaultValues(); void initConnectionMonitoring(); private: diff --git a/src/dataprovider/server/server.pro b/src/dataprovider/server/server.pro new file mode 100644 index 00000000..02474cbc --- /dev/null +++ b/src/dataprovider/server/server.pro @@ -0,0 +1,36 @@ +QT -= gui + +CONFIG += c++11 console +macos: CONFIG -= app_bundle +CONFIG += ivigenerator + +QT_FOR_CONFIG += ivicore +!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly") + +include($$SOURCE_DIR/config.pri) + +QFACE_FORMAT = server_qtro +QFACE_SOURCES = ../dataprovider.qface + +SOURCES += \ + main.cpp\ + server.cpp + +HEADERS += \ + server.h + +DEPENDPATH += $$OUT_PWD/../server + +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(dataprovider) + +INCLUDEPATH += $$OUT_PWD/../frontend + +QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$INSTALL_PREFIX/neptune3) + +DISTFILES += + +TARGET = dataprovider-server +DESTDIR = $$BUILD_DIR + +target.path = $$INSTALL_PREFIX/neptune3 +INSTALLS += target diff --git a/src/remotesettings/backend/backend.pro b/src/drivedata/backend/backend.pro index dd964045..053b5a98 100644 --- a/src/remotesettings/backend/backend.pro +++ b/src/drivedata/backend/backend.pro @@ -1,5 +1,5 @@ TEMPLATE=lib -TARGET = $$qtLibraryTarget(RemoteSettings_backend) +TARGET = $$qtLibraryTarget(drivedata_backend_qtro) CONFIG += ivigenerator plugin QT_FOR_CONFIG += ivicore @@ -7,7 +7,7 @@ QT_FOR_CONFIG += ivicore include($$SOURCE_DIR/config.pri) -LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(RemoteSettings) +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(drivedata) DESTDIR = $$BUILD_DIR/qtivi #needed for the android deployment to work @@ -22,7 +22,7 @@ PLUGIN_CLASS_NAME = IviSettingsBackendInterface QT += core ivicore QFACE_FORMAT = backend_qtro -QFACE_SOURCES = ../settings.qface +QFACE_SOURCES = ../drivedata.qface DEPENDPATH += $$OUT_PWD/../backend diff --git a/src/drivedata/backend_simulation/backend_simulation.pro b/src/drivedata/backend_simulation/backend_simulation.pro new file mode 100644 index 00000000..29a4b767 --- /dev/null +++ b/src/drivedata/backend_simulation/backend_simulation.pro @@ -0,0 +1,36 @@ +TEMPLATE=lib +TARGET = $$qtLibraryTarget(drivedata_backend_simulation) +CONFIG += ivigenerator plugin + +QT_FOR_CONFIG += ivicore +!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly") + +include($$SOURCE_DIR/config.pri) + +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(drivedata) +DESTDIR = $$BUILD_DIR/qtivi + +#needed for the android deployment to work +android: DESTDIR = $$BUILD_DIR/plugins/qtivi + +CONFIG += warn_off +INCLUDEPATH += $$OUT_PWD/../frontend +PLUGIN_TYPE = qtivi +PLUGIN_CLASS_NAME = DriveDataPlugin + +QT += core ivicore + +QFACE_FORMAT = backend_simulator +QFACE_SOURCES = ../drivedata.qface + +DEPENDPATH += $$OUT_PWD/../backend + +QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$INSTALL_PREFIX/neptune3/qtivi) + +target.path = $$INSTALL_PREFIX/neptune3/qtivi +INSTALLS += target + +#! [0] +RESOURCES += plugin_resource.qrc +#! [0] +QML_IMPORT_PATH = $$OUT_PWD/qml diff --git a/src/drivedata/backend_simulation/plugin_resource.qrc b/src/drivedata/backend_simulation/plugin_resource.qrc new file mode 100644 index 00000000..7b89debe --- /dev/null +++ b/src/drivedata/backend_simulation/plugin_resource.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/plugin_resource"> + <file>simulation.qml</file> + </qresource> +</RCC> diff --git a/src/drivedata/backend_simulation/simulation.qml b/src/drivedata/backend_simulation/simulation.qml new file mode 100644 index 00000000..1913c92a --- /dev/null +++ b/src/drivedata/backend_simulation/simulation.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.0 +import DriveData.simulation 1.0 + +Item { + InstrumentClusterBackend { + id: backend + property var settings : IviSimulator.findData(IviSimulator.simulationData, "InstrumentCluster") + + function initialize() { + IviSimulator.initializeDefault(settings, backend) + Base.initialize() + } + + property Timer timer: Timer { + interval: 2000 + onTriggered: { + if (backend.speed < 130) { + backend.speed = backend.speed + 10; + } else { + backend.speed = 0; + } + + if (backend.ePower < 100) { + backend.ePower = backend.ePower + 10; + } else { + backend.ePower = 0; + } + } + repeat: true + running: true + } + } +} diff --git a/src/drivedata/drivedata.pro b/src/drivedata/drivedata.pro new file mode 100644 index 00000000..e17d34b7 --- /dev/null +++ b/src/drivedata/drivedata.pro @@ -0,0 +1,21 @@ +TEMPLATE = subdirs + +SUBDIRS = frontend \ + backend_simulation \ + qml_plugin \ + +# Don't build the production backend on android and ios, only use the simulation backend +!android:!ios:SUBDIRS += \ + server \ + backend \ + +backend.depends = frontend +server.depends = frontend +backend_simulation.depends = frontend +qml_plugin.depends = frontend + +OTHER_FILES += + +DISTFILES += \ + drivedata.qface \ + drivedata.yaml diff --git a/src/drivedata/drivedata.qface b/src/drivedata/drivedata.qface new file mode 100644 index 00000000..8aa03225 --- /dev/null +++ b/src/drivedata/drivedata.qface @@ -0,0 +1,75 @@ +module DriveData 1.0; + +@config: {id: "DriveData"} +interface InstrumentCluster { + /* + * In Km/H + */ + real speed; + + /* + * In Km/H + */ + real speedLimit; + + /* + * In Km/H + */ + real speedCruise; + + /* + * Between 0 (inclusive) and 100 (inclusive) + */ + real ePower; + + /* + * 0 -> Park + * 1 -> Neutral + * 2 -> Drive + * 3 -> Reverse + */ + int driveTrainState; + + bool lowBeamHeadlight; + bool highBeamHeadlight; + bool fogLight; + bool stabilityControl; + bool seatBeltNotFastened; + bool leftTurn; + bool rightTurn; + bool ABSFailure; + bool parkBrake; + bool tyrePressureLow; + bool brakeFailure; + bool airbagFailure; + + /* + * outside tempterature in celsius degrees + */ + real outsideTemperatureCelsius; + + /* + * Mileage in km + */ + real mileageKm; + + /* + * 0 - normal + * 1 - eco + * 2 - sport + */ + int drivingMode; + int drivingModeRangeKm; + int drivingModeECORangeKm; + + /* + * Navigation + * progress 0.0 - 1.0 + * distance in km + */ + real navigationProgressPercents; + real navigationRouteDistanceKm; + + /** Whether a secondary (cluster) screen is available */ + bool available; +} diff --git a/src/drivedata/drivedata.yaml b/src/drivedata/drivedata.yaml new file mode 100644 index 00000000..06d5bd23 --- /dev/null +++ b/src/drivedata/drivedata.yaml @@ -0,0 +1,15 @@ +DriveData: + config_simulator: + simulationFile: "qrc:/plugin_resource/simulation.qml" + +DriveData.InstrumentCluster#speedLimit: + config_simulator: + default: 80 + +DriveData.InstrumentCluster#speedCruise: + config_simulator: + default: 120 + +DriveData.InstrumentCluster#driveTrainState: + config_simulator: + default: 2 diff --git a/src/drivedata/frontend/frontend.pro b/src/drivedata/frontend/frontend.pro new file mode 100644 index 00000000..88067ec4 --- /dev/null +++ b/src/drivedata/frontend/frontend.pro @@ -0,0 +1,20 @@ +TARGET = $$qtLibraryTarget(drivedata) +TEMPLATE = lib +CONFIG += ivigenerator +DESTDIR = $$LIB_DESTDIR + +QT_FOR_CONFIG += ivicore +!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly") + +macos: QMAKE_SONAME_PREFIX = @rpath + +include($$SOURCE_DIR/config.pri) + +DEFINES += QT_BUILD_DRIVEDATA_LIB +QT += ivicore ivicore-private qml + +QFACE_SOURCES = ../drivedata.qface + +target.path = $$INSTALL_PREFIX/neptune3/lib +win32:target.path = $$INSTALL_PREFIX/neptune3/ +INSTALLS += target diff --git a/src/remotesettings/qml_plugin/plugin.cpp b/src/drivedata/qml_plugin/plugin.cpp index ff8e57c1..4f3e6e97 100644 --- a/src/remotesettings/qml_plugin/plugin.cpp +++ b/src/drivedata/qml_plugin/plugin.cpp @@ -32,20 +32,20 @@ #include <QtQml/qqmlextensionplugin.h> #include <qqml.h> -#include "settingsmodule.h" +#include "drivedatamodule.h" QT_BEGIN_NAMESPACE -class RemoteSettingsPlugin : public QQmlExtensionPlugin +class DriveDataPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: virtual void registerTypes(const char *uri) override { - Q_ASSERT(QLatin1String(uri) == QLatin1String("shared.com.pelagicore.settings")); + Q_ASSERT(QLatin1String(uri) == QLatin1String("shared.com.pelagicore.drivedata")); - SettingsModule::registerQmlTypes(uri, 1, 0); + DriveDataModule::registerQmlTypes(uri, 1, 0); } }; diff --git a/src/drivedata/qml_plugin/qml_plugin.pro b/src/drivedata/qml_plugin/qml_plugin.pro new file mode 100644 index 00000000..ae44a9eb --- /dev/null +++ b/src/drivedata/qml_plugin/qml_plugin.pro @@ -0,0 +1,16 @@ +TEMPLATE = lib +CONFIG += plugin +TARGET = drivedataplugin +QT += qml +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(drivedata) +INCLUDEPATH += $$OUT_PWD/../frontend + +include($$SOURCE_DIR/config.pri) + +SOURCES += \ + plugin.cpp + +uri = com.pelagicore.drivedata +load(qmlplugin) + +QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$installPath) diff --git a/src/drivedata/qml_plugin/qmldir b/src/drivedata/qml_plugin/qmldir new file mode 100644 index 00000000..c03c5fb0 --- /dev/null +++ b/src/drivedata/qml_plugin/qmldir @@ -0,0 +1,3 @@ +module shared.com.pelagicore.drivedata +plugin drivedataplugin +classname DriveDataPlugin diff --git a/src/drivedata/server/main.cpp b/src/drivedata/server/main.cpp new file mode 100644 index 00000000..dbb85ab7 --- /dev/null +++ b/src/drivedata/server/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ +#include <QCoreApplication> +#include <QDir> +#include <QLockFile> + +#include "server.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + // single instance guard + QLockFile lockFile(QStringLiteral("%1/NeptuneDriveDataServer.lock").arg(QDir::tempPath())); + if (!lockFile.tryLock(100)) { + qCritical("Neptune DriveDataServer already running, aborting..."); + return EXIT_FAILURE; + } + + Server s; + s.start(); + + return a.exec(); +} diff --git a/src/drivedata/server/server.cpp b/src/drivedata/server/server.cpp new file mode 100644 index 00000000..69665af2 --- /dev/null +++ b/src/drivedata/server/server.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ +#include "server.h" +#include <QCoreApplication> + +Q_LOGGING_CATEGORY(driveDataServer, "driveData.server") + +Server::Server(QObject *parent) : QObject(parent) +{ + connect(QCoreApplication::instance(),&QCoreApplication::aboutToQuit, + this,&Server::onAboutToQuit); + +} + +void Server::start() +{ + m_instrumentClusterService.reset(new InstrumentClusterSimpleSource()); + Core::instance()->host()->enableRemoting(m_instrumentClusterService.data(), "DriveData.InstrumentCluster"); + qCDebug(driveDataServer) << "register service at: DriveData.InstrumentCluster"; +} + +void Server::onROError(QRemoteObjectNode::ErrorCode code) +{ + qCWarning(driveDataServer) << "Remote objects error, code:" << code; +} + +void Server::onAboutToQuit() +{ +} + +void Server::onTimeout() +{ +} diff --git a/src/drivedata/server/server.h b/src/drivedata/server/server.h new file mode 100644 index 00000000..763c9c87 --- /dev/null +++ b/src/drivedata/server/server.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ +#ifndef SERVER_H +#define SERVER_H + +#include <QObject> +#include <QSettings> + +#include "core.h" +#include "rep_instrumentcluster_source.h" + +Q_DECLARE_LOGGING_CATEGORY(driveDataServer) + +class Server : public QObject +{ + Q_OBJECT +public: + explicit Server(QObject *parent = nullptr); + + void start(); + +public slots: + void onROError(QRemoteObjectNode::ErrorCode code); + void onAboutToQuit(); + +protected slots: + void onTimeout(); + +protected: + QScopedPointer<InstrumentClusterSimpleSource> m_instrumentClusterService; +}; + +#endif // SERVER_H diff --git a/src/remotesettings/server/server.pro b/src/drivedata/server/server.pro index 10de4805..cab0972a 100644 --- a/src/remotesettings/server/server.pro +++ b/src/drivedata/server/server.pro @@ -10,7 +10,7 @@ QT_FOR_CONFIG += ivicore include($$SOURCE_DIR/config.pri) QFACE_FORMAT = server_qtro -QFACE_SOURCES = ../settings.qface +QFACE_SOURCES = ../drivedata.qface SOURCES += \ main.cpp\ @@ -21,7 +21,7 @@ HEADERS += \ DEPENDPATH += $$OUT_PWD/../server -LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(RemoteSettings) +LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(drivedata) INCLUDEPATH += $$OUT_PWD/../frontend @@ -29,7 +29,7 @@ QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptun DISTFILES += -TARGET = RemoteSettingsServer +TARGET = drivedata-server DESTDIR = $$BUILD_DIR target.path = $$INSTALL_PREFIX/neptune3 diff --git a/src/neptune3-ui/main.cpp b/src/neptune3-ui/main.cpp index f638aa38..be4b34cc 100644 --- a/src/neptune3-ui/main.cpp +++ b/src/neptune3-ui/main.cpp @@ -109,7 +109,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) // start the server; the server itself will ensure one instance only startExtraProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/vehiclefunctions-simulation-server"); - startExtraProcess(QCoreApplication::applicationDirPath() + "/RemoteSettingsServer"); + startExtraProcess(QCoreApplication::applicationDirPath() + "/drivedata-server"); + startExtraProcess(QCoreApplication::applicationDirPath() + "/dataprovider-server"); #endif // load the Qt translations diff --git a/src/remotesettings/qml_plugin/qmldir b/src/remotesettings/qml_plugin/qmldir deleted file mode 100644 index afee7e5e..00000000 --- a/src/remotesettings/qml_plugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module shared.com.pelagicore.settings -plugin remotesettingsplugin -classname RemoteSettingsPlugin diff --git a/src/remotesettings/settings.qface b/src/remotesettings/settings.qface deleted file mode 100644 index ba4a68af..00000000 --- a/src/remotesettings/settings.qface +++ /dev/null @@ -1,131 +0,0 @@ -module Settings 1.0 - -@config: {id: "UISettings"} -interface UISettings { - string language; - list<string> languages; - - bool twentyFourHourTimeFormat; - - /** - * 0 is muted and 1.0 is max - */ - real volume; - bool muted; - /* - * -1.0 left and +1.0 right and 0 is centered - */ - real balance; - - int theme; - string accentColor; - - bool rtlMode; - - bool door1Open; - bool door2Open; -} - -@config: {id: "InstrumentCluster"} -interface InstrumentCluster { - /* - * In Km/H - */ - real speed; - - /* - * In Km/H - */ - real speedLimit; - - /* - * In Km/H - */ - real speedCruise; - - /* - * Between 0 (inclusive) and 100 (inclusive) - */ - real ePower; - - /* - * 0 -> Park - * 1 -> Neutral - * 2 -> Drive - * 3 -> Reverse - */ - int driveTrainState; - - bool lowBeamHeadlight; - bool highBeamHeadlight; - bool fogLight; - bool stabilityControl; - bool seatBeltNotFastened; - bool leftTurn; - bool rightTurn; - bool ABSFailure; - bool parkBrake; - bool tyrePressureLow; - bool brakeFailure; - bool airbagFailure; - - /* - * outside tempterature in celsius degrees - */ - real outsideTemperatureCelsius; - - /* - * Mileage in km - */ - real mileageKm; - - /* - * 0 - normal - * 1 - eco - * 2 - sport - */ - int drivingMode; - int drivingModeRangeKm; - int drivingModeECORangeKm; - - /* - * Navigation - * progress 0.0 - 1.0 - * distance in km - */ - real navigationProgressPercents; - real navigationRouteDistanceKm; - - /* - * Whether the instrument cluster should be in navigation mode - * in this mode its gauges etc will be reshaped to give more room - * for the maps navigation content being displayed behind it - */ - bool navigationMode; - - /** Whether a secondary (cluster) screen is available */ - bool available; - - /** Whether both gaueges should be hidden or not */ - bool hideGauges; - bool flatGauges; -} - -@config: {id: "SystemUI"} -interface SystemUI { - /* - * Incrementing this value will make sysui switch to display the next - * available application instrument cluster window. - * - * This is a hack. What we really need here is just a plain signal that - * could be emitted on demand. So that's not really storing a setting - * but serving as plain RPC. - */ - int applicationICWindowSwitchCount -} - -@config: {id: "ConnectionMonitoring"} -interface ConnectionMonitoring { - int intervalMS; - int counter; -} diff --git a/src/src.pro b/src/src.pro index 9e5d8577..4741158e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,10 +1,11 @@ TEMPLATE = subdirs SUBDIRS += neptune3-ui -SUBDIRS += remotesettings +SUBDIRS += dataprovider \ + drivedata use_qsr{ #build Qt Safe Renderer Cluster SUBDIRS += neptune3-ui-qsr-cluster - neptune3-ui-qsr-cluster.depends = remotesettings + neptune3-ui-qsr-cluster.depends = dataprovider-server } diff --git a/sysui/instrumentcluster/InstrumentClusterWindow.qml b/sysui/instrumentcluster/InstrumentClusterWindow.qml index 20e69044..21f497ce 100644 --- a/sysui/instrumentcluster/InstrumentClusterWindow.qml +++ b/sysui/instrumentcluster/InstrumentClusterWindow.qml @@ -43,6 +43,7 @@ Window { property var clusterStore property var applicationModel property var instrumentClusterSettings: root.clusterStore.clusterSettings + property var uiSettings property bool invertedOrientation: root.clusterStore.invertedCluster property bool performanceOverlayVisible: false @@ -111,7 +112,7 @@ Window { } return false; } - Binding { target: instrumentClusterSettings; property: "navigationMode"; value: applicationICWindows.selectedNavigation } + Binding { target: uiSettings; property: "navigationMode"; value: applicationICWindows.selectedNavigation } } ApplicationICWindowItem { diff --git a/sysui/stores/ClusterStore.qml b/sysui/stores/ClusterStore.qml index 1c04cbf6..3f394a32 100644 --- a/sysui/stores/ClusterStore.qml +++ b/sysui/stores/ClusterStore.qml @@ -32,7 +32,8 @@ import QtQuick 2.8 import QtApplicationManager.SystemUI 2.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 +import shared.com.pelagicore.drivedata 1.0 QtObject { id: root diff --git a/sysui/stores/HUDStore.qml b/sysui/stores/HUDStore.qml index 15b07e43..d6beabad 100644 --- a/sysui/stores/HUDStore.qml +++ b/sysui/stores/HUDStore.qml @@ -32,7 +32,7 @@ import QtQuick 2.8 import QtApplicationManager.SystemUI 2.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.drivedata 1.0 QtObject { id: root diff --git a/sysui/stores/RootStore.qml b/sysui/stores/RootStore.qml index 2ff91b60..f937df79 100644 --- a/sysui/stores/RootStore.qml +++ b/sysui/stores/RootStore.qml @@ -39,7 +39,7 @@ import shared.utils 1.0 import system.models.application 1.0 -import shared.com.pelagicore.settings 1.0 +import shared.com.pelagicore.dataprovider 1.0 import shared.com.pelagicore.systeminfo 1.0 Store { diff --git a/tests/qmltests/qmltests.pro b/tests/qmltests/qmltests.pro index 19934b2d..758c07b6 100644 --- a/tests/qmltests/qmltests.pro +++ b/tests/qmltests/qmltests.pro @@ -5,7 +5,7 @@ SOURCES += testrunner.cpp include(../../config.pri) # This will add the install directory to the PATH variable of the target_wrapper.bat for the autotest -# This is needed as the libRemoteSettings.dll will be installed there +# This is needed as the libdataprovider.dll will be installed there win32 { extra_path.name = PATH extra_path.CONFIG = prepend |