- implemented authorization with secret in app
This commit is contained in:
parent
d4d42c9f6d
commit
7cca98106d
2 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,10 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
this->setState(Idle);
|
this->setState(Idle);
|
||||||
this->ble->startScanningForDevices();
|
this->ble->startScanningForDevices();
|
||||||
|
|
||||||
|
qDebug() << QCryptographicHash::hash("HalloTest", QCryptographicHash::Sha256).toHex();
|
||||||
|
// dd86fcfda3a20cbb8fbb3026a84550e0d70c2c79e7e8e36d6ffa04b9eef0401f
|
||||||
|
// dd86fcfda3a20cbb8fbb3026a84550e0d70c2c79e7e8e36d6ffa04b9eef0401f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +77,7 @@ void OmobiDisplayBackend::handleBluetoothDeviceConected() {
|
||||||
this->setState(Initing);
|
this->setState(Initing);
|
||||||
|
|
||||||
// tell display to send over existing model data
|
// tell display to send over existing model data
|
||||||
|
this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", QCryptographicHash::hash("1234", QCryptographicHash::Sha256).toHex()}});
|
||||||
this->sendBluetoothCommand(GetAllTextSetsCommand);
|
this->sendBluetoothCommand(GetAllTextSetsCommand);
|
||||||
this->sendBluetoothCommand(GetDisplayBrightnessCommand);
|
this->sendBluetoothCommand(GetDisplayBrightnessCommand);
|
||||||
}
|
}
|
||||||
|
@ -144,6 +149,8 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){
|
||||||
|
|
||||||
switch (header) {
|
switch (header) {
|
||||||
case AuthorizeSessionCommand: {
|
case AuthorizeSessionCommand: {
|
||||||
|
// TODO: handle error
|
||||||
|
this->refreshLoadingState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KeepAliveCommand: {
|
case KeepAliveCommand: {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
#include <qbluetoothleuart.h>
|
#include <qbluetoothleuart.h>
|
||||||
#include <omobidisplaytextmodel.h>
|
#include <omobidisplaytextmodel.h>
|
||||||
|
|
Loading…
Reference in a new issue