diff --git a/examples/meshtastic/cpp/android_service/main.cpp b/examples/meshtastic/cpp/android_service/main.cpp index da1d93f..af49cfb 100644 --- a/examples/meshtastic/cpp/android_service/main.cpp +++ b/examples/meshtastic/cpp/android_service/main.cpp @@ -32,5 +32,7 @@ int main(int argc, char* argv[]) { QtAndroidService qtAndroidService; srcNode.enableRemoting(&qtAndroidService); + Connection con(&qtAndroidService); + return app.exec(); } diff --git a/examples/meshtastic/cpp/android_service/qtandroidservice.rep b/examples/meshtastic/cpp/android_service/qtandroidservice.rep index bc5bb63..548b2cf 100644 --- a/examples/meshtastic/cpp/android_service/qtandroidservice.rep +++ b/examples/meshtastic/cpp/android_service/qtandroidservice.rep @@ -6,7 +6,6 @@ class QtAndroidService { SLOT(void read2()); SLOT(void write2(const QVariant&)); SLOT(void setBackgroundMode(bool)); - SIGNAL(deviceDiscovered(const QVariant&)); SIGNAL(bleError()); SIGNAL(setReady(const QVariant&)); diff --git a/examples/meshtastic/cpp/android_service/qtandroidservice_ro.h b/examples/meshtastic/cpp/android_service/qtandroidservice_ro.h index 138cba7..83eea6f 100644 --- a/examples/meshtastic/cpp/android_service/qtandroidservice_ro.h +++ b/examples/meshtastic/cpp/android_service/qtandroidservice_ro.h @@ -3,8 +3,7 @@ class QtAndroidService : public QtAndroidServiceSource { public: - QtAndroidService() { con = new Connection(this); } - Connection* con; + Connection* con = nullptr; public slots: void setConnectionType(const QVariant& a1) override { con->setConnectionType(a1); } diff --git a/examples/meshtastic/cpp/connection/ble/ble_meshtastic.cpp b/examples/meshtastic/cpp/connection/ble/ble_meshtastic.cpp index 6501b92..dee6990 100644 --- a/examples/meshtastic/cpp/connection/ble/ble_meshtastic.cpp +++ b/examples/meshtastic/cpp/connection/ble/ble_meshtastic.cpp @@ -108,7 +108,7 @@ void BLE_ME::searchCharacteristics() { if (!con->backgroundMode) { QVariantList vNames; 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")); } if (!con->backgroundMode) { - emitter->setReady(QVariant(QVariantList())); + emitter->setReady(QVariant(QVariantList() << false)); } delete mainService; mainService = nullptr; } diff --git a/examples/meshtastic/cpp/connection/connection.cpp b/examples/meshtastic/cpp/connection/connection.cpp index 1393051..0527ccf 100644 --- a/examples/meshtastic/cpp/connection/connection.cpp +++ b/examples/meshtastic/cpp/connection/connection.cpp @@ -14,10 +14,11 @@ #ifdef Q_OS_ANDROID Connection::Connection(QtAndroidService* service) { + service->con = this; // forward signal connect(this, &Connection::sendSavedPackets, service, &QtAndroidService::sendSavedPackets); - ble = new BLE_ME(service, service->con); - usb = new USB_ME(service, service->con); + ble = new BLE_ME(service, this); + usb = new USB_ME(service, this); } #else Connection::Connection() { diff --git a/examples/meshtastic/cpp/qt.cpp b/examples/meshtastic/cpp/qt.cpp index 7101271..c527597 100644 --- a/examples/meshtastic/cpp/qt.cpp +++ b/examples/meshtastic/cpp/qt.cpp @@ -110,13 +110,8 @@ QT::QT() : QObject() { con->setBackgroundMode(true); ecl_fun("app:background-mode-changed", true); } else if (state == Qt::ApplicationActive) { - static bool startup = true; - if (startup) { - startup = false; - } else { - con->setBackgroundMode(false); - ecl_fun("app:background-mode-changed", false); - } + con->setBackgroundMode(false); + ecl_fun("app:background-mode-changed", false); } }); #endif diff --git a/examples/meshtastic/lisp/lora.lisp b/examples/meshtastic/lisp/lora.lisp index aeab51a..8917995 100644 --- a/examples/meshtastic/lisp/lora.lisp +++ b/examples/meshtastic/lisp/lora.lisp @@ -71,7 +71,7 @@ (defun set-ready (args) ; see Qt (case radios:*connection* (:ble - (destructuring-bind (ready name ble-names) + (destructuring-bind (ready &optional name ble-names) args (setf *ready* ready) (when ready @@ -188,7 +188,7 @@ "Called when app changes from background to foreground (mobile only)." (let ((app:*background-mode* t)) (dolist (packet packets) - (received-from-radio packet)) + (received-from-radio (list packet))) (receiving-done)) ;; this will show eventual red circles with numbers of unread messages (when (group:unread-messages-p) diff --git a/examples/meshtastic/qml/ext/common/Toast.qml b/examples/meshtastic/qml/ext/common/Toast.qml index a6de72b..0a05b93 100644 --- a/examples/meshtastic/qml/ext/common/Toast.qml +++ b/examples/meshtastic/qml/ext/common/Toast.qml @@ -25,7 +25,7 @@ Rectangle { Text { id: msg font.pixelSize: 16 - font.weight: Font.DemiBold + font.bold: true anchors.centerIn: parent color: "white" wrapMode: Text.WordWrap