supla-device
Toggle main menu visibility
Loading...
Searching...
No Matches
src
supla
debug
debug_log_tcp_server.h
1
/*
2
Copyright (C) AC SOFTWARE SP. Z O.O.
3
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*/
18
19
#ifndef SRC_SUPLA_DEBUG_DEBUG_LOG_TCP_SERVER_H_
20
#define SRC_SUPLA_DEBUG_DEBUG_LOG_TCP_SERVER_H_
21
22
#include <stdint.h>
23
24
#include <supla/debug/debug_config.h>
25
#include <supla/debug/debug_log.h>
26
27
namespace
Supla {
28
namespace
Debug {
29
30
class
DebugLogTcpServer :
public
LogSink {
31
public
:
32
explicit
DebugLogTcpServer(uint16_t port = 7778);
33
~DebugLogTcpServer()
override
;
34
35
bool
begin();
36
void
end();
37
void
iterate();
38
void
writeLog(
int
priority,
const
char
*message)
override
;
39
40
private
:
41
void
writeLine(
int
priority,
const
char
*message);
42
bool
writeBytes(
const
char
*data,
unsigned
int
size);
43
44
uint16_t port = 7778;
45
46
#if SUPLA_INSECURE_DEBUG_INTERFACE && defined(SUPLA_LINUX)
47
int
listenSocket = -1;
48
int
clientSocket = -1;
49
bool
openListenSocket();
50
void
acceptClient();
51
void
closeListenSocket();
52
void
closeClient();
53
#elif SUPLA_INSECURE_DEBUG_INTERFACE && defined(ESP_PLATFORM) && \
54
!defined(ARDUINO)
55
int
listenSocket = -1;
56
int
clientSocket = -1;
57
bool
openListenSocket();
58
void
acceptClient();
59
void
closeListenSocket();
60
void
closeClient();
61
#elif SUPLA_INSECURE_DEBUG_INTERFACE && defined(ARDUINO) && \
62
(defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32))
63
class
Impl;
64
Impl *impl =
nullptr
;
65
#endif
66
};
67
68
}
// namespace Debug
69
}
// namespace Supla
70
71
#endif
// SRC_SUPLA_DEBUG_DEBUG_LOG_TCP_SERVER_H_
Generated by
1.17.0