ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
OCPP 2.0.1 handlers

Handlers

The handlers

virtual void ocpp::v2::ChargePointInterface::on_network_disconnected (OCPPInterfaceEnum ocpp_interface)=0
 Can be called when a network is disconnected, for example when an ethernet cable is removed. More...
 
virtual void ocpp::v2::ChargePointInterface::on_firmware_update_status_notification (int32_t request_id, const FirmwareStatusEnum &firmware_update_status)=0
 Chargepoint notifies about new firmware update status firmware_update_status. This function should be called during a Firmware Update to indicate the current firmware_update_status. More...
 
virtual void ocpp::v2::ChargePointInterface::on_session_started (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when a session has started. More...
 
virtual Get15118EVCertificateResponse ocpp::v2::ChargePointInterface::on_get_15118_ev_certificate_request (const Get15118EVCertificateRequest &request)=0
 Event handler that should be called when the EV sends a certificate request (for update or installation) More...
 
virtual void ocpp::v2::ChargePointInterface::on_transaction_started (const int32_t evse_id, const int32_t connector_id, const std::string &session_id, const DateTime &timestamp, const TriggerReasonEnum trigger_reason, const MeterValue &meter_start, const std::optional< IdToken > &id_token, const std::optional< IdToken > &group_id_token, const std::optional< int32_t > &reservation_id, const std::optional< int32_t > &remote_start_id, const ChargingStateEnum charging_state)=0
 Event handler that should be called when a transaction has started. More...
 
virtual void ocpp::v2::ChargePointInterface::on_transaction_finished (const int32_t evse_id, const DateTime &timestamp, const MeterValue &meter_stop, const ReasonEnum reason, const TriggerReasonEnum trigger_reason, const std::optional< IdToken > &id_token, const std::optional< std::string > &signed_meter_value, const ChargingStateEnum charging_state)=0
 Event handler that should be called when a transaction has finished. More...
 
virtual void ocpp::v2::ChargePointInterface::on_session_finished (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when a session has finished. More...
 
virtual void ocpp::v2::ChargePointInterface::on_authorized (const int32_t evse_id, const int32_t connector_id, const IdToken &id_token)=0
 Event handler that should be called when the given id_token is authorized. More...
 
virtual void ocpp::v2::ChargePointInterface::on_meter_value (const int32_t evse_id, const MeterValue &meter_value)=0
 Event handler that should be called when a new meter value is present. More...
 
virtual void ocpp::v2::ChargePointInterface::on_unavailable (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the connector on the given evse_id and connector_id becomes unavailable. More...
 
virtual void ocpp::v2::ChargePointInterface::on_enabled (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the connector returns from unavailable on the given evse_id and connector_id . More...
 
virtual void ocpp::v2::ChargePointInterface::on_faulted (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the connector on the given evse_id and connector_id is faulted. More...
 
virtual void ocpp::v2::ChargePointInterface::on_fault_cleared (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the fault on the connector on the given evse_id is cleared. More...
 
virtual void ocpp::v2::ChargePointInterface::on_reserved (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the connector on the given evse_id and connector_id is reserved. More...
 
virtual void ocpp::v2::ChargePointInterface::on_reservation_cleared (const int32_t evse_id, const int32_t connector_id)=0
 Event handler that should be called when the reservation of the connector is cleared. More...
 
virtual bool ocpp::v2::ChargePointInterface::on_charging_state_changed (const uint32_t evse_id, const ChargingStateEnum charging_state, const TriggerReasonEnum trigger_reason=TriggerReasonEnum::ChargingStateChanged)=0
 Event handler that will update the charging state internally when it has been changed. More...
 
virtual std::optional< std::string > ocpp::v2::ChargePointInterface::get_evse_transaction_id (int32_t evse_id)=0
 Gets the transaction id for a certain evse_id if there is an active transaction. More...
 
virtual void ocpp::v2::ChargePointInterface::on_event (const std::vector< EventData > &events)=0
 Event handler that can be called to trigger a NotifyEvent.req with the given events. More...
 
virtual void ocpp::v2::ChargePointInterface::on_log_status_notification (UploadLogStatusEnum status, int32_t requestId)=0
 Event handler that can be called to notify about the log status. More...
 
virtual void ocpp::v2::ChargePointInterface::on_security_event (const CiString< 50 > &event_type, const std::optional< CiString< 255 > > &tech_info, const std::optional< bool > &critical=std::nullopt, const std::optional< DateTime > &timestamp=std::nullopt)=0
 
virtual void ocpp::v2::ChargePointInterface::on_variable_changed (const SetVariableData &set_variable_data)=0
 Event handler that will update the variable internally when it has been changed on the fly. More...
 
virtual void ocpp::v2::ChargePointInterface::on_reservation_status (const int32_t reservation_id, const ReservationUpdateStatusEnum status)=0
 Event handler that will send a ReservationStatusUpdate request. More...
 

Detailed Description

Handlers that can be called from the implementing class

Function Documentation

◆ get_evse_transaction_id()

virtual std::optional< std::string > ocpp::v2::ChargePointInterface::get_evse_transaction_id ( int32_t  evse_id)
pure virtual

Gets the transaction id for a certain evse_id if there is an active transaction.

Parameters
evse_idThe evse to get the transaction for
Returns
The transaction id if a transaction is active, otherwise nullopt

Implemented in ocpp::v2::ChargePoint.

◆ on_authorized()

virtual void ocpp::v2::ChargePointInterface::on_authorized ( const int32_t  evse_id,
const int32_t  connector_id,
const IdToken id_token 
)
pure virtual

Event handler that should be called when the given id_token is authorized.

Implemented in ocpp::v2::ChargePoint.

◆ on_charging_state_changed()

virtual bool ocpp::v2::ChargePointInterface::on_charging_state_changed ( const uint32_t  evse_id,
const ChargingStateEnum  charging_state,
const TriggerReasonEnum  trigger_reason = TriggerReasonEnum::ChargingStateChanged 
)
pure virtual

Event handler that will update the charging state internally when it has been changed.

Parameters
evse_idThe evse id of which the charging state has changed.
charging_stateThe new charging state.
trigger_reasonThe trigger reason of the event. Defaults to ChargingStateChanged
Returns
True on success. False if evse id does not exist.

Implemented in ocpp::v2::ChargePoint.

◆ on_enabled()

virtual void ocpp::v2::ChargePointInterface::on_enabled ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the connector returns from unavailable on the given evse_id and connector_id .

Implemented in ocpp::v2::ChargePoint.

◆ on_event()

virtual void ocpp::v2::ChargePointInterface::on_event ( const std::vector< EventData > &  events)
pure virtual

Event handler that can be called to trigger a NotifyEvent.req with the given events.

Parameters
events

Implemented in ocpp::v2::ChargePoint.

◆ on_fault_cleared()

virtual void ocpp::v2::ChargePointInterface::on_fault_cleared ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the fault on the connector on the given evse_id is cleared.

Parameters
evse_idEVSE id where fault was cleared
connector_idConnector id where fault was cleared

Implemented in ocpp::v2::ChargePoint.

◆ on_faulted()

virtual void ocpp::v2::ChargePointInterface::on_faulted ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the connector on the given evse_id and connector_id is faulted.

Parameters
evse_idFaulted EVSE id
connector_idFaulted connector id

Implemented in ocpp::v2::ChargePoint.

◆ on_firmware_update_status_notification()

virtual void ocpp::v2::ChargePointInterface::on_firmware_update_status_notification ( int32_t  request_id,
const FirmwareStatusEnum &  firmware_update_status 
)
pure virtual

Chargepoint notifies about new firmware update status firmware_update_status. This function should be called during a Firmware Update to indicate the current firmware_update_status.

Parameters
request_idThe request_id. When it is -1, it will not be included in the request.
firmware_update_statusThe firmware_update_status

Implemented in ocpp::v2::ChargePoint.

◆ on_get_15118_ev_certificate_request()

virtual Get15118EVCertificateResponse ocpp::v2::ChargePointInterface::on_get_15118_ev_certificate_request ( const Get15118EVCertificateRequest request)
pure virtual

Event handler that should be called when the EV sends a certificate request (for update or installation)

Parameters
request

Implemented in ocpp::v2::ChargePoint.

◆ on_log_status_notification()

virtual void ocpp::v2::ChargePointInterface::on_log_status_notification ( UploadLogStatusEnum  status,
int32_t  requestId 
)
pure virtual

Event handler that can be called to notify about the log status.

This function should be called curing a Diagnostics / Log upload to indicate the current log status.

Parameters
statusLog status.
requestIdRequest id that was provided in GetLogRequest.

Implemented in ocpp::v2::ChargePoint.

◆ on_meter_value()

virtual void ocpp::v2::ChargePointInterface::on_meter_value ( const int32_t  evse_id,
const MeterValue meter_value 
)
pure virtual

Event handler that should be called when a new meter value is present.

Parameters
evse_id
meter_value

Implemented in ocpp::v2::ChargePoint.

◆ on_network_disconnected()

virtual void ocpp::v2::ChargePointInterface::on_network_disconnected ( OCPPInterfaceEnum  ocpp_interface)
pure virtual

Can be called when a network is disconnected, for example when an ethernet cable is removed.

This is introduced because the websocket can take several minutes to timeout when a network interface becomes unavailable, whereas the system can detect this sooner.

Parameters
ocpp_interfaceThe interface that is disconnected.

Implemented in ocpp::v2::ChargePoint.

◆ on_reservation_cleared()

virtual void ocpp::v2::ChargePointInterface::on_reservation_cleared ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the reservation of the connector is cleared.

Parameters
evse_idCleared EVSE id
connector_idCleared connector id.

Implemented in ocpp::v2::ChargePoint.

◆ on_reservation_status()

virtual void ocpp::v2::ChargePointInterface::on_reservation_status ( const int32_t  reservation_id,
const ReservationUpdateStatusEnum  status 
)
pure virtual

Event handler that will send a ReservationStatusUpdate request.

Parameters
reservation_idThe reservation id.
statusThe status.

Implemented in ocpp::v2::ChargePoint.

◆ on_reserved()

virtual void ocpp::v2::ChargePointInterface::on_reserved ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the connector on the given evse_id and connector_id is reserved.

Parameters
evse_idReserved EVSE id
connector_idReserved connector id

Implemented in ocpp::v2::ChargePoint.

◆ on_security_event()

virtual void ocpp::v2::ChargePointInterface::on_security_event ( const CiString< 50 > &  event_type,
const std::optional< CiString< 255 > > &  tech_info,
const std::optional< bool > &  critical = std::nullopt,
const std::optional< DateTime > &  timestamp = std::nullopt 
)
pure virtual

CSMS

Parameters
typetype of the security event
tech_infoadditional info of the security event
criticalif set this overwrites the default criticality recommended in the OCPP 2.0.1 appendix. A critical security event is transmitted as a message to the CSMS, a non-critical one is just written to the security log
timestampwhen this security event occured, if absent the current datetime is assumed

Implemented in ocpp::v2::ChargePoint.

◆ on_session_finished()

virtual void ocpp::v2::ChargePointInterface::on_session_finished ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when a session has finished.

Parameters
evse_id
connector_id

Implemented in ocpp::v2::ChargePoint.

◆ on_session_started()

virtual void ocpp::v2::ChargePointInterface::on_session_started ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when a session has started.

Parameters
evse_id
connector_id

Implemented in ocpp::v2::ChargePoint.

◆ on_transaction_finished()

virtual void ocpp::v2::ChargePointInterface::on_transaction_finished ( const int32_t  evse_id,
const DateTime timestamp,
const MeterValue meter_stop,
const ReasonEnum  reason,
const TriggerReasonEnum  trigger_reason,
const std::optional< IdToken > &  id_token,
const std::optional< std::string > &  signed_meter_value,
const ChargingStateEnum  charging_state 
)
pure virtual

Event handler that should be called when a transaction has finished.

Parameters
evse_id
timestamp
meter_stop
reason
id_token
signed_meter_value
charging_state

Implemented in ocpp::v2::ChargePoint.

◆ on_transaction_started()

virtual void ocpp::v2::ChargePointInterface::on_transaction_started ( const int32_t  evse_id,
const int32_t  connector_id,
const std::string &  session_id,
const DateTime timestamp,
const TriggerReasonEnum  trigger_reason,
const MeterValue meter_start,
const std::optional< IdToken > &  id_token,
const std::optional< IdToken > &  group_id_token,
const std::optional< int32_t > &  reservation_id,
const std::optional< int32_t > &  remote_start_id,
const ChargingStateEnum  charging_state 
)
pure virtual

Event handler that should be called when a transaction has started.

Parameters
evse_id
connector_id
session_id
timestamp
trigger_reason
meter_start
id_token
group_id_tokenOptional group id token
reservation_id
remote_start_id
charging_stateThe new charging state

Implemented in ocpp::v2::ChargePoint.

◆ on_unavailable()

virtual void ocpp::v2::ChargePointInterface::on_unavailable ( const int32_t  evse_id,
const int32_t  connector_id 
)
pure virtual

Event handler that should be called when the connector on the given evse_id and connector_id becomes unavailable.

Implemented in ocpp::v2::ChargePoint.

◆ on_variable_changed()

virtual void ocpp::v2::ChargePointInterface::on_variable_changed ( const SetVariableData set_variable_data)
pure virtual

Event handler that will update the variable internally when it has been changed on the fly.

Parameters
set_variable_datacontains data of the variable to set

Implemented in ocpp::v2::ChargePoint.