Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
OCPP library

OCPP Charge Point Implementation. More...

Data Structures

union  ocpp_io_value
 OCPP user callback notification/request of input/output values union member should be accessed with enum value ocpp_notify_reason correspondingly. More...
 
struct  ocpp_cp_info
 Parameters for ocpp_init information about Charge Point (CP) all are string literal except num_of_con. More...
 
struct  ocpp_cs_info
 Parameters for ocpp_init information about central system (CS) More...
 

Macros

#define CISTR50   50
 Max length of string literals e.g idtag.
 

Typedefs

typedef void * ocpp_session_handle_t
 Parameters opaque session handle for ocpp_* API.
 
typedef 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.
 

Enumerations

enum  ocpp_auth_status {
  OCPP_AUTH_INVALID , OCPP_AUTH_ACCEPTED , OCPP_AUTH_BLOCKED , OCPP_AUTH_EXPIRED ,
  OCPP_AUTH_CONCURRENT_TX
}
 OCPP IdTag authorization status in result to ocpp request authorization. More...
 
enum  ocpp_notify_reason { OCPP_USR_GET_METER_VALUE , OCPP_USR_START_CHARGING , OCPP_USR_STOP_CHARGING , OCPP_USR_UNLOCK_CONNECTOR }
 
enum  ocpp_meter_measurand {
  OCPP_OMM_CURRENT_FROM_EV , OCPP_OMM_CURRENT_TO_EV , OCPP_OMM_CURRENT_MAX_OFFERED_TO_EV , OCPP_OMM_ACTIVE_ENERGY_FROM_EV ,
  OCPP_OMM_ACTIVE_ENERGY_TO_EV , OCPP_OMM_REACTIVE_ENERGY_FROM_EV , OCPP_OMM_REACTIVE_ENERGY_TO_EV , OCPP_OMM_ACTIVE_POWER_FROM_EV ,
  OCPP_OMM_ACTIVE_POWER_TO_EV , OCPP_OMM_REACTIVE_POWER_FROM_EV , OCPP_OMM_REACTIVE_POWER_TO_EV , OCPP_OMM_POWERLINE_FREQ ,
  OCPP_OMM_POWER_FACTOR , OCPP_OMM_POWER_MAX_OFFERED_TO_EV , OCPP_OMM_FAN_SPEED , OCPP_OMM_CHARGING_PERCENT ,
  OCPP_OMM_TEMPERATURE , OCPP_OMM_VOLTAGE_AC_RMS , OCPP_OMM_END
}
 OCPP meter readings to be filled on user callback request from library. More...
 

Functions

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.
 
int ocpp_session_open (ocpp_session_handle_t *hndl)
 API to request a new Session.
 
void ocpp_session_close (ocpp_session_handle_t hndl)
 API to close a Session.
 
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.
 
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.
 
int ocpp_stop_transaction (ocpp_session_handle_t hndl, int meter_val, uint32_t timeout_ms)
 Notify transaction stopped to CS.
 

Detailed Description

OCPP Charge Point Implementation.

Since
4.3
Version
0.1.0
Note
The implementation assumes Websocket module is enabled.
By default the implementation uses OCPP version 1.6.

Macro Definition Documentation

◆ CISTR50

#define CISTR50   50

#include <include/zephyr/net/ocpp.h>

Max length of string literals e.g idtag.

Typedef Documentation

◆ ocpp_session_handle_t

typedef void* ocpp_session_handle_t

#include <include/zephyr/net/ocpp.h>

Parameters opaque session handle for ocpp_* API.

◆ ocpp_user_notify_callback_t

typedef int(* ocpp_user_notify_callback_t) (enum ocpp_notify_reason reason, union ocpp_io_value *io, void *user_data)

#include <include/zephyr/net/ocpp.h>

Asynchronous event notification callback registered by the application.

advised callback should not be hold for longer time to unblock the ocpp protocol stack/lib.

Parameters
[in]reasonfor callback invoked.
[in]ioreffered corresponding to reason.
[in]user_datapassed on ocpp_init.
Returns
0 or a negative error code (errno.h)

Enumeration Type Documentation

◆ ocpp_auth_status

#include <include/zephyr/net/ocpp.h>

OCPP IdTag authorization status in result to ocpp request authorization.

Enumerator
OCPP_AUTH_INVALID 

IdTag not valid.

OCPP_AUTH_ACCEPTED 

accepted, allowed to charge

OCPP_AUTH_BLOCKED 

blocked to charge

OCPP_AUTH_EXPIRED 

IdTag expired, not allowed to charge.

OCPP_AUTH_CONCURRENT_TX 

Parallel access of same IdTag.

◆ ocpp_meter_measurand

#include <include/zephyr/net/ocpp.h>

OCPP meter readings to be filled on user callback request from library.

Enumerator
OCPP_OMM_CURRENT_FROM_EV 

current from EV, in A

OCPP_OMM_CURRENT_TO_EV 

current to EV, in A

OCPP_OMM_CURRENT_MAX_OFFERED_TO_EV 

maximum current offered to EV, in A

OCPP_OMM_ACTIVE_ENERGY_FROM_EV 

active energy from EV, in Wh

OCPP_OMM_ACTIVE_ENERGY_TO_EV 

active energy to EV, in Wh

OCPP_OMM_REACTIVE_ENERGY_FROM_EV 

reactive energy from EV, in varh

OCPP_OMM_REACTIVE_ENERGY_TO_EV 

reactive energy to EV, in varh

OCPP_OMM_ACTIVE_POWER_FROM_EV 

active power from EV, in W

OCPP_OMM_ACTIVE_POWER_TO_EV 

active power to EV, in W

OCPP_OMM_REACTIVE_POWER_FROM_EV 

reactive power from EV, in var

OCPP_OMM_REACTIVE_POWER_TO_EV 

reactive power to EV, in var

OCPP_OMM_POWERLINE_FREQ 

powerline frequency, in Hz

OCPP_OMM_POWER_FACTOR 

power factor of supply

OCPP_OMM_POWER_MAX_OFFERED_TO_EV 

maximum power offered to EV, in W

OCPP_OMM_FAN_SPEED 

fan speed, in rpm

OCPP_OMM_CHARGING_PERCENT 

charging percentage

OCPP_OMM_TEMPERATURE 

temperature inside charge point, in Celsius

OCPP_OMM_VOLTAGE_AC_RMS 

AC RMS supply voltage, in V.

OCPP_OMM_END 

◆ ocpp_notify_reason

#include <include/zephyr/net/ocpp.h>

Enumerator
OCPP_USR_GET_METER_VALUE 

User must fill the current reading.

OCPP_USR_START_CHARGING 

Process the start charging request as like idtag received from local e.g authorize etc.

OCPP_USR_STOP_CHARGING 

Process the stop charging sequence.

OCPP_USR_UNLOCK_CONNECTOR 

Unlock mechanical connector of CP.

Function Documentation

◆ ocpp_authorize()

int ocpp_authorize ( ocpp_session_handle_t  hndl,
char *  idtag,
enum ocpp_auth_status status,
uint32_t  timeout_ms 
)

#include <include/zephyr/net/ocpp.h>

Authorize request call to CS to get validity of idtag.

Parameters
[in]hndlsession handle
[in]idtag(string literal) to get authorize validity
[out]statusauthorization status
[in]timeout_mstimeout in msec
Returns
0 on success or a negative error code (errno.h) indicating reason of failure

◆ ocpp_init()

int ocpp_init ( struct ocpp_cp_info cpi,
struct ocpp_cs_info csi,
ocpp_user_notify_callback_t  cb,
void *  user_data 
)

#include <include/zephyr/net/ocpp.h>

OCPP library init.

Parameters
[in]cpiCharge Point information
[in]csiCentral System information
[in]cbuser register callback
[in]user_datasame reference will be passed on callback
Returns
0 on success or a negative error code (errno.h) indicating reason of failure
Note
Must be called before any other ocpp API

◆ ocpp_session_close()

void ocpp_session_close ( ocpp_session_handle_t  hndl)

#include <include/zephyr/net/ocpp.h>

API to close a Session.

Parameters
[in]hndla handle received from session open

◆ ocpp_session_open()

int ocpp_session_open ( ocpp_session_handle_t hndl)

#include <include/zephyr/net/ocpp.h>

API to request a new Session.

Parameters
[out]hndla valid opaque handle
Returns
0 on success or a negative error code (errno.h) indicating reason of failure
Note
Each connector should open unique session after ocpp_init and prior to anyother ocpp_* request message api

◆ ocpp_start_transaction()

int ocpp_start_transaction ( ocpp_session_handle_t  hndl,
int  meter_val,
uint8_t  conn_id,
uint32_t  timeout_ms 
)

#include <include/zephyr/net/ocpp.h>

Notify transaction start to CS.

Parameters
[in]hndlsession handle
[in]meter_valenergy meter reading of this connector in Wh
[in]conn_idconnector id should be > 0 and sequential number
[in]timeout_mstimeout in msec
Returns
: 0 on success EACCES - not authorized, should follow the stop charging process a negative error code (errno.h) indicating reason of failure

◆ ocpp_stop_transaction()

int ocpp_stop_transaction ( ocpp_session_handle_t  hndl,
int  meter_val,
uint32_t  timeout_ms 
)

#include <include/zephyr/net/ocpp.h>

Notify transaction stopped to CS.

Parameters
[in]hndlsession handle
[in]meter_valenergy meter reading of this connector in Wh
[in]timeout_mstimeout in msec
Returns
0 on success or a negative error code (errno.h) indicating reason of failure