-
Notifications
You must be signed in to change notification settings - Fork 1
/
TelnetLog.h
35 lines (31 loc) · 1.05 KB
/
TelnetLog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// =================================================================================================
// eModbus: Copyright 2020 by Michael Harwerth, Bert Melis and the contributors to eModbus
// MIT license - see license.md for details
// =================================================================================================
// Include Arduino.h to make Print and Serial known
#include <Arduino.h>
#ifdef ESP8266
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif
#include <WiFiUdp.h>
class TelnetLog : public Print {
public:
TelnetLog(uint16_t port, uint8_t maxClients);
~TelnetLog();
void begin(const char *label);
void end();
void update();
inline bool isActive() { return telnetActive; };
size_t write(uint8_t c);
size_t write(const uint8_t *buffer, size_t size);
protected:
// Telnet definitions
bool TL_ConnectionEstablished; // Flag for successfully handled connection
uint8_t TL_maxClients;
WiFiServer *TL_Server;
WiFiClient *TL_Client;
bool telnetActive;
char myLabel[64];
};