ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Classes | Public Member Functions | Protected Member Functions | List of all members
ocpp::v2::ChargePoint Class Reference

Class implements OCPP2.0.1 Charging Station. More...

#include <charge_point.hpp>

Inheritance diagram for ocpp::v2::ChargePoint:
ocpp::v2::ChargePointInterface ocpp::ChargingStationBase

Public Member Functions

void start (BootReasonEnum bootreason=BootReasonEnum::PowerUp, bool start_connecting=true) override
 Starts the ChargePoint, initializes and connects to the Websocket endpoint. More...
 
void stop () override
 Stops the ChargePoint. Disconnects the websocket connection and stops MessageQueue and all timers. More...
 
void connect_websocket (std::optional< int32_t > network_profile_slot=std::nullopt) override
 Initializes the websocket and connects to a CSMS. Provide a network_profile_slot to connect to that specific slot. More...
 
virtual void disconnect_websocket () override
 Disconnects the the websocket connection to the CSMS if it is connected. More...
 
void on_network_disconnected (OCPPInterfaceEnum ocpp_interface) override
 Can be called when a network is disconnected, for example when an ethernet cable is removed. More...
 
void on_firmware_update_status_notification (int32_t request_id, const FirmwareStatusEnum &firmware_update_status) override
 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 on_session_started (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when a session has started. More...
 
Get15118EVCertificateResponse on_get_15118_ev_certificate_request (const Get15118EVCertificateRequest &request) override
 Event handler that should be called when the EV sends a certificate request (for update or installation) More...
 
void 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) override
 Event handler that should be called when a transaction has started. More...
 
void 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) override
 Event handler that should be called when a transaction has finished. More...
 
void on_session_finished (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when a session has finished. More...
 
void on_authorized (const int32_t evse_id, const int32_t connector_id, const IdToken &id_token) override
 Event handler that should be called when the given id_token is authorized. More...
 
void on_meter_value (const int32_t evse_id, const MeterValue &meter_value) override
 Event handler that should be called when a new meter value is present. More...
 
void on_unavailable (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the connector on the given evse_id and connector_id becomes unavailable. More...
 
void on_enabled (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the connector returns from unavailable on the given evse_id and connector_id . More...
 
void on_faulted (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the connector on the given evse_id and connector_id is faulted. More...
 
void on_fault_cleared (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the fault on the connector on the given evse_id is cleared. More...
 
void on_reserved (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the connector on the given evse_id and connector_id is reserved. More...
 
void on_reservation_cleared (const int32_t evse_id, const int32_t connector_id) override
 Event handler that should be called when the reservation of the connector is cleared. More...
 
bool on_charging_state_changed (const uint32_t evse_id, const ChargingStateEnum charging_state, const TriggerReasonEnum trigger_reason=TriggerReasonEnum::ChargingStateChanged) override
 Event handler that will update the charging state internally when it has been changed. More...
 
std::optional< std::string > get_evse_transaction_id (int32_t evse_id) override
 Gets the transaction id for a certain evse_id if there is an active transaction. More...
 
AuthorizeResponse validate_token (const IdToken id_token, const std::optional< CiString< 5500 > > &certificate, const std::optional< std::vector< OCSPRequestData > > &ocsp_request_data) override
 Validates provided id_token certificate and ocsp_request_data using CSMS, AuthCache or AuthList. More...
 
void on_event (const std::vector< EventData > &events) override
 Event handler that can be called to trigger a NotifyEvent.req with the given events. More...
 
void on_log_status_notification (UploadLogStatusEnum status, int32_t requestId) override
 Event handler that can be called to notify about the log status. More...
 
void 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) override
 
void on_variable_changed (const SetVariableData &set_variable_data) override
 Event handler that will update the variable internally when it has been changed on the fly. More...
 
void on_reservation_status (const int32_t reservation_id, const ReservationUpdateStatusEnum status) override
 Event handler that will send a ReservationStatusUpdate request. More...
 
std::optional< DataTransferResponsedata_transfer_req (const CiString< 255 > &vendorId, const std::optional< CiString< 50 > > &messageId, const std::optional< json > &data) override
 Data transfer mechanism initiated by charger. More...
 
std::optional< DataTransferResponsedata_transfer_req (const DataTransferRequest &request) override
 Data transfer mechanism initiated by charger. More...
 
void set_message_queue_resume_delay (std::chrono::seconds delay) override
 Delay draining the message queue after reconnecting, so the CSMS can perform post-reconnect checks first. More...
 
std::vector< GetVariableResultget_variables (const std::vector< GetVariableData > &get_variable_data_vector) override
 Gets variables specified within get_variable_data_vector from the device model and returns the result. This function is used internally in order to handle GetVariables.req messages and it can be used to get variables externally. More...
 
std::map< SetVariableData, SetVariableResultset_variables (const std::vector< SetVariableData > &set_variable_data_vector, const std::string &source) override
 Sets variables specified within set_variable_data_vector in the device model and returns the result. More...
 
GetCompositeScheduleResponse get_composite_schedule (const GetCompositeScheduleRequest &request) override
 Gets a composite schedule based on the given request. More...
 
std::optional< CompositeScheduleget_composite_schedule (int32_t evse_id, std::chrono::seconds duration, ChargingRateUnitEnum unit) override
 Gets a composite schedule based on the given parameters. More...
 
std::vector< CompositeScheduleget_all_composite_schedules (const int32_t duration, const ChargingRateUnitEnum &unit) override
 Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse. More...
 
std::optional< NetworkConnectionProfileget_network_connection_profile (const int32_t configuration_slot) const override
 Gets the configured NetworkConnectionProfile based on the given configuration_slot . The central system uri of the connection options will not contain ws:// or wss:// because this method removes it if present. This returns the value from the cached network connection profiles. More...
 
std::optional< int > get_priority_from_configuration_slot (const int configuration_slot) const override
 Get the priority of the given configuration slot. More...
 
const std::vector< int > & get_network_connection_slots () const override
 Get the network connection slots sorted by priority. Each item in the vector contains the configured configuration slots, where the slot with index 0 has the highest priority. More...
 
void send_not_implemented_error (const MessageId unique_message_id, const MessageTypeId message_type_id)
 
template<typename T >
RequestDeviceModelResponse< T > request_value (const Component &component_id, const Variable &variable_id, const AttributeEnum &attribute_enum)
 Requests a value of a VariableAttribute specified by combination of component_id and variable_id from the device model. More...
 
Constructors for 2.0.1
 ChargePoint (const std::map< int32_t, int32_t > &evse_connector_structure, std::shared_ptr< DeviceModel > device_model, std::shared_ptr< DatabaseHandler > database_handler, std::shared_ptr< MessageQueue< v2::MessageType > > message_queue, const std::string &message_log_path, const std::shared_ptr< EvseSecurity > evse_security, const Callbacks &callbacks)
 Construct a new ChargePoint object. More...
 
 ChargePoint (const std::map< int32_t, int32_t > &evse_connector_structure, std::unique_ptr< DeviceModelStorageInterface > device_model_storage_interface, const std::string &ocpp_main_path, const std::string &core_database_path, const std::string &sql_init_path, const std::string &message_log_path, const std::shared_ptr< EvseSecurity > evse_security, const Callbacks &callbacks)
 Construct a new ChargePoint object. More...
 
 ChargePoint (const std::map< int32_t, int32_t > &evse_connector_structure, const std::string &device_model_storage_address, const bool initialize_device_model, const std::string &device_model_migration_path, const std::string &device_model_config_path, const std::string &ocpp_main_path, const std::string &core_database_path, const std::string &sql_init_path, const std::string &message_log_path, const std::shared_ptr< EvseSecurity > evse_security, const Callbacks &callbacks)
 Construct a new ChargePoint object. More...
 
virtual void start (BootReasonEnum bootreason=BootReasonEnum::PowerUp, bool start_connecting=true)=0
 Starts the ChargePoint, initializes and connects to the Websocket endpoint. More...
 
virtual void stop ()=0
 Stops the ChargePoint. Disconnects the websocket connection and stops MessageQueue and all timers. More...
 
virtual void connect_websocket (std::optional< int32_t > network_profile_slot=std::nullopt)=0
 Initializes the websocket and connects to a CSMS. Provide a network_profile_slot to connect to that specific slot. More...
 
virtual void disconnect_websocket ()=0
 Disconnects the the websocket connection to the CSMS if it is connected. More...
 
virtual AuthorizeResponse validate_token (const IdToken id_token, const std::optional< CiString< 5500 > > &certificate, const std::optional< std::vector< OCSPRequestData > > &ocsp_request_data)=0
 Validates provided id_token certificate and ocsp_request_data using CSMS, AuthCache or AuthList. More...
 
virtual std::optional< DataTransferResponsedata_transfer_req (const CiString< 255 > &vendorId, const std::optional< CiString< 50 > > &messageId, const std::optional< json > &data)=0
 Data transfer mechanism initiated by charger. More...
 
virtual std::optional< DataTransferResponsedata_transfer_req (const DataTransferRequest &request)=0
 Data transfer mechanism initiated by charger. More...
 
virtual void set_message_queue_resume_delay (std::chrono::seconds delay)=0
 Delay draining the message queue after reconnecting, so the CSMS can perform post-reconnect checks first. More...
 
virtual std::vector< GetVariableResultget_variables (const std::vector< GetVariableData > &get_variable_data_vector)=0
 Gets variables specified within get_variable_data_vector from the device model and returns the result. This function is used internally in order to handle GetVariables.req messages and it can be used to get variables externally. More...
 
virtual std::map< SetVariableData, SetVariableResultset_variables (const std::vector< SetVariableData > &set_variable_data_vector, const std::string &source)=0
 Sets variables specified within set_variable_data_vector in the device model and returns the result. More...
 
virtual GetCompositeScheduleResponse get_composite_schedule (const GetCompositeScheduleRequest &request)=0
 Gets a composite schedule based on the given request. More...
 
virtual std::optional< CompositeScheduleget_composite_schedule (int32_t evse_id, std::chrono::seconds duration, ChargingRateUnitEnum unit)=0
 Gets a composite schedule based on the given parameters. More...
 
virtual std::vector< CompositeScheduleget_all_composite_schedules (const int32_t duration, const ChargingRateUnitEnum &unit)=0
 Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse. More...
 
virtual std::optional< NetworkConnectionProfileget_network_connection_profile (const int32_t configuration_slot) const =0
 Gets the configured NetworkConnectionProfile based on the given configuration_slot . The central system uri of the connection options will not contain ws:// or wss:// because this method removes it if present. This returns the value from the cached network connection profiles. More...
 
virtual std::optional< int > get_priority_from_configuration_slot (const int configuration_slot) const =0
 Get the priority of the given configuration slot. More...
 
virtual const std::vector< int > & get_network_connection_slots () const =0
 Get the network connection slots sorted by priority. Each item in the vector contains the configured configuration slots, where the slot with index 0 has the highest priority. More...
 
Handlers

The handlers

Protected Member Functions

void handle_message (const EnhancedMessage< v2::MessageType > &message)
 
void clear_invalid_charging_profiles ()
 

Detailed Description

Class implements OCPP2.0.1 Charging Station.

Member Function Documentation

◆ connect_websocket()

void ocpp::v2::ChargePoint::connect_websocket ( std::optional< int32_t >  network_profile_slot = std::nullopt)
overridevirtual

Initializes the websocket and connects to a CSMS. Provide a network_profile_slot to connect to that specific slot.

Parameters
network_profile_slotOptional slot to use when connecting. std::nullopt means the slot will be determined automatically.

Implements ocpp::v2::ChargePointInterface.

◆ data_transfer_req() [1/2]

std::optional< DataTransferResponse > ocpp::v2::ChargePoint::data_transfer_req ( const CiString< 255 > &  vendorId,
const std::optional< CiString< 50 > > &  messageId,
const std::optional< json > &  data 
)
overridevirtual

Data transfer mechanism initiated by charger.

Parameters
vendorId
messageId
data
Returns
DataTransferResponse containing the result from CSMS

Implements ocpp::v2::ChargePointInterface.

◆ data_transfer_req() [2/2]

std::optional< DataTransferResponse > ocpp::v2::ChargePoint::data_transfer_req ( const DataTransferRequest request)
overridevirtual

Data transfer mechanism initiated by charger.

Parameters
request
Returns
DataTransferResponse containing the result from CSMS. In case no response is received from the CSMS because the message timed out or the charging station is offline, std::nullopt is returned

Implements ocpp::v2::ChargePointInterface.

◆ disconnect_websocket()

void ocpp::v2::ChargePoint::disconnect_websocket ( )
overridevirtual

Disconnects the the websocket connection to the CSMS if it is connected.

Implements ocpp::v2::ChargePointInterface.

◆ get_all_composite_schedules()

std::vector< CompositeSchedule > ocpp::v2::ChargePoint::get_all_composite_schedules ( const int32_t  duration,
const ChargingRateUnitEnum &  unit 
)
overridevirtual

Gets composite schedules for all evse_ids (including 0) for the given duration and unit . If no valid profiles are given for an evse for the specified period, the composite schedule will be empty for this evse.

Parameters
durationof the request from. Composite schedules will be retrieved from now to (now + duration)
unitof the period entries of the composite schedules
Returns
vector of composite schedules, one for each evse_id including 0.

Implements ocpp::v2::ChargePointInterface.

◆ get_composite_schedule() [1/2]

GetCompositeScheduleResponse ocpp::v2::ChargePoint::get_composite_schedule ( const GetCompositeScheduleRequest request)
overridevirtual

Gets a composite schedule based on the given request.

Parameters
requestspecifies different options for the request
Returns
GetCompositeScheduleResponse containing the status of the operation and the composite schedule if the operation was successful

Implements ocpp::v2::ChargePointInterface.

◆ get_composite_schedule() [2/2]

std::optional< CompositeSchedule > ocpp::v2::ChargePoint::get_composite_schedule ( int32_t  evse_id,
std::chrono::seconds  duration,
ChargingRateUnitEnum  unit 
)
overridevirtual

Gets a composite schedule based on the given parameters.

Note
This will ignore TxDefaultProfiles and TxProfiles if no transaction is active on evse_id
Parameters
evse_idEvse to get the schedule for
durationHow long the schedule should be
unitChargingRateUnit to thet the schedule for
Returns
the composite schedule if the operation was successful, otherwise nullopt

Implements ocpp::v2::ChargePointInterface.

◆ get_evse_transaction_id()

std::optional< std::string > ocpp::v2::ChargePoint::get_evse_transaction_id ( int32_t  evse_id)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ get_network_connection_profile()

std::optional< NetworkConnectionProfile > ocpp::v2::ChargePoint::get_network_connection_profile ( const int32_t  configuration_slot) const
overridevirtual

Gets the configured NetworkConnectionProfile based on the given configuration_slot . The central system uri of the connection options will not contain ws:// or wss:// because this method removes it if present. This returns the value from the cached network connection profiles.

Parameters
network_configuration_priority
Returns

Implements ocpp::v2::ChargePointInterface.

◆ get_network_connection_slots()

const std::vector< int > & ocpp::v2::ChargePoint::get_network_connection_slots ( ) const
overridevirtual

Get the network connection slots sorted by priority. Each item in the vector contains the configured configuration slots, where the slot with index 0 has the highest priority.

Returns
The network connection slots

Implements ocpp::v2::ChargePointInterface.

◆ get_priority_from_configuration_slot()

std::optional< int > ocpp::v2::ChargePoint::get_priority_from_configuration_slot ( const int  configuration_slot) const
overridevirtual

Get the priority of the given configuration slot.

Parameters
configuration_slotThe configuration slot to get the priority from.
Returns
The priority if the configuration slot exists.

Implements ocpp::v2::ChargePointInterface.

◆ get_variables()

std::vector< GetVariableResult > ocpp::v2::ChargePoint::get_variables ( const std::vector< GetVariableData > &  get_variable_data_vector)
overridevirtual

Gets variables specified within get_variable_data_vector from the device model and returns the result. This function is used internally in order to handle GetVariables.req messages and it can be used to get variables externally.

Parameters
get_variable_data_vectorcontains data of the variables to get
Returns
Vector containing a result for each requested variable

Implements ocpp::v2::ChargePointInterface.

◆ on_authorized()

void ocpp::v2::ChargePoint::on_authorized ( const int32_t  evse_id,
const int32_t  connector_id,
const IdToken id_token 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_charging_state_changed()

bool ocpp::v2::ChargePoint::on_charging_state_changed ( const uint32_t  evse_id,
const ChargingStateEnum  charging_state,
const TriggerReasonEnum  trigger_reason = TriggerReasonEnum::ChargingStateChanged 
)
overridevirtual

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.

Implements ocpp::v2::ChargePointInterface.

◆ on_enabled()

void ocpp::v2::ChargePoint::on_enabled ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_event()

void ocpp::v2::ChargePoint::on_event ( const std::vector< EventData > &  events)
overridevirtual

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

Parameters
events

Implements ocpp::v2::ChargePointInterface.

◆ on_fault_cleared()

void ocpp::v2::ChargePoint::on_fault_cleared ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_faulted()

void ocpp::v2::ChargePoint::on_faulted ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_firmware_update_status_notification()

void ocpp::v2::ChargePoint::on_firmware_update_status_notification ( int32_t  request_id,
const FirmwareStatusEnum &  firmware_update_status 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_get_15118_ev_certificate_request()

Get15118EVCertificateResponse ocpp::v2::ChargePoint::on_get_15118_ev_certificate_request ( const Get15118EVCertificateRequest request)
overridevirtual

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

Parameters
request

Implements ocpp::v2::ChargePointInterface.

◆ on_log_status_notification()

void ocpp::v2::ChargePoint::on_log_status_notification ( UploadLogStatusEnum  status,
int32_t  requestId 
)
overridevirtual

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.

Implements ocpp::v2::ChargePointInterface.

◆ on_meter_value()

void ocpp::v2::ChargePoint::on_meter_value ( const int32_t  evse_id,
const MeterValue meter_value 
)
overridevirtual

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

Parameters
evse_id
meter_value

Implements ocpp::v2::ChargePointInterface.

◆ on_network_disconnected()

void ocpp::v2::ChargePoint::on_network_disconnected ( OCPPInterfaceEnum  ocpp_interface)
overridevirtual

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.

Implements ocpp::v2::ChargePointInterface.

◆ on_reservation_cleared()

void ocpp::v2::ChargePoint::on_reservation_cleared ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Parameters
evse_idCleared EVSE id
connector_idCleared connector id.

Implements ocpp::v2::ChargePointInterface.

◆ on_reservation_status()

void ocpp::v2::ChargePoint::on_reservation_status ( const int32_t  reservation_id,
const ReservationUpdateStatusEnum  status 
)
overridevirtual

Event handler that will send a ReservationStatusUpdate request.

Parameters
reservation_idThe reservation id.
statusThe status.

Implements ocpp::v2::ChargePointInterface.

◆ on_reserved()

void ocpp::v2::ChargePoint::on_reserved ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_security_event()

void ocpp::v2::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 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_session_finished()

void ocpp::v2::ChargePoint::on_session_finished ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Parameters
evse_id
connector_id

Implements ocpp::v2::ChargePointInterface.

◆ on_session_started()

void ocpp::v2::ChargePoint::on_session_started ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Parameters
evse_id
connector_id

Implements ocpp::v2::ChargePointInterface.

◆ on_transaction_finished()

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

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

Implements ocpp::v2::ChargePointInterface.

◆ on_transaction_started()

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

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

Implements ocpp::v2::ChargePointInterface.

◆ on_unavailable()

void ocpp::v2::ChargePoint::on_unavailable ( const int32_t  evse_id,
const int32_t  connector_id 
)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ on_variable_changed()

void ocpp::v2::ChargePoint::on_variable_changed ( const SetVariableData set_variable_data)
overridevirtual

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

Implements ocpp::v2::ChargePointInterface.

◆ request_value()

template<typename T >
RequestDeviceModelResponse< T > ocpp::v2::ChargePoint::request_value ( const Component component_id,
const Variable variable_id,
const AttributeEnum &  attribute_enum 
)
inline

Requests a value of a VariableAttribute specified by combination of component_id and variable_id from the device model.

Template Parameters
Tdatatype of the value that is requested
Parameters
component_id
variable_id
attribute_enum
Returns
Response to request that contains status of the request and the requested value as std::optional<T> . The value is present if the status is GetVariableStatusEnum::Accepted

◆ set_message_queue_resume_delay()

void ocpp::v2::ChargePoint::set_message_queue_resume_delay ( std::chrono::seconds  delay)
inlineoverridevirtual

Delay draining the message queue after reconnecting, so the CSMS can perform post-reconnect checks first.

Parameters
delayThe delay period (seconds)

Implements ocpp::v2::ChargePointInterface.

◆ set_variables()

std::map< SetVariableData, SetVariableResult > ocpp::v2::ChargePoint::set_variables ( const std::vector< SetVariableData > &  set_variable_data_vector,
const std::string &  source 
)
overridevirtual

Sets variables specified within set_variable_data_vector in the device model and returns the result.

Parameters
set_variable_data_vectorcontains data of the variables to set
Returns
Map containing the SetVariableData as a key and the SetVariableResult as a value for each requested change

Implements ocpp::v2::ChargePointInterface.

◆ start()

void ocpp::v2::ChargePoint::start ( BootReasonEnum  bootreason = BootReasonEnum::PowerUp,
bool  start_connecting = true 
)
overridevirtual

Starts the ChargePoint, initializes and connects to the Websocket endpoint.

Parameters
bootreasonOptional bootreason (default: PowerUp).
start_connectingOptional, set to false to initialize but not start connecting. Otherwise will connect to the first network profile. (default: true)

Implements ocpp::v2::ChargePointInterface.

◆ stop()

void ocpp::v2::ChargePoint::stop ( )
overridevirtual

Stops the ChargePoint. Disconnects the websocket connection and stops MessageQueue and all timers.

Implements ocpp::v2::ChargePointInterface.

◆ validate_token()

AuthorizeResponse ocpp::v2::ChargePoint::validate_token ( const IdToken  id_token,
const std::optional< CiString< 5500 > > &  certificate,
const std::optional< std::vector< OCSPRequestData > > &  ocsp_request_data 
)
overridevirtual

Validates provided id_token certificate and ocsp_request_data using CSMS, AuthCache or AuthList.

Parameters
id_token
certificate
ocsp_request_data
Returns
AuthorizeResponse containing the result of the validation

Implements ocpp::v2::ChargePointInterface.


The documentation for this class was generated from the following files: