Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ocpp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Linumiz
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
21
22#ifndef ZEPHYR_INCLUDE_NET_OCPP_H_
23#define ZEPHYR_INCLUDE_NET_OCPP_H_
24
25#include <stdio.h>
26#include <zephyr/kernel.h>
27#include <zephyr/net/net_ip.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35#define CISTR50 50
36
40#define OCPP_BASIC_AUTH_PASSWORD_MIN_LEN 16
41
53
66
86
111
117
126
132
158
166
167 struct {
170
173
177
178 struct {
180
182 int id_con;
184
185 struct {
186 int id_con;
188
189 struct {
190 int id_con;
192
193 struct {
197
198 struct {
199 int id_con;
203
207 struct {
208 const char *vendor_id;
209 const char *msg_id;
210 const char *data;
214};
215
220 char *model;
221 char *vendor;
222
224
226 char *sl_no;
227 char *box_sl_no;
228 char *fw_ver;
229 char *iccid;
230 char *imsi;
233};
234
242
256 const char *username;
266};
267
270 char *cs_ip;
271 char *ws_url;
272 int port;
274#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
275 struct ocpp_tls_credentials creds;
276#endif
278};
279
282
306 union ocpp_io_value *io,
307 void *user_data);
308
321int ocpp_init(struct ocpp_cp_info *cpi,
322 struct ocpp_cs_info *csi,
324 void *user_data);
325
337
344
356 char *idtag,
358 uint32_t timeout_ms);
359
373 int meter_val,
374 uint8_t conn_id,
375 uint32_t timeout_ms);
376
387 int meter_val,
388 uint32_t timeout_ms);
389
402 int conn_id,
404 enum ocpp_cp_error_code error,
405 uint32_t timeout_ms);
406
407#ifdef __cplusplus
408}
409#endif
410
411#endif /* ZEPHYR_INCLUDE_NET_OCPP_H_ */
412
unsigned short int net_sa_family_t
Socket address family type.
Definition net_ip.h:169
int ocpp_status_notification(ocpp_session_handle_t hndl, int conn_id, enum ocpp_cp_status status, enum ocpp_cp_error_code error, uint32_t timeout_ms)
Notify connector status to CS via StatusNotification.
int ocpp_session_open(ocpp_session_handle_t *hndl)
API to request a new Session.
ocpp_cp_status
OCPP charge point status reported in StatusNotification.
Definition ocpp.h:55
ocpp_req_status
Reply status the application sets for a central system request.
Definition ocpp.h:119
int(* ocpp_user_notify_callback_t)(enum ocpp_notify_reason reason, union ocpp_io_value *io, void *user_data)
Asynchronous event notification callback registered by the application.
Definition ocpp.h:305
ocpp_auth_status
OCPP IdTag authorization status in result to ocpp request authorization.
Definition ocpp.h:46
int ocpp_authorize(ocpp_session_handle_t hndl, char *idtag, enum ocpp_auth_status *status, uint32_t timeout_ms)
Authorize request call to CS to get validity of idtag.
ocpp_meter_measurand
OCPP meter readings to be filled on user callback request from library.
Definition ocpp.h:136
void * ocpp_session_handle_t
Parameters opaque session handle for ocpp_* API.
Definition ocpp.h:281
void ocpp_session_close(ocpp_session_handle_t hndl)
API to close a Session.
int ocpp_stop_transaction(ocpp_session_handle_t hndl, int meter_val, uint32_t timeout_ms)
Notify transaction stopped to CS.
ocpp_notify_reason
Definition ocpp.h:87
ocpp_cp_error_code
OCPP charge point error code reported in StatusNotification.
Definition ocpp.h:68
#define CISTR50
Max length of string literals e.g idtag.
Definition ocpp.h:35
ocpp_availability_type
OCPP availability type requested in ChangeAvailability.
Definition ocpp.h:128
int ocpp_init(struct ocpp_cp_info *cpi, struct ocpp_cs_info *csi, ocpp_user_notify_callback_t cb, void *user_data)
OCPP library init.
ocpp_reset_type
OCPP reset type requested by central system.
Definition ocpp.h:113
int ocpp_start_transaction(ocpp_session_handle_t hndl, int meter_val, uint8_t conn_id, uint32_t timeout_ms)
Notify transaction start to CS.
@ OCPP_CP_STATUS_SUSPENDED_EV
charging suspended by EV
Definition ocpp.h:60
@ OCPP_CP_STATUS_FAULTED
fault present
Definition ocpp.h:64
@ OCPP_CP_STATUS_CHARGING
charging in progress
Definition ocpp.h:58
@ OCPP_CP_STATUS_SUSPENDED_EVSE
charging suspended by EVSE
Definition ocpp.h:59
@ OCPP_CP_STATUS_RESERVED
connector reserved
Definition ocpp.h:62
@ OCPP_CP_STATUS_AVAILABLE
connector available
Definition ocpp.h:56
@ OCPP_CP_STATUS_UNAVAILABLE
connector not available
Definition ocpp.h:63
@ OCPP_CP_STATUS_FINISHING
transaction finishing
Definition ocpp.h:61
@ OCPP_CP_STATUS_PREPARING
preparing to charge
Definition ocpp.h:57
@ OCPP_REQ_SCHEDULED
ChangeAvailability applied after transaction.
Definition ocpp.h:122
@ OCPP_REQ_UNKNOWN_MESSAGE_ID
DataTransfer message id not known.
Definition ocpp.h:124
@ OCPP_REQ_UNKNOWN_VENDOR_ID
DataTransfer vendor id not known.
Definition ocpp.h:123
@ OCPP_REQ_REJECTED
request rejected
Definition ocpp.h:121
@ OCPP_REQ_ACCEPTED
request accepted
Definition ocpp.h:120
@ OCPP_AUTH_ACCEPTED
accepted, allowed to charge
Definition ocpp.h:48
@ OCPP_AUTH_INVALID
IdTag not valid.
Definition ocpp.h:47
@ OCPP_AUTH_BLOCKED
blocked to charge
Definition ocpp.h:49
@ OCPP_AUTH_CONCURRENT_TX
Parallel access of same IdTag.
Definition ocpp.h:51
@ OCPP_AUTH_EXPIRED
IdTag expired, not allowed to charge.
Definition ocpp.h:50
@ OCPP_OMM_REACTIVE_ENERGY_TO_EV
reactive energy to EV, in varh
Definition ocpp.h:143
@ OCPP_OMM_VOLTAGE_AC_RMS
AC RMS supply voltage, in V.
Definition ocpp.h:154
@ OCPP_OMM_POWER_MAX_OFFERED_TO_EV
maximum power offered to EV, in W
Definition ocpp.h:150
@ OCPP_OMM_ACTIVE_POWER_FROM_EV
active power from EV, in W
Definition ocpp.h:144
@ OCPP_OMM_REACTIVE_ENERGY_FROM_EV
reactive energy from EV, in varh
Definition ocpp.h:142
@ OCPP_OMM_TEMPERATURE
temperature inside charge point, in Celsius
Definition ocpp.h:153
@ OCPP_OMM_CURRENT_TO_EV
current to EV, in A
Definition ocpp.h:138
@ OCPP_OMM_ACTIVE_POWER_TO_EV
active power to EV, in W
Definition ocpp.h:145
@ OCPP_OMM_ACTIVE_ENERGY_TO_EV
active energy to EV, in Wh
Definition ocpp.h:141
@ OCPP_OMM_END
Definition ocpp.h:156
@ OCPP_OMM_REACTIVE_POWER_TO_EV
reactive power to EV, in var
Definition ocpp.h:147
@ OCPP_OMM_CURRENT_MAX_OFFERED_TO_EV
maximum current offered to EV, in A
Definition ocpp.h:139
@ OCPP_OMM_REACTIVE_POWER_FROM_EV
reactive power from EV, in var
Definition ocpp.h:146
@ OCPP_OMM_POWERLINE_FREQ
powerline frequency, in Hz
Definition ocpp.h:148
@ OCPP_OMM_ACTIVE_ENERGY_FROM_EV
active energy from EV, in Wh
Definition ocpp.h:140
@ OCPP_OMM_POWER_FACTOR
power factor of supply
Definition ocpp.h:149
@ OCPP_OMM_CHARGING_PERCENT
charging percentage
Definition ocpp.h:152
@ OCPP_OMM_CURRENT_FROM_EV
current from EV, in A
Definition ocpp.h:137
@ OCPP_OMM_FAN_SPEED
fan speed, in rpm
Definition ocpp.h:151
@ OCPP_USR_DATA_TRANSFER
Vendor specific data received from central system (DataTransfer).
Definition ocpp.h:109
@ OCPP_USR_START_CHARGING
Process the start charging request as like idtag received from local e.g authorize etc.
Definition ocpp.h:94
@ OCPP_USR_RESET
Reset the charge point (hard or soft).
Definition ocpp.h:103
@ OCPP_USR_UNLOCK_CONNECTOR
Unlock mechanical connector of CP.
Definition ocpp.h:100
@ OCPP_USR_STOP_CHARGING
Process the stop charging sequence.
Definition ocpp.h:97
@ OCPP_USR_CHANGE_AVAILABILITY
Change availability of a connector (operative/inoperative).
Definition ocpp.h:106
@ OCPP_USR_GET_METER_VALUE
User must fill the current reading.
Definition ocpp.h:89
@ OCPP_CP_ERR_OTHER_ERROR
other error
Definition ocpp.h:76
@ OCPP_CP_ERR_EV_COMMUNICATION_ERROR
communication with EV lost
Definition ocpp.h:71
@ OCPP_CP_ERR_LOCAL_LIST_CONFLICT
local list version conflict
Definition ocpp.h:75
@ OCPP_CP_ERR_RESET_FAILURE
reset failure
Definition ocpp.h:82
@ OCPP_CP_ERR_NO_ERROR
no error
Definition ocpp.h:69
@ OCPP_CP_ERR_WEAK_SIGNAL
weak signal
Definition ocpp.h:84
@ OCPP_CP_ERR_INTERNAL_ERROR
internal error
Definition ocpp.h:74
@ OCPP_CP_ERR_POWER_METER_FAILURE
power meter failure
Definition ocpp.h:79
@ OCPP_CP_ERR_UNDER_VOLTAGE
under voltage
Definition ocpp.h:83
@ OCPP_CP_ERR_POWER_SWITCH_FAILURE
power switch failure
Definition ocpp.h:80
@ OCPP_CP_ERR_HIGH_TEMPERATURE
over temperature
Definition ocpp.h:73
@ OCPP_CP_ERR_READER_FAILURE
id reader failure
Definition ocpp.h:81
@ OCPP_CP_ERR_OVER_VOLTAGE
over voltage
Definition ocpp.h:78
@ OCPP_CP_ERR_CONNECTOR_LOCK_FAILURE
connector lock failed
Definition ocpp.h:70
@ OCPP_CP_ERR_GROUND_FAILURE
ground fault detected
Definition ocpp.h:72
@ OCPP_CP_ERR_OVER_CURRENT_FAILURE
over current
Definition ocpp.h:77
@ OCPP_AVAILABILITY_INOPERATIVE
connector taken out of service
Definition ocpp.h:129
@ OCPP_AVAILABILITY_OPERATIVE
connector put into service
Definition ocpp.h:130
@ OCPP_RESET_SOFT
restart of the application only
Definition ocpp.h:115
@ OCPP_RESET_HARD
full reboot of the charge point
Definition ocpp.h:114
int sec_tag_t
Secure tag, a reference to TLS credential.
Definition tls_credentials.h:99
Public kernel APIs.
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
HTTP Basic authentication credentials of the charge point (CP).
Definition ocpp.h:251
const uint8_t * password
Authorization key (A00.FR.205), sent as it is: its bytes, not their hexadecimal digits.
Definition ocpp.h:260
const char * username
CP identity as used in the websocket URL (A00.FR.204), without colon or control characters,...
Definition ocpp.h:256
size_t password_len
Size of the password in bytes, from OCPP_BASIC_AUTH_PASSWORD_MIN_LEN to <code class='doxyxref' data-...
Definition ocpp.h:265
Parameters for ocpp_init information about Charge Point (CP) all are string literal except num_of_con...
Definition ocpp.h:219
char * iccid
ICC ID.
Definition ocpp.h:229
char * vendor
CP vendor.
Definition ocpp.h:221
char * model
Charge Point (CP) model.
Definition ocpp.h:220
char * meter_sl_no
Main power meter serial number.
Definition ocpp.h:231
char * sl_no
optional fields
Definition ocpp.h:226
char * box_sl_no
Box serial number.
Definition ocpp.h:227
char * meter_type
Main power meter type.
Definition ocpp.h:232
char * fw_ver
Firmware version.
Definition ocpp.h:228
char * imsi
IMSI.
Definition ocpp.h:230
int num_of_con
Max.
Definition ocpp.h:223
Parameters for ocpp_init information about central system (CS).
Definition ocpp.h:269
char * ws_url
Websocket url exclude ipaddr & port.
Definition ocpp.h:271
char * cs_ip
Central system IP address.
Definition ocpp.h:270
struct ocpp_basic_auth auth
HTTP Basic authentication credentials.
Definition ocpp.h:277
net_sa_family_t sa_family
IP protocol family type 4/6.
Definition ocpp.h:273
int port
Central system port number.
Definition ocpp.h:272
TLS credentials information of the central system (CS).
Definition ocpp.h:236
const sec_tag_t * sec_tag_list
TLS Sec tag list.
Definition ocpp.h:237
size_t sec_tag_list_size
Size of TLS Sec tag list.
Definition ocpp.h:239
size_t tls_hostname_size
Size of TLS Hostname.
Definition ocpp.h:240
char * tls_hostname
TLS Hostname.
Definition ocpp.h:238
TLS credentials management.
OCPP user callback notification/request of input/output values union member should be accessed with e...
Definition ocpp.h:165
struct ocpp_io_value::@076254152355146160000111030034137015126145162243 unlock_con
enum ocpp_meter_measurand mes
Input to user, measurand.
Definition ocpp.h:172
const char * data
Input to user, payload or NULL.
Definition ocpp.h:210
const char * vendor_id
Input to user, vendor id.
Definition ocpp.h:208
struct ocpp_io_value::@200105062227173236217034336327231135350245002323 reset
Reset request from CS.
struct ocpp_io_value::@074001050133124115026000245162122157175212043044 data_transfer
DataTransfer request from CS, the strings are valid only during the callback.
enum ocpp_reset_type type
Input to user, reset type requested.
Definition ocpp.h:194
struct ocpp_io_value::@226166230252051272120223167266060276346306222237 stop_charge
char val[50]
To be filled by user, value as string.
Definition ocpp.h:175
const char * msg_id
Input to user, message id or NULL.
Definition ocpp.h:209
struct ocpp_io_value::@151065356136272127247352365006176207161107307270 change_avail
ChangeAvailability request from CS.
struct ocpp_io_value::@342125247263004211324264350155277234326116017212 start_charge
enum ocpp_req_status status
To be filled by user, reply status.
Definition ocpp.h:195
int id_con
Input to user, requested connector_id or 0 - main meter.
Definition ocpp.h:169
char idtag[50]
Input to user.
Definition ocpp.h:179
struct ocpp_io_value::@234117015014134177353317005164332350243236005013 meter_val