Add WiFi scan results page
This commit is contained in:
@@ -20,17 +20,17 @@ find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick WebSockets LinguistTools)
|
|||||||
qt_standard_project_setup(REQUIRES 6.6 I18N_TRANSLATED_LANGUAGES de)
|
qt_standard_project_setup(REQUIRES 6.6 I18N_TRANSLATED_LANGUAGES de)
|
||||||
|
|
||||||
qt_add_executable(evcharger-app WIN32 MACOSX_BUNDLE
|
qt_add_executable(evcharger-app WIN32 MACOSX_BUNDLE
|
||||||
apikeyvaluehelper.cpp
|
apikeyvaluehelper.cpp
|
||||||
apikeyvaluehelper.h
|
apikeyvaluehelper.h
|
||||||
appsettings.cpp
|
appsettings.cpp
|
||||||
appsettings.h
|
appsettings.h
|
||||||
deviceconnection.cpp
|
deviceconnection.cpp
|
||||||
deviceconnection.h
|
deviceconnection.h
|
||||||
devicesmodel.cpp
|
devicesmodel.cpp
|
||||||
devicesmodel.h
|
devicesmodel.h
|
||||||
main.cpp
|
main.cpp
|
||||||
sendmessagehelper.cpp
|
sendmessagehelper.cpp
|
||||||
sendmessagehelper.h
|
sendmessagehelper.h
|
||||||
)
|
)
|
||||||
|
|
||||||
qt6_add_translations(evcharger-app
|
qt6_add_translations(evcharger-app
|
||||||
@@ -121,6 +121,7 @@ qt_add_qml_module(evcharger-app
|
|||||||
WiFiErrorsPage.qml
|
WiFiErrorsPage.qml
|
||||||
WiFiOnOffSwitch.qml
|
WiFiOnOffSwitch.qml
|
||||||
WiFiPage.qml
|
WiFiPage.qml
|
||||||
|
WiFiScanPage.qml
|
||||||
RESOURCES
|
RESOURCES
|
||||||
icons/Charger.svg
|
icons/Charger.svg
|
||||||
icons/ChargerV3.svg
|
icons/ChargerV3.svg
|
||||||
|
@@ -126,19 +126,19 @@ StackView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
source: {
|
source: {
|
||||||
if (devicetype.value == 'go-eCharger_V5' ||
|
if (devicetype.value == "go-eCharger_V5" ||
|
||||||
devicetype.value == 'go-eCharger_V4')
|
devicetype.value == "go-eCharger_V4")
|
||||||
{
|
{
|
||||||
if (isgo.value)
|
if (isgo.value)
|
||||||
return "images/geminiFlex.png"
|
return "images/geminiFlex.png"
|
||||||
else
|
else
|
||||||
return "images/geminiFix.png"
|
return "images/geminiFix.png"
|
||||||
} else if (devicetype.value == 'wattpilot_V2') {
|
} else if (devicetype.value == "wattpilot_V2") {
|
||||||
return "images/wattpilot.png"
|
return "images/wattpilot.png"
|
||||||
} else if (devicetype.value == 'go-eCharger' ||
|
} else if (devicetype.value == "go-eCharger" ||
|
||||||
devicetype.value == 'wattpilot') {
|
devicetype.value == "wattpilot") {
|
||||||
return "images/homeFix.png"
|
return "images/homeFix.png"
|
||||||
} else if (devicetype.value == 'go-eCharger_Phoenix') {
|
} else if (devicetype.value == "go-eCharger_Phoenix") {
|
||||||
return "images/phoenix.png"
|
return "images/phoenix.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -170,17 +170,17 @@ StackView {
|
|||||||
height: parent.height
|
height: parent.height
|
||||||
//Layout.fillHeight: true
|
//Layout.fillHeight: true
|
||||||
source: {
|
source: {
|
||||||
if (delegate.deviceType == 'go-eCharger_V5' ||
|
if (delegate.deviceType == "go-eCharger_V5" ||
|
||||||
delegate.deviceType == 'go-eCharger_V4' ||
|
delegate.deviceType == "go-eCharger_V4" ||
|
||||||
delegate.deviceType == 'wattpilot_V2')
|
delegate.deviceType == "wattpilot_V2")
|
||||||
{
|
{
|
||||||
return "icons/ChargerV4.svg"
|
return "icons/ChargerV4.svg"
|
||||||
} else if (delegate.deviceType == 'go-eCharger' ||
|
} else if (delegate.deviceType == "go-eCharger" ||
|
||||||
delegate.deviceType == 'wattpilot') {
|
delegate.deviceType == "wattpilot") {
|
||||||
return "icons/ChargerV3.svg"
|
return "icons/ChargerV3.svg"
|
||||||
} else if (delegate.deviceType == 'go-eCharger_Phoenix') {
|
} else if (delegate.deviceType == "go-eCharger_Phoenix") {
|
||||||
return "icons/Charger.svg"
|
return "icons/Charger.svg"
|
||||||
} else if (delegate.deviceType.includes('controller')) {
|
} else if (delegate.deviceType.includes("controller")) {
|
||||||
return "icons/Controller.svg"
|
return "icons/Controller.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,6 +293,7 @@ StackView {
|
|||||||
Button {
|
Button {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Solala")
|
text: qsTr("Solala")
|
||||||
|
onClicked: deviceSelected("wss://solalaweb.com/" + delegate.serial, delegate.password)
|
||||||
visible: theSettings.showSolalaweb
|
visible: theSettings.showSolalaweb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -180,12 +180,12 @@ NavigationPage {
|
|||||||
text: {
|
text: {
|
||||||
switch (updateStatus.value)
|
switch (updateStatus.value)
|
||||||
{
|
{
|
||||||
case 0: return 'Idle'
|
case 0: return "Idle"
|
||||||
case 1: return 'Updating'
|
case 1: return "Updating"
|
||||||
case 2: return 'Failed'
|
case 2: return "Failed"
|
||||||
case 3: return 'Succeeded'
|
case 3: return "Succeeded"
|
||||||
case 4: return 'NotReady'
|
case 4: return "NotReady"
|
||||||
case 5: return 'Verifying'
|
case 5: return "Verifying"
|
||||||
default: return updateStatus.value
|
default: return updateStatus.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ NavigationPage {
|
|||||||
apiKey: "ocl"
|
apiKey: "ocl"
|
||||||
}
|
}
|
||||||
|
|
||||||
text: updateProgress.value + ' / ' + updateLength.value
|
text: updateProgress.value + " / " + updateLength.value
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBar {
|
ProgressBar {
|
||||||
|
@@ -47,12 +47,12 @@ ColumnLayout {
|
|||||||
|
|
||||||
const hours = duration%24;
|
const hours = duration%24;
|
||||||
|
|
||||||
return (wasNegative ? qsTr('%0 ago') : qsTr('in %0'))
|
return (wasNegative ? qsTr("%0 ago") : qsTr("in %0"))
|
||||||
.arg(
|
.arg(
|
||||||
(hours < 10 ? '0' : '') + hours + ':' +
|
(hours < 10 ? "0" : "") + hours + ":" +
|
||||||
(minutes < 10 ? '0' : '') + minutes + ':' +
|
(minutes < 10 ? "0" : "") + minutes + ":" +
|
||||||
(seconds < 10 ? '0' : '') + seconds + '.' +
|
(seconds < 10 ? "0" : "") + seconds + "." +
|
||||||
(milliseconds < 100 ? '0' : '') + (milliseconds < 10 ? '0' : '') + milliseconds)
|
(milliseconds < 100 ? "0" : "") + (milliseconds < 10 ? "0" : "") + milliseconds)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ ItemDelegate {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
background.radius = 5
|
background.radius = 5
|
||||||
background.color = 'white'
|
background.color = "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: stackView.push(navigationItem.component)
|
onClicked: stackView.push(navigationItem.component)
|
||||||
|
@@ -16,7 +16,7 @@ Text {
|
|||||||
if (request.response.type == "response") {
|
if (request.response.type == "response") {
|
||||||
if (request.response.success)
|
if (request.response.success)
|
||||||
return "OK"
|
return "OK"
|
||||||
if ('message' in request.response)
|
if ("message" in request.response)
|
||||||
return request.response.message
|
return request.response.message
|
||||||
}
|
}
|
||||||
return JSON.stringify(request.response)
|
return JSON.stringify(request.response)
|
||||||
|
@@ -31,7 +31,7 @@ NavigationPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: '>'
|
text: ">"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ ItemDelegate {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
background.radius = 5
|
background.radius = 5
|
||||||
background.color = 'white'
|
background.color = "white"
|
||||||
contentItem.children[0].color = navigationItem.color
|
contentItem.children[0].color = navigationItem.color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
WiFiPage.qml
34
WiFiPage.qml
@@ -29,23 +29,35 @@ NavigationPage {
|
|||||||
text: {
|
text: {
|
||||||
switch (staStatus.value)
|
switch (staStatus.value)
|
||||||
{
|
{
|
||||||
case 0: return 'IDLE_STATUS'
|
case 0: return "IDLE_STATUS"
|
||||||
case 1: return 'NO_SSID_AVAIL'
|
case 1: return "NO_SSID_AVAIL"
|
||||||
case 2: return 'SCAN_COMPLETED'
|
case 2: return "SCAN_COMPLETED"
|
||||||
case 3: return 'CONNECTED'
|
case 3: return "CONNECTED"
|
||||||
case 4: return 'CONNECT_FAILED'
|
case 4: return "CONNECT_FAILED"
|
||||||
case 5: return 'CONNECTION_LOST'
|
case 5: return "CONNECTION_LOST"
|
||||||
case 6: return 'DISCONNECTED'
|
case 6: return "DISCONNECTED"
|
||||||
case 7: return 'CONNECTING'
|
case 7: return "CONNECTING"
|
||||||
case 8: return 'DISCONNECTING'
|
case 8: return "DISCONNECTING"
|
||||||
case 9: return 'NO_SHIELD'
|
case 9: return "NO_SHIELD"
|
||||||
case 10: return 'WAITING_FOR_IP'
|
case 10: return "WAITING_FOR_IP"
|
||||||
default: return staStatus.value
|
default: return staStatus.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
ApiKeyValueHelper {
|
||||||
|
id: wifiScanResult
|
||||||
|
deviceConnection: mainScreen.deviceConnection
|
||||||
|
apiKey: "scan"
|
||||||
|
}
|
||||||
|
|
||||||
|
text: qsTr("(%0) Wi-Fi Scan").arg(wifiScanResult.value == null ? 0 : wifiScanResult.value.length)
|
||||||
|
onClicked: stackView.push("WiFiScanPage.qml", {wifiScanResult} )
|
||||||
|
enabled: wifiScanResult.value != null
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
ApiKeyValueHelper {
|
ApiKeyValueHelper {
|
||||||
id: wifiErrorLog
|
id: wifiErrorLog
|
||||||
|
122
WiFiScanPage.qml
Normal file
122
WiFiScanPage.qml
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import EVChargerApp
|
||||||
|
|
||||||
|
BaseNavigationPage {
|
||||||
|
property ApiKeyValueHelper wifiScanResult
|
||||||
|
|
||||||
|
title: qsTr("Wi-Fi Scan Result")
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: listView
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
model: wifiScanResult.value
|
||||||
|
spacing: 5
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
delegate: WhiteBox {
|
||||||
|
required property var modelData
|
||||||
|
property var theModelData: modelData
|
||||||
|
|
||||||
|
width: listView.width
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
columns: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("SSID:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.ssid
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Authmode:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: {
|
||||||
|
switch (modelData.encryptionType)
|
||||||
|
{
|
||||||
|
case 0: return qsTr("OPEN")
|
||||||
|
case 1: return qsTr("WEP")
|
||||||
|
case 2: return qsTr("WPA_PSK")
|
||||||
|
case 3: return qsTr("WPA2_PSK")
|
||||||
|
case 4: return qsTr("WPA_WPA2_PSK")
|
||||||
|
case 5: return qsTr("WPA2_ENTERPRISE")
|
||||||
|
case 6: return qsTr("WPA3_PSK")
|
||||||
|
case 7: return qsTr("WPA2_WPA3_PSK")
|
||||||
|
case 8: return qsTr("WAPI_PSK")
|
||||||
|
case 9: return qsTr("OWE")
|
||||||
|
case 10: return qsTr("WPA3_ENT_192")
|
||||||
|
case 11: return qsTr("WPA3_EXT_PSK")
|
||||||
|
case 12: return qsTr("WPA3_EXT_PSK_MIXED_MODE")
|
||||||
|
}
|
||||||
|
return modelData.encryptionType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function wiFiCipherToString(cipher) {
|
||||||
|
const names = ['NONE', 'WEP40', 'WEP104', 'TKIP', 'CCMP', 'TKIP_CCMP', 'AES_CMAC128', 'SMS4', 'GCMP', 'GCMP256', 'AES_GMAC128', 'AES_GMAC256', 'UNKNOWN'];
|
||||||
|
|
||||||
|
if (cipher >= 0 && cipher < names.length)
|
||||||
|
return names[cipher];
|
||||||
|
|
||||||
|
return cipher;
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Pairwise cipher:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: parent.wiFiCipherToString("f" in modelData ? modelData.f[0] : modelData.pairwiseCipher)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Group cipher:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: parent.wiFiCipherToString("f" in modelData ? modelData.f[1] : modelData.groupCipher)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("RSSI:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.rssi
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Channel:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.channel
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("BSSID:")
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.bssid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
qmldir
1
qmldir
@@ -71,3 +71,4 @@ EVChargerApp 1.0 WhiteBox.qml
|
|||||||
EVChargerApp 1.0 WiFiErrorsPage.qml
|
EVChargerApp 1.0 WiFiErrorsPage.qml
|
||||||
EVChargerApp 1.0 WiFiOnOffSwitch.qml
|
EVChargerApp 1.0 WiFiOnOffSwitch.qml
|
||||||
EVChargerApp 1.0 WiFiPage.qml
|
EVChargerApp 1.0 WiFiPage.qml
|
||||||
|
EVChargerApp 1.0 WiFiScanPage.qml
|
||||||
|
Reference in New Issue
Block a user