revisions

This commit is contained in:
pls.153 2024-04-17 23:56:30 +02:00
parent 28875816c2
commit d97f30416e
8 changed files with 13 additions and 17 deletions

View file

@ -32,5 +32,7 @@ int main(int argc, char* argv[]) {
QtAndroidService qtAndroidService; QtAndroidService qtAndroidService;
srcNode.enableRemoting(&qtAndroidService); srcNode.enableRemoting(&qtAndroidService);
Connection con(&qtAndroidService);
return app.exec(); return app.exec();
} }

View file

@ -6,7 +6,6 @@ class QtAndroidService {
SLOT(void read2()); SLOT(void read2());
SLOT(void write2(const QVariant&)); SLOT(void write2(const QVariant&));
SLOT(void setBackgroundMode(bool)); SLOT(void setBackgroundMode(bool));
SIGNAL(deviceDiscovered(const QVariant&)); SIGNAL(deviceDiscovered(const QVariant&));
SIGNAL(bleError()); SIGNAL(bleError());
SIGNAL(setReady(const QVariant&)); SIGNAL(setReady(const QVariant&));

View file

@ -3,8 +3,7 @@
class QtAndroidService : public QtAndroidServiceSource { class QtAndroidService : public QtAndroidServiceSource {
public: public:
QtAndroidService() { con = new Connection(this); } Connection* con = nullptr;
Connection* con;
public slots: public slots:
void setConnectionType(const QVariant& a1) override { con->setConnectionType(a1); } void setConnectionType(const QVariant& a1) override { con->setConnectionType(a1); }

View file

@ -108,7 +108,7 @@ void BLE_ME::searchCharacteristics() {
if (!con->backgroundMode) { if (!con->backgroundMode) {
QVariantList vNames; QVariantList vNames;
for (auto name : qAsConst(names)) { vNames << name; } for (auto name : qAsConst(names)) { vNames << name; }
emitter->setReady(QVariant(QVariantList() << true << currentDevice.name().right(4) << vNames)); emitter->setReady(QVariant(QVariantList() << true << currentDevice.name().right(4) << QVariant(vNames)));
} }
} }
} }
@ -185,7 +185,7 @@ void BLE_ME::disconnecting() {
mainService->writeDescriptor(notifications, QByteArray::fromHex("0000")); mainService->writeDescriptor(notifications, QByteArray::fromHex("0000"));
} }
if (!con->backgroundMode) { if (!con->backgroundMode) {
emitter->setReady(QVariant(QVariantList())); emitter->setReady(QVariant(QVariantList() << false));
} }
delete mainService; mainService = nullptr; delete mainService; mainService = nullptr;
} }

View file

@ -14,10 +14,11 @@
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
Connection::Connection(QtAndroidService* service) { Connection::Connection(QtAndroidService* service) {
service->con = this;
// forward signal // forward signal
connect(this, &Connection::sendSavedPackets, service, &QtAndroidService::sendSavedPackets); connect(this, &Connection::sendSavedPackets, service, &QtAndroidService::sendSavedPackets);
ble = new BLE_ME(service, service->con); ble = new BLE_ME(service, this);
usb = new USB_ME(service, service->con); usb = new USB_ME(service, this);
} }
#else #else
Connection::Connection() { Connection::Connection() {

View file

@ -110,13 +110,8 @@ QT::QT() : QObject() {
con->setBackgroundMode(true); con->setBackgroundMode(true);
ecl_fun("app:background-mode-changed", true); ecl_fun("app:background-mode-changed", true);
} else if (state == Qt::ApplicationActive) { } else if (state == Qt::ApplicationActive) {
static bool startup = true; con->setBackgroundMode(false);
if (startup) { ecl_fun("app:background-mode-changed", false);
startup = false;
} else {
con->setBackgroundMode(false);
ecl_fun("app:background-mode-changed", false);
}
} }
}); });
#endif #endif

View file

@ -71,7 +71,7 @@
(defun set-ready (args) ; see Qt (defun set-ready (args) ; see Qt
(case radios:*connection* (case radios:*connection*
(:ble (:ble
(destructuring-bind (ready name ble-names) (destructuring-bind (ready &optional name ble-names)
args args
(setf *ready* ready) (setf *ready* ready)
(when ready (when ready
@ -188,7 +188,7 @@
"Called when app changes from background to foreground (mobile only)." "Called when app changes from background to foreground (mobile only)."
(let ((app:*background-mode* t)) (let ((app:*background-mode* t))
(dolist (packet packets) (dolist (packet packets)
(received-from-radio packet)) (received-from-radio (list packet)))
(receiving-done)) (receiving-done))
;; this will show eventual red circles with numbers of unread messages ;; this will show eventual red circles with numbers of unread messages
(when (group:unread-messages-p) (when (group:unread-messages-p)

View file

@ -25,7 +25,7 @@ Rectangle {
Text { Text {
id: msg id: msg
font.pixelSize: 16 font.pixelSize: 16
font.weight: Font.DemiBold font.bold: true
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
wrapMode: Text.WordWrap wrapMode: Text.WordWrap