forked from matth-x/MicroOcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArduinoOcpp.h
More file actions
111 lines (82 loc) · 4.07 KB
/
ArduinoOcpp.h
File metadata and controls
111 lines (82 loc) · 4.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// matth-x/ESP8266-OCPP
// Copyright Matthias Akstaller 2019 - 2021
// MIT License
#ifndef ARDUINOOCPP_H
#define ARDUINOOCPP_H
#include <ArduinoOcpp/Core/OcppOperation.h>
#include "Variants.h"
using ArduinoOcpp::OnReceiveConfListener;
using ArduinoOcpp::OnReceiveReqListener;
using ArduinoOcpp::OnSendConfListener;
using ArduinoOcpp::OnAbortListener;
using ArduinoOcpp::OnTimeoutListener;
using ArduinoOcpp::OnReceiveErrorListener;
#if USE_FACADE
void OCPP_initialize(String CS_hostname, uint16_t CS_port, String CS_url);
void OCPP_loop();
/*
* Provide hardware-related information to the library
*
* The library needs a way to obtain information from your charger that changes over time. The
* library calls following callbacks regularily (if they were set) to refresh its internal
* status.
*
* Set the callbacks once in your setup() function.
*/
void setPowerActiveImportSampler(float power());
void setEnergyActiveImportSampler(float energy());
void setEvRequestsEnergySampler(bool evRequestsEnergy());
/*
* React on calls by the library's internal functions
*
* The library needs to set parameters on your charger on a regular basis. The library calls
* following callbacks regularily (if they were set) to perform updates on your charger.
*
* Set the callbacks once in your setup() function.
*/
void setOnChargingRateLimitChange(void chargingRateChanged(float limit));
/*
* React on CS-initiated operations
*
* You can define custom behaviour in your integration which is executed every time the library
* receives a CS-initiated operation. The following functions set a callback function for the
* respective event. The library executes the callbacks always after its internal routines.
*
* Set the callbacks once in your setup() function.
*/
void setOnSetChargingProfileRequest(void listener(JsonObject payload)); //optional
void setOnRemoteStartTransactionSendConf(void listener(JsonObject payload)); //important, energize the power plug here
void setOnRemoteStopTransactionSendConf(void listener(JsonObject payload)); //important, de-energize the power plug here
void setOnResetSendConf(void listener(JsonObject payload)); //important, reset your device here (i.e. call ESP.reset();)
/*
* Perform CP-initiated operations
*
* Use following functions to send OCPP messages. Each function will adapt the library's
* internal state appropriatley (e.g. after a successful StartTransaction request the library
* will store the transactionId and send a StatusNotification).
*
* On receipt of the .conf() response the library calls the callback function
* "OnReceiveConfListener onConf" and passes the OCPP payload to it. The following functions
* are non-blocking. Your application code will immediately resume with the subsequent code
* in any case.
*/
void authorize(String &idTag, OnReceiveConfListener onConf = NULL, OnAbortListener onAbort = NULL, OnTimeoutListener onTimeout = NULL, OnReceiveErrorListener onError = NULL);
void bootNotification(String chargePointModel, String chargePointVendor, OnReceiveConfListener onConf = NULL, OnAbortListener onAbort = NULL, OnTimeoutListener onTimeout = NULL, OnReceiveErrorListener onError = NULL);
void startTransaction(OnReceiveConfListener onConf = NULL, OnAbortListener onAbort = NULL, OnTimeoutListener onTimeout = NULL, OnReceiveErrorListener onError = NULL);
void stopTransaction(OnReceiveConfListener onConf = NULL, OnAbortListener onAbort = NULL, OnTimeoutListener onTimeout = NULL, OnReceiveErrorListener onError = NULL);
/*
* Provide hardware-related information II
*
* When the EVSE state changes, you must notify the library in order to make StatusNotification
* work properly.
*
* Call these functions in your integration.
*/
//void startEvDrawsEnergy(); //<-- please use setEvRequestsEnergySampler(bool evRequestsEnergy());
//void stopEvDrawsEnergy(); //<-- please use setEvRequestsEnergySampler(bool evRequestsEnergy());
/*
* Access information about the internal state of the library
*/
int getTransactionId(); //returns the ID of the current transaction. Returns -1 if called before or after an transaction
#endif
#endif