This commit is contained in:
Jens Noack 2020-10-18 15:57:44 +02:00
commit 95abf60e86
37 changed files with 217 additions and 159 deletions

4
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "OmobiDisplayApp/QBluetoothLeUart"] [submodule "LedDisplayController/QBluetoothLeUart"]
path = OmobiDisplayApp/QBluetoothLeUart path = LedDisplayController/QBluetoothLeUart
url = https://itsblue.dev/itsblue-development/QBluetoothLeUart.git url = https://itsblue.dev/itsblue-development/QBluetoothLeUart.git

View file

@ -11,13 +11,13 @@ TEMPLATE = app
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
leddisplaybackend.cpp \
main.cpp \ main.cpp \
omobidisplaybackend.cpp \ leddisplaytextmodel.cpp
omobidisplaytextmodel.cpp
HEADERS += \ HEADERS += \
omobidisplaybackend.h \ leddisplaybackend.h \
omobidisplaytextmodel.h leddisplaytextmodel.h
RESOURCES += \ RESOURCES += \
ressources/qml/qml.qrc \ ressources/qml/qml.qrc \
@ -63,3 +63,10 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_ABIS = \ ANDROID_ABIS = \
armeabi-v7a armeabi-v7a
} }
contains(ANDROID_TARGET_ARCH,) {
ANDROID_ABIS = \
armeabi-v7a
}
ANDROID_ABIS = armeabi-v7a arm64-v8a

@ -0,0 +1 @@
Subproject commit d75f55a3a16a833599cd93e1fb22f2500a94dcf5

View file

@ -1,10 +1,10 @@
#include "omobidisplaybackend.h" #include "leddisplaybackend.h"
OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) LedDisplayBackend::LedDisplayBackend(QObject *parent) : QObject(parent)
{ {
this->bleClient = new QBluetoothLeUartClient(); this->bleClient = new QBluetoothLeUartClient();
this->bleClient->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); this->bleClient->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462");
this->displayTextModel = new OmobiDisplayTextModel(this); this->displayTextModel = new LedDisplayTextModel(this);
this->textSetsBuffer.clear(); this->textSetsBuffer.clear();
this->displayBrightness = -1; this->displayBrightness = -1;
this->waitingCommands = 0; this->waitingCommands = 0;
@ -14,26 +14,26 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent)
this->keepAliveTimer = new QTimer(this); this->keepAliveTimer = new QTimer(this);
this->keepAliveTimer->setInterval(5000); this->keepAliveTimer->setInterval(5000);
this->keepAliveTimer->setSingleShot(false); this->keepAliveTimer->setSingleShot(false);
connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive); connect(this->keepAliveTimer, &QTimer::timeout, this, &LedDisplayBackend::sendBluetoothKeepAlive);
connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &LedDisplayBackend::handleBluetoothStateChange);
connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &LedDisplayBackend::handleFoundNewDevice);
connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &LedDisplayBackend::handleBluetoothDataReceived);
connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &LedDisplayBackend::handleBluetoothDeviceConected);
connect(this->displayTextModel, &OmobiDisplayTextModel::dataChanged, this, &OmobiDisplayBackend::handleDisplayTextModelDataChanged); connect(this->displayTextModel, &LedDisplayTextModel::dataChanged, this, &LedDisplayBackend::handleDisplayTextModelDataChanged);
connect(this->displayTextModel, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayBackend::handleDisplayTextModelRowsInserted); connect(this->displayTextModel, &LedDisplayTextModel::rowsInserted, this, &LedDisplayBackend::handleDisplayTextModelRowsInserted);
connect(this->displayTextModel, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayBackend::handleDisplayTextModelRowsRemoved); connect(this->displayTextModel, &LedDisplayTextModel::rowsRemoved, this, &LedDisplayBackend::handleDisplayTextModelRowsRemoved);
this->setState(Idle); this->setState(Idle);
this->bleClient->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
void OmobiDisplayBackend::startScanning() { void LedDisplayBackend::startScanning() {
this->bleClient->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
void OmobiDisplayBackend::authenticate(QString code) { void LedDisplayBackend::authenticate(QString code) {
// tell display to send over existing model data // tell display to send over existing model data
this->setState(Authenticating); this->setState(Authenticating);
@ -47,16 +47,11 @@ void OmobiDisplayBackend::authenticate(QString code) {
this->sendBluetoothCommand(AuthenticateCommand, QVariantMap{{"secret", this->lastDisplaySecret}}); this->sendBluetoothCommand(AuthenticateCommand, QVariantMap{{"secret", this->lastDisplaySecret}});
} }
void OmobiDisplayBackend::handleBluetoothScanningError(QBluetoothLeUartClient::BluetoothScanError error) { void LedDisplayBackend::handleBluetoothScanningError(QBluetoothLeUartClient::BluetoothScanError error) {
if(error == QBluetoothLeUartClient::LocationPermissionDeniedError) { Q_UNUSED(error)
#ifdef Q_OS_ANDROID
// try to get permission
//QtAndroid::requestPermissions({"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"}, NULL);
#endif
}
} }
void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){ void LedDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){
switch(state){ switch(state){
case QBluetoothLeUartClient::Idle: { case QBluetoothLeUartClient::Idle: {
this->setState(Idle); this->setState(Idle);
@ -102,18 +97,18 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::Blu
this->keepAliveTimer->stop(); this->keepAliveTimer->stop();
} }
void OmobiDisplayBackend::handleBluetoothDeviceConected() { void LedDisplayBackend::handleBluetoothDeviceConected() {
if(this->settings->contains(this->bleClient->getCurrentDevice()->getAddress())) if(this->settings->contains(this->bleClient->getCurrentDevice()->getAddress()))
this->authenticate(this->settings->value(this->bleClient->getCurrentDevice()->getAddress()).toString()); this->authenticate(this->settings->value(this->bleClient->getCurrentDevice()->getAddress()).toString());
else else
this->setState(AuthenticationRequired); this->setState(AuthenticationRequired);
} }
void OmobiDisplayBackend::handleFoundNewDevice(QBluetoothLeUartDevice* device) { void LedDisplayBackend::handleFoundNewDevice(QBluetoothLeUartDevice* device) {
qDebug() << "Found a device: name: " << device->getName() << " address: " << device->getAddress(); qDebug() << "Found a device: name: " << device->getName() << " address: " << device->getAddress();
} }
void OmobiDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) { void LedDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) {
qDebug() << "Data changed: topLeft: " << topLeft << " bottomRight: " << bottomRight << " roles: " << roles; qDebug() << "Data changed: topLeft: " << topLeft << " bottomRight: " << bottomRight << " roles: " << roles;
@ -121,21 +116,21 @@ void OmobiDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &t
this->updateDisplayTextSetParameter(topLeft.row(), role); this->updateDisplayTextSetParameter(topLeft.row(), role);
} }
void OmobiDisplayBackend::handleDisplayTextModelRowsInserted(const QModelIndex &parent, int first, int last) { void LedDisplayBackend::handleDisplayTextModelRowsInserted(const QModelIndex &parent, int first, int last) {
qDebug() << "Rows inserted: parent: " << parent << " first: " << first << " last " << last; qDebug() << "Rows inserted: parent: " << parent << " first: " << first << " last " << last;
for(int i = 0; i < OmobiDisplayTextModel::OmobiDisplayTextModelRoleCount; i++) { for(int i = 0; i < LedDisplayTextModel::LedDisplayTextModelRoleCount; i++) {
this->updateDisplayTextSetParameter(first, i); this->updateDisplayTextSetParameter(first, i);
} }
} }
void OmobiDisplayBackend::handleDisplayTextModelRowsRemoved(const QModelIndex &parent, int first, int last) { void LedDisplayBackend::handleDisplayTextModelRowsRemoved(const QModelIndex &parent, int first, int last) {
qDebug() << "Rows removed: parent: " << parent << " first: " << first << " last " << last; qDebug() << "Rows removed: parent: " << parent << " first: " << first << " last " << last;
// Setting Text to "" will delete the item // Setting Text to "" will delete the item
this->updateDisplayTextSetParameter(first, OmobiDisplayTextModel::TextRole, ""); this->updateDisplayTextSetParameter(first, LedDisplayTextModel::TextRole, "");
} }
void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVariant data) { void LedDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVariant data) {
QVariantMap commandMap = { QVariantMap commandMap = {
{"header", command}, {"header", command},
{"data", data} {"data", data}
@ -153,7 +148,7 @@ void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVar
this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); this->bleClient->sendData(doc.toJson(QJsonDocument::Compact));
} }
void OmobiDisplayBackend::sendBluetoothKeepAlive() { void LedDisplayBackend::sendBluetoothKeepAlive() {
QJsonDocument doc = QJsonDocument::fromVariant(QVariantMap{{"header", KeepAliveCommand}}); QJsonDocument doc = QJsonDocument::fromVariant(QVariantMap{{"header", KeepAliveCommand}});
//qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented)); //qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented));
@ -161,8 +156,8 @@ void OmobiDisplayBackend::sendBluetoothKeepAlive() {
this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); this->bleClient->sendData(doc.toJson(QJsonDocument::Compact));
} }
void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ void LedDisplayBackend::handleBluetoothDataReceived(QString s){
//qDebug() << "New data: \n" << qPrintable(s); qDebug() << "New data: \n" << qPrintable(s);
QJsonParseError parseError; QJsonParseError parseError;
QJsonDocument doc = QJsonDocument::fromJson(s.toUtf8(), &parseError); QJsonDocument doc = QJsonDocument::fromJson(s.toUtf8(), &parseError);
@ -204,6 +199,8 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){
this->displayTextModel->maximumTextLength = data["maximumTextLength"].toInt(); this->displayTextModel->maximumTextLength = data["maximumTextLength"].toInt();
this->displayTextModel->maximumTextSets = data["maximumTextSets"].toInt(); this->displayTextModel->maximumTextSets = data["maximumTextSets"].toInt();
qDebug() << "text sets are: " << this->textSetsBuffer;
this->displayTextModel->setTexts(this->textSetsBuffer); this->displayTextModel->setTexts(this->textSetsBuffer);
this->textSetsBuffer.clear(); this->textSetsBuffer.clear();
@ -251,11 +248,11 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){
} }
void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter) { void LedDisplayBackend::updateDisplayTextSetParameter(int index, int parameter) {
this->updateDisplayTextSetParameter(index, parameter, this->displayTextModel->data(index, parameter).toString()); this->updateDisplayTextSetParameter(index, parameter, this->displayTextModel->data(index, parameter).toString());
} }
void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter, QString value) { void LedDisplayBackend::updateDisplayTextSetParameter(int index, int parameter, QString value) {
if(this->state == Initing) if(this->state == Initing)
return; return;
qDebug() << "Updating data at index: " << index << " parameter: " << parameter << " and value: " << value; qDebug() << "Updating data at index: " << index << " parameter: " << parameter << " and value: " << value;
@ -269,20 +266,20 @@ void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter
this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap); this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap);
} }
QBluetoothLeUartClient* OmobiDisplayBackend::getBleClient() { QBluetoothLeUartClient* LedDisplayBackend::getBleClient() {
return this->bleClient; return this->bleClient;
} }
OmobiDisplayTextModel* OmobiDisplayBackend::getDisplayTextModel() { LedDisplayTextModel* LedDisplayBackend::getDisplayTextModel() {
return this->displayTextModel; return this->displayTextModel;
} }
OmobiDisplayBackend::OmobiDisplayAppState OmobiDisplayBackend::getState() { LedDisplayBackend::OmobiDisplayAppState LedDisplayBackend::getState() {
return this->state; return this->state;
} }
void OmobiDisplayBackend::refreshLoadingState() { void LedDisplayBackend::refreshLoadingState() {
if(this->state != Initing && this->state != Loading) if(this->state != Initing && this->state != Loading)
return; return;
@ -296,7 +293,7 @@ void OmobiDisplayBackend::refreshLoadingState() {
this->waitingCommands--; this->waitingCommands--;
} }
void OmobiDisplayBackend::setState(OmobiDisplayAppState state) { void LedDisplayBackend::setState(OmobiDisplayAppState state) {
if(state == this->state) if(state == this->state)
return; return;
@ -309,11 +306,11 @@ void OmobiDisplayBackend::setState(OmobiDisplayAppState state) {
this->bleClient->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
int OmobiDisplayBackend::getDisplayBrightness() { int LedDisplayBackend::getDisplayBrightness() {
return this->displayBrightness; return this->displayBrightness;
} }
void OmobiDisplayBackend::setDisplayBrightness(int brightness) { void LedDisplayBackend::setDisplayBrightness(int brightness) {
if(brightness == this->displayBrightness) if(brightness == this->displayBrightness)
return; return;
@ -325,11 +322,11 @@ void OmobiDisplayBackend::setDisplayBrightness(int brightness) {
} }
void OmobiDisplayBackend::setDisplayCode(QString code) { void LedDisplayBackend::setDisplayCode(QString code) {
this->sendBluetoothCommand(SetDisplayCodeCommand, QVariantMap{{"displayCode",code}}); this->sendBluetoothCommand(SetDisplayCodeCommand, QVariantMap{{"displayCode",code}});
} }
void OmobiDisplayBackend::setDisplayName(QString name) { void LedDisplayBackend::setDisplayName(QString name) {
// This will restart the display!! // This will restart the display!!
this->sendBluetoothCommand(SetDisplayNameCommand, QVariantMap{{"displayName", name}}); this->sendBluetoothCommand(SetDisplayNameCommand, QVariantMap{{"displayName", name}});
} }

View file

@ -8,18 +8,18 @@
#include <QSettings> #include <QSettings>
#include <qbluetoothleuartclient.h> #include <qbluetoothleuartclient.h>
#include <omobidisplaytextmodel.h> #include <leddisplaytextmodel.h>
class OmobiDisplayBackend : public QObject class LedDisplayBackend : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QBluetoothLeUartClient* bleClient READ getBleClient NOTIFY bleClientChanged) Q_PROPERTY(QBluetoothLeUartClient* bleClient READ getBleClient NOTIFY bleClientChanged)
Q_PROPERTY(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged) Q_PROPERTY(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged)
Q_PROPERTY(OmobiDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged) Q_PROPERTY(LedDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged)
Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged)
public: public:
explicit OmobiDisplayBackend(QObject *parent = nullptr); explicit LedDisplayBackend(QObject *parent = nullptr);
enum OmobiDisplayAppState { enum OmobiDisplayAppState {
Idle, Idle,
@ -36,6 +36,11 @@ public:
}; };
Q_ENUM(OmobiDisplayAppState) Q_ENUM(OmobiDisplayAppState)
static void init() {
qmlRegisterType<LedDisplayBackend>("de.itsblue.LedDisplayController", 1, 0, "LedDisplayBackend");
qmlRegisterUncreatableType<LedDisplayTextModel>("de.itsblue.LedDisplayController", 1, 0, "LedDisplayTextModel", "LedDisplayTextModel cannot be created");
};
private: private:
enum OmobiDisplayCommand { enum OmobiDisplayCommand {
AuthenticateCommand = 0, AuthenticateCommand = 0,
@ -57,7 +62,7 @@ private:
OmobiDisplayAppState state; OmobiDisplayAppState state;
QBluetoothLeUartClient *bleClient; QBluetoothLeUartClient *bleClient;
QTimer *keepAliveTimer; QTimer *keepAliveTimer;
OmobiDisplayTextModel* displayTextModel; LedDisplayTextModel* displayTextModel;
int waitingCommands; int waitingCommands;
QList<QMap<int, QVariant>> textSetsBuffer; QList<QMap<int, QVariant>> textSetsBuffer;
int displayBrightness; int displayBrightness;
@ -70,7 +75,7 @@ public slots:
Q_INVOKABLE void authenticate(QString secret); Q_INVOKABLE void authenticate(QString secret);
Q_INVOKABLE QBluetoothLeUartClient* getBleClient(); Q_INVOKABLE QBluetoothLeUartClient* getBleClient();
Q_INVOKABLE OmobiDisplayAppState getState(); Q_INVOKABLE OmobiDisplayAppState getState();
Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE LedDisplayTextModel* getDisplayTextModel();
Q_INVOKABLE int getDisplayBrightness(); Q_INVOKABLE int getDisplayBrightness();
Q_INVOKABLE void setDisplayBrightness(int brightness); Q_INVOKABLE void setDisplayBrightness(int brightness);
Q_INVOKABLE void setDisplayCode(QString code); Q_INVOKABLE void setDisplayCode(QString code);

View file

@ -1,39 +1,39 @@
#include "omobidisplaytextmodel.h" #include "leddisplaytextmodel.h"
OmobiDisplayTextModel::OmobiDisplayTextModel(QObject* parent) : QAbstractListModel(parent) LedDisplayTextModel::LedDisplayTextModel(QObject* parent) : QAbstractListModel(parent)
{ {
this->maximumTextSets = 0; this->maximumTextSets = 0;
this->maximumTextLength = 0; this->maximumTextLength = 0;
connect(this, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayTextModel::rowCountChanged); connect(this, &LedDisplayTextModel::rowsInserted, this, &LedDisplayTextModel::rowCountChanged);
connect(this, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayTextModel::rowCountChanged); connect(this, &LedDisplayTextModel::rowsRemoved, this, &LedDisplayTextModel::rowCountChanged);
} }
int OmobiDisplayTextModel::rowCount(const QModelIndex &) const int LedDisplayTextModel::rowCount(const QModelIndex &) const
{ {
return this->texts.length(); return this->texts.length();
} }
QVariant OmobiDisplayTextModel::data(const QModelIndex &index, int role) const QVariant LedDisplayTextModel::data(const QModelIndex &index, int role) const
{ {
return this->data(index.row(), role); return this->data(index.row(), role);
} }
QVariant OmobiDisplayTextModel::data(int row, int role) const { QVariant LedDisplayTextModel::data(int row, int role) const {
if (row < rowCount()) { if (row < rowCount()) {
if(this->texts[row].contains(role)) { if(this->texts[row].contains(role)) {
if(role == IndexRole) if(role == IndexRole)
return row; return row;
QVariant value = this->texts[row][role]; QVariant value = this->texts[row][role];
value.convert(this->roleDataTypes[OmobiDisplayTextModelRole(role)]); value.convert(this->roleDataTypes[LedDisplayTextModelRole(role)]);
return value; return value;
} }
} }
return QVariant(); return QVariant();
} }
QHash<int, QByteArray> OmobiDisplayTextModel::roleNames() const QHash<int, QByteArray> LedDisplayTextModel::roleNames() const
{ {
static const QHash<int, QByteArray> roles { static const QHash<int, QByteArray> roles {
{ TextRole, "text" }, { TextRole, "text" },
@ -42,6 +42,7 @@ QHash<int, QByteArray> OmobiDisplayTextModel::roleNames() const
{ ColorRole, "color" }, { ColorRole, "color" },
{ AlignmentRole, "alignment" }, { AlignmentRole, "alignment" },
{ ScrollRole, "scroll" }, { ScrollRole, "scroll" },
{ ScrollDirectionRole, "scrollDirection" },
{ ScrollSpeedRole, "scrollSpeed" }, { ScrollSpeedRole, "scrollSpeed" },
{ ScrollCountRole, "scrollCount" }, { ScrollCountRole, "scrollCount" },
{ IndexRole, "index" } { IndexRole, "index" }
@ -49,13 +50,14 @@ QHash<int, QByteArray> OmobiDisplayTextModel::roleNames() const
return roles; return roles;
} }
void OmobiDisplayTextModel::append( void LedDisplayTextModel::append(
QString text, QString text,
bool active, bool active,
unsigned int runtime, unsigned int runtime,
QString color, QString color,
QString alignment, unsigned int alignment,
bool scroll, bool scroll,
unsigned int scrollDirection,
unsigned int scrollSpeed, unsigned int scrollSpeed,
unsigned int scrollCount unsigned int scrollCount
) { ) {
@ -74,6 +76,7 @@ void OmobiDisplayTextModel::append(
{ ColorRole, color }, { ColorRole, color },
{ AlignmentRole, alignment }, { AlignmentRole, alignment },
{ ScrollRole, scroll }, { ScrollRole, scroll },
{ ScrollDirectionRole, scrollDirection},
{ ScrollSpeedRole, scrollSpeed }, { ScrollSpeedRole, scrollSpeed },
{ ScrollCountRole, scrollCount } { ScrollCountRole, scrollCount }
}; };
@ -81,14 +84,14 @@ void OmobiDisplayTextModel::append(
this->append(roles); this->append(roles);
} }
void OmobiDisplayTextModel::append(const QMap<int, QVariant> &roles) { void LedDisplayTextModel::append(const QMap<int, QVariant> &roles) {
int row = this->texts.length(); int row = this->texts.length();
this->beginInsertRows(QModelIndex(), row, row); this->beginInsertRows(QModelIndex(), row, row);
this->texts.insert(row, roles); this->texts.insert(row, roles);
this->endInsertRows(); this->endInsertRows();
} }
bool OmobiDisplayTextModel::setData(const QModelIndex &index, const QVariant &value, int role) { bool LedDisplayTextModel::setData(const QModelIndex &index, const QVariant &value, int role) {
if (index.row() >= rowCount() || !this->texts[index.row()].contains(role)) if (index.row() >= rowCount() || !this->texts[index.row()].contains(role))
return false; return false;
@ -107,7 +110,7 @@ bool OmobiDisplayTextModel::setData(const QModelIndex &index, const QVariant &va
return true; return true;
} }
void OmobiDisplayTextModel::remove(int row) void LedDisplayTextModel::remove(int row)
{ {
if (row < 0 || row >= this->rowCount()) if (row < 0 || row >= this->rowCount())
return; return;
@ -117,12 +120,12 @@ void OmobiDisplayTextModel::remove(int row)
endRemoveRows(); endRemoveRows();
} }
void OmobiDisplayTextModel::clear() { void LedDisplayTextModel::clear() {
for(int i = 0; i < this->texts.length(); i++) for(int i = 0; i < this->texts.length(); i++)
this->remove(i); this->remove(i);
} }
bool OmobiDisplayTextModel::setTexts(QList<QMap<int, QVariant>> texts) { bool LedDisplayTextModel::setTexts(QList<QMap<int, QVariant>> texts) {
this->beginResetModel(); this->beginResetModel();
this->resetInternalData(); this->resetInternalData();
this->texts.clear(); this->texts.clear();
@ -134,11 +137,11 @@ bool OmobiDisplayTextModel::setTexts(QList<QMap<int, QVariant>> texts) {
return true; return true;
} }
QList<QMap<int, QVariant>> OmobiDisplayTextModel::getTexts() { QList<QMap<int, QVariant>> LedDisplayTextModel::getTexts() {
return this->texts; return this->texts;
} }
QMap<int, QVariant> OmobiDisplayTextModel::getText(const QModelIndex &index) { QMap<int, QVariant> LedDisplayTextModel::getText(const QModelIndex &index) {
if (index.row() < this->rowCount()) if (index.row() < this->rowCount())
return this->texts[index.row()]; return this->texts[index.row()];
@ -146,6 +149,6 @@ QMap<int, QVariant> OmobiDisplayTextModel::getText(const QModelIndex &index) {
} }
int OmobiDisplayTextModel::getMaximumTextSets() { int LedDisplayTextModel::getMaximumTextSets() {
return this->maximumTextSets; return this->maximumTextSets;
} }

View file

@ -1,33 +1,34 @@
#ifndef OMOBIDISPLAYTEXTMODEL_H #ifndef LEDDISPLAYTEXTMODEL_H
#define OMOBIDISPLAYTEXTMODEL_H #define LEDDISPLAYTEXTMODEL_H
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QObject> #include <QObject>
#include <QColor> #include <QColor>
#include <QDebug> #include <QDebug>
class OmobiDisplayTextModel : public QAbstractListModel class LedDisplayTextModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)
Q_PROPERTY(int maximumTextSets READ getMaximumTextSets NOTIFY maximumTextSetsChanged) Q_PROPERTY(int maximumTextSets READ getMaximumTextSets NOTIFY maximumTextSetsChanged)
public: public:
friend class OmobiDisplayBackend; friend class LedDisplayBackend;
enum OmobiDisplayTextModelRole { enum LedDisplayTextModelRole {
TextRole = Qt::DisplayRole, TextRole = Qt::DisplayRole,
ActiveRole, ActiveRole,
RuntimeRole, RuntimeRole,
ColorRole, ColorRole,
AlignmentRole, AlignmentRole,
ScrollRole, ScrollRole,
ScrollDirectionRole,
ScrollSpeedRole, ScrollSpeedRole,
ScrollCountRole, ScrollCountRole,
IndexRole, IndexRole,
OmobiDisplayTextModelRoleCount LedDisplayTextModelRoleCount
}; };
Q_ENUM(OmobiDisplayTextModelRole) Q_ENUM(LedDisplayTextModelRole)
enum OmobiDisplayTextAlignment enum OmobiDisplayTextAlignment
{ {
@ -46,8 +47,9 @@ public:
bool active, bool active,
unsigned int runtime, unsigned int runtime,
QString color, QString color,
QString alignment, unsigned int alignment,
bool scroll, bool scroll,
unsigned int scrollDirection,
unsigned int scrollSpeed, unsigned int scrollSpeed,
unsigned int scrollCount unsigned int scrollCount
); );
@ -60,7 +62,7 @@ public:
Q_INVOKABLE int getMaximumTextSets(); Q_INVOKABLE int getMaximumTextSets();
protected: protected:
OmobiDisplayTextModel(QObject* parent = nullptr); LedDisplayTextModel(QObject* parent = nullptr);
bool setTexts(QList<QMap<int, QVariant>> json); bool setTexts(QList<QMap<int, QVariant>> json);
QList<QMap<int, QVariant>> getTexts(); QList<QMap<int, QVariant>> getTexts();
@ -74,13 +76,14 @@ private:
int maximumTextSets; int maximumTextSets;
int maximumTextLength; int maximumTextLength;
const QMap<OmobiDisplayTextModelRole, QVariant::Type> roleDataTypes = { const QMap<LedDisplayTextModelRole, QVariant::Type> roleDataTypes = {
{TextRole, QVariant::String}, {TextRole, QVariant::String},
{ActiveRole, QVariant::Bool}, {ActiveRole, QVariant::Bool},
{RuntimeRole, QVariant::Int}, {RuntimeRole, QVariant::Int},
{ColorRole, QVariant::String}, {ColorRole, QVariant::String},
{AlignmentRole, QVariant::Int}, {AlignmentRole, QVariant::Int},
{ScrollRole, QVariant::Bool}, {ScrollRole, QVariant::Bool},
{ScrollDirectionRole, QVariant::Int},
{ScrollSpeedRole, QVariant::Int}, {ScrollSpeedRole, QVariant::Int},
{ScrollCountRole, QVariant::Int}, {ScrollCountRole, QVariant::Int},
{IndexRole, QVariant::Int} {IndexRole, QVariant::Int}
@ -91,4 +94,4 @@ signals:
void maximumTextSetsChanged(); void maximumTextSetsChanged();
}; };
#endif // OMOBIDISPLAYTEXTMODEL_H #endif // LEDDISPLAYTEXTMODEL_H

View file

@ -9,8 +9,8 @@
#include <QtAndroidExtras> #include <QtAndroidExtras>
#endif #endif
#include "omobidisplaybackend.h" #include "leddisplaybackend.h"
#include "omobidisplaytextmodel.h" #include "leddisplaytextmodel.h"
/*void permissionCallback(const QtAndroid::PermissionResultMap& results) { /*void permissionCallback(const QtAndroid::PermissionResultMap& results) {
for(QtAndroid::PermissionResult result : results) { for(QtAndroid::PermissionResult result : results) {
@ -32,8 +32,7 @@ int main(int argc, char *argv[])
translator.load(":/" + QLocale::system().name() + ".qm"); translator.load(":/" + QLocale::system().name() + ".qm");
app.installTranslator(&translator); app.installTranslator(&translator);
qmlRegisterType<OmobiDisplayBackend>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend"); LedDisplayBackend::init();
qmlRegisterUncreatableType<OmobiDisplayTextModel>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created");
QBluetoothLeUartClient::init(); QBluetoothLeUartClient::init();
QQuickStyle::setStyle("Material"); QQuickStyle::setStyle("Material");

View file

@ -20,10 +20,13 @@ Item {
property double glowScale: 1 property double glowScale: 1
property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5 property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5
property bool interactive: true property bool interactive: true
property int horizontalPadding: width * 0.15
property int verticalPadding: height * 0.15
signal clicked signal clicked
function checkIsDarkColor(color) { function checkIsDarkColor(color) {
var c = color.substring(1); // strip # var c = color.substring(1); // strip #
var rgb = parseInt(c, 16); // convert rrggbb to decimal var rgb = parseInt(c, 16); // convert rrggbb to decimal
var r = (rgb >> 16) & 0xff; // extract red var r = (rgb >> 16) & 0xff; // extract red
@ -96,8 +99,8 @@ Item {
id: contentText id: contentText
anchors.centerIn: background anchors.centerIn: background
width: background.width * 0.7 width: background.width - 2 * control.horizontalPadding
height: background.height * 0.7 height: background.height - 2 * control.verticalPadding
font.pixelSize: height font.pixelSize: height
fontSizeMode: Text.Fit fontSizeMode: Text.Fit

View file

@ -1,7 +1,7 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.9 import QtQuick.Controls 2.9
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
import de.itsblue.bluetoothleuart 1.0 import de.itsblue.bluetoothleuart 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
@ -30,41 +30,35 @@ Page {
Chip { Chip {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: mainLayout.height * 0.05 Layout.preferredHeight: 35
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
color: "white" verticalPadding: height * 0.25
horizontalPadding: width * 0.05
color: "#ffffff"
text: root.statusText
onClicked: { onClicked: {
backend.bleClient.startScanningForDevices() if(parseInt(root.state) === LedDisplayBackend.LocationPermissionDenied && !backend.bleClient.isLocationPermissionGranted())
backend.bleClient.requestLocationPermission()
else
backend.bleClient.startScanningForDevices()
} }
RowLayout { BusyIndicator {
spacing: mainLayout.anchors.margins id: busyIndicator
anchors.fill: parent anchors {
anchors.leftMargin: width * 0.05 right: parent.right
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
} }
height: parent.height
width: height
scale: 0.8
opacity: root.working ? 1:0
} }
} }
@ -154,7 +148,7 @@ Page {
color: "lightgrey" color: "lightgrey"
font.pixelSize: parent.height * 0.6 font.pixelSize: parent.height * 0.6
font.bold: true font.bold: true
text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? "...":"?" text: parseInt(root.state) === LedDisplayBackend.Scanning ? "...":"?"
} }
} }
@ -170,7 +164,7 @@ Page {
font.pixelSize: noDisplaysRect.height * 0.3 font.pixelSize: noDisplaysRect.height * 0.3
color: Qt.darker("lightgrey", 1.1) color: Qt.darker("lightgrey", 1.1)
text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? qsTr("Still scanning"):qsTr("No displays found") text: parseInt(root.state) === LedDisplayBackend.Scanning ? qsTr("Still scanning"):qsTr("No displays found")
} }
} }
@ -334,7 +328,7 @@ Page {
states: [ states: [
State { State {
name: OmobiDisplayBackend.Idle name: LedDisplayBackend.Idle
PropertyChanges { PropertyChanges {
target: root target: root
@ -348,7 +342,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.BluetoothOff name: LedDisplayBackend.BluetoothOff
PropertyChanges { PropertyChanges {
target: bluetoothOffItem target: bluetoothOffItem
opacity: 1 opacity: 1
@ -364,7 +358,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.LocationPermissionDenied name: LedDisplayBackend.LocationPermissionDenied
PropertyChanges { PropertyChanges {
target: noPermissionItem target: noPermissionItem
@ -381,7 +375,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.Scanning name: LedDisplayBackend.Scanning
PropertyChanges { PropertyChanges {
target: root target: root
@ -398,7 +392,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.ReadyToConnect name: LedDisplayBackend.ReadyToConnect
PropertyChanges { PropertyChanges {
target: root target: root
@ -408,7 +402,7 @@ Page {
}, },
State { State {
name: OmobiDisplayBackend.AuthenticationRequired name: LedDisplayBackend.AuthenticationRequired
PropertyChanges { PropertyChanges {
target: authenticationDialog target: authenticationDialog
@ -427,7 +421,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.Authenticating name: LedDisplayBackend.Authenticating
PropertyChanges { PropertyChanges {
target: availableDisplaysListView target: availableDisplaysListView
@ -442,7 +436,7 @@ Page {
}, },
State { State {
name: OmobiDisplayBackend.Connecting name: LedDisplayBackend.Connecting
PropertyChanges { PropertyChanges {
target: availableDisplaysListView target: availableDisplaysListView
@ -456,7 +450,7 @@ Page {
} }
}, },
State { State {
name: OmobiDisplayBackend.Initing name: LedDisplayBackend.Initing
PropertyChanges { PropertyChanges {
target: availableDisplaysListView target: availableDisplaysListView

View file

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
import de.itsblue.bluetoothleuart 1.0 import de.itsblue.bluetoothleuart 1.0
Page { Page {
@ -34,7 +34,7 @@ Page {
Chip { Chip {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: mainLayout.height * 0.05 Layout.preferredHeight: 35
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
interactive: false interactive: false
@ -105,6 +105,9 @@ Page {
DisplayEditDialog { DisplayEditDialog {
id: displayEditDialog id: displayEditDialog
Material.theme: root.Material.theme
Material.accent: root.Material.accent
} }
Dialog { Dialog {
@ -127,9 +130,11 @@ Page {
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose
modal: true modal: true
Material.theme: root.Material.theme
Material.accent: root.Material.accent
contentItem: ColumnLayout { contentItem: ColumnLayout {
BusyIndicator { BusyIndicator {
} }
Text { Text {
@ -141,10 +146,10 @@ Page {
states: [ states: [
State { State {
name: OmobiDisplayBackend.Connected name: LedDisplayBackend.Connected
}, },
State { State {
name: OmobiDisplayBackend.Loading name: LedDisplayBackend.Loading
PropertyChanges { PropertyChanges {
target: loadingDialog target: loadingDialog

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.9 import QtQuick.Layouts 1.9
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
Dialog { Dialog {
id: control id: control

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.9
import QtQuick.Layouts 1.9 import QtQuick.Layouts 1.9
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
ListView { ListView {
id: control id: control

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.9 import QtQuick.Layouts 1.9
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
Dialog { Dialog {
id: control id: control
@ -31,6 +31,7 @@ Dialog {
editingModel.color = colorColorPicker.value editingModel.color = colorColorPicker.value
editingModel.alignment = alignmentComboBox.currentIndex editingModel.alignment = alignmentComboBox.currentIndex
editingModel.scroll = scrollSwitch.checked editingModel.scroll = scrollSwitch.checked
editingModel.scrollDirection = scrollDirectionComboBox.currentIndex
editingModel.scrollSpeed = scrollSpeedSpinBox.value editingModel.scrollSpeed = scrollSpeedSpinBox.value
editingModel.scrollCount = scrollCountSpinBox.value editingModel.scrollCount = scrollCountSpinBox.value
} }
@ -39,8 +40,9 @@ Dialog {
activeSwitch.checked, activeSwitch.checked,
runtimeSpinBox.value, runtimeSpinBox.value,
colorColorPicker.value, colorColorPicker.value,
alignmentComboBox.currentText, alignmentComboBox.currentIndex,
scrollSwitch.checked, scrollSwitch.checked,
scrollDirectionComboBox.currentIndex,
scrollSpeedSpinBox.value, scrollSpeedSpinBox.value,
scrollCountSpinBox.value scrollCountSpinBox.value
) )
@ -83,6 +85,7 @@ Dialog {
id: runtimeSpinBox id: runtimeSpinBox
Layout.fillWidth: true Layout.fillWidth: true
editable: true editable: true
from: 1
to: 3600 to: 3600
text: qsTr("Runtime (in s)") text: qsTr("Runtime (in s)")
} }
@ -96,7 +99,7 @@ Dialog {
ComboBoxDelegate { ComboBoxDelegate {
id: alignmentComboBox id: alignmentComboBox
Layout.fillWidth: true Layout.fillWidth: true
model: ["left", "center", "right"] model: [qsTr("left"), qsTr("center"), qsTr("right")]
text: qsTr("Alignment") text: qsTr("Alignment")
} }
@ -106,6 +109,13 @@ Dialog {
text: qsTr("Scroll") text: qsTr("Scroll")
} }
ComboBoxDelegate {
id: scrollDirectionComboBox
Layout.fillWidth: true
model: [qsTr("right to left"), qsTr("left to right")]
text: qsTr("Scroll direction")
}
SpinBoxDelegate { SpinBoxDelegate {
id: scrollSpeedSpinBox id: scrollSpeedSpinBox
Layout.fillWidth: true Layout.fillWidth: true
@ -117,7 +127,7 @@ Dialog {
SpinBoxDelegate { SpinBoxDelegate {
id: scrollCountSpinBox id: scrollCountSpinBox
Layout.fillWidth: true Layout.fillWidth: true
from: 0 from: 1
editable: true editable: true
text: qsTr("Scroll count") text: qsTr("Scroll count")
} }
@ -165,6 +175,7 @@ Dialog {
colorColorPicker.value = editingModel.color colorColorPicker.value = editingModel.color
alignmentComboBox.currentIndex = editingModel.alignment alignmentComboBox.currentIndex = editingModel.alignment
scrollSwitch.checked = editingModel.scroll scrollSwitch.checked = editingModel.scroll
scrollDirectionComboBox.currentIndex = editingModel.scrollDirection
scrollSpeedSpinBox.value = editingModel.scrollSpeed scrollSpeedSpinBox.value = editingModel.scrollSpeed
scrollCountSpinBox.value = editingModel.scrollCount scrollCountSpinBox.value = editingModel.scrollCount
@ -181,11 +192,12 @@ Dialog {
function reset() { function reset() {
activeSwitch.checked = true activeSwitch.checked = true
textTextField.value = "" textTextField.value = ""
runtimeSpinBox.value = 0 runtimeSpinBox.value = 1
colorColorPicker.value = "" colorColorPicker.value = "#ffffff"
alignmentComboBox.currentIndex = 0 alignmentComboBox.currentIndex = 0
scrollSwitch.checked = false scrollSwitch.checked = false
scrollDirectionComboBox.currentIndex = 0
scrollSpeedSpinBox.value = 5 scrollSpeedSpinBox.value = 5
scrollCountSpinBox.value = 0 scrollCountSpinBox.value = 1
} }
} }

View file

@ -1,7 +1,7 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.LedDisplayController 1.0
import de.itsblue.bluetoothleuart 1.0 import de.itsblue.bluetoothleuart 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
@ -24,7 +24,7 @@ ApplicationWindow {
anchors.fill: parent anchors.fill: parent
Material.accent: "#0094ff" Material.accent: "#0094ff"
Material.theme: Material.System Material.theme: Material.Light
header: ToolBar { header: ToolBar {
id: headerToolBar id: headerToolBar
@ -97,7 +97,7 @@ ApplicationWindow {
} }
} }
OmobiDisplayBackend { LedDisplayBackend {
id: backend id: backend
} }
@ -171,7 +171,7 @@ ApplicationWindow {
states: [ states: [
State { State {
name: OmobiDisplayBackend.Idle name: LedDisplayBackend.Idle
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -179,7 +179,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.BluetoothOff name: LedDisplayBackend.BluetoothOff
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -187,7 +187,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.LocationPermissionDenied name: LedDisplayBackend.LocationPermissionDenied
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -195,7 +195,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Scanning name: LedDisplayBackend.Scanning
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -203,7 +203,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.ReadyToConnect name: LedDisplayBackend.ReadyToConnect
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -211,7 +211,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Connecting name: LedDisplayBackend.Connecting
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -219,7 +219,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.AuthenticationRequired name: LedDisplayBackend.AuthenticationRequired
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -227,7 +227,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Authenticating name: LedDisplayBackend.Authenticating
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -235,7 +235,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Initing name: LedDisplayBackend.Initing
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectPageComp currentComponent: connectPageComp
@ -243,7 +243,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Connected name: LedDisplayBackend.Connected
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectedPageComp currentComponent: connectedPageComp
@ -259,7 +259,7 @@ ApplicationWindow {
}, },
State { State {
name: OmobiDisplayBackend.Loading name: LedDisplayBackend.Loading
PropertyChanges { PropertyChanges {
target: mainStack target: mainStack
currentComponent: connectedPageComp currentComponent: connectedPageComp

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

@ -55,6 +55,24 @@
<source>No displays found. Tap to scan again</source> <source>No displays found. Tap to scan again</source>
<translation>Keine Displays gefunden. Tippe um erneut zu suchen</translation> <translation>Keine Displays gefunden. Tippe um erneut zu suchen</translation>
</message> </message>
<message>
<source>Bluetooth is turned off</source>
<translation>Bluetooth ist ausgeschaltet</translation>
</message>
<message>
<source>Error:
Location permission denied!</source>
<translation>Fehler:
Standort-Berechtigung verweigert!</translation>
</message>
<message>
<source>This app requires location permission in order for Bluetooth to work, it will not actually access your location.</source>
<translation>Diese App benötigt die Standort-Berechtigung, damit sie Bluetooth verwenden kann. Sie wird nicht auf deinen Standort zugreifen.</translation>
</message>
<message>
<source>Tap here to continue</source>
<translation>Tippe hier um fortzufahren</translation>
</message>
</context> </context>
<context> <context>
<name>ConnectedPage</name> <name>ConnectedPage</name>

@ -1 +0,0 @@
Subproject commit 76e457593e889885fd410fdbcdd659706a1eceb8

View file

@ -59,6 +59,7 @@ public:
ColorParameter, ColorParameter,
AlignmentParameter, AlignmentParameter,
ScrollParameter, ScrollParameter,
ScrollDirectionParameter,
ScrollSpeedParameter, ScrollSpeedParameter,
ScrollCountParameter, ScrollCountParameter,
IndexParameter, IndexParameter,
@ -126,6 +127,7 @@ private:
char color[7]; char color[7];
text_align_t alignment; text_align_t alignment;
bool scroll; bool scroll;
int scrollDirection;
int scrollSpeed; /*!< Between 0 and 10 */ int scrollSpeed; /*!< Between 0 and 10 */
uint16_t scrollCount; uint16_t scrollCount;
} text_set_t; } text_set_t;
@ -138,7 +140,7 @@ private:
} sets_t; } sets_t;
// storage variables // storage variables
const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0}; const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0, 0};
sets_t text_sets; sets_t text_sets;
// storage control // storage control

View file

@ -292,6 +292,12 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe
returnValue = currentTextSet->scroll ? "true" : "false"; returnValue = currentTextSet->scroll ? "true" : "false";
break; break;
case ScrollDirectionParameter:
if(set)
currentTextSet->scrollDirection = value->toInt();
else
returnValue = currentTextSet->scrollDirection;
break;
case ScrollSpeedParameter: case ScrollSpeedParameter:
if (set) if (set)
{ {

View file

@ -110,6 +110,10 @@ void OmobiLedDisplay::onDataReceived(String dataString)
textSetIndex, textSetIndex,
LedDisplayController::DisplayTextSetParameter(textSetParameter)); LedDisplayController::DisplayTextSetParameter(textSetParameter));
Serial.println("sending parameter: " + String(textSetParameter) + " with value: " + this->ledDisplayController->getTextSetParameter(
textSetIndex,
LedDisplayController::DisplayTextSetParameter(textSetParameter)));
String json; String json;
serializeJson(doc, json); serializeJson(doc, json);
this->bleServer->sendData(json); this->bleServer->sendData(json);