* refactor: removed UITask dependency from MyMesh. New MyMesh::Listener interface

* UITask's are now a MyMesh task Listener
This commit is contained in:
Scott Powell
2026-09-16 21:03:44 +10:00
parent 0ec5ed5fe7
commit 3caf033de2
10 changed files with 152 additions and 75 deletions
+4 -7
View File
@@ -12,6 +12,7 @@
#endif
#include "NodePrefs.h"
#include "MyMesh.h"
enum class UIEventType {
none,
@@ -22,25 +23,21 @@ enum class UIEventType {
ack
};
class AbstractUITask {
class AbstractUITask : public MyMesh::Listener {
protected:
mesh::MainBoard* _board;
MultiSerialInterface* _interfaceManager;
bool _connected;
AbstractUITask(mesh::MainBoard* board, MultiSerialInterface* interfaceManager) : _board(board), _interfaceManager(interfaceManager) {
_connected = false;
}
public:
void setHasConnection(bool connected) { _connected = connected; }
bool hasConnection() const { return _connected; }
bool hasConnection() const { return _interfaceManager->isConnected(); }
uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); }
bool isBluetoothEnabled() const { return _interfaceManager->isBluetoothEnabled(); }
void enableBluetooth() { _interfaceManager->enableBluetooth(); }
void disableBluetooth() { _interfaceManager->disableBluetooth(); }
virtual void msgRead(int msgcount) = 0;
virtual void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) = 0;
virtual void notify(UIEventType t = UIEventType::none) = 0;
virtual void loop() = 0;
};