From 458eba1f8ffb6263166722220c953fa581235f85 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 01:08:23 +0200 Subject: [PATCH 1/6] Added authentication on App side --- OmobiDisplayApp/omobidisplaybackend.cpp | 33 ++++++--- OmobiDisplayApp/omobidisplaybackend.h | 3 + .../ressources/qml/ConnectPage.qml | 74 +++++++++++++++++++ .../ressources/qml/TextInputDelegate.qml | 2 + OmobiDisplayApp/ressources/qml/main.qml | 16 ++++ 5 files changed, 116 insertions(+), 12 deletions(-) diff --git a/OmobiDisplayApp/omobidisplaybackend.cpp b/OmobiDisplayApp/omobidisplaybackend.cpp index ff3cc48..48602cd 100644 --- a/OmobiDisplayApp/omobidisplaybackend.cpp +++ b/OmobiDisplayApp/omobidisplaybackend.cpp @@ -24,10 +24,6 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) this->setState(Idle); this->ble->startScanningForDevices(); - - qDebug() << QCryptographicHash::hash("HalloTest", QCryptographicHash::Sha256).toHex(); - // dd86fcfda3a20cbb8fbb3026a84550e0d70c2c79e7e8e36d6ffa04b9eef0401f - // dd86fcfda3a20cbb8fbb3026a84550e0d70c2c79e7e8e36d6ffa04b9eef0401f } @@ -35,6 +31,15 @@ void OmobiDisplayBackend::startScanning() { this->ble->startScanningForDevices(); } +void OmobiDisplayBackend::authenticate(QString code) { + // tell display to send over existing model data + this->setState(Authenticating); + QString combinedCode = this->ble->getCurrentDevice()->getAddress().toUpper() + code; + QString secret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex(); + + this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", secret}}); +} + void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state){ switch(state){ case QBluetoothLeUart::Idle: { @@ -74,12 +79,8 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::Bluetooth } void OmobiDisplayBackend::handleBluetoothDeviceConected() { - this->setState(Initing); - - // tell display to send over existing model data - this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", QCryptographicHash::hash("1234", QCryptographicHash::Sha256).toHex()}}); - this->sendBluetoothCommand(GetAllTextSetsCommand); - this->sendBluetoothCommand(GetDisplayBrightnessCommand); + this->setState(AuthenticationRequired); + // TODO: stuff } void OmobiDisplayBackend::handleFoundNewDevice(QBluetoothLeUartDevice* device) { @@ -149,8 +150,16 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ switch (header) { case AuthorizeSessionCommand: { - // TODO: handle error - this->refreshLoadingState(); + if(status != Success) { + this->setState(AuthenticationRequired); + return; + } + + this->waitingCommands = 0; + this->setState(Initing); + this->sendBluetoothCommand(GetAllTextSetsCommand); + this->sendBluetoothCommand(GetDisplayBrightnessCommand); + break; } case KeepAliveCommand: { diff --git a/OmobiDisplayApp/omobidisplaybackend.h b/OmobiDisplayApp/omobidisplaybackend.h index f0bdfdb..f9a5fec 100644 --- a/OmobiDisplayApp/omobidisplaybackend.h +++ b/OmobiDisplayApp/omobidisplaybackend.h @@ -25,6 +25,8 @@ public: Scanning, ReadyToConnect, Connecting, + AuthenticationRequired, + Authenticating, Initing, Connected, Loading @@ -57,6 +59,7 @@ private: public slots: Q_INVOKABLE void startScanning(); + Q_INVOKABLE void authenticate(QString secret); Q_INVOKABLE QBluetoothLeUart* getBleController(); Q_INVOKABLE OmobiDisplayAppState getState(); Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); diff --git a/OmobiDisplayApp/ressources/qml/ConnectPage.qml b/OmobiDisplayApp/ressources/qml/ConnectPage.qml index b765333..e28c844 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectPage.qml @@ -126,6 +126,45 @@ Page { } } + Dialog { + id: authenticationDialog + + property bool shouldBeOpened: false + + parent: Overlay.overlay + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + + width: parent.width * 0.9 + + modal: true + closePolicy: Popup.NoAutoClose + standardButtons: Dialog.Ok | Dialog.Cancel + + title: qsTr("Input code") + + onShouldBeOpenedChanged: { + if(shouldBeOpened) + open() + else + close() + } + + onAccepted: { + backend.authenticate(secretTextInput.text) + } + + onRejected: { + backend.bleController.disconnectFromDevice() + } + + contentItem: TextField { + id: secretTextInput + placeholderText: qsTr("code") + Keys.onReturnPressed: authenticationDialog.accept() + } + } + states: [ State { name: OmobiDisplayBackend.Idle @@ -154,6 +193,41 @@ Page { working: false } }, + + State { + name: OmobiDisplayBackend.AuthenticationRequired + + PropertyChanges { + target: authenticationDialog + shouldBeOpened: true + } + + PropertyChanges { + target: availableDevicesListView + enabled: false + } + + PropertyChanges { + target: root + statusText: "trying to authenticate..." + working: true + } + }, + State { + name: OmobiDisplayBackend.Authenticating + + PropertyChanges { + target: availableDevicesListView + enabled: false + } + + PropertyChanges { + target: root + statusText: "trying to authenticate..." + working: true + } + }, + State { name: OmobiDisplayBackend.Connecting diff --git a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml index e60d694..0e708ad 100644 --- a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml @@ -73,6 +73,8 @@ ItemDelegate { placeholderText: control.placeholderText text: control.value + + Keys.onReturnPressed: textEditDialog.accept() } onAccepted: { diff --git a/OmobiDisplayApp/ressources/qml/main.qml b/OmobiDisplayApp/ressources/qml/main.qml index 8cb292e..5d62b80 100644 --- a/OmobiDisplayApp/ressources/qml/main.qml +++ b/OmobiDisplayApp/ressources/qml/main.qml @@ -104,6 +104,22 @@ ApplicationWindow { } }, + State { + name: OmobiDisplayBackend.AuthenticationRequired + PropertyChanges { + target: mainStack + currentComponent: connectPageComp + } + }, + + State { + name: OmobiDisplayBackend.Authenticating + PropertyChanges { + target: mainStack + currentComponent: connectPageComp + } + }, + State { name: OmobiDisplayBackend.Initing PropertyChanges { From 2edc225c35eac934a8d11f4137c2670225fae066 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 01:08:43 +0200 Subject: [PATCH 2/6] Added authentication on ESP side --- .../include/BluetoothLeUartServer.h | 2 ++ .../include/EepromManager.h | 9 ++--- .../src/BluetoothLeUartServer.cpp | 34 ++++++++++++------- .../src/EepromManager.cpp | 1 - .../src/OmobiLedDisplay.cpp | 7 ++-- vscode/OmobiLEDdisplayBluetooth/src/main.cpp | 2 +- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/vscode/OmobiLEDdisplayBluetooth/include/BluetoothLeUartServer.h b/vscode/OmobiLEDdisplayBluetooth/include/BluetoothLeUartServer.h index 5421e4c..f957974 100644 --- a/vscode/OmobiLEDdisplayBluetooth/include/BluetoothLeUartServer.h +++ b/vscode/OmobiLEDdisplayBluetooth/include/BluetoothLeUartServer.h @@ -62,6 +62,8 @@ public: bool getDeviceConnected(); bool disconnectCurrentDevice(); + String getDeviceAddress(); + protected: // callbacks for BLEServer void onConnect(BLEServer *pServer, esp_ble_gatts_cb_param_t *param) override; diff --git a/vscode/OmobiLEDdisplayBluetooth/include/EepromManager.h b/vscode/OmobiLEDdisplayBluetooth/include/EepromManager.h index e38964e..ce1b5f5 100644 --- a/vscode/OmobiLEDdisplayBluetooth/include/EepromManager.h +++ b/vscode/OmobiLEDdisplayBluetooth/include/EepromManager.h @@ -27,25 +27,22 @@ private: template const T &writeToEeprom(int address, size_t size, const T &t) { - Serial.println("Writing at: " + String(address) + " size: " + String(sizeof(T))); if (sizeof(T) > size) { - Serial.println("Error writing: Size should be: " + String(size)); + Serial.println("[Error][EepromManager] writing: Size should be: " + String(size) + " but was: " + String(sizeof(T))); return t; } const T &res = EEPROM.put(address, t); - Serial.println("Eeprom commit returned: " + String(EEPROM.commit())); + EEPROM.commit(); return res; } template T &readFromEeprom(int address, size_t size, T &t) { - Serial.println("Reading at: " + String(address) + " size: " + String(sizeof(T))); - if (sizeof(T) > size) { - Serial.println("Error reading: Size should be: " + String(size)); + Serial.println("[Error][EepromManager] reading: Size should be: " + String(size) + " but was: " + String(sizeof(T))); return t; } diff --git a/vscode/OmobiLEDdisplayBluetooth/src/BluetoothLeUartServer.cpp b/vscode/OmobiLEDdisplayBluetooth/src/BluetoothLeUartServer.cpp index 6ed7215..f6ec47a 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/BluetoothLeUartServer.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/BluetoothLeUartServer.cpp @@ -56,6 +56,27 @@ void BluetoothLeUartServer::sendData(String data) txCharacteristic->notify(); } +bool BluetoothLeUartServer::getDeviceConnected() +{ + return this->deviceConnected; +} + +bool BluetoothLeUartServer::disconnectCurrentDevice() { + if(!this->getDeviceConnected()) + return false; + + this->bleServer->disconnect(this->deviceConnectionId); + return true; +} + +String BluetoothLeUartServer::getDeviceAddress() { + + String address = BLEDevice::getAddress().toString().c_str(); + address.toUpperCase(); + + return address; +} + void BluetoothLeUartServer::onConnect(BLEServer* pServer, esp_ble_gatts_cb_param_t *param) { // only allow one device @@ -84,17 +105,4 @@ void BluetoothLeUartServer::onWrite(BLECharacteristic *rxCharacteristic) { if (this->callbacks != nullptr) this->callbacks->onDataReceived(rxCharacteristic->getValue().c_str()); -} - -bool BluetoothLeUartServer::getDeviceConnected() -{ - return this->deviceConnected; -} - -bool BluetoothLeUartServer::disconnectCurrentDevice() { - if(!this->getDeviceConnected()) - return false; - - this->bleServer->disconnect(this->deviceConnectionId); - return true; } \ No newline at end of file diff --git a/vscode/OmobiLEDdisplayBluetooth/src/EepromManager.cpp b/vscode/OmobiLEDdisplayBluetooth/src/EepromManager.cpp index 5deb52d..22c7370 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/EepromManager.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/EepromManager.cpp @@ -8,7 +8,6 @@ EepromManager::EepromManager() EepromUnit *EepromManager::registerEempromUnit(size_t size) { - Serial.println("Registering new EepromUnit with size: " + String(size) + " at " + String(this->currentAddressEnding)); // create a new Unit at the current address ending EepromUnit *newUnit = new EepromUnit(this, this->currentAddressEnding, size); // move the new address ending diff --git a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp index 7367518..bc85f0b 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp @@ -65,18 +65,21 @@ void OmobiLedDisplay::onDataReceived(String dataString) OmobiDisplayStatusCode replyStatus = InternalError; JsonObject replyData = replyDoc.createNestedObject("data"); - if (requestHeader != AuthorizeSessionCommand && !this->sessionAuthorized) + if (requestHeader > KeepAliveCommand && !this->sessionAuthorized) replyStatus = Unauthorized; else switch (requestHeader) { case AuthorizeSessionCommand: { + String combinedCode = this->bleServer->getDeviceAddress() + String(this->properties.deviceCode); + String secret = this->sha256(combinedCode); + if (this->sessionAuthorized) { replyStatus = Success; } - else if (requestData["secret"] == this->sha256(this->properties.deviceCode)) + else if (requestData["secret"] == secret) { replyStatus = Success; this->sessionAuthorized = true; diff --git a/vscode/OmobiLEDdisplayBluetooth/src/main.cpp b/vscode/OmobiLEDdisplayBluetooth/src/main.cpp index ba685d7..919e2d6 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/main.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/main.cpp @@ -13,7 +13,7 @@ void setup() Adafruit_NeoMatrix *displayMatrix = new Adafruit_NeoMatrix( 8, 8, - 1, + 2, 1, PIN, NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS + NEO_TILE_PROGRESSIVE + From 72ab73b28085349b4172719bbbbb5c60ba011714 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 03:22:37 +0200 Subject: [PATCH 3/6] made name and code modifiable --- OmobiDisplayApp/OmobiDisplayApp.pro | 2 +- OmobiDisplayApp/omobidisplaybackend.cpp | 22 ++-- OmobiDisplayApp/omobidisplaybackend.h | 6 +- OmobiDisplayApp/ressources/qml/Chip.qml | 39 +++++- .../ressources/qml/ConnectPage.qml | 1 + .../ressources/qml/ConnectedPage.qml | 28 ++++- .../ressources/qml/DisplayEditDialog.qml | 91 ++++++++++++++ .../ressources/qml/PasswordInputDelegate.qml | 119 ++++++++++++++++++ .../ressources/qml/TextEditDialog.qml | 3 - OmobiDisplayApp/ressources/qml/main.qml | 5 + OmobiDisplayApp/ressources/qml/qml.qrc | 2 + .../ressources/shared/fa5regular.woff | Bin 0 -> 16800 bytes OmobiDisplayApp/ressources/shared/shared.qrc | 1 + .../include/OmobiLedDisplay.h | 5 +- .../src/OmobiLedDisplay.cpp | 33 ++++- 15 files changed, 338 insertions(+), 19 deletions(-) create mode 100644 OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml create mode 100644 OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml create mode 100644 OmobiDisplayApp/ressources/shared/fa5regular.woff diff --git a/OmobiDisplayApp/OmobiDisplayApp.pro b/OmobiDisplayApp/OmobiDisplayApp.pro index 696c527..900cbb2 100644 --- a/OmobiDisplayApp/OmobiDisplayApp.pro +++ b/OmobiDisplayApp/OmobiDisplayApp.pro @@ -1,4 +1,4 @@ -QT += quick bluetooth +QT += quick bluetooth quickcontrols2 CONFIG += c++11 TARGET = OmobiDisplayApp diff --git a/OmobiDisplayApp/omobidisplaybackend.cpp b/OmobiDisplayApp/omobidisplaybackend.cpp index 48602cd..b9dbcc4 100644 --- a/OmobiDisplayApp/omobidisplaybackend.cpp +++ b/OmobiDisplayApp/omobidisplaybackend.cpp @@ -209,16 +209,14 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ this->refreshLoadingState(); break; } - case SetTextSetParameterCommand: { + case SetTextSetParameterCommand: + case SetDisplayBrightnessCommand: + case SetDisplayCodeCommand: + case SetDisplayNameCommand: // TODO: Error handling this->refreshLoadingState(); break; - } - case SetDisplayBrightnessCommand: { - // TODO: Error handling - this->refreshLoadingState(); - break; - } + } } @@ -296,3 +294,13 @@ void OmobiDisplayBackend::setDisplayBrightness(int brightness) { emit this->displayBrightnessChanged(); } + + +void OmobiDisplayBackend::setDisplayCode(QString code) { + this->sendBluetoothCommand(SetDisplayCodeCommand, QVariantMap{{"displayCode",code}}); +} + +void OmobiDisplayBackend::setDisplayName(QString name) { + // This will restart the display!! + this->sendBluetoothCommand(SetDisplayNameCommand, QVariantMap{{"displayName", name}}); +} diff --git a/OmobiDisplayApp/omobidisplaybackend.h b/OmobiDisplayApp/omobidisplaybackend.h index f9a5fec..377fe2a 100644 --- a/OmobiDisplayApp/omobidisplaybackend.h +++ b/OmobiDisplayApp/omobidisplaybackend.h @@ -41,7 +41,9 @@ private: GetTextSetParameterCommand = 11, GetDisplayBrightnessCommand = 12, SetTextSetParameterCommand = 20, - SetDisplayBrightnessCommand = 21 + SetDisplayBrightnessCommand = 21, + SetDisplayCodeCommand = 22, + SetDisplayNameCommand = 23 }; enum OmobiDisplayStatusCode { @@ -65,6 +67,8 @@ public slots: Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE int getDisplayBrightness(); Q_INVOKABLE void setDisplayBrightness(int brightness); + Q_INVOKABLE void setDisplayCode(QString code); + Q_INVOKABLE void setDisplayName(QString name); private slots: void handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state); diff --git a/OmobiDisplayApp/ressources/qml/Chip.qml b/OmobiDisplayApp/ressources/qml/Chip.qml index 32ce03b..601f1e0 100644 --- a/OmobiDisplayApp/ressources/qml/Chip.qml +++ b/OmobiDisplayApp/ressources/qml/Chip.qml @@ -1,6 +1,10 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtGraphicalEffects 1.12 +import QtQuick.Templates 2.12 as T +import QtQuick.Controls.impl 2.12 +import QtQuick.Controls.Material 2.12 +import QtQuick.Controls.Material.impl 2.12 Item { id: control @@ -15,6 +19,7 @@ Item { property bool glowVisible: true property double glowScale: 0.9 property double glowOpacity: Math.pow( control.opacity, 100 ) + property bool interactive: true signal clicked @@ -49,10 +54,42 @@ Item { anchors.fill: parent color: control.color radius: height * 0.5 + clip: true Behavior on color { ColorAnimation {} } + + + Ripple { + id: ripple + clipRadius: height + clip: true + width: parent.width + height: parent.height + pressed: mouseArea.pressed + anchor: background + active: mouseArea.pressed || mouseArea.visualFocus || mouseArea.containsMouse + color: control.Material.rippleColor + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Item { + width: ripple.width + height: ripple.height + Rectangle { + anchors.fill: parent + radius: Math.min(width, height) * 0.5 + } + } + } + } + } + + + ColorOverlay { + source: ripple + color: "red" } Text { @@ -75,7 +112,7 @@ Item { MouseArea { id: mouseArea anchors.fill: parent - enabled: control.enabled + enabled: control.enabled && control.interactive onClicked: control.clicked() } } diff --git a/OmobiDisplayApp/ressources/qml/ConnectPage.qml b/OmobiDisplayApp/ressources/qml/ConnectPage.qml index e28c844..17e34a9 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectPage.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.0 import de.itsblue.omobidisplayapp 1.0 import de.itsblue.bluetoothleuart 1.0 import QtQuick.Controls.Material 2.0 +import QtGraphicalEffects 1.0 Page { id: root diff --git a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml index 4a98d13..b001671 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml @@ -2,6 +2,7 @@ import QtQuick 2.0 import QtQuick.Controls 2.9 import QtQuick.Layouts 1.0 import QtQuick.Controls.Material 2.0 +import QtGraphicalEffects 1.0 import de.itsblue.omobidisplayapp 1.0 import de.itsblue.bluetoothleuart 1.0 @@ -30,7 +31,28 @@ Page { color: root.Material.foreground - text: "Omobi Display 1" //backend.bleController.currentDevice.name + text: backend.bleController.currentDevice === null ? "":backend.bleController.currentDevice.name + + ToolButton { + id: editButton + anchors { + verticalCenter: parent.verticalCenter + left: parent.right + margins: parent.height * 0.1 + } + + height: parent.height * 0.7 + width: height + + font.styleName: fontAwesome.name + font.pixelSize: height * 0.3 + + flat: true + + text: "\uf044" + + onClicked: displayEditDialog.edit() + } } Text { @@ -65,6 +87,10 @@ Page { } } + DisplayEditDialog { + id: displayEditDialog + } + Dialog { id: loadingDialog diff --git a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml new file mode 100644 index 0000000..ee26b5a --- /dev/null +++ b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml @@ -0,0 +1,91 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.9 +import QtQuick.Controls.Material 2.0 + +import de.itsblue.omobidisplayapp 1.0 + +Dialog { + id: control + + parent: Overlay.overlay + + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + + width: parent.width * 0.9 + + modal: true + + title: qsTr("Edit display settings") + + onAccepted: { + backend.setDisplayCode(codeTextField.value) + backend.setDisplayName(nameTextField.value) + } + + contentItem: ColumnLayout { + id: dataFieldsGridLayout + + width: control.width * 0.9 + + TextInputDelegate { + id: nameTextField + Layout.fillWidth: true + required: true + text: qsTr("Display name\n(needs restart)") + } + + PasswordInputDelegate { + id: codeTextField + Layout.fillWidth: true + required: true + text: qsTr("Display code (4 digits)") + placeholderText: qsTr("Enter new display code") + repeatPlaceholderText: qsTr("Enter new display code again") + } + } + + + footer: DialogButtonBox { + + // alignment: Qt.AlignHCenter + buttonLayout: DialogButtonBox.GnomeLayout + + Material.background: "transparent" + + Button { + flat: true + enabled: nameTextField.value !== "" + text: "save" + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } + + Button { + flat: true + text: "cancel" + DialogButtonBox.buttonRole: DialogButtonBox.RejectRole + } + } + + function edit() { + + reset() + + nameTextField.value = backend.bleController.currentDevice.name + + open() + } + + function add(model) { + editingModel = model + editing = false + reset() + open() + } + + function reset() { + nameTextField.value = "" + codeTextField.value = "" + } +} diff --git a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml new file mode 100644 index 0000000..00326e4 --- /dev/null +++ b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml @@ -0,0 +1,119 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.9 +import QtQuick.Controls.Material 2.0 +import QtQuick.Layouts 1.0 + +ItemDelegate { + id: control + + property string value: "" + property bool required: false + property color textColor: control.required && value === "" ? "red":control.Material.foreground + property string placeholderText: "" + property string repeatPlaceholderText: "" + property int minimumLength: 4 + property int maximumLength: 4 + + onClicked: { + textField.text = value + textEditDialog.open() + } + + Text { + anchors { + right: nextPageIconText.left + verticalCenter: parent.verticalCenter + rightMargin: control.padding + } + + width: parent.width * 0.6 + elide: Text.ElideRight + font.pixelSize: parent.font.pixelSize + + horizontalAlignment: Text.AlignRight + + text: "****" + } + + Text { + id: nextPageIconText + + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + rightMargin: control.padding + } + + font.pixelSize: parent.height * 0.5 + + verticalAlignment: Text.AlignVCenter + + text: ">" + } + + Dialog { + id: textEditDialog + parent: Overlay.overlay + + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + + width: parent.width * 0.9 + + Material.theme: control.Material.theme + Material.accent: control.Material.accent + modal: true + + title: control.text + + contentItem: ColumnLayout { + TextField { + id: textField + + Layout.fillWidth: true + + placeholderText: control.placeholderText + text: control.value + + color: text.length < 4 || text.length > 4 ? "red":control.Material.foreground + } + + TextField { + id: repeatTextField + + Layout.fillWidth: true + + placeholderText: control.repeatPlaceholderText + text: control.value + + color: repeatTextField.text !== textField.text ? "red":control.Material.foreground + } + } + + + footer: DialogButtonBox { + + // alignment: Qt.AlignHCenter + buttonLayout: DialogButtonBox.GnomeLayout + + Material.background: "transparent" + + Button { + flat: true + enabled: !(textField.text.length < 4 || textField.text.length > 4) && textField.text === repeatTextField.text + text: "save" + DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole + } + + Button { + flat: true + text: "cancel" + DialogButtonBox.buttonRole: DialogButtonBox.RejectRole + } + } + + onAccepted: { + control.value = textField.text + } + } +} diff --git a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml index 9c3359a..58ba22e 100644 --- a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml +++ b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml @@ -62,9 +62,6 @@ Dialog { ColumnLayout { id: dataFieldsGridLayout - property double fontSizeMultiplier: 0.14 - property double labelWidthMultiplier: 0.4 - width: control.width * 0.9 SwitchDelegate { diff --git a/OmobiDisplayApp/ressources/qml/main.qml b/OmobiDisplayApp/ressources/qml/main.qml index 5d62b80..d7e292a 100644 --- a/OmobiDisplayApp/ressources/qml/main.qml +++ b/OmobiDisplayApp/ressources/qml/main.qml @@ -42,6 +42,11 @@ ApplicationWindow { id: backend } + FontLoader { + id: fontAwesome + source: "qrc:/fa5regular.woff" + } + StackView { id: mainStack diff --git a/OmobiDisplayApp/ressources/qml/qml.qrc b/OmobiDisplayApp/ressources/qml/qml.qrc index 0875c94..20565fe 100644 --- a/OmobiDisplayApp/ressources/qml/qml.qrc +++ b/OmobiDisplayApp/ressources/qml/qml.qrc @@ -13,5 +13,7 @@ ColorPickerDelegate.qml ColorPicker.qml Chip.qml + DisplayEditDialog.qml + PasswordInputDelegate.qml diff --git a/OmobiDisplayApp/ressources/shared/fa5regular.woff b/OmobiDisplayApp/ressources/shared/fa5regular.woff new file mode 100644 index 0000000000000000000000000000000000000000..24de566a5c97289a86ce0c238a195da0d3251263 GIT binary patch literal 16800 zcmZ5{V~{9K%Y465lccMrGSxMmiJP35 z7yux^uL$M?!2UOe&;UvU!TdM-|3yqp`40d9Aj2<@{R^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jaH5EZVlhRj9o{l7@b{u;+Ui#drSG zo2RCiWp(yI-bM9R@n6o^D4V$*u^}vHlVl|uPdy*gbv*87?0Vhyynv9Xk;oDV0_U4> z_K>@sUkiV0`pN+LH(T?I-$HI{_)iTOg5?n7{(QXT%|^`re0{h2Imhlpbe@Ud1A@$NOCW- zN0;2e<_ti@w?+Ez@$6i754w=1U>F-E;2iIP~_71tdZ8>T#wWen>ivqWBSp# z@0v}aRj(zFCu4ypEzPjL)8-Q~ z2B*IlygQ5pwY|@Um)T8cXp;uFHJ);Q(RqccmxUacSRv34^^7ilL@WoQ-T21XpUN!A8_jHb`4o2SK9npyLtA`fTI-C_k1)jA8^I}9y74X>_sU6ol;p;M!0 z#gsy$>}fcvOa9n(mCWHm9V}qj*OkwgC=7Zq0ct&7+GdDZS0HNSJ(EZ9Q}rg zi+WS5%FqoBF(0{!hD~3vI?D%s^b1B!*wk(FzM{ReqSzX3y5=G!g|Ie??DegeHM6=< f^T0hF-L{XeT%c=JDXyt+xV@DB10tt^kN^Mx@BjzA literal 0 HcmV?d00001 diff --git a/OmobiDisplayApp/ressources/shared/shared.qrc b/OmobiDisplayApp/ressources/shared/shared.qrc index 8be7d48..74f0f89 100644 --- a/OmobiDisplayApp/ressources/shared/shared.qrc +++ b/OmobiDisplayApp/ressources/shared/shared.qrc @@ -2,5 +2,6 @@ omobi.png itsblue.png + fa5regular.woff diff --git a/vscode/OmobiLEDdisplayBluetooth/include/OmobiLedDisplay.h b/vscode/OmobiLEDdisplayBluetooth/include/OmobiLedDisplay.h index 347ce50..8a64a6b 100644 --- a/vscode/OmobiLEDdisplayBluetooth/include/OmobiLedDisplay.h +++ b/vscode/OmobiLEDdisplayBluetooth/include/OmobiLedDisplay.h @@ -33,12 +33,15 @@ private: GetTextSetParameterCommand = 11, GetDisplayBrightnessCommand = 12, SetTextSetParameterCommand = 20, - SetDisplayBrightnessCommand = 21 + SetDisplayBrightnessCommand = 21, + SetDisplayCodeCommand = 22, + SetDisplayNameCommand = 23 }; enum OmobiDisplayStatusCode { Success = 200, + BadRequestError = 400, Unauthorized = 401, InternalError = 500, DisplayControllerError = 501 diff --git a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp index bc85f0b..ad03c03 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp @@ -12,12 +12,13 @@ OmobiLedDisplay::OmobiLedDisplay(String deviceName, Adafruit_NeoMatrix *ledDispl this->ledDisplayController = new LedDisplayController(ledDisplayMatrix); this->ledDisplayController->registerEepromUnit(this->eepromManager); - // init ble server - this->bleServer = new BluetoothLeUartServer("Omobi Display", "92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); - this->bleServer->setCallbacks(this); - + // register eeprom for this class this->eepromUnit = this->eepromManager->registerEempromUnit(sizeof(DisplayProperties)); this->loadProperties(); + + // init ble server + this->bleServer = new BluetoothLeUartServer(this->properties.deviceName, "92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); + this->bleServer->setCallbacks(this); } void OmobiLedDisplay::loop() @@ -170,6 +171,30 @@ void OmobiLedDisplay::onDataReceived(String dataString) replyStatus = Success; break; } + case SetDisplayCodeCommand: { + String code = requestData["displayCode"]; + if(code.length() != 4) { + replyStatus = BadRequestError; + break; + } + + strncpy(this->properties.deviceCode, code.c_str(), sizeof(this->properties.deviceCode)); + this->storeProperties(); + replyStatus = Success; + break; + } + case SetDisplayNameCommand: { + String name = requestData["displayName"]; + if(name.length() <= 0) { + replyStatus = BadRequestError; + break; + } + + strncpy(this->properties.deviceName, name.c_str(), sizeof(this->properties.deviceName)); + this->storeProperties(); + replyStatus = Success; + break; + } default: break; } From 4cc66eb08230f50dbdc76c3248f35ccded32c7d5 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 21:51:06 +0200 Subject: [PATCH 4/6] some renaming --- OmobiDisplayApp/ressources/qml/NextPageDelegate.qml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 OmobiDisplayApp/ressources/qml/NextPageDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/NextPageDelegate.qml b/OmobiDisplayApp/ressources/qml/NextPageDelegate.qml deleted file mode 100644 index b5b034a..0000000 --- a/OmobiDisplayApp/ressources/qml/NextPageDelegate.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.9 - -ItemDelegate { - -} From fe5292afacd631b471415edc96e788453b34884a Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 21:51:33 +0200 Subject: [PATCH 5/6] - Major styling improvements - Some renaming --- OmobiDisplayApp/OmobiDisplayApp.pro | 6 +- OmobiDisplayApp/QBluetoothLeUart | 2 +- OmobiDisplayApp/main.cpp | 10 +- OmobiDisplayApp/omobidisplaybackend.cpp | 47 ++--- OmobiDisplayApp/omobidisplaybackend.h | 12 +- OmobiDisplayApp/ressources/qml/Chip.qml | 8 +- .../ressources/qml/ColorPickerDelegate.qml | 3 +- .../ressources/qml/ComboBoxDelegate.qml | 3 +- .../ressources/qml/ConnectPage.qml | 187 +++++++++++------- .../ressources/qml/ConnectedPage.qml | 95 ++++----- .../ressources/qml/DisplayEditDialog.qml | 2 +- .../ressources/qml/DisplayTextDelegate.qml | 2 +- .../ressources/qml/PasswordInputDelegate.qml | 3 +- .../ressources/qml/SpinBoxDelegate.qml | 3 +- .../ressources/qml/TextEditDialog.qml | 2 +- .../ressources/qml/TextInputDelegate.qml | 5 +- OmobiDisplayApp/ressources/qml/main.qml | 105 +++++++++- OmobiDisplayApp/ressources/qml/qml.qrc | 1 - OmobiDisplayApp/ressources/translations/de.qm | Bin 0 -> 3073 bytes OmobiDisplayApp/ressources/translations/de.ts | 163 +++++++++++++++ .../ressources/translations/translations.qrc | 5 + 21 files changed, 493 insertions(+), 171 deletions(-) create mode 100644 OmobiDisplayApp/ressources/translations/de.qm create mode 100644 OmobiDisplayApp/ressources/translations/de.ts create mode 100644 OmobiDisplayApp/ressources/translations/translations.qrc diff --git a/OmobiDisplayApp/OmobiDisplayApp.pro b/OmobiDisplayApp/OmobiDisplayApp.pro index 900cbb2..0ec8ca4 100644 --- a/OmobiDisplayApp/OmobiDisplayApp.pro +++ b/OmobiDisplayApp/OmobiDisplayApp.pro @@ -20,7 +20,11 @@ HEADERS += \ RESOURCES += \ ressources/qml/qml.qrc \ - ressources/shared/shared.qrc + ressources/shared/shared.qrc \ + ressources/translations/translations.qrc + +TRANSLATIONS += \ + ressources/translations/de.ts # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = diff --git a/OmobiDisplayApp/QBluetoothLeUart b/OmobiDisplayApp/QBluetoothLeUart index 76e4575..1ec609e 160000 --- a/OmobiDisplayApp/QBluetoothLeUart +++ b/OmobiDisplayApp/QBluetoothLeUart @@ -1 +1 @@ -Subproject commit 76e457593e889885fd410fdbcdd659706a1eceb8 +Subproject commit 1ec609e7c22308cacffe7fe03de14380463b8470 diff --git a/OmobiDisplayApp/main.cpp b/OmobiDisplayApp/main.cpp index 4d73779..79e3c05 100644 --- a/OmobiDisplayApp/main.cpp +++ b/OmobiDisplayApp/main.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include #include "omobidisplaybackend.h" #include "omobidisplaytextmodel.h" @@ -12,9 +13,14 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + QTranslator translator; + translator.load(":/" + QLocale::system().name() + ".qm"); + translator.load(":/de.qm"); + app.installTranslator(&translator); + qmlRegisterType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend"); qmlRegisterUncreatableType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created"); - QBluetoothLeUart::init(); + QBluetoothLeUartClient::init(); QQuickStyle::setStyle("Material"); diff --git a/OmobiDisplayApp/omobidisplaybackend.cpp b/OmobiDisplayApp/omobidisplaybackend.cpp index b9dbcc4..393dc51 100644 --- a/OmobiDisplayApp/omobidisplaybackend.cpp +++ b/OmobiDisplayApp/omobidisplaybackend.cpp @@ -2,8 +2,8 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) { - this->ble = new QBluetoothLeUart(); - this->ble->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); + this->bleClient = new QBluetoothLeUartClient(); + this->bleClient->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); this->displayTextModel = new OmobiDisplayTextModel(this); this->textSetsBuffer.clear(); this->displayBrightness = -1; @@ -14,65 +14,65 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) this->keepAliveTimer->setSingleShot(false); connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive); - connect(this->ble, &QBluetoothLeUart::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); - connect(this->ble, &QBluetoothLeUart::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); - connect(this->ble, &QBluetoothLeUart::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); - connect(this->ble, &QBluetoothLeUart::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); + connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); + connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); + connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); + connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); connect(this->displayTextModel, &OmobiDisplayTextModel::dataChanged, this, &OmobiDisplayBackend::handleDisplayTextModelDataChanged); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayBackend::handleDisplayTextModelRowsInserted); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayBackend::handleDisplayTextModelRowsRemoved); this->setState(Idle); - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } void OmobiDisplayBackend::startScanning() { - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } void OmobiDisplayBackend::authenticate(QString code) { // tell display to send over existing model data this->setState(Authenticating); - QString combinedCode = this->ble->getCurrentDevice()->getAddress().toUpper() + code; + QString combinedCode = this->bleClient->getCurrentDevice()->getAddress().toUpper() + code; QString secret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex(); this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", secret}}); } -void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state){ +void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){ switch(state){ - case QBluetoothLeUart::Idle: { + case QBluetoothLeUartClient::Idle: { this->setState(Idle); break; } - case QBluetoothLeUart::Scanning: { + case QBluetoothLeUartClient::Scanning: { this->setState(Scanning); break; } - case QBluetoothLeUart::ScanFinished: { + case QBluetoothLeUartClient::ScanFinished: { this->setState(ReadyToConnect); break; } - case QBluetoothLeUart::Connecting: { + case QBluetoothLeUartClient::Connecting: { this->setState(Connecting); break; } - case QBluetoothLeUart::ScanningForService: { + case QBluetoothLeUartClient::ScanningForService: { this->setState(Connecting); break; } - case QBluetoothLeUart::ServiceFound: { + case QBluetoothLeUartClient::ServiceFound: { this->setState(Connecting); break; } - case QBluetoothLeUart::Connected: + case QBluetoothLeUartClient::Connected: { break; } } - if(state == QBluetoothLeUart::Connected) + if(state == QBluetoothLeUartClient::Connected) this->keepAliveTimer->start(); else if(this->keepAliveTimer->isActive()) this->keepAliveTimer->stop(); @@ -80,6 +80,7 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::Bluetooth void OmobiDisplayBackend::handleBluetoothDeviceConected() { this->setState(AuthenticationRequired); + this->authenticate("1234"); // TODO: stuff } @@ -124,7 +125,7 @@ void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVar if(this->state == Connected) this->setState(Loading); - this->ble->sendData(doc.toJson(QJsonDocument::Compact)); + this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } void OmobiDisplayBackend::sendBluetoothKeepAlive() { @@ -132,7 +133,7 @@ void OmobiDisplayBackend::sendBluetoothKeepAlive() { qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented)); - this->ble->sendData(doc.toJson(QJsonDocument::Compact)); + this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ @@ -240,8 +241,8 @@ void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap); } -QBluetoothLeUart* OmobiDisplayBackend::getBleController() { - return this->ble; +QBluetoothLeUartClient* OmobiDisplayBackend::getBleClient() { + return this->bleClient; } @@ -277,7 +278,7 @@ void OmobiDisplayBackend::setState(OmobiDisplayAppState state) { qDebug() << "Now in " << state << " state"; if(this->state == Idle) - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } int OmobiDisplayBackend::getDisplayBrightness() { diff --git a/OmobiDisplayApp/omobidisplaybackend.h b/OmobiDisplayApp/omobidisplaybackend.h index 377fe2a..8da8338 100644 --- a/OmobiDisplayApp/omobidisplaybackend.h +++ b/OmobiDisplayApp/omobidisplaybackend.h @@ -6,13 +6,13 @@ #include #include -#include +#include #include class OmobiDisplayBackend : public QObject { Q_OBJECT - Q_PROPERTY(QBluetoothLeUart* bleController READ getBleController NOTIFY bleControllerChanged) + Q_PROPERTY(QBluetoothLeUartClient* bleClient READ getBleClient NOTIFY bleClientChanged) Q_PROPERTY(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged) Q_PROPERTY(OmobiDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged) Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) @@ -52,7 +52,7 @@ private: }; OmobiDisplayAppState state; - QBluetoothLeUart *ble; + QBluetoothLeUartClient *bleClient; QTimer *keepAliveTimer; OmobiDisplayTextModel* displayTextModel; int waitingCommands; @@ -62,7 +62,7 @@ private: public slots: Q_INVOKABLE void startScanning(); Q_INVOKABLE void authenticate(QString secret); - Q_INVOKABLE QBluetoothLeUart* getBleController(); + Q_INVOKABLE QBluetoothLeUartClient* getBleClient(); Q_INVOKABLE OmobiDisplayAppState getState(); Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE int getDisplayBrightness(); @@ -71,7 +71,7 @@ public slots: Q_INVOKABLE void setDisplayName(QString name); private slots: - void handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state); + void handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state); void handleFoundNewDevice(QBluetoothLeUartDevice* device); void handleBluetoothDeviceConected(); @@ -90,7 +90,7 @@ private slots: signals: void stateChanged(); - void bleControllerChanged(); + void bleClientChanged(); void displayTextModelChanged(); void displayBrightnessChanged(); diff --git a/OmobiDisplayApp/ressources/qml/Chip.qml b/OmobiDisplayApp/ressources/qml/Chip.qml index 601f1e0..351bc8a 100644 --- a/OmobiDisplayApp/ressources/qml/Chip.qml +++ b/OmobiDisplayApp/ressources/qml/Chip.qml @@ -14,11 +14,11 @@ Item { property string text: "" property string color: "" property bool isDarkColor: control.checkIsDarkColor(color) - property double glowRadius: 0.001 - property double glowSpread: 0.2 + property double glowRadius: 0.01 + property double glowSpread: 0.01 property bool glowVisible: true - property double glowScale: 0.9 - property double glowOpacity: Math.pow( control.opacity, 100 ) + property double glowScale: 1 + property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5 property bool interactive: true signal clicked diff --git a/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml b/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml index a5f799e..848075e 100644 --- a/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml @@ -44,10 +44,11 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml b/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml index 9ad453f..8b82948 100644 --- a/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml @@ -42,12 +42,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.Material.foreground - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/ConnectPage.qml b/OmobiDisplayApp/ressources/qml/ConnectPage.qml index 17e34a9..a8d229c 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectPage.qml @@ -9,34 +9,67 @@ import QtGraphicalEffects 1.0 Page { id: root + property bool actionButtonVisible: false + property bool backButtonVisible: false property string statusText property bool working + title: qsTr("Available displays") + ColumnLayout { + id: mainLayout anchors { fill: parent - margins: parent.height * 0.01 - topMargin: 0 + margins: Math.min(parent.height, parent.width) * 0.05 } - Text { - Layout.preferredWidth: parent.width * 0.6 - Layout.preferredHeight: parent.height * 0.1 + Chip { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.05 Layout.alignment: Layout.Center + color: "white" - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + onClicked: { + backend.bleClient.startScanningForDevices() + } - fontSizeMode: Text.Fit - font.pixelSize: 500 - minimumPixelSize: 1 + RowLayout { + spacing: mainLayout.anchors.margins - text: qsTr("Available devices") + anchors.fill: parent + anchors.leftMargin: width * 0.05 + anchors.rightMargin: 0 + + Text { + Layout.fillHeight: true + Layout.fillWidth: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.4 + text: root.statusText + } + + BusyIndicator { + Layout.fillHeight: true + Layout.preferredWidth: height + + id: busyIndicator + + scale: 0.8 + + opacity: root.working ? 1:0 + } + + } + } + + Item { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.025 } ListView { - id: availableDevicesListView + id: availableDisplaysListView Layout.preferredWidth: parent.width Layout.fillHeight: true @@ -45,7 +78,7 @@ Page { clip: true boundsBehavior: Flickable.OvershootBounds - model: backend.bleController.availableDevicesModel + model: backend.bleClient.availableDevicesModel add: Transition { NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 } @@ -59,64 +92,19 @@ Page { spacing: 5 - header: ItemDelegate { - id: headerDelegate - - width: parent.width - height: implicitHeight * 0.8 - - topInset: 10 - bottomInset: 10 - - text: root.statusText - - onClicked: backend.bleController.startScanningForDevices() - - Rectangle { - anchors.fill: parent - anchors.topMargin: 10 - anchors.bottomMargin: 10 - color: "transparent" - border.color: "lightgrey" - border.width: 3 - } - - Item { - anchors { - right: parent.right - rightMargin: parent.height * 0.15 - verticalCenter: parent.verticalCenter - } - - height: (parent.height - 20) * 0.7 - width: height - - BusyIndicator { - id: busyIndicator - - anchors.centerIn: parent - - width: parent.width - height: parent.height - - opacity: root.working ? 1:0 - } - } - } - delegate: ItemDelegate { width: parent.width text: name - onClicked: backend.bleController.connectToDevice(device) + onClicked: backend.bleClient.connectToDevice(device) Rectangle { anchors { top: parent.top left: parent.left right: parent.right - topMargin: - availableDevicesListView.spacing * 0.5 + topMargin: - availableDisplaysListView.spacing * 0.5 } color: "lightgrey" @@ -124,6 +112,61 @@ Page { visible: index !== 0 } } + + Item { + anchors.centerIn: parent + + width: Math.min(parent.height, parent.width) + height: Math.min(parent.height, parent.width) + + opacity: availableDisplaysListView.model.rowCount === 0 ? 1:0 + + Behavior on opacity { + NumberAnimation {} + } + + Rectangle { + id: noDisplaysRect + + anchors { + top: parent.top + topMargin: parent.height * 0.2 + horizontalCenter: parent.horizontalCenter + } + + width: parent.width * 0.7 + height: width * 0.3 + + color: "transparent" + + border.width: height * 0.15 + border.color: "lightgrey" + + Text { + anchors.centerIn: parent + anchors.verticalCenterOffset: text === "..." ? -height * 0.25:0 + color: "lightgrey" + font.pixelSize: parent.height * 0.6 + font.bold: true + text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? "...":"?" + } + } + + Text { + id: noDisplaysText + anchors { + top: noDisplaysRect.bottom + topMargin: noDisplaysRect.height * 0.15 + horizontalCenter: parent.horizontalCenter + } + + font.bold: true + font.pixelSize: noDisplaysRect.height * 0.3 + + color: Qt.darker("lightgrey", 1.1) + text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? qsTr("Still scanning"):qsTr("No displays found") + } + } } } @@ -156,7 +199,7 @@ Page { } onRejected: { - backend.bleController.disconnectFromDevice() + backend.bleClient.disconnectFromDevice() } contentItem: TextField { @@ -172,7 +215,7 @@ Page { PropertyChanges { target: root - statusText: "Tap here to scan" + statusText: qsTr("Tap here to scan") working: false } }, @@ -181,7 +224,7 @@ Page { PropertyChanges { target: root - statusText: "Scanning..." + statusText: qsTr("Scanning...") working: true } }, @@ -190,7 +233,7 @@ Page { PropertyChanges { target: root - statusText: availableDevicesListView.model.rowCount() > 0 ? "Please select a device or tap to scan again":"No devices found. Tap to scan again" + statusText: availableDisplaysListView.model.rowCount > 0 ? qsTr("Please select a device or tap to scan again"):qsTr("No displays found. Tap to scan again") working: false } }, @@ -204,13 +247,13 @@ Page { } PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to authenticate..." + statusText: qsTr("trying to authenticate...") working: true } }, @@ -218,13 +261,13 @@ Page { name: OmobiDisplayBackend.Authenticating PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to authenticate..." + statusText: qsTr("trying to authenticate...") working: true } }, @@ -233,13 +276,13 @@ Page { name: OmobiDisplayBackend.Connecting PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to connect..." + statusText: qsTr("trying to connect...") working: true } }, @@ -247,13 +290,13 @@ Page { name: OmobiDisplayBackend.Initing PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "loading data..." + statusText: qsTr("loading data...") working: true } } diff --git a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml index b001671..9788b0b 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml @@ -10,72 +10,77 @@ import de.itsblue.bluetoothleuart 1.0 Page { id: root + property bool actionButtonVisible: true + property bool backButtonVisible: true + + title: backend.bleClient.currentDevice === null ? "":backend.bleClient.currentDevice.name + + function backButtonClicked() { + backend.bleClient.disconnectFromDevice() + } + + function actionButtonClicked() { + displayEditDialog.edit() + } + ColumnLayout { + id: mainLayout anchors { fill: parent - margins: parent.height * 0.01 - topMargin: 0 + margins: Math.min(parent.height, parent.width) * 0.05 } - Text { - Layout.preferredWidth: parent.width * 0.6 - Layout.preferredHeight: parent.height * 0.1 + Chip { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.05 Layout.alignment: Layout.Center - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + interactive: false - fontSizeMode: Text.Fit - font.pixelSize: 500 - minimumPixelSize: 1 + color: "white" - color: root.Material.foreground + RowLayout { + spacing: mainLayout.anchors.margins - text: backend.bleController.currentDevice === null ? "":backend.bleController.currentDevice.name + anchors.fill: parent + anchors.leftMargin: width * 0.05 + anchors.rightMargin: anchors.leftMargin - ToolButton { - id: editButton - anchors { - verticalCenter: parent.verticalCenter - left: parent.right - margins: parent.height * 0.1 + Text { + Layout.fillHeight: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.5 + text: "\uf186" } - height: parent.height * 0.7 - width: height + Slider { + Layout.fillWidth: true + Layout.fillHeight: true - font.styleName: fontAwesome.name - font.pixelSize: height * 0.3 + from: 0 + to: 10 + stepSize: 1 - flat: true + value: backend.displayBrightness - text: "\uf044" + onPressedChanged: { + if(!pressed) + backend.displayBrightness = value + } + } - onClicked: displayEditDialog.edit() + Text { + Layout.fillHeight: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.5 + text: "\uf185" + } } } - Text { - Layout.alignment: Layout.Center - - color: root.Material.foreground - - text: qsTr("Brightness:") - } - - Slider { + Item { Layout.fillWidth: true - - from: 0 - to: 10 - stepSize: 1 - - value: backend.displayBrightness - - onPressedChanged: { - if(!pressed) - backend.displayBrightness = value - } + Layout.preferredHeight: mainLayout.height * 0.025 } DisplayTextModelListView { diff --git a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml index ee26b5a..1dd331b 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml +++ b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml @@ -72,7 +72,7 @@ Dialog { reset() - nameTextField.value = backend.bleController.currentDevice.name + nameTextField.value = backend.bleClient.currentDevice.name open() } diff --git a/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml b/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml index 25df49e..1daff2c 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml @@ -56,7 +56,7 @@ ItemDelegate { ColorAnimation {} } - text: model.scroll ? qsTr("scrolling"):qsTr("false") + text: model.scroll ? qsTr("scrolling"):"" onClicked: { control.clicked() diff --git a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml index 00326e4..707ca94 100644 --- a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml @@ -45,10 +45,11 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml b/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml index 34c13d2..f8d8d98 100644 --- a/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml @@ -38,12 +38,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.Material.foreground - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml index 58ba22e..f248110 100644 --- a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml +++ b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml @@ -116,7 +116,7 @@ Dialog { id: scrollCountSpinBox Layout.fillWidth: true from: 0 - text: qsTr("Scroll count:") + text: qsTr("Scroll count") } } } diff --git a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml index 0e708ad..54d3618 100644 --- a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml @@ -22,7 +22,7 @@ ItemDelegate { rightMargin: control.padding } - width: parent.width * 0.6 + width: parent.width * 0.4 elide: Text.ElideRight font.pixelSize: parent.font.pixelSize @@ -43,12 +43,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.textColor - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/main.qml b/OmobiDisplayApp/ressources/qml/main.qml index d7e292a..31f4139 100644 --- a/OmobiDisplayApp/ressources/qml/main.qml +++ b/OmobiDisplayApp/ressources/qml/main.qml @@ -4,12 +4,13 @@ import QtQuick.Window 2.12 import de.itsblue.omobidisplayapp 1.0 import de.itsblue.bluetoothleuart 1.0 import QtQuick.Controls.Material 2.0 +import QtQuick.Layouts 1.0 ApplicationWindow { width: 540 height: 960 visible: true - title: qsTr("Hello World") + title: qsTr("Itsblue smart display") Page { id: app @@ -26,16 +27,73 @@ ApplicationWindow { Material.theme: Material.System header: ToolBar { + id: headerToolBar + + height: 50 + implicitWidth: parent.width + Material.background: "white" - Image { + RowLayout { anchors.fill: parent - anchors.margins: parent.height * 0.1 - fillMode: Image.PreserveAspectFit - source: "qrc:/omobi.png" + ToolButton { + id: backToolButton + + enabled: false + Layout.fillHeight: true + Layout.preferredWidth: height + + opacity: mainStack.currentItem.backButtonVisible ? 1:0 + + font.styleName: fontAwesome.name + font.pixelSize: height * 0.6 + Material.foreground: "black" + + text: "\uf104" + + contentItem: Item {} + + Text { + anchors.centerIn: parent + font.pixelSize: parent.font.pixelSize + text: parent.text + } + + onClicked: mainStack.currentItem.backButtonClicked() + } + + Text { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Layout.Center + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + text: mainStack.currentItem.title + } + + ToolButton { + id: actionToolButton + + Layout.fillHeight: true + Layout.preferredWidth: height + + opacity: mainStack.currentItem.actionButtonVisible ? 1:0 + + font.styleName: fontAwesome.name + font.pixelSize: height * 0.4 + Material.foreground: "black" + + flat: true + + text: "\uf013" + + onClicked: mainStack.currentItem.actionButtonClicked() + + } } - } OmobiDisplayBackend { @@ -61,6 +119,22 @@ ApplicationWindow { initialItem: connectedPageComp + replaceEnter: Transition { + NumberAnimation { + properties: "opacity" + from: 0 + to: 1 + } + } + + replaceExit: Transition { + NumberAnimation { + properties: "opacity" + from: 1 + to: 0 + } + } + Component { id: connectPageComp ConnectPage { @@ -71,6 +145,7 @@ ApplicationWindow { Component { id: connectedPageComp ConnectedPage { + opacity: 0 state: app.state } } @@ -92,7 +167,7 @@ ApplicationWindow { currentComponent: connectPageComp } }, - + State { name: OmobiDisplayBackend.ReadyToConnect PropertyChanges { @@ -139,6 +214,14 @@ ApplicationWindow { target: mainStack currentComponent: connectedPageComp } + PropertyChanges { + target: headerToolBar + state: "open" + } + PropertyChanges { + target: backToolButton + enabled: true + } }, State { @@ -147,6 +230,14 @@ ApplicationWindow { target: mainStack currentComponent: connectedPageComp } + PropertyChanges { + target: headerToolBar + state: "open" + } + PropertyChanges { + target: backToolButton + enabled: true + } } ] } diff --git a/OmobiDisplayApp/ressources/qml/qml.qrc b/OmobiDisplayApp/ressources/qml/qml.qrc index 20565fe..40ec2cd 100644 --- a/OmobiDisplayApp/ressources/qml/qml.qrc +++ b/OmobiDisplayApp/ressources/qml/qml.qrc @@ -7,7 +7,6 @@ DisplayTextModelListView.qml TextEditDialog.qml TextInputDelegate.qml - NextPageDelegate.qml SpinBoxDelegate.qml ComboBoxDelegate.qml ColorPickerDelegate.qml diff --git a/OmobiDisplayApp/ressources/translations/de.qm b/OmobiDisplayApp/ressources/translations/de.qm new file mode 100644 index 0000000000000000000000000000000000000000..55c0917ba5ede975236b059af17271dc54f395f3 GIT binary patch literal 3073 zcmb_eOK2oj6uq5v_jJ1Rn>Z8AOwbn<>5QQnF)JCxm_&`r5KNqih*(|qQYox{)mFVu zCRzAd=~5UK6o0dbZiXO2qCtkN1QB%S!i7H^(Vd$hE_Cp`S6$WVo~ocCP1pC`b3f z%?MHU)2^4c)`+^^?cV+V0_-Te@!@A!hx5lcA9*o*dE_a)uV(iyY!PMpa$~_)IB(}} zuAT+XX6}v0;D@$yZ@xZ3)bm2_(%bI<p^b&Y!4E0`G$!bLki0?G-=zaUSQp zOWixqVcqkkAO3n3aTZGZpPN|!erf-z1kP@+`QF#SeZ2SLE#r9qO5a^4??E25zN={r2%8TeVku5hP=#lLpL@-{k0oP1iQKgp&l8Mx-eXoegLs7@}P ztW!|HQp)2$G_`6tu2FS4vz(yr8tcIkJT6UpLU2>g8#d1<+zEOBI92=w&;p<-RI7PE zO`g7HxOYgz=*2lvZ%Af(7EeU2(8HmHM(cSuYNkEqe`NCBj?( z4xTD-xrhYn_^I?7RKrn~Q{dPjiMtJ)RRJ1g(h8oolD+kspek(9s59xYz%&FiY{L%U=lGZZ5*xWR#Y_!*-GbU zP?531eI7BAh+d#(GsiJyQ``3hJ%Vvkt*O{Dz=|4=_L2;^o?#&sW*O2*E6YT4YFll^ z04H>_)d1=?C#@ZNMEdIr84YGM{&!E_@6(MmN#Xv6dq<)P*!3 zgIZuhS!fTo*sMd-vacyH+=?aUbVtXthzV4;Op`c1fjFIL?r1z_==zyZy0p-+@+7pu zc4RQF2tL|;H)}a^#xY#a)_QiP!c6RnC}dtLvJ~FY@zp22yHc@N{GKYa(Ne*uLP1(Ed>C zLF_ChsP=Rd9Nb-c0@L?gw<(IL?u#@Pg&(`lPwBvw<9-!y$0!WLqyfKvbGBsIe6e}Y zlgN#Fp|Cv-SFxoAkrnZKXW<{emXxjZVEXMyc+Z! zNh(#W#ve6Ye;_1ff1}oLwF`yb6mnT}sCN05#`HhhfW88}> + + + + ConnectPage + + Available devices + Verfügbare Geräte + + + Input code + Geben sie den Code ein + + + code + Code + + + Tap here to scan + Tippe hier um zu suchen + + + Scanning... + Suchen... + + + Please select a device or tap to scan again + Wähle ein Display, oder tippe um erneut zu suchen + + + trying to authenticate... + Versuche anzumelden... + + + trying to connect... + Versuche zu verbinden... + + + loading data... + Lade Daten... + + + Available displays + Verfügbare Displays + + + Still scanning + Suche läuft + + + No displays found + Keine Displays gefunden + + + No displays found. Tap to scan again + Keine Displays gefunden. Tippe um erneut zu suchen + + + + ConnectedPage + + Brightness: + Helligkeit: + + + loading... + laden... + + + + DisplayEditDialog + + Edit display settings + Display Einstellungen bearbeiten + + + Display name +(needs restart) + Displayname\n(neutstart nötig) + + + Display code (4 digits) + Display Code (4 Zeichen) + + + Enter new display code + Geben sie den neuen Display Code ein + + + Enter new display code again + Geben sie den neuen Display Code erneut ein + + + + DisplayTextDelegate + + scrolling + scrollen + + + false + nein + + + active + aktiv + + + inactive + inaktiv + + + + TextEditDialog + + Active + Aktiv + + + Enter some text to be displayed + Geben sie den anzuzeigenden Text ein + + + Text + Text + + + Runtime (in s) + Laufzeit (in s) + + + Color + Farbe + + + Alignment + Ausrichtung + + + Scroll + Scrollen + + + Scroll speed + Scrollgeschwindigkeit + + + Scroll count: + Scrolldurchläufe + + + Scroll count + Scrolldurchläufe + + + + main + + Itsblue smart display + Itsblue smart display + + + diff --git a/OmobiDisplayApp/ressources/translations/translations.qrc b/OmobiDisplayApp/ressources/translations/translations.qrc new file mode 100644 index 0000000..4923ee3 --- /dev/null +++ b/OmobiDisplayApp/ressources/translations/translations.qrc @@ -0,0 +1,5 @@ + + + de.qm + + From bd17fc54e4c247937547bf450656549fdab8ae4e Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 21:51:42 +0200 Subject: [PATCH 6/6] lib --- OmobiDisplayApp/QBluetoothLeUart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmobiDisplayApp/QBluetoothLeUart b/OmobiDisplayApp/QBluetoothLeUart index 1ec609e..534277a 160000 --- a/OmobiDisplayApp/QBluetoothLeUart +++ b/OmobiDisplayApp/QBluetoothLeUart @@ -1 +1 @@ -Subproject commit 1ec609e7c22308cacffe7fe03de14380463b8470 +Subproject commit 534277a19867f2e41a2699fc863e1cae48dee741