Files
MeshCore-Solo/examples/companion_radio/AbstractUITask.h
T

44 lines
1.2 KiB
C++
Raw Normal View History

2025-08-16 20:04:54 +10:00
#pragma once
#include <MeshCore.h>
#include <helpers/ui/DisplayDriver.h>
#include <helpers/ui/UIScreen.h>
#include <helpers/SensorManager.h>
#include <helpers/MultiSerialInterface.h>
2025-08-16 20:04:54 +10:00
#include <Arduino.h>
#ifdef PIN_BUZZER
#include <helpers/ui/buzzer.h>
#endif
#include "NodePrefs.h"
#include "MyMesh.h"
2025-08-16 20:04:54 +10:00
enum class UIEventType {
none,
contactMessage,
channelMessage,
roomMessage,
newContactMessage,
ack
};
class AbstractUITask : public MyMesh::Listener {
2025-08-16 20:04:54 +10:00
protected:
mesh::MainBoard* _board;
MultiSerialInterface* _interfaceManager;
2025-08-16 20:04:54 +10:00
AbstractUITask(mesh::MainBoard* board, MultiSerialInterface* interfaceManager) : _board(board), _interfaceManager(interfaceManager) {
2025-08-16 20:04:54 +10:00
}
public:
bool hasConnection() const { return _interfaceManager->isConnected(); }
2025-08-16 20:04:54 +10:00
uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); }
bool isBluetoothEnabled() const { return _interfaceManager->isBluetoothEnabled(); }
void enableBluetooth() { _interfaceManager->enableBluetooth(); }
void disableBluetooth() { _interfaceManager->disableBluetooth(); }
virtual void notify(UIEventType t = UIEventType::none) = 0;
2025-08-17 16:31:50 +10:00
virtual void loop() = 0;
2025-08-16 20:04:54 +10:00
};