aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Kozlov <AnKozlov@luxoft.com>2019-09-23 13:43:11 +0200
committerAnatoly Kozlov <AnKozlov@luxoft.com>2019-10-21 13:06:31 +0000
commitfd77d2a42fa062d7e4de653a5bc1266f0addcd86 (patch)
treed82bb0cdad57c0c89bdef189119e6fec8c7a4f42
parentcac011093378115a70a8f40ce58d393fc31321f5 (diff)
[Settings] Add connectivity options
- Add Qt IVI plugin to emulate connectivity features - Add WiFi settings to The Settings application Change-Id: I2e03cd3fa92a7a566455bf5c525d7aad94da62da Reviewed-by: Alexandra Betouni <ABetouni@luxoft.com> Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
-rw-r--r--apps/com.pelagicore.apps.settings/Main.qml2
-rw-r--r--apps/com.pelagicore.apps.settings/assets/assets.js2
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-0.png3
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-1.png3
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-2.png3
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-3.png3
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-4.png3
-rw-r--r--apps/com.pelagicore.apps.settings/assets/icons/ic_connection_secured.png3
-rw-r--r--apps/com.pelagicore.apps.settings/controls/qmldir1
-rw-r--r--apps/com.pelagicore.apps.settings/helper/qmldir1
-rw-r--r--apps/com.pelagicore.apps.settings/panels/ConnectivityPanel.qml81
-rw-r--r--apps/com.pelagicore.apps.settings/panels/HotspotPanel.qml201
-rw-r--r--apps/com.pelagicore.apps.settings/panels/WiFiPanel.qml244
-rw-r--r--apps/com.pelagicore.apps.settings/panels/qmldir4
-rw-r--r--apps/com.pelagicore.apps.settings/popups/WiFiPopup.qml173
-rw-r--r--apps/com.pelagicore.apps.settings/popups/qmldir2
-rw-r--r--apps/com.pelagicore.apps.settings/store/RootStore.qml7
-rw-r--r--apps/com.pelagicore.apps.settings/views/SettingsView.qml90
-rw-r--r--imports_shared/assets/icons/neptune/sysui/ic-connectivity_OFF.png3
-rw-r--r--imports_shared/assets/icons/neptune/sysui/ic-connectivity_ON.png3
-rw-r--r--imports_shared/assets/icons/neptune/sysui/ic_secured_connection.png3
-rw-r--r--imports_shared/assets/translations/ar_MA.ts4
-rw-r--r--imports_shared/assets/translations/cs_CZ.ts4
-rw-r--r--imports_shared/assets/translations/de_DE.ts4
-rw-r--r--imports_shared/assets/translations/en_GB.ts4
-rw-r--r--imports_shared/assets/translations/en_US.ts4
-rw-r--r--imports_shared/assets/translations/ja_JP.ts4
-rw-r--r--imports_shared/assets/translations/ko_KR.ts4
-rw-r--r--imports_shared/assets/translations/zh_CN.ts4
-rw-r--r--src/connectivity/connectivity.pro19
-rw-r--r--src/connectivity/connectivity.qface45
-rw-r--r--src/connectivity/connectivity.yaml27
-rw-r--r--src/connectivity/connectivity/connectivity.pro18
-rw-r--r--src/connectivity/connectivity_plugin/connectivity_plugin.pro23
-rw-r--r--src/connectivity/wifi_simulation/plugin_resource.qrc5
-rw-r--r--src/connectivity/wifi_simulation/simulation.qml194
-rw-r--r--src/connectivity/wifi_simulation/wifi_simulation.pro28
-rw-r--r--src/src.pro3
38 files changed, 1225 insertions, 4 deletions
diff --git a/apps/com.pelagicore.apps.settings/Main.qml b/apps/com.pelagicore.apps.settings/Main.qml
index 4f69f889..766a5520 100644
--- a/apps/com.pelagicore.apps.settings/Main.qml
+++ b/apps/com.pelagicore.apps.settings/Main.qml
@@ -62,5 +62,7 @@ ApplicationCCWindow {
width: root.exposedRect.width
height: root.exposedRect.height
store: RootStore {}
+ wifi: store.wifi
+ rootItem: root.contentItem
}
}
diff --git a/apps/com.pelagicore.apps.settings/assets/assets.js b/apps/com.pelagicore.apps.settings/assets/assets.js
index f765858c..cd441a4d 100644
--- a/apps/com.pelagicore.apps.settings/assets/assets.js
+++ b/apps/com.pelagicore.apps.settings/assets/assets.js
@@ -33,7 +33,7 @@
.pragma library
var gfx_dir = Qt.resolvedUrl('gfx');
-var icon_dir = Qt.resolvedUrl('icon');
+var icon_dir = Qt.resolvedUrl('icons');
function gfx(name) {
return gfx_dir + '/' + name + '.png';
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-0.png b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-0.png
new file mode 100644
index 00000000..1bab1d1b
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-0.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0690199f841f20cb4d15df83a57e85c5ccdb3bb6f0235f0ccea1ea3f3d624bb0
+size 1081
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-1.png b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-1.png
new file mode 100644
index 00000000..9458b201
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-1.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:caeb704286f089c1ae41604dfff0f34249c051f2a8fdc1230b9281b1ea353b53
+size 1085
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-2.png b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-2.png
new file mode 100644
index 00000000..e6c0cf7a
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-2.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bd137e3d8ac9705fee4893755b32e8e1e1522f23d3dd3ac21bc4ab111ab37413
+size 1098
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-3.png b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-3.png
new file mode 100644
index 00000000..8dba24a2
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-3.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0f1274257f7a17dd0be9d5abb6a82d56206578940ffe78be118e19c50fa1b87d
+size 1090
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-4.png b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-4.png
new file mode 100644
index 00000000..dcebc4a3
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic-wifi-signal-4.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9559b443f91f45cae2981e9b70b24f7f6bada30ace403b95f7af7c1018388f52
+size 1104
diff --git a/apps/com.pelagicore.apps.settings/assets/icons/ic_connection_secured.png b/apps/com.pelagicore.apps.settings/assets/icons/ic_connection_secured.png
new file mode 100644
index 00000000..ab1706d3
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/assets/icons/ic_connection_secured.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a4607f8bb8a9d2c4b056760edcd01a8ad62313061916050cfdb7c37eab270d06
+size 2128
diff --git a/apps/com.pelagicore.apps.settings/controls/qmldir b/apps/com.pelagicore.apps.settings/controls/qmldir
index 8318551a..7919325b 100644
--- a/apps/com.pelagicore.apps.settings/controls/qmldir
+++ b/apps/com.pelagicore.apps.settings/controls/qmldir
@@ -1 +1,2 @@
ColorSelector 1.0 ColorSelector.qml
+
diff --git a/apps/com.pelagicore.apps.settings/helper/qmldir b/apps/com.pelagicore.apps.settings/helper/qmldir
index 10ffc893..934646c5 100644
--- a/apps/com.pelagicore.apps.settings/helper/qmldir
+++ b/apps/com.pelagicore.apps.settings/helper/qmldir
@@ -1,2 +1 @@
Helper 1.0 Helper.qml
-
diff --git a/apps/com.pelagicore.apps.settings/panels/ConnectivityPanel.qml b/apps/com.pelagicore.apps.settings/panels/ConnectivityPanel.qml
new file mode 100644
index 00000000..d62964c0
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/panels/ConnectivityPanel.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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 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.8
+import QtQuick.Controls 2.3
+
+import shared.controls 1.0
+import shared.utils 1.0
+
+import shared.Style 1.0
+import shared.Sizes 1.0
+
+import "../controls"
+
+Control {
+ id: root
+
+ property bool wifiAvailable: true
+ property alias bluetoothAvailable: bluetoothItem.enabled
+
+ signal wifiClicked()
+ signal hotspotClicked()
+
+ contentItem: Column {
+
+ ListItem {
+ id: wifiItem
+ width: root.width
+ text: "WiFi"
+ rightToolSymbol: "ic-next-level"
+ enabled: root.wifiAvailable
+ onClicked: root.wifiClicked()
+ }
+
+ ListItem {
+ id: hotspotItem
+ width: root.width
+ text: "Hotspot"
+ rightToolSymbol: "ic-next-level"
+ enabled: root.wifiAvailable
+ onClicked: root.hotspotClicked()
+ }
+
+ ListItem {
+ id: bluetoothItem
+ width: root.width
+ text: "Bluetooth"
+ rightToolSymbol: "ic-next-level"
+ dividerVisible: false
+ }
+ }
+}
diff --git a/apps/com.pelagicore.apps.settings/panels/HotspotPanel.qml b/apps/com.pelagicore.apps.settings/panels/HotspotPanel.qml
new file mode 100644
index 00000000..4ca26ccd
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/panels/HotspotPanel.qml
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** 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 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.8
+import QtQuick.Controls 2.3
+
+import shared.controls 1.0
+import shared.utils 1.0
+
+import shared.Style 1.0
+import shared.Sizes 1.0
+
+import "../controls"
+
+Control {
+ id: root
+
+ property bool hotspotEnabled: false
+ property alias ssid: ssidTextField.text
+ property alias password: passwTextField.text
+
+ signal backButtonClicked()
+ signal toggleEnableHotspot()
+
+ contentItem: Flickable {
+ id: flickable
+ width: parent.width
+ height: parent.height
+ clip: true
+ flickableDirection: Flickable.VerticalFlick
+ interactive: contentHeight > height
+ contentHeight: column1.height
+ ScrollBar.vertical: ScrollBar { }
+
+ Column {
+ id: column1
+
+ Item {
+ id: listHeader
+ width: Sizes.dp(720)
+ height: Sizes.dp(94)
+
+ ToolButton {
+ id: backButton
+ objectName: "backButton"
+ anchors.left: parent.left
+ anchors.leftMargin: Sizes.dp(13.5)
+ anchors.verticalCenter: parent.verticalCenter
+ icon.name: LayoutMirroring.enabled ? "ic_forward" : "ic_back"
+ onClicked: root.backButtonClicked()
+ }
+ Label {
+ id: headerLabel
+ width: Sizes.dp(600)
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ text: "Hotspot"
+ }
+ Rectangle {
+ id: headerDivider
+ width: parent.width
+ height: Sizes.dp(1)
+ anchors.bottom: parent.bottom
+ color: "grey" //todo: change to #contrast 60%
+ }
+ }
+
+ Item {
+ id: spacing0
+ width: parent.width
+ height: Sizes.dp(53)
+ }
+
+ SwitchDelegate {
+ text: "Hotspot Enabled"
+ width: root.width
+ checked: root.hotspotEnabled
+ onToggled: root.hotspotEnabled = checked
+ enabled: root.ssid !== "" && root.password !== ""
+ }
+
+ Item {
+ id: spacing1
+ width: parent.width
+ height: Sizes.dp(80)
+ }
+
+ Label {
+ id: ssidTitle
+ width: root.width
+ text: "SSID"
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ color: Style.contrastColor
+ enabled: !root.hotspotEnabled
+ }
+
+ Item {
+ id: spacing2
+ width: parent.width
+ height: Sizes.dp(20)
+ }
+
+ TextField {
+ id: ssidTextField
+ width: root.width
+ height: Sizes.dp (100)
+ font.family: Style.fontFamily
+ font.pixelSize: Sizes.fontSizeM
+ color: Style.contrastColor
+ selectedTextColor: Style.contrastColor
+ leftPadding: Sizes.dp(18)
+ rightPadding: Sizes.dp(63)
+ horizontalAlignment: TextInput.AlignLeft
+ enabled: !root.hotspotEnabled
+ background: Rectangle {
+ border.color: Style.buttonColor
+ border.width: Sizes.dp(1)
+ color: "transparent"
+ radius: height/2
+ }
+ }
+
+ Item {
+ id: spacing3
+ width: parent.width
+ height: Sizes.dp(80)
+ }
+
+ Label {
+ id: passwTitle
+ width: root.width
+ text: "Password"
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ color: Style.contrastColor
+ enabled: !root.hotspotEnabled
+ }
+
+ Item {
+ id: spacing4
+ width: parent.width
+ height: Sizes.dp(20)
+ }
+
+ TextField {
+ id: passwTextField
+ width: root.width
+ height: Sizes.dp (100)
+ font.family: Style.fontFamily
+ font.pixelSize: Sizes.fontSizeM
+ color: Style.contrastColor
+ selectedTextColor: Style.contrastColor
+ leftPadding: Sizes.dp(18)
+ rightPadding: Sizes.dp(63)
+ horizontalAlignment: TextInput.AlignLeft
+ enabled: !root.hotspotEnabled
+ background: Rectangle {
+ border.color: Style.buttonColor
+ border.width: Sizes.dp(1)
+ color: "transparent"
+ radius: height/2
+ }
+ }
+
+ }
+ }
+
+}
diff --git a/apps/com.pelagicore.apps.settings/panels/WiFiPanel.qml b/apps/com.pelagicore.apps.settings/panels/WiFiPanel.qml
new file mode 100644
index 00000000..6ff0ee6d
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/panels/WiFiPanel.qml
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** 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 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.8
+import QtQuick.Controls 2.3
+
+import shared.controls 1.0
+import shared.utils 1.0
+
+import shared.Style 1.0
+import shared.Sizes 1.0
+
+import "../controls"
+import "../assets"
+
+Control {
+ id: root
+
+ property bool wifiEnabled: false
+ property string selectedWiFiStatus: "Disconnected" //Disconnected, Connecting, Connected or Disconnecting
+ property string selectedWiFiSSID: ""
+ property bool _wifiSelected: selectedWiFiStatus !== "Disconnected"
+ property string _selectedWiFiStatusText: selectedWiFiStatus === "Disconnected" ? "Disconnecting" : selectedWiFiStatus
+ property Item rootItem
+ property var wifiAccessPointsList
+
+ signal connectToWiFiClicked ( string ssid )
+ signal disconnectFromWiFiClicked ( string ssid )
+ signal backButtonClicked()
+ signal passwordProvided( string ssid, string password )
+ signal connectionCancelled()
+
+ onConnectToWiFiClicked: flickable.contentY = 0
+
+ contentItem: Flickable {
+ id: flickable
+ width: parent.width
+ height: parent.height
+ clip: true
+ flickableDirection: Flickable.VerticalFlick
+ interactive: contentHeight > height
+ contentHeight: column1.height
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+
+ Column {
+ id:column1
+
+ Item {
+ id: listHeader
+ width: Sizes.dp(720)
+ height: Sizes.dp(94)
+
+ ToolButton {
+ id: backButton
+ objectName: "backButton"
+ anchors.left: parent.left
+ anchors.leftMargin: Sizes.dp(13.5)
+ anchors.verticalCenter: parent.verticalCenter
+ icon.name: LayoutMirroring.enabled ? "ic_forward" : "ic_back"
+ onClicked: root.backButtonClicked()
+ }
+ Label {
+ id: headerLabel
+ width: Sizes.dp(600)
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ text: "WiFi"
+ }
+ Rectangle {
+ id: headerDivider
+ width: parent.width
+ height: Sizes.dp(1)
+ anchors.bottom: parent.bottom
+ color: "grey"
+ }
+ }
+
+ Item {
+ id: spacing0
+ width: parent.width
+ height: Sizes.dp(53)
+ }
+
+ SwitchDelegate {
+ text: "WiFi Enabled"
+ width: root.width
+ checked: root.wifiEnabled
+ onToggled: root.wifiEnabled = checked
+ }
+
+ Item {
+ width: root.width
+ height: root.wifiEnabled && root._wifiSelected ? activeWiFi.height + spacing1.height : 0.0
+ clip: true
+ opacity: root.wifiEnabled && root._wifiSelected ? 1.0 : 0.4
+ Behavior on height { NumberAnimation { duration: 200; easing.type: Easing.InOutQuad } }
+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.InOutQuad } }
+ visible: height > 0.0
+
+ Column {
+ width: parent.width
+
+ Item {
+ id: spacing1
+ width: parent.width
+ height: Sizes.dp(40)
+ }
+
+ ListItemBasic {
+ id: activeWiFi
+ text: root.selectedWiFiSSID
+ subText: root._selectedWiFiStatusText
+ width: parent.width
+ dividerVisible: false
+
+ accessoryDelegateComponent1: Button {
+ implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+ implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
+ leftPadding: Sizes.dp(30)
+ rightPadding: Sizes.dp(30)
+ topPadding: Sizes.dp(8)
+ bottomPadding: Sizes.dp(8)
+ text: "Disconnect"
+ enabled: root.selectedWiFiStatus !== "Disconnecting"
+ font.pixelSize: Sizes.fontSizeS
+ onClicked: root.disconnectFromWiFiClicked( root.selectedWiFiSSID )
+ }
+ }
+ }
+ }
+
+ Item {
+ width: root.width
+ height: root.wifiEnabled ? contentColumn2.height : 0.0
+ clip: true
+ opacity: root.wifiEnabled ? 1.0 : 0.4
+ Behavior on height { NumberAnimation { duration: 200; easing.type: Easing.InOutQuad } }
+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.InOutQuad } }
+ visible: height > 0.0
+
+ Column {
+ id: contentColumn2
+ width: parent.width
+
+ Item {
+ id: spacing2
+ width: root.width
+ height: Sizes.dp(40)
+ }
+
+ ListView {
+ id: wifiListView
+ width: root.width
+ height: Sizes.dp(96) * count
+ interactive: false
+
+ model: wifiAccessPointsList
+
+ delegate: ListItem {
+ width: root.width
+ height: Sizes.dp(96)
+ icon.source: {
+ if (model.modelData.strength >= 80) {
+ return Assets.icon("ic-wifi-signal-4");
+ } else if (model.modelData.strength >= 60) {
+ return Assets.icon("ic-wifi-signal-3");
+ } else if (model.modelData.strength >= 40) {
+ return Assets.icon("ic-wifi-signal-2");
+ } else if (model.modelData.strength >= 20) {
+ return Assets.icon("ic-wifi-signal-1");
+ } else {
+ return Assets.icon("ic-wifi-signal-0");
+ }
+ }
+ text: model.modelData.ssid
+ secondaryText: model.modelData.connected ? "Connected" : ""
+ rightToolSymbol: model.modelData.security != 0 ? "ic_secured_connection" : ""
+ dividerVisible: index !== wifiListView.count - 1
+ onClicked: root.connectToWiFiClicked(model.modelData.ssid)
+ }
+ }
+
+ Item {
+ id: spacing3
+ width: root.width
+ height: Sizes.dp(40)
+ }
+
+ /* TODO: The backend is not ready yet for hidden networks
+ ListItem {
+ id: manualConnection
+ rightToolSymbol: "ic-next-level"
+ dividerVisible: false
+ onClicked: {
+ var pos = mapToItem(root.rootItem, width/2, height/2);
+ wifiPopup.ssid = ""
+ wifiPopup.password = ""
+ wifiPopup.manual = true
+ wifiPopup.originItemX = pos.x;
+ wifiPopup.originItemY = pos.y;
+ wifiPopup.popupY = Sizes.dp(Math.round(Config.centerConsoleHeight/2 - 410))
+ wifiPopup.visible = true;
+ }
+ }
+ */
+ }
+ }
+ }
+ }
+
+}
diff --git a/apps/com.pelagicore.apps.settings/panels/qmldir b/apps/com.pelagicore.apps.settings/panels/qmldir
index 978a4031..d47a3e34 100644
--- a/apps/com.pelagicore.apps.settings/panels/qmldir
+++ b/apps/com.pelagicore.apps.settings/panels/qmldir
@@ -2,3 +2,7 @@ ColorsPanel 1.0 ColorsPanel.qml
DateTimePanel 1.0 DateTimePanel.qml
LanguagePanel 1.0 LanguagePanel.qml
ThemesPanel 1.0 ThemesPanel.qml
+WiFiPanel 1.0 WiFiPanel.qml
+ConnectivityPanel 1.0 ConnectivityPanel.qml
+HotspotPanel 1.0 HotspotPanel.qml
+
diff --git a/apps/com.pelagicore.apps.settings/popups/WiFiPopup.qml b/apps/com.pelagicore.apps.settings/popups/WiFiPopup.qml
new file mode 100644
index 00000000..430299ed
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/popups/WiFiPopup.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** 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 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.6
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.3
+import application.windows 1.0
+import shared.utils 1.0
+
+import shared.Style 1.0
+import shared.Sizes 1.0
+
+PopupWindow {
+ id: root
+
+ property alias ssid: ssidTextField.text
+ property alias password: passwTextField.text
+ property bool manual: false
+
+ signal connectClicked(string ssid, string password)
+ signal cancelClicked()
+
+ QtObject {
+ id: p
+ property bool okClicked: false
+ }
+
+ Label {
+ anchors.baseline: parent.top
+ anchors.baselineOffset: Sizes.dp(78)
+ font.pixelSize: Sizes.fontSizeM
+ width: parent.width
+ text: !root.manual ? "Input password" : "Manual connection"
+ horizontalAlignment: Text.AlignHCenter
+ }
+ Image {
+ id: shadow
+ anchors.top: parent.top
+ anchors.topMargin: Sizes.dp(120)
+ width: parent.width
+ height: Sizes.dp(sourceSize.height)
+ source: Style.image("popup-title-shadow")
+ }
+
+ ColumnLayout {
+ id: columnFields
+ spacing: Sizes.dp(50)
+ anchors.top: parent.top
+ anchors.topMargin: Sizes.dp(170)
+ anchors.left: parent.left
+ anchors.leftMargin: Sizes.dp(100)
+ anchors.right: parent.right
+ anchors.rightMargin: Sizes.dp(100)
+
+ Label {
+ id: ssidTitle
+ Layout.preferredHeight: Sizes.dp(50)
+ Layout.alignment: Qt.AlignBottom | Qt.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ Layout.bottomMargin: -Sizes.dp(25)
+ text: "SSID"
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ color: Style.contrastColor
+ }
+
+ TextField {
+ id: ssidTextField
+ Layout.fillWidth: true
+ Layout.preferredHeight: Sizes.dp(100)
+ font.family: Style.fontFamily
+ font.pixelSize: Sizes.fontSizeM
+ color: Style.contrastColor
+ selectedTextColor: Style.contrastColor
+ leftPadding: Sizes.dp(18)
+ rightPadding: Sizes.dp(63)
+ horizontalAlignment: TextInput.AlignLeft
+ readOnly: !root.manual
+
+ background: Rectangle {
+ border.color: Style.buttonColor
+ border.width: Sizes.dp(1)
+ color: "transparent"
+ radius: height/2
+ }
+ }
+
+ Label {
+ id: passwTitle
+ Layout.preferredHeight: Sizes.dp(50)
+ Layout.alignment: Qt.AlignBottom | Qt.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ Layout.bottomMargin: -Sizes.dp(25)
+ text: "Password"
+ font.pixelSize: Sizes.fontSizeS
+ elide: Text.ElideRight
+ color: Style.contrastColor
+ }
+
+ TextField {
+ id: passwTextField
+ Layout.fillWidth: true
+ Layout.preferredHeight: Sizes.dp(100)
+ font.family: Style.fontFamily
+ font.pixelSize: Sizes.fontSizeM
+ color: Style.contrastColor
+ selectedTextColor: Style.contrastColor
+ leftPadding: Sizes.dp(18)
+ rightPadding: Sizes.dp(63)
+ horizontalAlignment: TextInput.AlignLeft
+
+ background: Rectangle {
+ border.color: Style.buttonColor
+ border.width: Sizes.dp(1)
+ color: "transparent"
+ radius: height/2
+
+ }
+ }
+
+ }
+ Button {
+ anchors.top: columnFields.bottom
+ anchors.topMargin: Sizes.dp(100)
+ anchors.right: parent.right
+ anchors.rightMargin: Sizes.dp(100)
+ width: Sizes.dp(315)
+ height: Sizes.dp(64)
+ font.pixelSize: Sizes.fontSizeS
+ text: "Connect"
+ onClicked: {
+ p.okClicked = true;
+ root.close();
+ root.connectClicked(ssidTextField.text, passwTextField.text);
+ }
+ }
+
+ onVisibleChanged: {
+ if ((!root.visible) && (!p.okClicked)) {
+ root.cancelClicked();
+ p.okClicked = false;
+ }
+ }
+}
diff --git a/apps/com.pelagicore.apps.settings/popups/qmldir b/apps/com.pelagicore.apps.settings/popups/qmldir
new file mode 100644
index 00000000..e4a77423
--- /dev/null
+++ b/apps/com.pelagicore.apps.settings/popups/qmldir
@@ -0,0 +1,2 @@
+WiFiPopup 1.0 WiFiPopup.qml
+
diff --git a/apps/com.pelagicore.apps.settings/store/RootStore.qml b/apps/com.pelagicore.apps.settings/store/RootStore.qml
index b527c3c8..4df89611 100644
--- a/apps/com.pelagicore.apps.settings/store/RootStore.qml
+++ b/apps/com.pelagicore.apps.settings/store/RootStore.qml
@@ -35,12 +35,19 @@ import QtQml.Models 2.3
import shared.utils 1.0
import shared.com.pelagicore.remotesettings 1.0
import shared.Style 1.0
+import shared.Connectivity 1.0
import "../helper"
QtObject {
id: root
+ readonly property WiFi wifi: WiFi {}
+ readonly property int connectivityStatusConnecting: WiFi.Connecting
+ readonly property int connectivityStatusConnected: WiFi.Connected
+ readonly property int connectivityStatusDisconnecting: WiFi.Disconnecting
+ readonly property int connectivityStatusDisconnected: WiFi.Disconnected
+
readonly property Helper helper: Helper {}
readonly property UISettings uiSettings: UISettings {
onAccentColorChanged: {
diff --git a/apps/com.pelagicore.apps.settings/views/SettingsView.qml b/apps/com.pelagicore.apps.settings/views/SettingsView.qml
index 85a33be9..223f539d 100644
--- a/apps/com.pelagicore.apps.settings/views/SettingsView.qml
+++ b/apps/com.pelagicore.apps.settings/views/SettingsView.qml
@@ -42,6 +42,7 @@ import shared.Sizes 1.0
import "../assets"
import "../store"
import "../panels"
+import "../popups"
Control {
id: root
@@ -49,6 +50,21 @@ Control {
implicitHeight: Sizes.dp(540)
property RootStore store
+ property Item rootItem
+ property QtObject wifi
+
+ WiFiPopup {
+ id: wifiPopup
+ manual: false
+ readonly property point pos: mapToItem(root, width/2, height/2)
+ width: Sizes.dp(910)
+ height: Sizes.dp(820)
+ originItemX: pos.x
+ originItemY: pos.y
+ popupY: Sizes.dp(Math.round(Config.centerConsoleHeight/2 - 410))
+ onConnectClicked: wifi.sendCredentials(ssid, password)
+ onCancelClicked: wifi.disconnectFromAccessPoint(wifi.activeAccessPoint.ssid)
+ }
ButtonGroup {
id: toolGroup
@@ -61,7 +77,6 @@ Control {
anchors.topMargin: Sizes.dp(436)
anchors.bottom: parent.bottom
anchors.bottomMargin: Sizes.dp(20)
-
clip: true
Item {
@@ -83,6 +98,7 @@ Control {
ListModel {
id: fullTabsModel
+ ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "connectivity"); icon: 'ic-connectivity'; objectName: "connectivityViewButton" }
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "languages"); icon: 'ic-languages'; objectName: "languageViewButton"}
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "date"); icon: 'ic-time'; objectName: "dateViewButton" }
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "themes"); icon: 'ic-themes'; objectName: "themesViewButton" }
@@ -91,6 +107,7 @@ Control {
ListModel {
id: themelessTabsModel
+ ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "connectivity"); icon: 'ic-connectivity'; objectName: "connectivityViewButton" }
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "languages"); icon: 'ic-languages'; objectName: "languageViewButton"}
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "date"); icon: 'ic-time'; objectName: "dateViewButton" }
ListElement { text: QT_TRANSLATE_NOOP("SettingsToolsColumn", "colors"); icon: 'ic-color'; objectName: "colorsViewButton" }
@@ -106,6 +123,76 @@ Control {
anchors.bottom: parent.bottom
width: Sizes.dp(720)
+ ConnectivityPanel {
+ objectName: "connectivityPanel"
+ id: connectivityPanel
+
+ property int view: 0 //0=menu, 1=wifi, 2=hotspot
+
+ anchors.fill: parent
+ visible: toolsColumn.currentIcon === 'ic-connectivity' && connectivityPanel.view === 0
+
+ wifiAvailable: wifi.available
+ bluetoothAvailable: false
+
+ onWifiClicked: view = 1
+ onHotspotClicked: view = 2
+ }
+
+ WiFiPanel {
+ id: wifiPanel
+ objectName: "wifiPanel"
+ anchors.fill: parent
+ visible: toolsColumn.currentIcon === 'ic-connectivity' && connectivityPanel.view === 1
+
+ wifiEnabled: wifi.enabled
+ wifiAccessPointsList: wifi.accessPoints
+ rootItem: root.rootItem
+ selectedWiFiStatus: {
+ if (wifi.connectionStatus == store.connectivityStatusConnecting) {
+ return "Connecting";
+ } else if (wifi.connectionStatus == store.connectivityStatusConnected) {
+ return "Connected";
+ } else if (wifi.connectionStatus == store.connectivityStatusDisconnecting) {
+ return "Disconnecting";
+ } else {
+ return "Disconnected";
+ }
+ }
+ selectedWiFiSSID: wifi.activeAccessPoint.ssid
+
+ onBackButtonClicked: connectivityPanel.view = 0
+ onWifiEnabledChanged: wifi.enabled = wifiEnabled
+ onConnectToWiFiClicked: wifi.connectToAccessPoint(ssid)
+ onDisconnectFromWiFiClicked: wifi.disconnectFromAccessPoint(ssid)
+ }
+
+ Connections {
+ target: wifi
+ onCredentialsRequested: {
+ wifiPopup.ssid = ssid;
+ wifiPopup.visible = true;
+ }
+ }
+
+ HotspotPanel {
+ objectName: "hotspotPanel"
+ anchors.fill: parent
+ visible: toolsColumn.currentIcon === 'ic-connectivity' && connectivityPanel.view === 2
+ hotspotEnabled: wifi.hotspotEnabled
+ ssid: wifi.hotspotSSID
+ password: wifi.hotspotPassword
+
+ onHotspotEnabledChanged: {
+ if (hotspotEnabled) {
+ wifi.hotspotSSID = ssid;
+ wifi.hotspotPassword = password;
+ }
+ wifi.hotspotEnabled = hotspotEnabled
+ }
+ onBackButtonClicked: connectivityPanel.view = 0
+ }
+
LanguagePanel {
objectName: "languagePanel"
anchors.fill: parent
@@ -150,3 +237,4 @@ Control {
}
}
}
+
diff --git a/imports_shared/assets/icons/neptune/sysui/ic-connectivity_OFF.png b/imports_shared/assets/icons/neptune/sysui/ic-connectivity_OFF.png
new file mode 100644
index 00000000..f6b51e18
--- /dev/null
+++ b/imports_shared/assets/icons/neptune/sysui/ic-connectivity_OFF.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:13e49591991166a6aff1ebb4d465ffa3c00c58d1c29d80c1bc89e65c95a67e9f
+size 939
diff --git a/imports_shared/assets/icons/neptune/sysui/ic-connectivity_ON.png b/imports_shared/assets/icons/neptune/sysui/ic-connectivity_ON.png
new file mode 100644
index 00000000..a39fb596
--- /dev/null
+++ b/imports_shared/assets/icons/neptune/sysui/ic-connectivity_ON.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a36a7c8d906d9aa642e1b54cab6472f6f4d241060ecf9ab5417202b157b4f82b
+size 850
diff --git a/imports_shared/assets/icons/neptune/sysui/ic_secured_connection.png b/imports_shared/assets/icons/neptune/sysui/ic_secured_connection.png
new file mode 100644
index 00000000..a5dfa480
--- /dev/null
+++ b/imports_shared/assets/icons/neptune/sysui/ic_secured_connection.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:501c2c3031395b3245a09e8ef8126c670e64ef29dd0f2c1c14965cf483ae5983
+size 1167
diff --git a/imports_shared/assets/translations/ar_MA.ts b/imports_shared/assets/translations/ar_MA.ts
index d7d0a86c..f0a18f4d 100644
--- a/imports_shared/assets/translations/ar_MA.ts
+++ b/imports_shared/assets/translations/ar_MA.ts
@@ -886,6 +886,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>TiresPanel</name>
diff --git a/imports_shared/assets/translations/cs_CZ.ts b/imports_shared/assets/translations/cs_CZ.ts
index 08cca34b..075e3f98 100644
--- a/imports_shared/assets/translations/cs_CZ.ts
+++ b/imports_shared/assets/translations/cs_CZ.ts
@@ -1742,6 +1742,10 @@ UX na cestu</translation>
<source>colors</source>
<translation>barvy</translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>StatusBar</name>
diff --git a/imports_shared/assets/translations/de_DE.ts b/imports_shared/assets/translations/de_DE.ts
index 0cc9ff59..ba03be3d 100644
--- a/imports_shared/assets/translations/de_DE.ts
+++ b/imports_shared/assets/translations/de_DE.ts
@@ -1271,6 +1271,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>StatusBar</name>
diff --git a/imports_shared/assets/translations/en_GB.ts b/imports_shared/assets/translations/en_GB.ts
index c7ccf9aa..2bb07199 100644
--- a/imports_shared/assets/translations/en_GB.ts
+++ b/imports_shared/assets/translations/en_GB.ts
@@ -923,6 +923,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>TiresPanel</name>
diff --git a/imports_shared/assets/translations/en_US.ts b/imports_shared/assets/translations/en_US.ts
index 2907023a..0e99acaa 100644
--- a/imports_shared/assets/translations/en_US.ts
+++ b/imports_shared/assets/translations/en_US.ts
@@ -881,6 +881,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>TiresPanel</name>
diff --git a/imports_shared/assets/translations/ja_JP.ts b/imports_shared/assets/translations/ja_JP.ts
index 11cd9919..6598349a 100644
--- a/imports_shared/assets/translations/ja_JP.ts
+++ b/imports_shared/assets/translations/ja_JP.ts
@@ -1409,6 +1409,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>StatusBar</name>
diff --git a/imports_shared/assets/translations/ko_KR.ts b/imports_shared/assets/translations/ko_KR.ts
index 18e987c8..e1a48f8c 100644
--- a/imports_shared/assets/translations/ko_KR.ts
+++ b/imports_shared/assets/translations/ko_KR.ts
@@ -1428,6 +1428,10 @@
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>StatusBar</name>
diff --git a/imports_shared/assets/translations/zh_CN.ts b/imports_shared/assets/translations/zh_CN.ts
index ad0c684c..7ae1774f 100644
--- a/imports_shared/assets/translations/zh_CN.ts
+++ b/imports_shared/assets/translations/zh_CN.ts
@@ -1472,6 +1472,10 @@ If it is wrong, you can just delete first two charactor, just ues &quot;源&quot
<source>colors</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <source>connectivity</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>StatusBar</name>
diff --git a/src/connectivity/connectivity.pro b/src/connectivity/connectivity.pro
new file mode 100644
index 00000000..15b2ab5f
--- /dev/null
+++ b/src/connectivity/connectivity.pro
@@ -0,0 +1,19 @@
+TEMPLATE = subdirs
+
+# Frontend
+SUBDIRS = connectivity
+
+# QML Plugin
+SUBDIRS += connectivity_plugin
+
+# WiFi Backend simulation
+SUBDIRS += wifi_simulation
+
+# WiFi Backend implementation
+# SUBDIRS += wifi_backend
+
+wifi_simulation.depends = connectivity
+# wifi_backend.depends = connectivity
+connectivity_plugin.depends = connectivity
+
+OTHER_FILES += connectivity.qface
diff --git a/src/connectivity/connectivity.qface b/src/connectivity/connectivity.qface
new file mode 100644
index 00000000..61b0ab6b
--- /dev/null
+++ b/src/connectivity/connectivity.qface
@@ -0,0 +1,45 @@
+@config: { qml_type: "shared.Connectivity" }
+module Connectivity 1.0;
+
+enum ConnectionStatus {
+ Connecting, Connected, Disconnecting, Disconnected
+}
+
+enum SecurityType {
+ NoSecurity,
+ WEP,
+ WPA_PSK,
+ WPA_EAP
+}
+
+struct AccessPoint {
+ string ssid;
+ bool connected;
+ int strength;
+ SecurityType security;
+}
+
+interface WiFi {
+ readonly bool available; // Whether wifi is available on the device
+ bool enabled; // Enables/Disables the wifi module
+
+ bool hotspotEnabled; // Enables/Disables a hotspot on the device
+ string hotspotSSID; // Holds a name of the configured wifi hotspot
+ string hotspotPassword; // Holds a password of the configured wifi hotspot
+
+ readonly list<AccessPoint> accessPoints; // List of available access points to connect
+
+ readonly ConnectionStatus connectionStatus; // Current status connection
+ readonly AccessPoint activeAccessPoint; // Holds an active access point
+
+ void connectToAccessPoint(string ssid); // Initiates connection to the given wifi access point
+ void disconnectFromAccessPoint(string ssid); // Initiates disconnect from the active access point
+ void sendCredentials(string ssid, string password); // Sends credentials if a chosen access point requires it
+
+ signal credentialsRequested(string ssid); // Gets emitted when the chosen access point requires a password
+
+ readonly string errorString; // Holds a description of occurred error
+}
+
+
+
diff --git a/src/connectivity/connectivity.yaml b/src/connectivity/connectivity.yaml
new file mode 100644
index 00000000..bc92c229
--- /dev/null
+++ b/src/connectivity/connectivity.yaml
@@ -0,0 +1,27 @@
+Connectivity:
+ config_simulator:
+ simulationFile: "qrc:/plugin_resource/simulation.qml"
+
+Connectivity.WiFi#available:
+ config_simulator:
+ default: true
+
+Connectivity.WiFi#enabled:
+ config_simulator:
+ default: false
+
+Connectivity.WiFi#connectionStatus:
+ config_simulator:
+ default: ConnectionStatus.Disconnected
+
+Connectivity.WiFi#hotspotEnabled:
+ config_simulator:
+ default: false
+
+Connectivity.WiFi#hotspotSSID:
+ config_simulator:
+ default: ""
+
+Connectivity.WiFi#hotspotPassword:
+ config_simulator:
+ default: ""
diff --git a/src/connectivity/connectivity/connectivity.pro b/src/connectivity/connectivity/connectivity.pro
new file mode 100644
index 00000000..c5c3018e
--- /dev/null
+++ b/src/connectivity/connectivity/connectivity.pro
@@ -0,0 +1,18 @@
+TARGET = $$qtLibraryTarget(Connectivity)
+TEMPLATE = lib
+CONFIG += ivigenerator
+
+QT += ivicore ivicore-private qml quick
+QT_FOR_CONFIG += ivicore
+!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly")
+
+QFACE_SOURCES = ../connectivity.qface
+
+DESTDIR = $$LIB_DESTDIR
+
+include($$SOURCE_DIR/config.pri)
+
+macos: QMAKE_SONAME_PREFIX = @rpath
+target.path = $$INSTALL_PREFIX/neptune3/lib
+win32:target.path = $$INSTALL_PREFIX/neptune3/
+INSTALLS += target
diff --git a/src/connectivity/connectivity_plugin/connectivity_plugin.pro b/src/connectivity/connectivity_plugin/connectivity_plugin.pro
new file mode 100644
index 00000000..c2fc9d1b
--- /dev/null
+++ b/src/connectivity/connectivity_plugin/connectivity_plugin.pro
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += ivicore qml
+
+LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(Connectivity)
+INCLUDEPATH += $$OUT_PWD/../connectivity
+
+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 = qmlplugin
+QFACE_SOURCES = ../connectivity.qface
+
+load(ivigenerator)
+
+uri = Connectivity
+EXTRA_FILES += $$OUT_PWD/qmldir \
+ $$OUT_PWD/plugins.qmltypes
+load(qmlplugin)
+
+QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$installPath)
diff --git a/src/connectivity/wifi_simulation/plugin_resource.qrc b/src/connectivity/wifi_simulation/plugin_resource.qrc
new file mode 100644
index 00000000..7b89debe
--- /dev/null
+++ b/src/connectivity/wifi_simulation/plugin_resource.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/plugin_resource">
+ <file>simulation.qml</file>
+ </qresource>
+</RCC>
diff --git a/src/connectivity/wifi_simulation/simulation.qml b/src/connectivity/wifi_simulation/simulation.qml
new file mode 100644
index 00000000..39f1da75
--- /dev/null
+++ b/src/connectivity/wifi_simulation/simulation.qml
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Luxoft Sweden AB
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune 3 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 shared.Connectivity.simulation 1.0
+
+Item {
+ WiFiBackend {
+ id: backend
+ property var settings : IviSimulator.findData(IviSimulator.simulationData, "WiFi")
+
+ function initialize() {
+ IviSimulator.initializeDefault(settings, backend)
+ Base.initialize()
+
+ for (var i = 0; i < 7; i++) {
+ var ap = {}
+ ap.ssid = "Access Point " + i
+ ap.connected = false
+ ap.strength = Math.floor( Math.random()*100 )
+ ap.security = Math.floor( Math.random()*5 )
+
+ allAccessPoints.push(ap)
+ }
+
+ backend.accessPoints = allAccessPoints
+ }
+
+ readonly property var allAccessPoints: []
+
+ readonly property Timer timerAccessPoints : Timer {
+ property int itteration: 0
+ interval: 3000
+ repeat: true
+ running: backend.enabled
+ onTriggered: {
+ var sign = Math.random() <= 0.5 ? 1 : -1
+
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ if ( Math.random() < 0.5 ) {
+ var strength = ( backend.allAccessPoints[j].strength + sign * 27 ) % 100;
+ if (strength < 0) {
+ strength = -1 * strength
+ }
+ backend.allAccessPoints[j].strength = strength
+ }
+ }
+ backend.accessPoints = backend.allAccessPoints
+ backend.timerAccessPoints.itteration += 1
+ }
+ }
+
+ readonly property Timer timerConnecting : Timer {
+ interval: 3000
+ repeat: false
+ onTriggered: {
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ if (backend.accessPoints[j].ssid == backend.activeAccessPoint.ssid) {
+ backend.allAccessPoints[j].connected = true
+ backend.activeAccessPoint.connected = true
+ backend.connectionStatus = WiFi.Connected
+ backend.timerConnectingTimeout.stop()
+ } else {
+ backend.allAccessPoints[j].connected = false
+ }
+ }
+ backend.accessPoints = backend.allAccessPoints
+ }
+ }
+
+ readonly property Timer timerDisconnecting : Timer {
+ interval: 500
+ repeat: false
+ onTriggered: {
+ backend.activeAccessPoint.ssid = ""
+ backend.activeAccessPoint.connected = false
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ backend.allAccessPoints[j].connected = false
+ backend.connectionStatus = WiFi.Disconnected
+ }
+ backend.accessPoints = backend.allAccessPoints
+ }
+ }
+
+ readonly property Timer timerConnectingTimeout : Timer {
+ interval: 180000
+ repeat: false
+ onTriggered: {
+ if ( backend.connectionStatus == WiFi.Connecting ) {
+ backend.errorString = "Connection timeout."
+ backend.connectionStatus = WiFi.Disconnected
+ backend.activeAccessPoint.ssid = ""
+ backend.activeAccessPoint.connected = false
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ backend.allAccessPoints[j].connected = false
+ }
+ backend.accessPoints = backend.allAccessPoints
+ }
+ }
+ }
+
+ function connectToAccessPoint(qtIviReply, ssid) {
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ if (backend.accessPoints[j].ssid == ssid) {
+ var security = backend.allAccessPoints[j].security
+ backend.connectionStatus = WiFi.Connecting
+ backend.activeAccessPoint.ssid = ssid
+ if (security != WiFi.NoSecurity) {
+ backend.credentialsRequested(ssid)
+ } else {
+ timerConnecting.start()
+ backend.timerConnectingTimeout.restart()
+ }
+ break
+ }
+ }
+
+ qtIviReply.setSuccess(0)
+ return qtIviReply
+ }
+
+
+ function sendCredentials(qtIviReply, ssid, password) {
+ var success = false;
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ if ( backend.activeAccessPoint.ssid == backend.allAccessPoints[j].ssid ) {
+ timerConnecting.start()
+ backend.timerConnectingTimeout.restart()
+ success = true
+ break
+ }
+ }
+
+ if (success) {
+ qtIviReply.setSuccess(0)
+ } else {
+ qtIviReply.setFailed()
+ }
+ return qtIviReply
+ }
+
+ function disconnectFromAccessPoint(qtIviReply, ssid) {
+ backend.connectionStatus = WiFi.Disconnecting
+ timerDisconnecting.start()
+ qtIviReply.setSuccess(0)
+ return qtIviReply
+ }
+
+ readonly property Connections backendSignals: Connections {
+ target: backend
+ onEnabledChanged: {
+ if (!backend.enabled) {
+ for (var j = 0; j < backend.allAccessPoints.length; j++) {
+ backend.allAccessPoints[j].connected = false
+ }
+ backend.accessPoints = backend.allAccessPoints
+ backend.activeAccessPoint.ssid = ""
+ backend.activeAccessPoint.connected = false
+ backend.connectionStatus = WiFi.Disconnected
+
+ backend.timerConnectingTimeout.stop()
+ }
+ }
+ }
+ }
+}
diff --git a/src/connectivity/wifi_simulation/wifi_simulation.pro b/src/connectivity/wifi_simulation/wifi_simulation.pro
new file mode 100644
index 00000000..5546c090
--- /dev/null
+++ b/src/connectivity/wifi_simulation/wifi_simulation.pro
@@ -0,0 +1,28 @@
+TEMPLATE = lib
+TARGET = $$qtLibraryTarget(wifi_simulation)
+CONFIG += ivigenerator plugin
+
+QT += core ivicore
+QT_FOR_CONFIG += ivicore
+!qtConfig(ivigenerator): error("No ivigenerator available: Make sure QtIvi is installed and configured correctly")
+
+LIBS += -L$$LIB_DESTDIR -l$$qtLibraryTarget(Connectivity)
+DESTDIR = $$BUILD_DIR/qtivi
+
+include($$SOURCE_DIR/config.pri)
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../connectivity.qface
+PLUGIN_TYPE = qtivi
+
+INCLUDEPATH += $$OUT_PWD/../connectivity
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH = $$OUT_PWD/../connectivity/qml
+
+QMAKE_RPATHDIR += $$QMAKE_REL_RPATH_BASE/$$relative_path($$INSTALL_PREFIX/neptune3/lib, $$INSTALL_PREFIX/neptune3/qtivi)
+
+target.path = $$INSTALL_PREFIX/neptune3/qtivi
+INSTALLS += target
+
+RESOURCES += plugin_resource.qrc
diff --git a/src/src.pro b/src/src.pro
index 89fb51e2..3b496a5f 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -2,7 +2,8 @@ TEMPLATE = subdirs
SUBDIRS += neptune3-ui
SUBDIRS += remotesettings \
- drivedata
+ drivedata \
+ connectivity
#build Qt Safe Renderer Cluster
qtHaveModule(qtsaferenderer):load(qtsaferenderer-tools):qtsaferenderer-tools-available {