ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Public Member Functions | List of all members
ocpp::v2::ChargePointInterface Class Referenceabstract

Interface class for OCPP2.0.1 Charging Station. More...

#include <charge_point.hpp>

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

Public Member Functions

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

virtual void 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 > 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 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 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 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 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 on_reservation_status (const int32_t reservation_id, const ReservationUpdateStatusEnum status)=0
 Event handler that will send a ReservationStatusUpdate request. More...
 

Detailed Description

Interface class for OCPP2.0.1 Charging Station.

Member Function Documentation

◆ connect_websocket()

virtual void ocpp::v2::ChargePointInterface::connect_websocket ( std::optional< int32_t >  network_profile_slot = std::nullopt)
pure virtual

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.

Implemented in ocpp::v2::ChargePoint.

◆ data_transfer_req() [1/2]

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

Data transfer mechanism initiated by charger.

Parameters
vendorId
messageId
data
Returns
DataTransferResponse containing the result from CSMS

Implemented in ocpp::v2::ChargePoint.

◆ data_transfer_req() [2/2]

virtual std::optional< DataTransferResponse > ocpp::v2::ChargePointInterface::data_transfer_req ( const DataTransferRequest request)
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ disconnect_websocket()

virtual void ocpp::v2::ChargePointInterface::disconnect_websocket ( )
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ get_all_composite_schedules()

virtual std::vector< CompositeSchedule > ocpp::v2::ChargePointInterface::get_all_composite_schedules ( const int32_t  duration,
const ChargingRateUnitEnum &  unit 
)
pure virtual

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.

Implemented in ocpp::v2::ChargePoint.

◆ get_composite_schedule() [1/2]

virtual GetCompositeScheduleResponse ocpp::v2::ChargePointInterface::get_composite_schedule ( const GetCompositeScheduleRequest request)
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ get_composite_schedule() [2/2]

virtual std::optional< CompositeSchedule > ocpp::v2::ChargePointInterface::get_composite_schedule ( int32_t  evse_id,
std::chrono::seconds  duration,
ChargingRateUnitEnum  unit 
)
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ get_network_connection_profile()

virtual std::optional< NetworkConnectionProfile > ocpp::v2::ChargePointInterface::get_network_connection_profile ( const int32_t  configuration_slot) const
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ get_network_connection_slots()

virtual const std::vector< int > & ocpp::v2::ChargePointInterface::get_network_connection_slots ( ) const
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ get_priority_from_configuration_slot()

virtual std::optional< int > ocpp::v2::ChargePointInterface::get_priority_from_configuration_slot ( const int  configuration_slot) const
pure virtual

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.

Implemented in ocpp::v2::ChargePoint.

◆ get_variables()

virtual std::vector< GetVariableResult > ocpp::v2::ChargePointInterface::get_variables ( const std::vector< GetVariableData > &  get_variable_data_vector)
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ set_message_queue_resume_delay()

virtual void ocpp::v2::ChargePointInterface::set_message_queue_resume_delay ( std::chrono::seconds  delay)
pure virtual

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

Parameters
delayThe delay period (seconds)

Implemented in ocpp::v2::ChargePoint.

◆ set_variables()

virtual std::map< SetVariableData, SetVariableResult > ocpp::v2::ChargePointInterface::set_variables ( const std::vector< SetVariableData > &  set_variable_data_vector,
const std::string &  source 
)
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ start()

virtual void ocpp::v2::ChargePointInterface::start ( BootReasonEnum  bootreason = BootReasonEnum::PowerUp,
bool  start_connecting = true 
)
pure virtual

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)

Implemented in ocpp::v2::ChargePoint.

◆ stop()

virtual void ocpp::v2::ChargePointInterface::stop ( )
pure virtual

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

Implemented in ocpp::v2::ChargePoint.

◆ validate_token()

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

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

Implemented in ocpp::v2::ChargePoint.


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