mirror of https://github.com/meshcore-dev/MeshCore
9 changed files with 86 additions and 101 deletions
@ -0,0 +1,46 @@ |
|||||
|
#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, |
||||
|
newContactMessage, |
||||
|
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; } |
||||
|
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) = 0; |
||||
|
virtual void soundBuzzer(UIEventType bet = UIEventType::none) = 0; |
||||
|
virtual void loop(); |
||||
|
}; |
||||
@ -1,7 +1,6 @@ |
|||||
#include "UITask.h" |
#include "UITask.h" |
||||
#include <helpers/TxtDataHelpers.h> |
#include <helpers/TxtDataHelpers.h> |
||||
#include "NodePrefs.h" |
#include "../MyMesh.h" |
||||
#include "MyMesh.h" |
|
||||
#include "target.h" |
#include "target.h" |
||||
|
|
||||
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
||||
Loading…
Reference in new issue