make the code simpler

This commit is contained in:
Marcel Walter
2026-01-05 01:02:41 +01:00
parent 49d043bd5e
commit 453cf8094c
4 changed files with 62 additions and 66 deletions
-14
View File
@@ -1,14 +0,0 @@
#pragma once
#include <Arduino.h>
class ITrigger
{
public:
ITrigger(/* args */) = default;
~ITrigger() = default;
virtual void printText(String text) = 0;
virtual void printOpen() = 0;
virtual void printClose() = 0;
};
+8 -3
View File
@@ -3,7 +3,11 @@
#include <UniversalTelegramBot.h>
#include <WiFiClientSecure.h>
#include "ITrigger.h"
struct TelegramCommand
{
const String command;
void (*const functionPointer) (const String arguments);
};
class Telegram
{
@@ -13,14 +17,15 @@ private:
unsigned long bot_lasttime; // last time messages' scan has been done
ITrigger &trigger;
WiFiClientSecure &secured_client;
UniversalTelegramBot bot;
TelegramCommand *cmdList;
uint32_t cmdListCount;
void handleNewMessages(int numNewMessages);
public:
Telegram(WiFiClientSecure &sec_client, ITrigger &trig);
Telegram(WiFiClientSecure &sec_client, TelegramCommand commandList[], uint32_t commandListCount);
~Telegram();
void init();