30 lines
627 B
C++
30 lines
627 B
C++
#pragma once
|
|
#include <Arduino.h>
|
|
#include <UniversalTelegramBot.h>
|
|
#include <WiFiClientSecure.h>
|
|
|
|
#include "ITrigger.h"
|
|
|
|
class Telegram
|
|
{
|
|
private:
|
|
static const char *BOT_TOKEN;
|
|
static const unsigned long BOT_MTBS; // mean time between scan messages
|
|
|
|
|
|
unsigned long bot_lasttime; // last time messages' scan has been done
|
|
ITrigger &trigger;
|
|
WiFiClientSecure &secured_client;
|
|
UniversalTelegramBot bot;
|
|
|
|
void handleNewMessages(int numNewMessages);
|
|
|
|
public:
|
|
Telegram(WiFiClientSecure &sec_client, ITrigger &trig);
|
|
~Telegram();
|
|
|
|
void init();
|
|
void cyclic(unsigned long now);
|
|
};
|
|
|