forked from matth-x/MicroOcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOcppSocket.h
More file actions
54 lines (39 loc) · 1.2 KB
/
Copy pathOcppSocket.h
File metadata and controls
54 lines (39 loc) · 1.2 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
// matth-x/ESP8266-OCPP
// Copyright Matthias Akstaller 2019 - 2021
// MIT License
#ifndef OCPPSOCKET_H
#define OCPPSOCKET_H
#include <WebSocketsClient.h>
#include <WebSocketsServer.h>
#include <ArduinoOcpp/Core/OcppServer.h>
namespace ArduinoOcpp {
class OcppSocket {
public:
OcppSocket();
virtual ~OcppSocket() = default;
virtual bool sendTXT(String &out) = 0;
virtual void setReceiveTXTcallback(ReceiveTXTcallback &receiveTXT) = 0; //ReceiveTXTcallback is defined in OcppServer.h
};
namespace EspWiFi {
class OcppClientSocket : public OcppSocket {
private:
//std::shared_ptr<WebSocketsClient> wsock;
WebSocketsClient *wsock;
public:
//OcppClientSocket(ReceiveTXTcallback &receiveTXT, std::shared_ptr<WebSocketsClient> wsock);
OcppClientSocket(WebSocketsClient *wsock);
bool sendTXT(String &out);
void setReceiveTXTcallback(ReceiveTXTcallback &receiveTXT);
};
class OcppServerSocket : public OcppSocket {
private:
IPAddress ip_addr;
public:
OcppServerSocket(IPAddress &ip_addr);
~OcppServerSocket();
bool sendTXT(String &out);
void setReceiveTXTcallback(ReceiveTXTcallback &receiveTXT);
};
} //end namespace EspWiFi
} //end namespace ArduinoOcpp
#endif