mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-28 07:48:13 +00:00
The enum value and its case label were never emitted after PR #16 — both dispatch sites in MyMesh.cpp now use advertReceivedFlood or advertReceivedZeroHop exclusively. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <MeshCore.h>
|
|
#include <helpers/ui/DisplayDriver.h>
|
|
#include <helpers/ui/UIScreen.h>
|
|
#include <helpers/SensorManager.h>
|
|
#include <helpers/BaseSerialInterface.h>
|
|
#include <Arduino.h>
|
|
|
|
#ifdef PIN_BUZZER
|
|
#include <helpers/ui/buzzer.h>
|
|
#endif
|
|
|
|
#include "NodePrefs.h"
|
|
|
|
enum class UIEventType {
|
|
none,
|
|
contactMessage,
|
|
channelMessage,
|
|
roomMessage,
|
|
advertReceivedFlood,
|
|
advertReceivedZeroHop,
|
|
ack
|
|
};
|
|
|
|
class AbstractUITask {
|
|
protected:
|
|
mesh::MainBoard* _board;
|
|
BaseSerialInterface* _serial;
|
|
bool _connected;
|
|
|
|
AbstractUITask(mesh::MainBoard* board, BaseSerialInterface* serial) : _board(board), _serial(serial) {
|
|
_connected = false;
|
|
}
|
|
|
|
public:
|
|
void setHasConnection(bool connected) { _connected = connected; }
|
|
bool hasConnection() const { return _connected; }
|
|
// True only when a BLE central is actually bonded/connected. On a dual
|
|
// (BLE+USB) interface hasConnection() is always true (USB counts), so use
|
|
// this for BLE-specific UI like the pairing-PIN prompt.
|
|
bool isBLEConnected() const { return _serial->isBLEConnected(); }
|
|
// True when a companion app is connected over any transport (BLE bonded or an
|
|
// open USB-CDC port). For app-connected behaviour like Auto buzzer mute.
|
|
bool isClientConnected() const { return _serial->isClientConnected(); }
|
|
uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); }
|
|
bool isSerialEnabled() const { return _serial->isEnabled(); }
|
|
void enableSerial() { _serial->enable(); }
|
|
void disableSerial() { _serial->disable(); }
|
|
virtual void msgRead(int msgcount) = 0;
|
|
virtual void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount, uint8_t contact_type = 0, const uint8_t* pub_key = nullptr) = 0;
|
|
virtual void notify(UIEventType t = UIEventType::none) = 0;
|
|
virtual void addChannelMsg(uint8_t channel_idx, const char* text) {}
|
|
virtual void addDMMsg(const uint8_t* pub_key, bool outgoing, const char* text) {}
|
|
virtual void loop() = 0;
|
|
};
|