make the code simpler
This commit is contained in:
@@ -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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user