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

Handlers

The handlers

void ocpp::v16::ChargePoint::on_meter_values (int32_t connector, const Measurement &measurement)
 Stores the given powermeter values for the given connector . This function can be called when a new meter value is present. More...
 
void ocpp::v16::ChargePoint::on_max_current_offered (int32_t connector, int32_t max_current)
 Stores the given max_current for the given connector offered to the EV. This function can be called when the value for the maximum current for the connector changes. It will be used to report the Measurand Current_Offered if it is configured. More...
 
void ocpp::v16::ChargePoint::on_max_power_offered (int32_t connector, int32_t max_power)
 Stores the given max_power for the given connector offered to the EV. This function can be called when the value for the maximum power for the connector changes. It will be used to report the Measurand Power_Offered if it is configured. More...
 
void ocpp::v16::ChargePoint::on_session_started (int32_t connector, const std::string &session_id, const SessionStartedReason reason, const std::optional< std::string > &session_logging_path)
 Notifies chargepoint that a new session with the given session_id has been started at the given connector with the given reason . The logs of the session will be written into session_logging_path if present. This function must be called when first interaction with user or EV occurs. This can be a valid authorization or the connection of cable and/or EV to the given connector. More...
 
void ocpp::v16::ChargePoint::on_session_stopped (int32_t connector, const std::string &session_id)
 Notifies chargepoint that a session has been stopped at the given connector. This function must be called when the EV disconnects from the given connector . More...
 
void ocpp::v16::ChargePoint::on_transaction_started (const int32_t &connector, const std::string &session_id, const std::string &id_token, const double meter_start, std::optional< int32_t > reservation_id, const ocpp::DateTime &timestamp, std::optional< std::string > signed_meter_value)
 Notifies chargepoint that a transaction at the given connector with the given parameters has been started. This function must be called at the point that all conditions for charging are met, for instance, EV is connected to Charge Point and user has been authorized. More...
 
void ocpp::v16::ChargePoint::on_transaction_stopped (const int32_t connector, const std::string &session_id, const Reason &reason, ocpp::DateTime timestamp, float energy_wh_import, std::optional< CiString< 20 > > id_tag_end, std::optional< std::string > signed_meter_value)
 Notifies chargepoint that the transaction on the given connector with the given reason has been stopped. This function must be called at the point where one of the preconditions for charging irrevocably becomes false, for instance when a user swipes to stop the transaction and the stop is authorized or if the EV disconnects. More...
 
void ocpp::v16::ChargePoint::on_suspend_charging_ev (int32_t connector, const std::optional< CiString< 50 > > info=std::nullopt)
 This function should be called when EV indicates that it suspends charging on the given connector. More...
 
void ocpp::v16::ChargePoint::on_suspend_charging_evse (int32_t connector, const std::optional< CiString< 50 > > info=std::nullopt)
 This function should be called when EVSE indicates that it suspends charging on the given connector. More...
 
void ocpp::v16::ChargePoint::on_resume_charging (int32_t connector)
 This function should be called when charging resumes on the given connector. More...
 
void ocpp::v16::ChargePoint::on_error (int32_t connector, const ErrorInfo &error_info)
 This function should be called if an error with the given error_info is present. This function will trigger a StatusNotification.req containing the given error_info . It will change the present state of the state machine to faulted, in case the corresponding flag is set in the given error_info. This function can be called multiple times for different errors. Errors reported using this function stay active as long as they are cleared by on_error_cleared(). More...
 
void ocpp::v16::ChargePoint::on_error_cleared (int32_t connector, const std::string uuid)
 This function should be called if an error with the given uuid has been cleared. If this leads to the fact that no other error is active anymore, this function will initiate a StatusNotification.req that reports the current state and no error. More...
 
void ocpp::v16::ChargePoint::on_all_errors_cleared (int32_t connector)
 Clears all previously reported errors at the same time for the given connector . This will clear a previously reported "Faulted" state if present. More...
 
void ocpp::v16::ChargePoint::on_log_status_notification (int32_t request_id, std::string log_status)
 Chargepoint notifies about new log status log_status . This function should be called during a Diagnostics / Log upload to indicate the current log_status . More...
 
void ocpp::v16::ChargePoint::on_firmware_update_status_notification (int32_t request_id, const ocpp::FirmwareStatusNotification firmware_update_status)
 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...
 
void ocpp::v16::ChargePoint::on_reservation_start (int32_t connector)
 This function must be called when a reservation is started at the given connector . More...
 
void ocpp::v16::ChargePoint::on_reservation_end (int32_t connector)
 This function must be called when a reservation ends at the given connector. More...
 
void ocpp::v16::ChargePoint::on_enabled (int32_t connector)
 Notifies chargepoint that the connector is enabled . This function should be called when the connector becomes functional and operational. More...
 
void ocpp::v16::ChargePoint::on_disabled (int32_t connector)
 Notifies chargepoint that the connector is disabled . This function should be called when the connector becomes inoperative. More...
 
void ocpp::v16::ChargePoint::on_plugin_timeout (int32_t connector)
 Notifies chargepoint that a ConnectionTimeout occured for the given connector . This function should be called when an EV is plugged in but the authorization is present within the specified ConnectionTimeout.
 
void ocpp::v16::ChargePoint::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)
 Notifies chargepoint that a SecurityEvent occurs. This will send a SecurityEventNotification.req to the CSMS. More...
 
ChangeAvailabilityResponse ocpp::v16::ChargePoint::on_change_availability (const ChangeAvailabilityRequest &request)
 Handles an internal ChangeAvailabilityRequest (in the same way as if it was emitted by the CSMS). More...
 

Detailed Description

Handlers that can be called from the implementing class.

Function Documentation

◆ on_all_errors_cleared()

void ocpp::v16::ChargePoint::on_all_errors_cleared ( int32_t  connector)

Clears all previously reported errors at the same time for the given connector . This will clear a previously reported "Faulted" state if present.

Parameters
connector

◆ on_change_availability()

ChangeAvailabilityResponse ocpp::v16::ChargePoint::on_change_availability ( const ChangeAvailabilityRequest request)

Handles an internal ChangeAvailabilityRequest (in the same way as if it was emitted by the CSMS).

Parameters
request

◆ on_disabled()

void ocpp::v16::ChargePoint::on_disabled ( int32_t  connector)

Notifies chargepoint that the connector is disabled . This function should be called when the connector becomes inoperative.

Parameters
connector

◆ on_enabled()

void ocpp::v16::ChargePoint::on_enabled ( int32_t  connector)

Notifies chargepoint that the connector is enabled . This function should be called when the connector becomes functional and operational.

Parameters
connector

◆ on_error()

void ocpp::v16::ChargePoint::on_error ( int32_t  connector,
const ErrorInfo error_info 
)

This function should be called if an error with the given error_info is present. This function will trigger a StatusNotification.req containing the given error_info . It will change the present state of the state machine to faulted, in case the corresponding flag is set in the given error_info. This function can be called multiple times for different errors. Errors reported using this function stay active as long as they are cleared by on_error_cleared().

Parameters
connector
error_infoAdditional information related to the error

◆ on_error_cleared()

void ocpp::v16::ChargePoint::on_error_cleared ( int32_t  connector,
const std::string  uuid 
)

This function should be called if an error with the given uuid has been cleared. If this leads to the fact that no other error is active anymore, this function will initiate a StatusNotification.req that reports the current state and no error.

Parameters
connector
uuidof a previously reported error. If uuid is not known, the event will be ignored

◆ on_firmware_update_status_notification()

void ocpp::v16::ChargePoint::on_firmware_update_status_notification ( int32_t  request_id,
const ocpp::FirmwareStatusNotification  firmware_update_status 
)

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_idA request_id of -1 indicates a FirmwareStatusNotification.req, else a SignedFirmwareUpdateStatusNotification.req .
firmware_update_statusThe firmware_update_status

◆ on_log_status_notification()

void ocpp::v16::ChargePoint::on_log_status_notification ( int32_t  request_id,
std::string  log_status 
)

Chargepoint notifies about new log status log_status . This function should be called during a Diagnostics / Log upload to indicate the current log_status .

Parameters
request_idA request_id of -1 indicates a DiagnosticsStatusNotification.req, else a LogStatusNotification.req.
log_statusThe log_status should be either be convertable to the ocpp::v16::UploadLogStatusEnumType enum or ocpp::v16::DiagnosticsStatus enum depending on the previous request, which could have been a DiagnosticsUpload.req or a GetLog.req (Security Whitepaper)

◆ on_max_current_offered()

void ocpp::v16::ChargePoint::on_max_current_offered ( int32_t  connector,
int32_t  max_current 
)

Stores the given max_current for the given connector offered to the EV. This function can be called when the value for the maximum current for the connector changes. It will be used to report the Measurand Current_Offered if it is configured.

Parameters
connector
max_currentin Amps

◆ on_max_power_offered()

void ocpp::v16::ChargePoint::on_max_power_offered ( int32_t  connector,
int32_t  max_power 
)

Stores the given max_power for the given connector offered to the EV. This function can be called when the value for the maximum power for the connector changes. It will be used to report the Measurand Power_Offered if it is configured.

Parameters
connector
max_powerin Watts

◆ on_meter_values()

void ocpp::v16::ChargePoint::on_meter_values ( int32_t  connector,
const Measurement measurement 
)

Stores the given powermeter values for the given connector . This function can be called when a new meter value is present.

Parameters
connector
measurementstructure that can contain all kinds of measurands

◆ on_reservation_end()

void ocpp::v16::ChargePoint::on_reservation_end ( int32_t  connector)

This function must be called when a reservation ends at the given connector.

Parameters
connector

◆ on_reservation_start()

void ocpp::v16::ChargePoint::on_reservation_start ( int32_t  connector)

This function must be called when a reservation is started at the given connector .

Parameters
connector

◆ on_resume_charging()

void ocpp::v16::ChargePoint::on_resume_charging ( int32_t  connector)

This function should be called when charging resumes on the given connector.

Parameters
connector

◆ on_security_event()

void ocpp::v16::ChargePoint::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 
)

Notifies chargepoint that a SecurityEvent occurs. This will send a SecurityEventNotification.req to the CSMS.

Parameters
event_typetype of the security event
tech_infoadditional info of the security event
criticalif set this overwrites the default criticality recommended in the OCPP 1.6 security whitepaper. 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

◆ on_session_started()

void ocpp::v16::ChargePoint::on_session_started ( int32_t  connector,
const std::string &  session_id,
const SessionStartedReason  reason,
const std::optional< std::string > &  session_logging_path 
)

Notifies chargepoint that a new session with the given session_id has been started at the given connector with the given reason . The logs of the session will be written into session_logging_path if present. This function must be called when first interaction with user or EV occurs. This can be a valid authorization or the connection of cable and/or EV to the given connector.

Parameters
connector
session_idunique id of the session
reasonfor the initiation of the session
session_logging_pathoptional filesystem path to where the session log should be written

◆ on_session_stopped()

void ocpp::v16::ChargePoint::on_session_stopped ( int32_t  connector,
const std::string &  session_id 
)

Notifies chargepoint that a session has been stopped at the given connector. This function must be called when the EV disconnects from the given connector .

Parameters
connector
session_id

◆ on_suspend_charging_ev()

void ocpp::v16::ChargePoint::on_suspend_charging_ev ( int32_t  connector,
const std::optional< CiString< 50 > >  info = std::nullopt 
)

This function should be called when EV indicates that it suspends charging on the given connector.

Parameters
connector
reason

◆ on_suspend_charging_evse()

void ocpp::v16::ChargePoint::on_suspend_charging_evse ( int32_t  connector,
const std::optional< CiString< 50 > >  info = std::nullopt 
)

This function should be called when EVSE indicates that it suspends charging on the given connector.

Parameters
connector
reason

◆ on_transaction_started()

void ocpp::v16::ChargePoint::on_transaction_started ( const int32_t &  connector,
const std::string &  session_id,
const std::string &  id_token,
const double  meter_start,
std::optional< int32_t >  reservation_id,
const ocpp::DateTime timestamp,
std::optional< std::string >  signed_meter_value 
)

Notifies chargepoint that a transaction at the given connector with the given parameters has been started. This function must be called at the point that all conditions for charging are met, for instance, EV is connected to Charge Point and user has been authorized.

Parameters
connector
session_id
id_tokenthat has been used to authorize the transaction
meter_startstart meter value in Wh
reservation_id
timestampof the start of transaction
signed_meter_valuee.g. in OCMF format

◆ on_transaction_stopped()

void ocpp::v16::ChargePoint::on_transaction_stopped ( const int32_t  connector,
const std::string &  session_id,
const Reason &  reason,
ocpp::DateTime  timestamp,
float  energy_wh_import,
std::optional< CiString< 20 > >  id_tag_end,
std::optional< std::string >  signed_meter_value 
)

Notifies chargepoint that the transaction on the given connector with the given reason has been stopped. This function must be called at the point where one of the preconditions for charging irrevocably becomes false, for instance when a user swipes to stop the transaction and the stop is authorized or if the EV disconnects.

Parameters
connector
session_id
reason
timestampof the end of transaction
energy_wh_importstop meter value in Wh
id_tag_end
signed_meter_valuee.g. in OCMF format