ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
charge_point_callbacks.hpp
1#pragma once
2
3#include <cstdint>
4#include <memory>
5
6#include <ocpp/v2/connectivity_manager.hpp>
7#include <ocpp/v2/device_model.hpp>
8
9#include <ocpp/v2/messages/BootNotification.hpp>
10#include <ocpp/v2/messages/ClearDisplayMessage.hpp>
11#include <ocpp/v2/messages/DataTransfer.hpp>
12#include <ocpp/v2/messages/GetDisplayMessages.hpp>
13#include <ocpp/v2/messages/GetLog.hpp>
14#include <ocpp/v2/messages/RequestStartTransaction.hpp>
15#include <ocpp/v2/messages/ReserveNow.hpp>
16#include <ocpp/v2/messages/SetDisplayMessage.hpp>
17#include <ocpp/v2/messages/TransactionEvent.hpp>
18#include <ocpp/v2/messages/UnlockConnector.hpp>
19#include <ocpp/v2/messages/UpdateFirmware.hpp>
20
21namespace ocpp::v2 {
22struct Callbacks {
26
30
37 bool all_callbacks_valid(std::shared_ptr<DeviceModel> device_model) const;
38
43 std::function<bool(const std::optional<const int32_t> evse_id, const ResetEnum& reset_type)>
45 std::function<void(const std::optional<const int32_t> evse_id, const ResetEnum& reset_type)> reset_callback;
46 std::function<RequestStartStopStatusEnum(const int32_t evse_id, const ReasonEnum& stop_reason)>
47 stop_transaction_callback;
48 std::function<void(const int32_t evse_id)> pause_charging_callback;
49
56 std::optional<std::function<void(const OperationalStatusEnum new_status)>>
58
65 std::optional<std::function<void(const int32_t evse_id, const OperationalStatusEnum new_status)>>
67
72 std::function<void(const int32_t evse_id, const int32_t connector_id, const OperationalStatusEnum new_status)>
74
75 std::function<GetLogResponse(const GetLogRequest& request)> get_log_request_callback;
76 std::function<UnlockConnectorResponse(const int32_t evse_id, const int32_t connecor_id)> unlock_connector_callback;
77 // callback to be called when the request can be accepted. authorize_remote_start indicates if Authorize.req needs
78 // to follow or not
79 std::function<RequestStartStopStatusEnum(const RequestStartTransactionRequest& request,
80 const bool authorize_remote_start)>
81 remote_start_transaction_callback;
82
87 std::function<ocpp::ReservationCheckStatus(const int32_t evse_id, const CiString<36> idToken,
88 const std::optional<CiString<36>> groupIdToken)>
90 std::function<UpdateFirmwareResponse(const UpdateFirmwareRequest& request)> update_firmware_request_callback;
91 // callback to be called when a variable has been changed by the CSMS
92 std::optional<std::function<void(const SetVariableData& set_variable_data)>> variable_changed_callback;
93 // callback is called when receiving a SetNetworkProfile.req from the CSMS
94 std::optional<std::function<SetNetworkProfileStatusEnum(
95 const int32_t configuration_slot, const NetworkConnectionProfile& network_connection_profile)>>
96 validate_network_profile_callback;
97 std::optional<ConfigureNetworkConnectionProfileCallback> configure_network_connection_profile_callback;
98 std::optional<std::function<void(const ocpp::DateTime& currentTime)>> time_sync_callback;
99
101 std::optional<std::function<void(const std::string& message, MessageDirection direction)>> ocpp_messages_callback;
102
108 std::function<void(const CiString<50>& event_type, const std::optional<CiString<255>>& tech_info)>
110
112 std::function<void()> set_charging_profiles_callback;
113
115 std::optional<std::function<void(const ocpp::v2::BootNotificationResponse& boot_notification_response)>>
117
120 std::optional<std::function<std::string(const std::optional<CertificateHashDataType> customer_certificate,
121 const std::optional<IdToken> id_token,
122 const std::optional<CiString<64>> customer_identifier)>>
124
126 std::optional<std::function<void(const std::optional<CertificateHashDataType> customer_certificate,
127 const std::optional<IdToken> id_token,
128 const std::optional<CiString<64>> customer_identifier)>>
130
132 std::optional<std::function<void()>> all_connectors_unavailable_callback;
133
136 std::optional<std::function<DataTransferResponse(const DataTransferRequest& request)>> data_transfer_callback;
137
139 std::optional<std::function<void(const TransactionEventRequest& transaction_event)>> transaction_event_callback;
140
142 std::optional<std::function<void(const TransactionEventRequest& transaction_event,
143 const TransactionEventResponse& transaction_event_response)>>
145
147 std::optional<std::function<void(const bool is_connected, const int configuration_slot,
148 const NetworkConnectionProfile& network_connection_profile)>>
150
152 std::optional<std::function<std::vector<DisplayMessage>(const GetDisplayMessagesRequest& request)>>
154 std::optional<std::function<SetDisplayMessageResponse(const std::vector<DisplayMessage>& display_messages)>>
155 set_display_message_callback;
156 std::optional<std::function<ClearDisplayMessageResponse(const ClearDisplayMessageRequest& request)>>
157 clear_display_message_callback;
158
160 std::optional<std::function<void(const RunningCost& running_cost, const uint32_t number_of_decimals,
161 std::optional<std::string> currency_code)>>
163
165 std::optional<std::function<ReserveNowStatusEnum(const ReserveNowRequest& request)>> reserve_now_callback;
167 std::optional<std::function<bool(const int32_t reservationId)>> cancel_reservation_callback;
168
170
172};
173} // namespace ocpp::v2
Contains a DateTime implementation that can parse and create RFC 3339 compatible strings.
Definition: types.hpp:109
std::optional< std::function< void(const ocpp::v2::BootNotificationResponse &boot_notification_response)> > boot_notification_callback
Callback for when a bootnotification response is received.
Definition: charge_point_callbacks.hpp:116
std::optional< std::function< void(const std::optional< CertificateHashDataType > customer_certificate, const std::optional< IdToken > id_token, const std::optional< CiString< 64 > > customer_identifier)> > clear_customer_information_callback
Callback function that can be called to clear customer information based on the given arguments.
Definition: charge_point_callbacks.hpp:129
std::optional< std::function< void(const int32_t evse_id, const OperationalStatusEnum new_status)> > evse_effective_operative_status_changed_callback
Used to notify the user of libocpp that the Operative/Inoperative state of an EVSE changed If as a re...
Definition: charge_point_callbacks.hpp:66
std::optional< std::function< std::string(const std::optional< CertificateHashDataType > customer_certificate, const std::optional< IdToken > id_token, const std::optional< CiString< 64 > > customer_identifier)> > get_customer_information_callback
Callback function that can be used to get (human readable) customer information based on the given ar...
Definition: charge_point_callbacks.hpp:123
std::optional< std::function< void(const bool is_connected, const int configuration_slot, const NetworkConnectionProfile &network_connection_profile)> > connection_state_changed_callback
Callback function is called when the websocket connection status changes.
Definition: charge_point_callbacks.hpp:149
std::optional< std::function< std::vector< DisplayMessage >(const GetDisplayMessagesRequest &request)> > get_display_message_callback
Callback functions called for get / set / clear display messages.
Definition: charge_point_callbacks.hpp:153
std::function< bool(const std::optional< const int32_t > evse_id, const ResetEnum &reset_type)> is_reset_allowed_callback
Callback if reset is allowed. If evse_id has a value, reset only applies to the given evse id....
Definition: charge_point_callbacks.hpp:44
std::optional< std::function< void(const TransactionEventRequest &transaction_event, const TransactionEventResponse &transaction_event_response)> > transaction_event_response_callback
Callback function that is called when a transaction_event_response was received from the CSMS.
Definition: charge_point_callbacks.hpp:144
std::optional< std::function< void(const OperationalStatusEnum new_status)> > cs_effective_operative_status_changed_callback
Used to notify the user of libocpp that the Operative/Inoperative state of the charging station chang...
Definition: charge_point_callbacks.hpp:57
std::optional< std::function< bool(const int32_t reservationId)> > cancel_reservation_callback
Callback function is called when a cancel reservation request is received from the CSMS.
Definition: charge_point_callbacks.hpp:167
bool all_callbacks_valid(std::shared_ptr< DeviceModel > device_model) const
Function to check if the callback struct is completely filled. All std::functions should hold a funct...
Definition: charge_point_callbacks.cpp:7
std::optional< std::function< void()> > all_connectors_unavailable_callback
Callback function that can be called when all connectors are unavailable.
Definition: charge_point_callbacks.hpp:132
std::optional< std::function< void(const RunningCost &running_cost, const uint32_t number_of_decimals, std::optional< std::string > currency_code)> > set_running_cost_callback
Callback function is called when running cost is set.
Definition: charge_point_callbacks.hpp:162
std::function< void(const CiString< 50 > &event_type, const std::optional< CiString< 255 > > &tech_info)> security_event_callback
callback function that can be used to react to a security event callback. This callback is called onl...
Definition: charge_point_callbacks.hpp:109
std::optional< std::function< void(const std::string &message, MessageDirection direction)> > ocpp_messages_callback
callback to be called to configure ocpp message logging
Definition: charge_point_callbacks.hpp:101
std::function< ocpp::ReservationCheckStatus(const int32_t evse_id, const CiString< 36 > idToken, const std::optional< CiString< 36 > > groupIdToken)> is_reservation_for_token_callback
Check if the current reservation for the given evse id is made for the id token / group id token.
Definition: charge_point_callbacks.hpp:89
std::optional< std::function< ReserveNowStatusEnum(const ReserveNowRequest &request)> > reserve_now_callback
Callback function is called when a reservation request is received from the CSMS.
Definition: charge_point_callbacks.hpp:165
std::optional< std::function< void(const TransactionEventRequest &transaction_event)> > transaction_event_callback
Callback function that is called when a transaction_event was sent to the CSMS.
Definition: charge_point_callbacks.hpp:139
std::optional< std::function< DataTransferResponse(const DataTransferRequest &request)> > data_transfer_callback
Callback function that can be used to handle arbitrary data transfers for all vendorId and messageId.
Definition: charge_point_callbacks.hpp:136
std::function< void()> set_charging_profiles_callback
Callback for indicating when a charging profile is received and was accepted.
Definition: charge_point_callbacks.hpp:112
std::function< void(const int32_t evse_id, const int32_t connector_id, const OperationalStatusEnum new_status)> connector_effective_operative_status_changed_callback
Used to notify the user of libocpp that the Operative/Inoperative state of a connector changed.
Definition: charge_point_callbacks.hpp:73
Definition: types.hpp:414
Contains a OCPP BootNotificationResponse message.
Definition: BootNotification.hpp:40
Definition: charge_point_callbacks.hpp:22
Contains a OCPP ClearDisplayMessage message.
Definition: ClearDisplayMessage.hpp:19
Contains a OCPP ClearDisplayMessageResponse message.
Definition: ClearDisplayMessage.hpp:39
Contains a OCPP DataTransfer message.
Definition: DataTransfer.hpp:19
Contains a OCPP DataTransferResponse message.
Definition: DataTransfer.hpp:41
Contains a OCPP GetDisplayMessages message.
Definition: GetDisplayMessages.hpp:19
Contains a OCPP GetLog message.
Definition: GetLog.hpp:19
Contains a OCPP GetLogResponse message.
Definition: GetLog.hpp:43
Definition: ocpp_types.hpp:831
Contains a OCPP StartTransaction message.
Definition: RequestStartTransaction.hpp:19
Contains a OCPP ReserveNow message.
Definition: ReserveNow.hpp:19
Contains a OCPP SetDisplayMessageResponse message.
Definition: SetDisplayMessage.hpp:39
Definition: ocpp_types.hpp:898
Contains a OCPP TransactionEvent message.
Definition: TransactionEvent.hpp:19
Contains a OCPP TransactionEventResponse message.
Definition: TransactionEvent.hpp:50
Contains a OCPP UnlockConnectorResponse message.
Definition: UnlockConnector.hpp:40
Contains a OCPP UpdateFirmware message.
Definition: UpdateFirmware.hpp:19
Contains a OCPP UpdateFirmwareResponse message.
Definition: UpdateFirmware.hpp:42