forked from matth-x/MicroOcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOcppServer.h
More file actions
56 lines (37 loc) · 1.07 KB
/
Copy pathOcppServer.h
File metadata and controls
56 lines (37 loc) · 1.07 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// matth-x/ArduinoOcpp
// Copyright Matthias Akstaller 2019 - 2022
// MIT License
#ifndef OCPPSERVER_H
#define OCPPSERVER_H
#include <vector>
#include <ArduinoOcpp/Core/OcppSocket.h>
namespace ArduinoOcpp {
using WsClient = uint8_t;
} //end namespace ArduinoOcpp
#ifndef AO_CUSTOM_WS
#include <WebSocketsServer.h>
namespace ArduinoOcpp {
namespace EspWiFi {
struct ReceiveTXTroute {
IPAddress ip_addr;
WsClient num;
ReceiveTXTcallback processTXT;
};
class OcppServer {
private:
std::vector<ReceiveTXTroute> receiveTXTrouting;
WebSocketsServer wsockServer = WebSocketsServer(80);
OcppServer();
static OcppServer *instance;
public:
static OcppServer *getInstance();
void loop();
void wsockEvent(WsClient num, WStype_t type, uint8_t * payload, size_t length);
void setReceiveTXTcallback(IPAddress &ip_addr, ReceiveTXTcallback &callback);
void removeReceiveTXTcallback(IPAddress &ip_addr);
bool sendTXT(IPAddress &ip_addr, String &out);
};
} //end namespace EspWiFi
} //end namespace ArduinoOcpp
#endif //ndef AO_CUSTOM_WS
#endif