diff --git a/CMakeLists.txt b/CMakeLists.txt index 22ac3357e..1e160f28f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.14) project(ocpp - VERSION 0.24.1 + VERSION 0.25.0 DESCRIPTION "A C++ implementation of the Open Charge Point Protocol" LANGUAGES CXX ) diff --git a/config/v2/component_config/custom/Connector_1_1.json b/config/v2/component_config/custom/Connector_1_1.json index 77e745289..8109da033 100644 --- a/config/v2/component_config/custom/Connector_1_1.json +++ b/config/v2/component_config/custom/Connector_1_1.json @@ -19,7 +19,8 @@ } ], "description": "This variable reports current availability state for the Connector. Optional, because already reported in StatusNotification.", - "type": "string" + "type": "string", + "default": "Available" }, "ConnectorAvailable": { "variable_name": "Available", diff --git a/config/v2/component_config/custom/Connector_2_1.json b/config/v2/component_config/custom/Connector_2_1.json index 2559c4f2a..cbf5f3c7f 100644 --- a/config/v2/component_config/custom/Connector_2_1.json +++ b/config/v2/component_config/custom/Connector_2_1.json @@ -19,7 +19,8 @@ } ], "description": "This variable reports current availability state for the Connector. Optional, because already reported in StatusNotification.", - "type": "string" + "type": "string", + "default": "Available" }, "ConnectorAvailable": { "variable_name": "Available", diff --git a/config/v2/component_config/standardized/ChargingStation.json b/config/v2/component_config/standardized/ChargingStation.json index 3e8e3897f..92decde23 100644 --- a/config/v2/component_config/standardized/ChargingStation.json +++ b/config/v2/component_config/standardized/ChargingStation.json @@ -35,7 +35,7 @@ ], "description": "This variable reports current availability state for the ChargingStation", "type": "string", - "default": "" + "default": "Available" }, "ChargingStationPhaseRotation": { "variable_name": "PhaseRotation", diff --git a/config/v2/component_config/standardized/InternalCtrlr.json b/config/v2/component_config/standardized/InternalCtrlr.json index 59ad5ed86..f687dfba4 100644 --- a/config/v2/component_config/standardized/InternalCtrlr.json +++ b/config/v2/component_config/standardized/InternalCtrlr.json @@ -835,6 +835,24 @@ "description": "If enabled we allow connections using security level 0. This does pose a security risk and is not allowed according to the OCPP spec", "default": false, "type": "boolean" + }, + "SupportedOcppVersions": { + "variable_name": "SupportedOcppVersions", + "characteristics": { + "supportsMonitoring": true, + "dataType": "SequenceList", + "valuesList": "ocpp2.0.1,ocpp2.1" + }, + "attributes": [ + { + "type": "Actual", + "mutability": "ReadOnly", + "value": "ocpp2.1,ocpp2.0.1" + } + ], + "description": "List of supported OCPP versions in order of preference", + "default": "ocpp2.1,ocpp2.0.1", + "type": "string" } }, "required": [ @@ -847,6 +865,7 @@ "NetworkConnectionProfiles", "NumberOfConnectors", "SupportedCiphers12", - "SupportedCiphers13" + "SupportedCiphers13", + "SupportedOcppVersions" ] } diff --git a/config/v2/device_model_migrations/3_down-variable_required.sql b/config/v2/device_model_migrations/3_down-variable_required.sql new file mode 100644 index 000000000..e7ae188dd --- /dev/null +++ b/config/v2/device_model_migrations/3_down-variable_required.sql @@ -0,0 +1,2 @@ +ALTER TABLE VARIABLE +ADD REQUIRED INTEGER DEFAULT FALSE; diff --git a/config/v2/device_model_migrations/3_up-variable_required.sql b/config/v2/device_model_migrations/3_up-variable_required.sql new file mode 100644 index 000000000..b8d161e71 --- /dev/null +++ b/config/v2/device_model_migrations/3_up-variable_required.sql @@ -0,0 +1,2 @@ +ALTER TABLE VARIABLE +DROP COLUMN REQUIRED; diff --git a/doc/v2/ocpp_201_device_model_initialization.md b/doc/v2/ocpp_201_device_model_initialization.md index a9a5d5f44..2d52b8233 100644 --- a/doc/v2/ocpp_201_device_model_initialization.md +++ b/doc/v2/ocpp_201_device_model_initialization.md @@ -1,4 +1,4 @@ -# OCPP 2.0.1: Device model initialization and inserting of config values +# OCPP 2.0.1 and 2.1: Device model initialization and inserting of config values If there is no custom database used for the device model, and 'initialize_device_model' is set to true in the constructor of ChargePoint, the device model will be created or updated when ChargePoint is created. This document will @@ -43,3 +43,15 @@ addition of a new one. Note: OCPP requires EVSE and Connector numbering starting from 1 counting upwards. Note: There should be no duplicate components or variables in the component config files. + +## Required variables + +There are some required Variables, which can be found in the OCPP spec. +Some `Variables` are only required if the `Component` is `Available`, for example `Reservation` and `Smart Charging`. +There are some Components that are always required because that is how libocpp works: `AlignedDataCtrlr` and +`SampledDataCtrlr`. +When libocpp is started and initialized, all required Variables will be checked and an DeviceModelError is thrown if +one of the required Variables is not there. + +This also implies, that if you write code that needs a required `Variable`, when trying to get that variable with +`DeviceModel::get_value(...)`, you should first check if the Component that Variable belongs to is `Available`. diff --git a/include/ocpp/common/types.hpp b/include/ocpp/common/types.hpp index 98eb96ac0..bac2ec287 100644 --- a/include/ocpp/common/types.hpp +++ b/include/ocpp/common/types.hpp @@ -442,7 +442,8 @@ enum class CaCertificateType { V2G, MO, CSMS, - MF + MF, + OEM }; namespace conversions { @@ -577,6 +578,7 @@ enum class CertificateType { CSMSRootCertificate, V2GCertificateChain, MFRootCertificate, + OEMRootCertificate, }; namespace conversions { @@ -633,7 +635,8 @@ std::ostream& operator<<(std::ostream& os, const OcppProtocolVersion& ocpp_proto enum class CertificateSigningUseEnum { ChargingStationCertificate, V2GCertificate, - ManufacturerCertificate + ManufacturerCertificate, + V2G20Certificate }; namespace conversions { diff --git a/include/ocpp/v2/charge_point.hpp b/include/ocpp/v2/charge_point.hpp index 2a403ac42..4e51b867e 100644 --- a/include/ocpp/v2/charge_point.hpp +++ b/include/ocpp/v2/charge_point.hpp @@ -248,7 +248,7 @@ class ChargePointInterface { /// \param certificate /// \param ocsp_request_data /// \return AuthorizeResponse containing the result of the validation - virtual AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, + virtual AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) = 0; /// \brief Data transfer mechanism initiated by charger @@ -363,6 +363,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa // states std::atomic registration_status; + std::atomic ocpp_version = + OcppProtocolVersion::Unknown; // version that is currently in use, selected by CSMS in websocket handshake std::atomic upload_log_status; std::atomic upload_log_status_id; BootReasonEnum bootreason; @@ -400,7 +402,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa // internal helper functions void initialize(const std::map& evse_connector_structure, const std::string& message_log_path); void websocket_connected_callback(const int configuration_slot, - const NetworkConnectionProfile& network_connection_profile); + const NetworkConnectionProfile& network_connection_profile, + const OcppProtocolVersion ocpp_version); void websocket_disconnected_callback(const int configuration_slot, const NetworkConnectionProfile& network_connection_profile); void websocket_connection_failed(ConnectionFailedReason reason); @@ -562,7 +565,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa std::optional get_evse_transaction_id(int32_t evse_id) override; - AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, + AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) override; void on_event(const std::vector& events) override; diff --git a/include/ocpp/v2/charge_point_callbacks.hpp b/include/ocpp/v2/charge_point_callbacks.hpp index 3f7ccda85..7887588cf 100644 --- a/include/ocpp/v2/charge_point_callbacks.hpp +++ b/include/ocpp/v2/charge_point_callbacks.hpp @@ -84,8 +84,8 @@ struct Callbacks { /// \brief Check if the current reservation for the given evse id is made for the id token / group id token. /// \return The reservation check status of this evse / id token. /// - std::function idToken, - const std::optional> groupIdToken)> + std::function idToken, + const std::optional> groupIdToken)> is_reservation_for_token_callback; std::function update_firmware_request_callback; // callback to be called when a variable has been changed by the CSMS @@ -145,7 +145,8 @@ struct Callbacks { /// \brief Callback function is called when the websocket connection status changes std::optional> + const NetworkConnectionProfile& network_connection_profile, + const OcppProtocolVersion ocpp_version)>> connection_state_changed_callback; /// \brief Callback functions called for get / set / clear display messages diff --git a/include/ocpp/v2/connectivity_manager.hpp b/include/ocpp/v2/connectivity_manager.hpp index d059a41c3..240e947d0 100644 --- a/include/ocpp/v2/connectivity_manager.hpp +++ b/include/ocpp/v2/connectivity_manager.hpp @@ -15,8 +15,15 @@ namespace v2 { class DeviceModel; -using WebsocketConnectionCallback = std::function; +/// \brief The result of a configuration of a network profile. +struct ConfigNetworkResult { + std::optional interface_address; ///< ip address or interface string + bool success; ///< true if the configuration was successful +}; + +using WebsocketConnectionCallback = + std::function; using WebsocketConnectionFailedCallback = std::function; using ConfigureNetworkConnectionProfileCallback = std::function( const int32_t configuration_slot, const NetworkConnectionProfile& network_connection_profile)>; diff --git a/include/ocpp/v2/constants.hpp b/include/ocpp/v2/constants.hpp index 1d3ca72d5..b532a52b1 100644 --- a/include/ocpp/v2/constants.hpp +++ b/include/ocpp/v2/constants.hpp @@ -10,7 +10,8 @@ namespace v2 { /// \brief OCPP 2.0.1 defines this as 5600 but it can be set to a higher value, which we do here, if it's reported via /// the device model, which we do as well -constexpr std::size_t ISO15118_GET_EV_CERTIFICATE_EXI_RESPONSE_SIZE = 7500; +/// 17000 is the minimum value from OCPP 2.1 +constexpr std::size_t ISO15118_GET_EV_CERTIFICATE_EXI_RESPONSE_SIZE = 17000; } // namespace v2 } // namespace ocpp diff --git a/include/ocpp/v2/ctrlr_component_variables.hpp b/include/ocpp/v2/ctrlr_component_variables.hpp index 5ecd6661a..23626be38 100644 --- a/include/ocpp/v2/ctrlr_component_variables.hpp +++ b/include/ocpp/v2/ctrlr_component_variables.hpp @@ -4,10 +4,63 @@ #ifndef OCPP_V2_CTRLR_COMPONENT_VARIABLES #define OCPP_V2_CTRLR_COMPONENT_VARIABLES +#include + #include namespace ocpp { namespace v2 { +/// +/// \brief Required ComponentVariable. +/// +struct RequiredComponentVariable : ComponentVariable { + /// \brief Constructor + RequiredComponentVariable() : required_for({OcppProtocolVersion::v201, OcppProtocolVersion::v21}){}; + + /// + /// \brief RequiredComponentVariable + /// \param component Component + /// \param variable Variable + /// \param custom_data Custom data (default nullopt) + /// \param required_for Required for which version. Multiple versions can be given. + /// + RequiredComponentVariable(const Component component, const std::optional variable, + const std::optional custom_data = std::nullopt, + const std::set& required_for = {OcppProtocolVersion::v201, + OcppProtocolVersion::v21}) : + ComponentVariable(), required_for(required_for) { + this->component = component; + this->variable = variable; + this->customData = custom_data; + }; + + /// \brief For which ocpp protocol version(s) this component variable is required. + std::set required_for; +}; + +/// +/// \brief Required variables per component. +/// +/// First value is the 'available' variable from the specific component. Second value is a set of required variables. +/// This makes it possible to check only for the required variables if a component is available. +/// +extern const std::vector>> + required_component_available_variables; + +/// +/// \brief Required variables that should always exist, regardless of any available or not available controller. +/// +extern const std::vector required_variables; + +/// +/// \brief Required variables of an EVSE. +/// +extern const std::vector required_evse_variables; + +/// +/// \brief Required variables of a connector. +/// +extern const std::vector required_connector_variables; namespace ControllerComponents { extern const Component InternalCtrlr; @@ -88,6 +141,7 @@ extern const ComponentVariable MessageQueueSizeThreshold; extern const ComponentVariable MaxMessageSize; extern const ComponentVariable ResumeTransactionsOnBoot; extern const ComponentVariable AllowSecurityLevelZeroConnections; +extern const RequiredComponentVariable SupportedOcppVersions; extern const ComponentVariable AlignedDataCtrlrEnabled; extern const ComponentVariable AlignedDataCtrlrAvailable; extern const RequiredComponentVariable AlignedDataInterval; diff --git a/include/ocpp/v2/database_handler.hpp b/include/ocpp/v2/database_handler.hpp index bcbe310f0..c6903aa2e 100644 --- a/include/ocpp/v2/database_handler.hpp +++ b/include/ocpp/v2/database_handler.hpp @@ -167,7 +167,7 @@ class DatabaseHandlerInterface { /// \brief Inserts or updates the given \p profile to CHARGING_PROFILES table virtual void insert_or_update_charging_profile( const int evse_id, const v2::ChargingProfile& profile, - const ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO) = 0; + const CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO) = 0; /// \brief Deletes the profile with the given \p profile_id virtual bool delete_charging_profile(const int profile_id) = 0; @@ -196,7 +196,7 @@ class DatabaseHandlerInterface { /// \brief Retrieves all ChargingProfiles grouped by EVSE ID virtual std::map> get_all_charging_profiles_group_by_evse() = 0; - virtual ChargingLimitSourceEnum get_charging_limit_source_for_profile(const int profile_id) = 0; + virtual CiString<20> get_charging_limit_source_for_profile(const int profile_id) = 0; virtual std::unique_ptr new_statement(const std::string& sql) = 0; }; @@ -270,7 +270,7 @@ class DatabaseHandler : public DatabaseHandlerInterface, public common::Database /// charging profiles void insert_or_update_charging_profile( const int evse_id, const v2::ChargingProfile& profile, - const ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO) override; + const CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO) override; bool delete_charging_profile(const int profile_id) override; void delete_charging_profile_by_transaction_id(const std::string& transaction_id) override; bool clear_charging_profiles() override; @@ -282,7 +282,7 @@ class DatabaseHandler : public DatabaseHandlerInterface, public common::Database std::vector get_charging_profiles_for_evse(const int evse_id) override; std::vector get_all_charging_profiles() override; virtual std::map> get_all_charging_profiles_group_by_evse() override; - ChargingLimitSourceEnum get_charging_limit_source_for_profile(const int profile_id) override; + CiString<20> get_charging_limit_source_for_profile(const int profile_id) override; std::unique_ptr new_statement(const std::string& sql) override; }; diff --git a/include/ocpp/v2/device_model.hpp b/include/ocpp/v2/device_model.hpp index c14a7f975..99632c092 100644 --- a/include/ocpp/v2/device_model.hpp +++ b/include/ocpp/v2/device_model.hpp @@ -8,6 +8,7 @@ #include +#include #include namespace ocpp { @@ -135,6 +136,36 @@ class DeviceModel { bool component_variables_match(const std::vector& component_variables, const ocpp::v2::Component& component_, const struct ocpp::v2::Variable& variable_); + /// + /// \brief Helper function to check if a variable has a value. + /// \param component_variable Component variable to check. + /// \param attribute Attribute to check. + /// + /// \throws DeviceModelError if variable has no value or value is an empty string. + /// + void check_variable_has_value(const ComponentVariable& component_variable, + const AttributeEnum attribute = AttributeEnum::Actual); + + /// + /// \brief Helper function to check if a required variable has a value. + /// \param required_variable Required component variable to check. + /// \param supported_versions The current supported ocpp versions. + /// \throws DeviceModelError if variable has no value or value is an empty string. + /// + void check_required_variable(const RequiredComponentVariable& required_variable, + const std::vector& supported_versions); + + /// + /// \brief Loop over all required variables to check if they have a value. + /// + /// This will check for all required variables from `ctrlr_component_variables.cpp` `required_variables`. + /// It will also check for specific required variables that belong to a specific controller. If a controller is not + /// available, the 'required' variables of that component are not required at this point. + /// + /// \throws DeviceModelError if one of the variables does not have a value or value is an empty string. + /// + void check_required_variables(); + public: /// \brief Constructor for the device model /// \param device_model_storage_interface pointer to a device model interface class diff --git a/include/ocpp/v2/evse.hpp b/include/ocpp/v2/evse.hpp index 4eee09631..75af46d62 100644 --- a/include/ocpp/v2/evse.hpp +++ b/include/ocpp/v2/evse.hpp @@ -41,7 +41,7 @@ class EvseInterface { /// \param connector_type The connector type to check. /// \return True if connector type is unknown or this evse has the given connector type. /// - virtual bool does_connector_exist(ConnectorEnum connector_type) const = 0; + virtual bool does_connector_exist(CiString<20> connector_type) const = 0; /// /// \brief Get connector status. @@ -54,7 +54,7 @@ class EvseInterface { /// \param connector_type The connector type to filter on (optional). /// \return Connector status. If connector type is given and does not exist, std::nullopt. /// - virtual std::optional get_connector_status(std::optional connector_type) = 0; + virtual std::optional get_connector_status(std::optional> connector_type) = 0; /// \brief Opens a new transaction /// \param transaction_id id of the transaction @@ -228,7 +228,7 @@ class Evse : public EvseInterface { /// \param connector_id Connector id /// \return The connector type. If evse or connector id is not correct: std::nullopt. /// - std::optional get_evse_connector_type(const uint32_t connector_id) const; + std::optional> get_evse_connector_type(const uint32_t connector_id) const; public: /// \brief Construct a new Evse object @@ -252,8 +252,8 @@ class Evse : public EvseInterface { int32_t get_id() const; uint32_t get_number_of_connectors() const; - bool does_connector_exist(const ConnectorEnum connector_type) const override; - std::optional get_connector_status(std::optional connector_type) override; + bool does_connector_exist(const CiString<20> connector_type) const override; + std::optional get_connector_status(std::optional> connector_type) override; void open_transaction(const std::string& transaction_id, const int32_t connector_id, const DateTime& timestamp, const MeterValue& meter_start, const std::optional& id_token, diff --git a/include/ocpp/v2/evse_manager.hpp b/include/ocpp/v2/evse_manager.hpp index 15648bd53..366b21e91 100644 --- a/include/ocpp/v2/evse_manager.hpp +++ b/include/ocpp/v2/evse_manager.hpp @@ -37,7 +37,7 @@ class EvseManagerInterface { /// \param evse_id The evse id to check for. /// \param connector_type The connector type. /// \return False if evse id does not exist or evse does not have the given connector type. - virtual bool does_connector_exist(const int32_t evse_id, ConnectorEnum connector_type) const = 0; + virtual bool does_connector_exist(const int32_t evse_id, const CiString<20> connector_type) const = 0; /// \brief Check if an evse with \p id exists virtual bool does_evse_exist(int32_t id) const = 0; @@ -91,7 +91,7 @@ class EvseManager : public EvseManagerInterface { EvseInterface& get_evse(int32_t id) override; const EvseInterface& get_evse(const int32_t id) const override; - virtual bool does_connector_exist(const int32_t evse_id, const ConnectorEnum connector_type) const override; + virtual bool does_connector_exist(const int32_t evse_id, const CiString<20> connector_type) const override; bool does_evse_exist(const int32_t id) const override; bool are_all_connectors_effectively_inoperative() const override; diff --git a/include/ocpp/v2/functional_blocks/authorization.hpp b/include/ocpp/v2/functional_blocks/authorization.hpp index 4b5851e18..3e3ae9ca7 100644 --- a/include/ocpp/v2/functional_blocks/authorization.hpp +++ b/include/ocpp/v2/functional_blocks/authorization.hpp @@ -21,7 +21,7 @@ class AuthorizationInterface : public MessageHandlerInterface { } virtual void start_auth_cache_cleanup_thread() = 0; - virtual AuthorizeResponse authorize_req(const IdToken id_token, const std::optional>& certificate, + virtual AuthorizeResponse authorize_req(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) = 0; virtual void trigger_authorization_cache_cleanup() = 0; ///\brief Calculate and update the authorization cache size in the device model @@ -38,7 +38,7 @@ class AuthorizationInterface : public MessageHandlerInterface { /// \param certificate /// \param ocsp_request_data /// \return AuthorizeResponse containing the result of the validation - virtual AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, + virtual AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) = 0; }; @@ -58,7 +58,7 @@ class Authorization : public AuthorizationInterface { ~Authorization(); void start_auth_cache_cleanup_thread() override; void handle_message(const ocpp::EnhancedMessage& message) override; - AuthorizeResponse authorize_req(const IdToken id_token, const std::optional>& certificate, + AuthorizeResponse authorize_req(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) override; void trigger_authorization_cache_cleanup() override; void update_authorization_cache_size() override; @@ -72,7 +72,7 @@ class Authorization : public AuthorizationInterface { /// \param certificate /// \param ocsp_request_data /// \return AuthorizeResponse containing the result of the validation - AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, + AuthorizeResponse validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) override; private: // Functions diff --git a/include/ocpp/v2/functional_blocks/diagnostics.hpp b/include/ocpp/v2/functional_blocks/diagnostics.hpp index f7555b9b1..a324bb17a 100644 --- a/include/ocpp/v2/functional_blocks/diagnostics.hpp +++ b/include/ocpp/v2/functional_blocks/diagnostics.hpp @@ -66,6 +66,7 @@ class Diagnostics : public DiagnosticsInterface { /// \brief Callback function that can be called to clear customer information based on the given arguments std::optional clear_customer_information_callback; + const bool is_monitoring_available; private: // Functions /* OCPP message requests */ @@ -104,5 +105,9 @@ class Diagnostics : public DiagnosticsInterface { void clear_customer_information(const std::optional customer_certificate, const std::optional id_token, const std::optional> customer_identifier); + + /// \brief Check if monitoring is available and if not, throw. + /// \param type Message type to include in MessageTypeNotImplementedException when thrown. + void throw_when_monitoring_not_available(const MessageType type); }; } // namespace ocpp::v2 diff --git a/include/ocpp/v2/functional_blocks/meter_values.hpp b/include/ocpp/v2/functional_blocks/meter_values.hpp index 1f66a7eee..193ef5952 100644 --- a/include/ocpp/v2/functional_blocks/meter_values.hpp +++ b/include/ocpp/v2/functional_blocks/meter_values.hpp @@ -10,6 +10,7 @@ namespace ocpp::v2 { struct FunctionalBlockContext; +struct RequiredComponentVariable; class MeterValuesInterface : public MessageHandlerInterface { public: diff --git a/include/ocpp/v2/functional_blocks/reservation.hpp b/include/ocpp/v2/functional_blocks/reservation.hpp index 2b6464d11..edceba0e7 100644 --- a/include/ocpp/v2/functional_blocks/reservation.hpp +++ b/include/ocpp/v2/functional_blocks/reservation.hpp @@ -14,8 +14,8 @@ struct CancelReservationRequest; typedef std::function ReserveNowCallback; typedef std::function CancelReservationCallback; -typedef std::function idToken, - const std::optional> groupIdToken)> +typedef std::function idToken, + const std::optional> groupIdToken)> IsReservationForTokenCallback; class ReservationInterface : public MessageHandlerInterface { diff --git a/include/ocpp/v2/functional_blocks/smart_charging.hpp b/include/ocpp/v2/functional_blocks/smart_charging.hpp index 4893509ff..0cd0259a5 100644 --- a/include/ocpp/v2/functional_blocks/smart_charging.hpp +++ b/include/ocpp/v2/functional_blocks/smart_charging.hpp @@ -91,7 +91,7 @@ class SmartChargingInterface : public MessageHandlerInterface { /// virtual SetChargingProfileResponse conform_validate_and_add_profile( ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO, + CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO, AddChargingProfileSource source_of_request = AddChargingProfileSource::SetChargingProfile) = 0; /// @@ -138,7 +138,7 @@ class SmartCharging : public SmartChargingInterface { SetChargingProfileResponse conform_validate_and_add_profile( ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO, + CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO, AddChargingProfileSource source_of_request = AddChargingProfileSource::SetChargingProfile) override; ProfileValidationResultEnum conform_and_validate_profile( ChargingProfile& profile, int32_t evse_id, @@ -191,9 +191,8 @@ class SmartCharging : public SmartChargingInterface { /// /// \brief Adds a given \p profile and associated \p evse_id to our stored list of profiles /// - SetChargingProfileResponse - add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO); + SetChargingProfileResponse add_profile(ChargingProfile& profile, int32_t evse_id, + CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO); /// /// \brief Clears profiles from the system using the given \p request @@ -214,9 +213,8 @@ class SmartCharging : public SmartChargingInterface { private: // Functions /* OCPP message requests */ - void report_charging_profile_req(const int32_t request_id, const int32_t evse_id, - const ChargingLimitSourceEnum source, const std::vector& profiles, - const bool tbc); + void report_charging_profile_req(const int32_t request_id, const int32_t evse_id, const CiString<20> source, + const std::vector& profiles, const bool tbc); void report_charging_profile_req(const ReportChargingProfilesRequest& req); /* OCPP message handlers */ diff --git a/include/ocpp/v2/init_device_model_db.hpp b/include/ocpp/v2/init_device_model_db.hpp index b6382594f..5642d823d 100644 --- a/include/ocpp/v2/init_device_model_db.hpp +++ b/include/ocpp/v2/init_device_model_db.hpp @@ -43,7 +43,6 @@ namespace ocpp::v2 { /// \brief Class that holds a component. /// /// When the component is read from the database, the component id will be set. -/// When the component is read from the component config file, the 'required' vector will be filled. /// struct ComponentKey { std::optional db_id; ///< \brief Component id in the database. @@ -51,7 +50,6 @@ struct ComponentKey { std::optional instance; ///< \brief Component instance. std::optional evse_id; ///< \brief Component evse id. std::optional connector_id; ///< \brief Component connector id. - std::vector required; ///< \brief List of required variables. /// /// \brief operator <, needed to add this class as key in a map. @@ -85,8 +83,6 @@ struct DeviceModelVariable { VariableCharacteristics characteristics; /// \brief Variable attributes std::vector attributes; - /// \brief True if variable is required - bool required; /// \brief Variable instance std::optional instance; /// \brief Default value, if this is set in the component config json @@ -221,11 +217,9 @@ class InitDeviceModelDb : public common::DatabaseHandlerCommon { /// /// \brief Get all component properties (variables) from the given (component) json. /// \param component_properties The json component properties - /// \param required_properties The vector of required properties of this component. /// \return A vector with all Variables belonging to this component. /// - std::vector get_all_component_properties(const json& component_properties, - std::vector required_properties); + std::vector get_all_component_properties(const json& component_properties); /// /// \brief Insert variable characteristics diff --git a/include/ocpp/v2/messages/Authorize.hpp b/include/ocpp/v2/messages/Authorize.hpp index 56cff8e76..b88b946bb 100644 --- a/include/ocpp/v2/messages/Authorize.hpp +++ b/include/ocpp/v2/messages/Authorize.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_AUTHORIZE_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP Authorize message struct AuthorizeRequest : public ocpp::Message { IdToken idToken; - std::optional customData; - std::optional> certificate; + std::optional> certificate; std::optional> iso15118CertificateHashData; + std::optional customData; /// \brief Provides the type of this Authorize message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +40,10 @@ std::ostream& operator<<(std::ostream& os, const AuthorizeRequest& k); /// \brief Contains a OCPP AuthorizeResponse message struct AuthorizeResponse : public ocpp::Message { IdTokenInfo idTokenInfo; - std::optional customData; std::optional certificateStatus; + std::optional> allowedEnergyTransfer; + std::optional tariff; + std::optional customData; /// \brief Provides the type of this AuthorizeResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/BootNotification.hpp b/include/ocpp/v2/messages/BootNotification.hpp index bf77d3e55..e4c9f2ddb 100644 --- a/include/ocpp/v2/messages/BootNotification.hpp +++ b/include/ocpp/v2/messages/BootNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_BOOTNOTIFICATION_HPP @@ -41,8 +41,8 @@ struct BootNotificationResponse : public ocpp::Message { ocpp::DateTime currentTime; int32_t interval; RegistrationStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this BootNotificationResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/CancelReservation.hpp b/include/ocpp/v2/messages/CancelReservation.hpp index 3994bb0dd..e1e5bae0c 100644 --- a/include/ocpp/v2/messages/CancelReservation.hpp +++ b/include/ocpp/v2/messages/CancelReservation.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CANCELRESERVATION_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const CancelReservationRequest& k); /// \brief Contains a OCPP CancelReservationResponse message struct CancelReservationResponse : public ocpp::Message { CancelReservationStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this CancelReservationResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/CertificateSigned.hpp b/include/ocpp/v2/messages/CertificateSigned.hpp index c79e93201..3e26f5a60 100644 --- a/include/ocpp/v2/messages/CertificateSigned.hpp +++ b/include/ocpp/v2/messages/CertificateSigned.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CERTIFICATESIGNED_HPP @@ -18,8 +18,9 @@ namespace v2 { /// \brief Contains a OCPP CertificateSigned message struct CertificateSignedRequest : public ocpp::Message { CiString<10000> certificateChain; - std::optional customData; std::optional certificateType; + std::optional requestId; + std::optional customData; /// \brief Provides the type of this CertificateSigned message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const CertificateSignedRequest& k); /// \brief Contains a OCPP CertificateSignedResponse message struct CertificateSignedResponse : public ocpp::Message { CertificateSignedStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this CertificateSignedResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ChangeAvailability.hpp b/include/ocpp/v2/messages/ChangeAvailability.hpp index b9c90db34..e6ee9dc31 100644 --- a/include/ocpp/v2/messages/ChangeAvailability.hpp +++ b/include/ocpp/v2/messages/ChangeAvailability.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CHANGEAVAILABILITY_HPP @@ -18,8 +18,8 @@ namespace v2 { /// \brief Contains a OCPP ChangeAvailability message struct ChangeAvailabilityRequest : public ocpp::Message { OperationalStatusEnum operationalStatus; - std::optional customData; std::optional evse; + std::optional customData; /// \brief Provides the type of this ChangeAvailability message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const ChangeAvailabilityRequest& k); /// \brief Contains a OCPP ChangeAvailabilityResponse message struct ChangeAvailabilityResponse : public ocpp::Message { ChangeAvailabilityStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ChangeAvailabilityResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ClearCache.hpp b/include/ocpp/v2/messages/ClearCache.hpp index df0c3f780..7aec80dc0 100644 --- a/include/ocpp/v2/messages/ClearCache.hpp +++ b/include/ocpp/v2/messages/ClearCache.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CLEARCACHE_HPP @@ -37,8 +37,8 @@ std::ostream& operator<<(std::ostream& os, const ClearCacheRequest& k); /// \brief Contains a OCPP ClearCacheResponse message struct ClearCacheResponse : public ocpp::Message { ClearCacheStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ClearCacheResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ClearChargingProfile.hpp b/include/ocpp/v2/messages/ClearChargingProfile.hpp index 990784e00..05baa3cc6 100644 --- a/include/ocpp/v2/messages/ClearChargingProfile.hpp +++ b/include/ocpp/v2/messages/ClearChargingProfile.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CLEARCHARGINGPROFILE_HPP @@ -17,9 +17,9 @@ namespace v2 { /// \brief Contains a OCPP ClearChargingProfile message struct ClearChargingProfileRequest : public ocpp::Message { - std::optional customData; std::optional chargingProfileId; std::optional chargingProfileCriteria; + std::optional customData; /// \brief Provides the type of this ClearChargingProfile message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const ClearChargingProfileRequest& k) /// \brief Contains a OCPP ClearChargingProfileResponse message struct ClearChargingProfileResponse : public ocpp::Message { ClearChargingProfileStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ClearChargingProfileResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ClearDisplayMessage.hpp b/include/ocpp/v2/messages/ClearDisplayMessage.hpp index edf659853..3b76e6573 100644 --- a/include/ocpp/v2/messages/ClearDisplayMessage.hpp +++ b/include/ocpp/v2/messages/ClearDisplayMessage.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CLEARDISPLAYMESSAGE_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const ClearDisplayMessageRequest& k); /// \brief Contains a OCPP ClearDisplayMessageResponse message struct ClearDisplayMessageResponse : public ocpp::Message { ClearMessageStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ClearDisplayMessageResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ClearVariableMonitoring.hpp b/include/ocpp/v2/messages/ClearVariableMonitoring.hpp index 05b632179..b6479b88c 100644 --- a/include/ocpp/v2/messages/ClearVariableMonitoring.hpp +++ b/include/ocpp/v2/messages/ClearVariableMonitoring.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CLEARVARIABLEMONITORING_HPP diff --git a/include/ocpp/v2/messages/ClearedChargingLimit.hpp b/include/ocpp/v2/messages/ClearedChargingLimit.hpp index 1e11ebc38..e74ad6dbe 100644 --- a/include/ocpp/v2/messages/ClearedChargingLimit.hpp +++ b/include/ocpp/v2/messages/ClearedChargingLimit.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CLEAREDCHARGINGLIMIT_HPP @@ -9,7 +9,6 @@ #include #include -#include #include namespace ocpp { @@ -17,9 +16,9 @@ namespace v2 { /// \brief Contains a OCPP ClearedChargingLimit message struct ClearedChargingLimitRequest : public ocpp::Message { - ChargingLimitSourceEnum chargingLimitSource; - std::optional customData; + CiString<20> chargingLimitSource; std::optional evseId; + std::optional customData; /// \brief Provides the type of this ClearedChargingLimit message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/CostUpdated.hpp b/include/ocpp/v2/messages/CostUpdated.hpp index 79dad42db..896fb6cc1 100644 --- a/include/ocpp/v2/messages/CostUpdated.hpp +++ b/include/ocpp/v2/messages/CostUpdated.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_COSTUPDATED_HPP diff --git a/include/ocpp/v2/messages/CustomerInformation.hpp b/include/ocpp/v2/messages/CustomerInformation.hpp index 4fc3ceeab..75d268083 100644 --- a/include/ocpp/v2/messages/CustomerInformation.hpp +++ b/include/ocpp/v2/messages/CustomerInformation.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_CUSTOMERINFORMATION_HPP @@ -20,10 +20,10 @@ struct CustomerInformationRequest : public ocpp::Message { int32_t requestId; bool report; bool clear; - std::optional customData; std::optional customerCertificate; std::optional idToken; std::optional> customerIdentifier; + std::optional customData; /// \brief Provides the type of this CustomerInformation message as a human readable string /// \returns the message type as a human readable string @@ -43,8 +43,8 @@ std::ostream& operator<<(std::ostream& os, const CustomerInformationRequest& k); /// \brief Contains a OCPP CustomerInformationResponse message struct CustomerInformationResponse : public ocpp::Message { CustomerInformationStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this CustomerInformationResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/DataTransfer.hpp b/include/ocpp/v2/messages/DataTransfer.hpp index 38867e9f6..acac43aee 100644 --- a/include/ocpp/v2/messages/DataTransfer.hpp +++ b/include/ocpp/v2/messages/DataTransfer.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_DATATRANSFER_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP DataTransfer message struct DataTransferRequest : public ocpp::Message { CiString<255> vendorId; - std::optional customData; std::optional> messageId; std::optional data; + std::optional customData; /// \brief Provides the type of this DataTransfer message as a human readable string /// \returns the message type as a human readable string @@ -40,9 +40,9 @@ std::ostream& operator<<(std::ostream& os, const DataTransferRequest& k); /// \brief Contains a OCPP DataTransferResponse message struct DataTransferResponse : public ocpp::Message { DataTransferStatusEnum status; - std::optional customData; std::optional statusInfo; std::optional data; + std::optional customData; /// \brief Provides the type of this DataTransferResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/DeleteCertificate.hpp b/include/ocpp/v2/messages/DeleteCertificate.hpp index 908828191..33d3449ce 100644 --- a/include/ocpp/v2/messages/DeleteCertificate.hpp +++ b/include/ocpp/v2/messages/DeleteCertificate.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_DELETECERTIFICATE_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const DeleteCertificateRequest& k); /// \brief Contains a OCPP DeleteCertificateResponse message struct DeleteCertificateResponse : public ocpp::Message { DeleteCertificateStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this DeleteCertificateResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/FirmwareStatusNotification.hpp b/include/ocpp/v2/messages/FirmwareStatusNotification.hpp index ec7b52c63..32f9a6320 100644 --- a/include/ocpp/v2/messages/FirmwareStatusNotification.hpp +++ b/include/ocpp/v2/messages/FirmwareStatusNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_FIRMWARESTATUSNOTIFICATION_HPP @@ -18,8 +18,9 @@ namespace v2 { /// \brief Contains a OCPP FirmwareStatusNotification message struct FirmwareStatusNotificationRequest : public ocpp::Message { FirmwareStatusEnum status; - std::optional customData; std::optional requestId; + std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this FirmwareStatusNotification message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/Get15118EVCertificate.hpp b/include/ocpp/v2/messages/Get15118EVCertificate.hpp index 19a6d28e6..77a553c30 100644 --- a/include/ocpp/v2/messages/Get15118EVCertificate.hpp +++ b/include/ocpp/v2/messages/Get15118EVCertificate.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GET15118EVCERTIFICATE_HPP @@ -20,7 +20,9 @@ namespace v2 { struct Get15118EVCertificateRequest : public ocpp::Message { CiString<50> iso15118SchemaVersion; CertificateActionEnum action; - CiString<5600> exiRequest; + CiString<11000> exiRequest; + std::optional maximumContractCertificateChains; + std::optional>> prioritizedEMAIDs; std::optional customData; /// \brief Provides the type of this Get15118EVCertificate message as a human readable string @@ -42,8 +44,9 @@ std::ostream& operator<<(std::ostream& os, const Get15118EVCertificateRequest& k struct Get15118EVCertificateResponse : public ocpp::Message { Iso15118EVCertificateStatusEnum status; CiString exiResponse; - std::optional customData; std::optional statusInfo; + std::optional remainingContracts; + std::optional customData; /// \brief Provides the type of this Get15118EVCertificateResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetBaseReport.hpp b/include/ocpp/v2/messages/GetBaseReport.hpp index 11b70c39e..288021ddd 100644 --- a/include/ocpp/v2/messages/GetBaseReport.hpp +++ b/include/ocpp/v2/messages/GetBaseReport.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETBASEREPORT_HPP @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const GetBaseReportRequest& k); /// \brief Contains a OCPP GetBaseReportResponse message struct GetBaseReportResponse : public ocpp::Message { GenericDeviceModelStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this GetBaseReportResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetCertificateStatus.hpp b/include/ocpp/v2/messages/GetCertificateStatus.hpp index 8a623610a..b9ac144ef 100644 --- a/include/ocpp/v2/messages/GetCertificateStatus.hpp +++ b/include/ocpp/v2/messages/GetCertificateStatus.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETCERTIFICATESTATUS_HPP @@ -38,9 +38,9 @@ std::ostream& operator<<(std::ostream& os, const GetCertificateStatusRequest& k) /// \brief Contains a OCPP GetCertificateStatusResponse message struct GetCertificateStatusResponse : public ocpp::Message { GetCertificateStatusEnum status; - std::optional customData; std::optional statusInfo; - std::optional> ocspResult; + std::optional> ocspResult; + std::optional customData; /// \brief Provides the type of this GetCertificateStatusResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetChargingProfiles.hpp b/include/ocpp/v2/messages/GetChargingProfiles.hpp index 9475aad07..f6f4f13b9 100644 --- a/include/ocpp/v2/messages/GetChargingProfiles.hpp +++ b/include/ocpp/v2/messages/GetChargingProfiles.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETCHARGINGPROFILES_HPP @@ -19,8 +19,8 @@ namespace v2 { struct GetChargingProfilesRequest : public ocpp::Message { int32_t requestId; ChargingProfileCriterion chargingProfile; - std::optional customData; std::optional evseId; + std::optional customData; /// \brief Provides the type of this GetChargingProfiles message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const GetChargingProfilesRequest& k); /// \brief Contains a OCPP GetChargingProfilesResponse message struct GetChargingProfilesResponse : public ocpp::Message { GetChargingProfileStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this GetChargingProfilesResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetCompositeSchedule.hpp b/include/ocpp/v2/messages/GetCompositeSchedule.hpp index 5c51d9871..1e272ccd5 100644 --- a/include/ocpp/v2/messages/GetCompositeSchedule.hpp +++ b/include/ocpp/v2/messages/GetCompositeSchedule.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETCOMPOSITESCHEDULE_HPP @@ -19,8 +19,8 @@ namespace v2 { struct GetCompositeScheduleRequest : public ocpp::Message { int32_t duration; int32_t evseId; - std::optional customData; std::optional chargingRateUnit; + std::optional customData; /// \brief Provides the type of this GetCompositeSchedule message as a human readable string /// \returns the message type as a human readable string @@ -40,9 +40,9 @@ std::ostream& operator<<(std::ostream& os, const GetCompositeScheduleRequest& k) /// \brief Contains a OCPP GetCompositeScheduleResponse message struct GetCompositeScheduleResponse : public ocpp::Message { GenericStatusEnum status; - std::optional customData; std::optional statusInfo; std::optional schedule; + std::optional customData; /// \brief Provides the type of this GetCompositeScheduleResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetDisplayMessages.hpp b/include/ocpp/v2/messages/GetDisplayMessages.hpp index d917614fe..ec134cc29 100644 --- a/include/ocpp/v2/messages/GetDisplayMessages.hpp +++ b/include/ocpp/v2/messages/GetDisplayMessages.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETDISPLAYMESSAGES_HPP @@ -18,10 +18,10 @@ namespace v2 { /// \brief Contains a OCPP GetDisplayMessages message struct GetDisplayMessagesRequest : public ocpp::Message { int32_t requestId; - std::optional customData; std::optional> id; std::optional priority; std::optional state; + std::optional customData; /// \brief Provides the type of this GetDisplayMessages message as a human readable string /// \returns the message type as a human readable string @@ -41,8 +41,8 @@ std::ostream& operator<<(std::ostream& os, const GetDisplayMessagesRequest& k); /// \brief Contains a OCPP GetDisplayMessagesResponse message struct GetDisplayMessagesResponse : public ocpp::Message { GetDisplayMessagesStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this GetDisplayMessagesResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetInstalledCertificateIds.hpp b/include/ocpp/v2/messages/GetInstalledCertificateIds.hpp index c8d69a172..5c71e33bf 100644 --- a/include/ocpp/v2/messages/GetInstalledCertificateIds.hpp +++ b/include/ocpp/v2/messages/GetInstalledCertificateIds.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETINSTALLEDCERTIFICATEIDS_HPP @@ -17,8 +17,8 @@ namespace v2 { /// \brief Contains a OCPP GetInstalledCertificateIds message struct GetInstalledCertificateIdsRequest : public ocpp::Message { - std::optional customData; std::optional> certificateType; + std::optional customData; /// \brief Provides the type of this GetInstalledCertificateIds message as a human readable string /// \returns the message type as a human readable string @@ -38,9 +38,9 @@ std::ostream& operator<<(std::ostream& os, const GetInstalledCertificateIdsReque /// \brief Contains a OCPP GetInstalledCertificateIdsResponse message struct GetInstalledCertificateIdsResponse : public ocpp::Message { GetInstalledCertificateStatusEnum status; - std::optional customData; std::optional statusInfo; std::optional> certificateHashDataChain; + std::optional customData; /// \brief Provides the type of this GetInstalledCertificateIdsResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetLocalListVersion.hpp b/include/ocpp/v2/messages/GetLocalListVersion.hpp index 9f60d5500..9c44437b9 100644 --- a/include/ocpp/v2/messages/GetLocalListVersion.hpp +++ b/include/ocpp/v2/messages/GetLocalListVersion.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETLOCALLISTVERSION_HPP diff --git a/include/ocpp/v2/messages/GetLog.hpp b/include/ocpp/v2/messages/GetLog.hpp index 35b83ac6b..e1135396c 100644 --- a/include/ocpp/v2/messages/GetLog.hpp +++ b/include/ocpp/v2/messages/GetLog.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETLOG_HPP @@ -20,9 +20,9 @@ struct GetLogRequest : public ocpp::Message { LogParameters log; LogEnum logType; int32_t requestId; - std::optional customData; std::optional retries; std::optional retryInterval; + std::optional customData; /// \brief Provides the type of this GetLog message as a human readable string /// \returns the message type as a human readable string @@ -42,9 +42,9 @@ std::ostream& operator<<(std::ostream& os, const GetLogRequest& k); /// \brief Contains a OCPP GetLogResponse message struct GetLogResponse : public ocpp::Message { LogStatusEnum status; - std::optional customData; std::optional statusInfo; std::optional> filename; + std::optional customData; /// \brief Provides the type of this GetLogResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetMonitoringReport.hpp b/include/ocpp/v2/messages/GetMonitoringReport.hpp index ea7025a80..3951b0aae 100644 --- a/include/ocpp/v2/messages/GetMonitoringReport.hpp +++ b/include/ocpp/v2/messages/GetMonitoringReport.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETMONITORINGREPORT_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP GetMonitoringReport message struct GetMonitoringReportRequest : public ocpp::Message { int32_t requestId; - std::optional customData; std::optional> componentVariable; std::optional> monitoringCriteria; + std::optional customData; /// \brief Provides the type of this GetMonitoringReport message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const GetMonitoringReportRequest& k); /// \brief Contains a OCPP GetMonitoringReportResponse message struct GetMonitoringReportResponse : public ocpp::Message { GenericDeviceModelStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this GetMonitoringReportResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetReport.hpp b/include/ocpp/v2/messages/GetReport.hpp index 0936bf4f3..5274d9c13 100644 --- a/include/ocpp/v2/messages/GetReport.hpp +++ b/include/ocpp/v2/messages/GetReport.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETREPORT_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP GetReport message struct GetReportRequest : public ocpp::Message { int32_t requestId; - std::optional customData; std::optional> componentVariable; std::optional> componentCriteria; + std::optional customData; /// \brief Provides the type of this GetReport message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const GetReportRequest& k); /// \brief Contains a OCPP GetReportResponse message struct GetReportResponse : public ocpp::Message { GenericDeviceModelStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this GetReportResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetTransactionStatus.hpp b/include/ocpp/v2/messages/GetTransactionStatus.hpp index befe02e02..9d013d498 100644 --- a/include/ocpp/v2/messages/GetTransactionStatus.hpp +++ b/include/ocpp/v2/messages/GetTransactionStatus.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETTRANSACTIONSTATUS_HPP @@ -16,8 +16,8 @@ namespace v2 { /// \brief Contains a OCPP GetTransactionStatus message struct GetTransactionStatusRequest : public ocpp::Message { - std::optional customData; std::optional> transactionId; + std::optional customData; /// \brief Provides the type of this GetTransactionStatus message as a human readable string /// \returns the message type as a human readable string @@ -37,8 +37,8 @@ std::ostream& operator<<(std::ostream& os, const GetTransactionStatusRequest& k) /// \brief Contains a OCPP GetTransactionStatusResponse message struct GetTransactionStatusResponse : public ocpp::Message { bool messagesInQueue; - std::optional customData; std::optional ongoingIndicator; + std::optional customData; /// \brief Provides the type of this GetTransactionStatusResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/GetVariables.hpp b/include/ocpp/v2/messages/GetVariables.hpp index 74f4cbfab..b9850cd54 100644 --- a/include/ocpp/v2/messages/GetVariables.hpp +++ b/include/ocpp/v2/messages/GetVariables.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_GETVARIABLES_HPP diff --git a/include/ocpp/v2/messages/Heartbeat.hpp b/include/ocpp/v2/messages/Heartbeat.hpp index 8e28d2abf..ab08e2bc2 100644 --- a/include/ocpp/v2/messages/Heartbeat.hpp +++ b/include/ocpp/v2/messages/Heartbeat.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_HEARTBEAT_HPP diff --git a/include/ocpp/v2/messages/InstallCertificate.hpp b/include/ocpp/v2/messages/InstallCertificate.hpp index d19224289..71e64b67d 100644 --- a/include/ocpp/v2/messages/InstallCertificate.hpp +++ b/include/ocpp/v2/messages/InstallCertificate.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_INSTALLCERTIFICATE_HPP @@ -18,7 +18,7 @@ namespace v2 { /// \brief Contains a OCPP InstallCertificate message struct InstallCertificateRequest : public ocpp::Message { InstallCertificateUseEnum certificateType; - CiString<5500> certificate; + CiString<10000> certificate; std::optional customData; /// \brief Provides the type of this InstallCertificate message as a human readable string @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const InstallCertificateRequest& k); /// \brief Contains a OCPP InstallCertificateResponse message struct InstallCertificateResponse : public ocpp::Message { InstallCertificateStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this InstallCertificateResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/LogStatusNotification.hpp b/include/ocpp/v2/messages/LogStatusNotification.hpp index 41fbd59de..17dbf29f7 100644 --- a/include/ocpp/v2/messages/LogStatusNotification.hpp +++ b/include/ocpp/v2/messages/LogStatusNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_LOGSTATUSNOTIFICATION_HPP @@ -18,8 +18,9 @@ namespace v2 { /// \brief Contains a OCPP LogStatusNotification message struct LogStatusNotificationRequest : public ocpp::Message { UploadLogStatusEnum status; - std::optional customData; std::optional requestId; + std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this LogStatusNotification message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/MeterValues.hpp b/include/ocpp/v2/messages/MeterValues.hpp index 9e114423f..e9ee16283 100644 --- a/include/ocpp/v2/messages/MeterValues.hpp +++ b/include/ocpp/v2/messages/MeterValues.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_METERVALUES_HPP diff --git a/include/ocpp/v2/messages/NotifyChargingLimit.hpp b/include/ocpp/v2/messages/NotifyChargingLimit.hpp index 8c0b25300..8bee47a04 100644 --- a/include/ocpp/v2/messages/NotifyChargingLimit.hpp +++ b/include/ocpp/v2/messages/NotifyChargingLimit.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYCHARGINGLIMIT_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP NotifyChargingLimit message struct NotifyChargingLimitRequest : public ocpp::Message { ChargingLimit chargingLimit; - std::optional customData; std::optional> chargingSchedule; std::optional evseId; + std::optional customData; /// \brief Provides the type of this NotifyChargingLimit message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyCustomerInformation.hpp b/include/ocpp/v2/messages/NotifyCustomerInformation.hpp index ea544350f..7b1a894f1 100644 --- a/include/ocpp/v2/messages/NotifyCustomerInformation.hpp +++ b/include/ocpp/v2/messages/NotifyCustomerInformation.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYCUSTOMERINFORMATION_HPP @@ -20,8 +20,8 @@ struct NotifyCustomerInformationRequest : public ocpp::Message { int32_t seqNo; ocpp::DateTime generatedAt; int32_t requestId; - std::optional customData; std::optional tbc; + std::optional customData; /// \brief Provides the type of this NotifyCustomerInformation message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyDisplayMessages.hpp b/include/ocpp/v2/messages/NotifyDisplayMessages.hpp index 175d7b3af..ec2d40100 100644 --- a/include/ocpp/v2/messages/NotifyDisplayMessages.hpp +++ b/include/ocpp/v2/messages/NotifyDisplayMessages.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYDISPLAYMESSAGES_HPP @@ -18,9 +18,9 @@ namespace v2 { /// \brief Contains a OCPP NotifyDisplayMessages message struct NotifyDisplayMessagesRequest : public ocpp::Message { int32_t requestId; - std::optional customData; std::optional> messageInfo; std::optional tbc; + std::optional customData; /// \brief Provides the type of this NotifyDisplayMessages message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyEVChargingNeeds.hpp b/include/ocpp/v2/messages/NotifyEVChargingNeeds.hpp index e7e3a1376..863b01fdd 100644 --- a/include/ocpp/v2/messages/NotifyEVChargingNeeds.hpp +++ b/include/ocpp/v2/messages/NotifyEVChargingNeeds.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYEVCHARGINGNEEDS_HPP @@ -17,10 +17,11 @@ namespace v2 { /// \brief Contains a OCPP NotifyEVChargingNeeds message struct NotifyEVChargingNeedsRequest : public ocpp::Message { - ChargingNeeds chargingNeeds; int32_t evseId; - std::optional customData; + ChargingNeeds chargingNeeds; std::optional maxScheduleTuples; + std::optional timestamp; + std::optional customData; /// \brief Provides the type of this NotifyEVChargingNeeds message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +41,8 @@ std::ostream& operator<<(std::ostream& os, const NotifyEVChargingNeedsRequest& k /// \brief Contains a OCPP NotifyEVChargingNeedsResponse message struct NotifyEVChargingNeedsResponse : public ocpp::Message { NotifyEVChargingNeedsStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this NotifyEVChargingNeedsResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyEVChargingSchedule.hpp b/include/ocpp/v2/messages/NotifyEVChargingSchedule.hpp index f08566359..a5c4b40b1 100644 --- a/include/ocpp/v2/messages/NotifyEVChargingSchedule.hpp +++ b/include/ocpp/v2/messages/NotifyEVChargingSchedule.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYEVCHARGINGSCHEDULE_HPP @@ -20,6 +20,8 @@ struct NotifyEVChargingScheduleRequest : public ocpp::Message { ocpp::DateTime timeBase; ChargingSchedule chargingSchedule; int32_t evseId; + std::optional selectedChargingScheduleId; + std::optional powerToleranceAcceptance; std::optional customData; /// \brief Provides the type of this NotifyEVChargingSchedule message as a human readable string @@ -40,8 +42,8 @@ std::ostream& operator<<(std::ostream& os, const NotifyEVChargingScheduleRequest /// \brief Contains a OCPP NotifyEVChargingScheduleResponse message struct NotifyEVChargingScheduleResponse : public ocpp::Message { GenericStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this NotifyEVChargingScheduleResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyEvent.hpp b/include/ocpp/v2/messages/NotifyEvent.hpp index 1411dc271..a53dbfe0d 100644 --- a/include/ocpp/v2/messages/NotifyEvent.hpp +++ b/include/ocpp/v2/messages/NotifyEvent.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYEVENT_HPP @@ -20,8 +20,8 @@ struct NotifyEventRequest : public ocpp::Message { ocpp::DateTime generatedAt; int32_t seqNo; std::vector eventData; - std::optional customData; std::optional tbc; + std::optional customData; /// \brief Provides the type of this NotifyEvent message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyMonitoringReport.hpp b/include/ocpp/v2/messages/NotifyMonitoringReport.hpp index c52f44146..cafabb754 100644 --- a/include/ocpp/v2/messages/NotifyMonitoringReport.hpp +++ b/include/ocpp/v2/messages/NotifyMonitoringReport.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYMONITORINGREPORT_HPP @@ -20,9 +20,9 @@ struct NotifyMonitoringReportRequest : public ocpp::Message { int32_t requestId; int32_t seqNo; ocpp::DateTime generatedAt; - std::optional customData; std::optional> monitor; std::optional tbc; + std::optional customData; /// \brief Provides the type of this NotifyMonitoringReport message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/NotifyReport.hpp b/include/ocpp/v2/messages/NotifyReport.hpp index 81d701652..75dcff981 100644 --- a/include/ocpp/v2/messages/NotifyReport.hpp +++ b/include/ocpp/v2/messages/NotifyReport.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_NOTIFYREPORT_HPP @@ -20,9 +20,9 @@ struct NotifyReportRequest : public ocpp::Message { int32_t requestId; ocpp::DateTime generatedAt; int32_t seqNo; - std::optional customData; std::optional> reportData; std::optional tbc; + std::optional customData; /// \brief Provides the type of this NotifyReport message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/PublishFirmware.hpp b/include/ocpp/v2/messages/PublishFirmware.hpp index 7507e451d..30ccba414 100644 --- a/include/ocpp/v2/messages/PublishFirmware.hpp +++ b/include/ocpp/v2/messages/PublishFirmware.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_PUBLISHFIRMWARE_HPP @@ -17,12 +17,12 @@ namespace v2 { /// \brief Contains a OCPP PublishFirmware message struct PublishFirmwareRequest : public ocpp::Message { - CiString<512> location; + CiString<2000> location; CiString<32> checksum; int32_t requestId; - std::optional customData; std::optional retries; std::optional retryInterval; + std::optional customData; /// \brief Provides the type of this PublishFirmware message as a human readable string /// \returns the message type as a human readable string @@ -42,8 +42,8 @@ std::ostream& operator<<(std::ostream& os, const PublishFirmwareRequest& k); /// \brief Contains a OCPP PublishFirmwareResponse message struct PublishFirmwareResponse : public ocpp::Message { GenericStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this PublishFirmwareResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/PublishFirmwareStatusNotification.hpp b/include/ocpp/v2/messages/PublishFirmwareStatusNotification.hpp index 2c96b7674..3c955ff0e 100644 --- a/include/ocpp/v2/messages/PublishFirmwareStatusNotification.hpp +++ b/include/ocpp/v2/messages/PublishFirmwareStatusNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_PUBLISHFIRMWARESTATUSNOTIFICATION_HPP @@ -18,9 +18,10 @@ namespace v2 { /// \brief Contains a OCPP PublishFirmwareStatusNotification message struct PublishFirmwareStatusNotificationRequest : public ocpp::Message { PublishFirmwareStatusEnum status; - std::optional customData; - std::optional>> location; + std::optional>> location; std::optional requestId; + std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this PublishFirmwareStatusNotification message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ReportChargingProfiles.hpp b/include/ocpp/v2/messages/ReportChargingProfiles.hpp index 68614921e..665ab08f7 100644 --- a/include/ocpp/v2/messages/ReportChargingProfiles.hpp +++ b/include/ocpp/v2/messages/ReportChargingProfiles.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_REPORTCHARGINGPROFILES_HPP @@ -18,11 +18,11 @@ namespace v2 { /// \brief Contains a OCPP ReportChargingProfiles message struct ReportChargingProfilesRequest : public ocpp::Message { int32_t requestId; - ChargingLimitSourceEnum chargingLimitSource; + CiString<20> chargingLimitSource; std::vector chargingProfile; int32_t evseId; - std::optional customData; std::optional tbc; + std::optional customData; /// \brief Provides the type of this ReportChargingProfiles message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/RequestStartTransaction.hpp b/include/ocpp/v2/messages/RequestStartTransaction.hpp index a0c690e18..c94fbc60a 100644 --- a/include/ocpp/v2/messages/RequestStartTransaction.hpp +++ b/include/ocpp/v2/messages/RequestStartTransaction.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_REQUESTSTARTTRANSACTION_HPP @@ -19,10 +19,10 @@ namespace v2 { struct RequestStartTransactionRequest : public ocpp::Message { IdToken idToken; int32_t remoteStartId; - std::optional customData; std::optional evseId; std::optional groupIdToken; std::optional chargingProfile; + std::optional customData; /// \brief Provides the type of this StartTransaction message as a human readable string /// \returns the message type as a human readable string @@ -42,9 +42,9 @@ std::ostream& operator<<(std::ostream& os, const RequestStartTransactionRequest& /// \brief Contains a OCPP StartTransactionResponse message struct RequestStartTransactionResponse : public ocpp::Message { RequestStartStopStatusEnum status; - std::optional customData; std::optional statusInfo; std::optional> transactionId; + std::optional customData; /// \brief Provides the type of this StartTransactionResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/RequestStopTransaction.hpp b/include/ocpp/v2/messages/RequestStopTransaction.hpp index 5c783eba3..565f21acb 100644 --- a/include/ocpp/v2/messages/RequestStopTransaction.hpp +++ b/include/ocpp/v2/messages/RequestStopTransaction.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_REQUESTSTOPTRANSACTION_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const RequestStopTransactionRequest& /// \brief Contains a OCPP StopTransactionResponse message struct RequestStopTransactionResponse : public ocpp::Message { RequestStartStopStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this StopTransactionResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/ReservationStatusUpdate.hpp b/include/ocpp/v2/messages/ReservationStatusUpdate.hpp index 2e2589377..ddb188a31 100644 --- a/include/ocpp/v2/messages/ReservationStatusUpdate.hpp +++ b/include/ocpp/v2/messages/ReservationStatusUpdate.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_RESERVATIONSTATUSUPDATE_HPP diff --git a/include/ocpp/v2/messages/ReserveNow.hpp b/include/ocpp/v2/messages/ReserveNow.hpp index 57d07e440..9e7b205fa 100644 --- a/include/ocpp/v2/messages/ReserveNow.hpp +++ b/include/ocpp/v2/messages/ReserveNow.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_RESERVENOW_HPP @@ -20,10 +20,10 @@ struct ReserveNowRequest : public ocpp::Message { int32_t id; ocpp::DateTime expiryDateTime; IdToken idToken; - std::optional customData; - std::optional connectorType; + std::optional> connectorType; std::optional evseId; std::optional groupIdToken; + std::optional customData; /// \brief Provides the type of this ReserveNow message as a human readable string /// \returns the message type as a human readable string @@ -43,8 +43,8 @@ std::ostream& operator<<(std::ostream& os, const ReserveNowRequest& k); /// \brief Contains a OCPP ReserveNowResponse message struct ReserveNowResponse : public ocpp::Message { ReserveNowStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ReserveNowResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/Reset.hpp b/include/ocpp/v2/messages/Reset.hpp index fb90ea148..bebeada46 100644 --- a/include/ocpp/v2/messages/Reset.hpp +++ b/include/ocpp/v2/messages/Reset.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_RESET_HPP @@ -18,8 +18,8 @@ namespace v2 { /// \brief Contains a OCPP Reset message struct ResetRequest : public ocpp::Message { ResetEnum type; - std::optional customData; std::optional evseId; + std::optional customData; /// \brief Provides the type of this Reset message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const ResetRequest& k); /// \brief Contains a OCPP ResetResponse message struct ResetResponse : public ocpp::Message { ResetStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this ResetResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SecurityEventNotification.hpp b/include/ocpp/v2/messages/SecurityEventNotification.hpp index 21bc4f7ea..f422e35b7 100644 --- a/include/ocpp/v2/messages/SecurityEventNotification.hpp +++ b/include/ocpp/v2/messages/SecurityEventNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SECURITYEVENTNOTIFICATION_HPP @@ -18,8 +18,8 @@ namespace v2 { struct SecurityEventNotificationRequest : public ocpp::Message { CiString<50> type; ocpp::DateTime timestamp; - std::optional customData; std::optional> techInfo; + std::optional customData; /// \brief Provides the type of this SecurityEventNotification message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SendLocalList.hpp b/include/ocpp/v2/messages/SendLocalList.hpp index 2e625da5b..fc9a2e38f 100644 --- a/include/ocpp/v2/messages/SendLocalList.hpp +++ b/include/ocpp/v2/messages/SendLocalList.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SENDLOCALLIST_HPP @@ -19,8 +19,8 @@ namespace v2 { struct SendLocalListRequest : public ocpp::Message { int32_t versionNumber; UpdateEnum updateType; - std::optional customData; std::optional> localAuthorizationList; + std::optional customData; /// \brief Provides the type of this SendLocalList message as a human readable string /// \returns the message type as a human readable string @@ -40,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const SendLocalListRequest& k); /// \brief Contains a OCPP SendLocalListResponse message struct SendLocalListResponse : public ocpp::Message { SendLocalListStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SendLocalListResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetChargingProfile.hpp b/include/ocpp/v2/messages/SetChargingProfile.hpp index 1a20b9248..3ccc31a06 100644 --- a/include/ocpp/v2/messages/SetChargingProfile.hpp +++ b/include/ocpp/v2/messages/SetChargingProfile.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETCHARGINGPROFILE_HPP @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const SetChargingProfileRequest& k); /// \brief Contains a OCPP SetChargingProfileResponse message struct SetChargingProfileResponse : public ocpp::Message { ChargingProfileStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SetChargingProfileResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetDisplayMessage.hpp b/include/ocpp/v2/messages/SetDisplayMessage.hpp index 482a77456..a1aeb8a60 100644 --- a/include/ocpp/v2/messages/SetDisplayMessage.hpp +++ b/include/ocpp/v2/messages/SetDisplayMessage.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETDISPLAYMESSAGE_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const SetDisplayMessageRequest& k); /// \brief Contains a OCPP SetDisplayMessageResponse message struct SetDisplayMessageResponse : public ocpp::Message { DisplayMessageStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SetDisplayMessageResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetMonitoringBase.hpp b/include/ocpp/v2/messages/SetMonitoringBase.hpp index 606721858..1c84cf85f 100644 --- a/include/ocpp/v2/messages/SetMonitoringBase.hpp +++ b/include/ocpp/v2/messages/SetMonitoringBase.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETMONITORINGBASE_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const SetMonitoringBaseRequest& k); /// \brief Contains a OCPP SetMonitoringBaseResponse message struct SetMonitoringBaseResponse : public ocpp::Message { GenericDeviceModelStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SetMonitoringBaseResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetMonitoringLevel.hpp b/include/ocpp/v2/messages/SetMonitoringLevel.hpp index 7630fdbc9..bc068451f 100644 --- a/include/ocpp/v2/messages/SetMonitoringLevel.hpp +++ b/include/ocpp/v2/messages/SetMonitoringLevel.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETMONITORINGLEVEL_HPP @@ -38,8 +38,8 @@ std::ostream& operator<<(std::ostream& os, const SetMonitoringLevelRequest& k); /// \brief Contains a OCPP SetMonitoringLevelResponse message struct SetMonitoringLevelResponse : public ocpp::Message { GenericStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SetMonitoringLevelResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetNetworkProfile.hpp b/include/ocpp/v2/messages/SetNetworkProfile.hpp index e6e427949..7458d6bbe 100644 --- a/include/ocpp/v2/messages/SetNetworkProfile.hpp +++ b/include/ocpp/v2/messages/SetNetworkProfile.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETNETWORKPROFILE_HPP @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const SetNetworkProfileRequest& k); /// \brief Contains a OCPP SetNetworkProfileResponse message struct SetNetworkProfileResponse : public ocpp::Message { SetNetworkProfileStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SetNetworkProfileResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/SetVariableMonitoring.hpp b/include/ocpp/v2/messages/SetVariableMonitoring.hpp index 851d9dba2..43a9783f5 100644 --- a/include/ocpp/v2/messages/SetVariableMonitoring.hpp +++ b/include/ocpp/v2/messages/SetVariableMonitoring.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETVARIABLEMONITORING_HPP diff --git a/include/ocpp/v2/messages/SetVariables.hpp b/include/ocpp/v2/messages/SetVariables.hpp index 5da708ece..76fe917e9 100644 --- a/include/ocpp/v2/messages/SetVariables.hpp +++ b/include/ocpp/v2/messages/SetVariables.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SETVARIABLES_HPP diff --git a/include/ocpp/v2/messages/SignCertificate.hpp b/include/ocpp/v2/messages/SignCertificate.hpp index 88c8a3770..315bc08c0 100644 --- a/include/ocpp/v2/messages/SignCertificate.hpp +++ b/include/ocpp/v2/messages/SignCertificate.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_SIGNCERTIFICATE_HPP @@ -18,8 +18,10 @@ namespace v2 { /// \brief Contains a OCPP SignCertificate message struct SignCertificateRequest : public ocpp::Message { CiString<5500> csr; - std::optional customData; std::optional certificateType; + std::optional hashRootCertificate; + std::optional requestId; + std::optional customData; /// \brief Provides the type of this SignCertificate message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +41,8 @@ std::ostream& operator<<(std::ostream& os, const SignCertificateRequest& k); /// \brief Contains a OCPP SignCertificateResponse message struct SignCertificateResponse : public ocpp::Message { GenericStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this SignCertificateResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/StatusNotification.hpp b/include/ocpp/v2/messages/StatusNotification.hpp index c1e762156..d4d031b69 100644 --- a/include/ocpp/v2/messages/StatusNotification.hpp +++ b/include/ocpp/v2/messages/StatusNotification.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_STATUSNOTIFICATION_HPP diff --git a/include/ocpp/v2/messages/TransactionEvent.hpp b/include/ocpp/v2/messages/TransactionEvent.hpp index 1cdd80cc1..2a10d0230 100644 --- a/include/ocpp/v2/messages/TransactionEvent.hpp +++ b/include/ocpp/v2/messages/TransactionEvent.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_TRANSACTIONEVENT_HPP @@ -22,14 +22,17 @@ struct TransactionEventRequest : public ocpp::Message { TriggerReasonEnum triggerReason; int32_t seqNo; Transaction transactionInfo; - std::optional customData; + std::optional costDetails; std::optional> meterValue; std::optional offline; std::optional numberOfPhasesUsed; std::optional cableMaxCurrent; std::optional reservationId; + std::optional preconditioningStatus; + std::optional evseSleep; std::optional evse; std::optional idToken; + std::optional customData; /// \brief Provides the type of this TransactionEvent message as a human readable string /// \returns the message type as a human readable string @@ -48,11 +51,13 @@ std::ostream& operator<<(std::ostream& os, const TransactionEventRequest& k); /// \brief Contains a OCPP TransactionEventResponse message struct TransactionEventResponse : public ocpp::Message { - std::optional customData; std::optional totalCost; std::optional chargingPriority; std::optional idTokenInfo; + std::optional transactionLimit; std::optional updatedPersonalMessage; + std::optional> updatedPersonalMessageExtra; + std::optional customData; /// \brief Provides the type of this TransactionEventResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/TriggerMessage.hpp b/include/ocpp/v2/messages/TriggerMessage.hpp index f1312804c..9c67d55c4 100644 --- a/include/ocpp/v2/messages/TriggerMessage.hpp +++ b/include/ocpp/v2/messages/TriggerMessage.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_TRIGGERMESSAGE_HPP @@ -18,8 +18,9 @@ namespace v2 { /// \brief Contains a OCPP TriggerMessage message struct TriggerMessageRequest : public ocpp::Message { MessageTriggerEnum requestedMessage; - std::optional customData; std::optional evse; + std::optional> customTrigger; + std::optional customData; /// \brief Provides the type of this TriggerMessage message as a human readable string /// \returns the message type as a human readable string @@ -39,8 +40,8 @@ std::ostream& operator<<(std::ostream& os, const TriggerMessageRequest& k); /// \brief Contains a OCPP TriggerMessageResponse message struct TriggerMessageResponse : public ocpp::Message { TriggerMessageStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this TriggerMessageResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/UnlockConnector.hpp b/include/ocpp/v2/messages/UnlockConnector.hpp index 205bca67c..f0b4e809e 100644 --- a/include/ocpp/v2/messages/UnlockConnector.hpp +++ b/include/ocpp/v2/messages/UnlockConnector.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_UNLOCKCONNECTOR_HPP @@ -39,8 +39,8 @@ std::ostream& operator<<(std::ostream& os, const UnlockConnectorRequest& k); /// \brief Contains a OCPP UnlockConnectorResponse message struct UnlockConnectorResponse : public ocpp::Message { UnlockStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this UnlockConnectorResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/messages/UnpublishFirmware.hpp b/include/ocpp/v2/messages/UnpublishFirmware.hpp index 5eadb73c7..e7a043af8 100644 --- a/include/ocpp/v2/messages/UnpublishFirmware.hpp +++ b/include/ocpp/v2/messages/UnpublishFirmware.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_UNPUBLISHFIRMWARE_HPP diff --git a/include/ocpp/v2/messages/UpdateFirmware.hpp b/include/ocpp/v2/messages/UpdateFirmware.hpp index a73accacb..9b2266360 100644 --- a/include/ocpp/v2/messages/UpdateFirmware.hpp +++ b/include/ocpp/v2/messages/UpdateFirmware.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_UPDATEFIRMWARE_HPP @@ -19,9 +19,9 @@ namespace v2 { struct UpdateFirmwareRequest : public ocpp::Message { int32_t requestId; Firmware firmware; - std::optional customData; std::optional retries; std::optional retryInterval; + std::optional customData; /// \brief Provides the type of this UpdateFirmware message as a human readable string /// \returns the message type as a human readable string @@ -41,8 +41,8 @@ std::ostream& operator<<(std::ostream& os, const UpdateFirmwareRequest& k); /// \brief Contains a OCPP UpdateFirmwareResponse message struct UpdateFirmwareResponse : public ocpp::Message { UpdateFirmwareStatusEnum status; - std::optional customData; std::optional statusInfo; + std::optional customData; /// \brief Provides the type of this UpdateFirmwareResponse message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v2/ocpp_enums.hpp b/include/ocpp/v2/ocpp_enums.hpp index bd8344e84..7764fd797 100644 --- a/include/ocpp/v2/ocpp_enums.hpp +++ b/include/ocpp/v2/ocpp_enums.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_OCPP_ENUMS_HPP @@ -11,31 +11,25 @@ namespace ocpp { namespace v2 { -// from: AuthorizeRequest -enum class IdTokenEnum { - Central, - eMAID, - ISO14443, - ISO15693, - KeyCode, - Local, - MacAddress, - NoAuthorization, +// from: AFRRSignalResponse +enum class GenericStatusEnum { + Accepted, + Rejected, }; namespace conversions { -/// \brief Converts the given IdTokenEnum \p e to human readable string -/// \returns a string representation of the IdTokenEnum -std::string id_token_enum_to_string(IdTokenEnum e); +/// \brief Converts the given GenericStatusEnum \p e to human readable string +/// \returns a string representation of the GenericStatusEnum +std::string generic_status_enum_to_string(GenericStatusEnum e); -/// \brief Converts the given std::string \p s to IdTokenEnum -/// \returns a IdTokenEnum from a string representation -IdTokenEnum string_to_id_token_enum(const std::string& s); +/// \brief Converts the given std::string \p s to GenericStatusEnum +/// \returns a GenericStatusEnum from a string representation +GenericStatusEnum string_to_generic_status_enum(const std::string& s); } // namespace conversions -/// \brief Writes the string representation of the given IdTokenEnum \p id_token_enum to the given output stream \p os -/// \returns an output stream with the IdTokenEnum written to -std::ostream& operator<<(std::ostream& os, const IdTokenEnum& id_token_enum); +/// \brief Writes the string representation of the given GenericStatusEnum \p generic_status_enum to the given output +/// stream \p os \returns an output stream with the GenericStatusEnum written to +std::ostream& operator<<(std::ostream& os, const GenericStatusEnum& generic_status_enum); // from: AuthorizeRequest enum class HashAlgorithmEnum { @@ -92,6 +86,7 @@ enum class MessageFormatEnum { HTML, URI, UTF8, + QRCODE, }; namespace conversions { @@ -134,6 +129,101 @@ AuthorizeCertificateStatusEnum string_to_authorize_certificate_status_enum(const /// AuthorizeCertificateStatusEnum written to std::ostream& operator<<(std::ostream& os, const AuthorizeCertificateStatusEnum& authorize_certificate_status_enum); +// from: AuthorizeResponse +enum class EnergyTransferModeEnum { + AC_single_phase, + AC_two_phase, + AC_three_phase, + DC, + AC_BPT, + AC_BPT_DER, + AC_DER, + DC_BPT, + DC_ACDP, + DC_ACDP_BPT, + WPT, +}; + +namespace conversions { +/// \brief Converts the given EnergyTransferModeEnum \p e to human readable string +/// \returns a string representation of the EnergyTransferModeEnum +std::string energy_transfer_mode_enum_to_string(EnergyTransferModeEnum e); + +/// \brief Converts the given std::string \p s to EnergyTransferModeEnum +/// \returns a EnergyTransferModeEnum from a string representation +EnergyTransferModeEnum string_to_energy_transfer_mode_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given EnergyTransferModeEnum \p energy_transfer_mode_enum to the +/// given output stream \p os \returns an output stream with the EnergyTransferModeEnum written to +std::ostream& operator<<(std::ostream& os, const EnergyTransferModeEnum& energy_transfer_mode_enum); + +// from: AuthorizeResponse +enum class DayOfWeekEnum { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday, +}; + +namespace conversions { +/// \brief Converts the given DayOfWeekEnum \p e to human readable string +/// \returns a string representation of the DayOfWeekEnum +std::string day_of_week_enum_to_string(DayOfWeekEnum e); + +/// \brief Converts the given std::string \p s to DayOfWeekEnum +/// \returns a DayOfWeekEnum from a string representation +DayOfWeekEnum string_to_day_of_week_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given DayOfWeekEnum \p day_of_week_enum to the given output stream \p +/// os \returns an output stream with the DayOfWeekEnum written to +std::ostream& operator<<(std::ostream& os, const DayOfWeekEnum& day_of_week_enum); + +// from: AuthorizeResponse +enum class EvseKindEnum { + AC, + DC, +}; + +namespace conversions { +/// \brief Converts the given EvseKindEnum \p e to human readable string +/// \returns a string representation of the EvseKindEnum +std::string evse_kind_enum_to_string(EvseKindEnum e); + +/// \brief Converts the given std::string \p s to EvseKindEnum +/// \returns a EvseKindEnum from a string representation +EvseKindEnum string_to_evse_kind_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given EvseKindEnum \p evse_kind_enum to the given output stream \p os +/// \returns an output stream with the EvseKindEnum written to +std::ostream& operator<<(std::ostream& os, const EvseKindEnum& evse_kind_enum); + +// from: BatterySwapRequest +enum class BatterySwapEventEnum { + BatteryIn, + BatteryOut, + BatteryOutTimeout, +}; + +namespace conversions { +/// \brief Converts the given BatterySwapEventEnum \p e to human readable string +/// \returns a string representation of the BatterySwapEventEnum +std::string battery_swap_event_enum_to_string(BatterySwapEventEnum e); + +/// \brief Converts the given std::string \p s to BatterySwapEventEnum +/// \returns a BatterySwapEventEnum from a string representation +BatterySwapEventEnum string_to_battery_swap_event_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given BatterySwapEventEnum \p battery_swap_event_enum to the given +/// output stream \p os \returns an output stream with the BatterySwapEventEnum written to +std::ostream& operator<<(std::ostream& os, const BatterySwapEventEnum& battery_swap_event_enum); + // from: BootNotificationRequest enum class BootReasonEnum { ApplicationReset, @@ -206,6 +296,7 @@ std::ostream& operator<<(std::ostream& os, const CancelReservationStatusEnum& ca enum class CertificateSigningUseEnum { ChargingStationCertificate, V2GCertificate, + V2G20Certificate, }; namespace conversions { @@ -283,6 +374,30 @@ ChangeAvailabilityStatusEnum string_to_change_availability_status_enum(const std /// to the given output stream \p os \returns an output stream with the ChangeAvailabilityStatusEnum written to std::ostream& operator<<(std::ostream& os, const ChangeAvailabilityStatusEnum& change_availability_status_enum); +// from: ChangeTransactionTariffResponse +enum class TariffChangeStatusEnum { + Accepted, + Rejected, + TooManyElements, + ConditionNotSupported, + TxNotFound, + NoCurrencyChange, +}; + +namespace conversions { +/// \brief Converts the given TariffChangeStatusEnum \p e to human readable string +/// \returns a string representation of the TariffChangeStatusEnum +std::string tariff_change_status_enum_to_string(TariffChangeStatusEnum e); + +/// \brief Converts the given std::string \p s to TariffChangeStatusEnum +/// \returns a TariffChangeStatusEnum from a string representation +TariffChangeStatusEnum string_to_tariff_change_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffChangeStatusEnum \p tariff_change_status_enum to the +/// given output stream \p os \returns an output stream with the TariffChangeStatusEnum written to +std::ostream& operator<<(std::ostream& os, const TariffChangeStatusEnum& tariff_change_status_enum); + // from: ClearCacheResponse enum class ClearCacheStatusEnum { Accepted, @@ -309,6 +424,8 @@ enum class ChargingProfilePurposeEnum { ChargingStationMaxProfile, TxDefaultProfile, TxProfile, + PriorityCharging, + LocalGeneration, }; namespace conversions { @@ -346,10 +463,73 @@ ClearChargingProfileStatusEnum string_to_clear_charging_profile_status_enum(cons /// ClearChargingProfileStatusEnum written to std::ostream& operator<<(std::ostream& os, const ClearChargingProfileStatusEnum& clear_charging_profile_status_enum); +// from: ClearDERControlRequest +enum class DERControlEnum { + EnterService, + FreqDroop, + FreqWatt, + FixedPFAbsorb, + FixedPFInject, + FixedVar, + Gradients, + HFMustTrip, + HFMayTrip, + HVMustTrip, + HVMomCess, + HVMayTrip, + LimitMaxDischarge, + LFMustTrip, + LVMustTrip, + LVMomCess, + LVMayTrip, + PowerMonitoringMustTrip, + VoltVar, + VoltWatt, + WattPF, + WattVar, +}; + +namespace conversions { +/// \brief Converts the given DERControlEnum \p e to human readable string +/// \returns a string representation of the DERControlEnum +std::string dercontrol_enum_to_string(DERControlEnum e); + +/// \brief Converts the given std::string \p s to DERControlEnum +/// \returns a DERControlEnum from a string representation +DERControlEnum string_to_dercontrol_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given DERControlEnum \p dercontrol_enum to the given output stream \p +/// os \returns an output stream with the DERControlEnum written to +std::ostream& operator<<(std::ostream& os, const DERControlEnum& dercontrol_enum); + +// from: ClearDERControlResponse +enum class DERControlStatusEnum { + Accepted, + Rejected, + NotSupported, + NotFound, +}; + +namespace conversions { +/// \brief Converts the given DERControlStatusEnum \p e to human readable string +/// \returns a string representation of the DERControlStatusEnum +std::string dercontrol_status_enum_to_string(DERControlStatusEnum e); + +/// \brief Converts the given std::string \p s to DERControlStatusEnum +/// \returns a DERControlStatusEnum from a string representation +DERControlStatusEnum string_to_dercontrol_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given DERControlStatusEnum \p dercontrol_status_enum to the given +/// output stream \p os \returns an output stream with the DERControlStatusEnum written to +std::ostream& operator<<(std::ostream& os, const DERControlStatusEnum& dercontrol_status_enum); + // from: ClearDisplayMessageResponse enum class ClearMessageStatusEnum { Accepted, Unknown, + Rejected, }; namespace conversions { @@ -366,6 +546,27 @@ ClearMessageStatusEnum string_to_clear_message_status_enum(const std::string& s) /// given output stream \p os \returns an output stream with the ClearMessageStatusEnum written to std::ostream& operator<<(std::ostream& os, const ClearMessageStatusEnum& clear_message_status_enum); +// from: ClearTariffsResponse +enum class TariffClearStatusEnum { + Accepted, + Rejected, + NoTariff, +}; + +namespace conversions { +/// \brief Converts the given TariffClearStatusEnum \p e to human readable string +/// \returns a string representation of the TariffClearStatusEnum +std::string tariff_clear_status_enum_to_string(TariffClearStatusEnum e); + +/// \brief Converts the given std::string \p s to TariffClearStatusEnum +/// \returns a TariffClearStatusEnum from a string representation +TariffClearStatusEnum string_to_tariff_clear_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffClearStatusEnum \p tariff_clear_status_enum to the given +/// output stream \p os \returns an output stream with the TariffClearStatusEnum written to +std::ostream& operator<<(std::ostream& os, const TariffClearStatusEnum& tariff_clear_status_enum); + // from: ClearVariableMonitoringResponse enum class ClearMonitoringStatusEnum { Accepted, @@ -387,28 +588,6 @@ ClearMonitoringStatusEnum string_to_clear_monitoring_status_enum(const std::stri /// the given output stream \p os \returns an output stream with the ClearMonitoringStatusEnum written to std::ostream& operator<<(std::ostream& os, const ClearMonitoringStatusEnum& clear_monitoring_status_enum); -// from: ClearedChargingLimitRequest -enum class ChargingLimitSourceEnum { - EMS, - Other, - SO, - CSO, -}; - -namespace conversions { -/// \brief Converts the given ChargingLimitSourceEnum \p e to human readable string -/// \returns a string representation of the ChargingLimitSourceEnum -std::string charging_limit_source_enum_to_string(ChargingLimitSourceEnum e); - -/// \brief Converts the given std::string \p s to ChargingLimitSourceEnum -/// \returns a ChargingLimitSourceEnum from a string representation -ChargingLimitSourceEnum string_to_charging_limit_source_enum(const std::string& s); -} // namespace conversions - -/// \brief Writes the string representation of the given ChargingLimitSourceEnum \p charging_limit_source_enum to the -/// given output stream \p os \returns an output stream with the ChargingLimitSourceEnum written to -std::ostream& operator<<(std::ostream& os, const ChargingLimitSourceEnum& charging_limit_source_enum); - // from: CustomerInformationResponse enum class CustomerInformationStatusEnum { Accepted, @@ -591,6 +770,48 @@ GenericDeviceModelStatusEnum string_to_generic_device_model_status_enum(const st /// GenericDeviceModelStatusEnum written to std::ostream& operator<<(std::ostream& os, const GenericDeviceModelStatusEnum& generic_device_model_status_enum); +// from: GetCertificateChainStatusRequest +enum class CertificateStatusSourceEnum { + CRL, + OCSP, +}; + +namespace conversions { +/// \brief Converts the given CertificateStatusSourceEnum \p e to human readable string +/// \returns a string representation of the CertificateStatusSourceEnum +std::string certificate_status_source_enum_to_string(CertificateStatusSourceEnum e); + +/// \brief Converts the given std::string \p s to CertificateStatusSourceEnum +/// \returns a CertificateStatusSourceEnum from a string representation +CertificateStatusSourceEnum string_to_certificate_status_source_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given CertificateStatusSourceEnum \p certificate_status_source_enum +/// to the given output stream \p os \returns an output stream with the CertificateStatusSourceEnum written to +std::ostream& operator<<(std::ostream& os, const CertificateStatusSourceEnum& certificate_status_source_enum); + +// from: GetCertificateChainStatusResponse +enum class CertificateStatusEnum { + Good, + Revoked, + Unknown, + Failed, +}; + +namespace conversions { +/// \brief Converts the given CertificateStatusEnum \p e to human readable string +/// \returns a string representation of the CertificateStatusEnum +std::string certificate_status_enum_to_string(CertificateStatusEnum e); + +/// \brief Converts the given std::string \p s to CertificateStatusEnum +/// \returns a CertificateStatusEnum from a string representation +CertificateStatusEnum string_to_certificate_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given CertificateStatusEnum \p certificate_status_enum to the given +/// output stream \p os \returns an output stream with the CertificateStatusEnum written to +std::ostream& operator<<(std::ostream& os, const CertificateStatusEnum& certificate_status_enum); + // from: GetCertificateStatusResponse enum class GetCertificateStatusEnum { Accepted, @@ -653,24 +874,30 @@ ChargingRateUnitEnum string_to_charging_rate_unit_enum(const std::string& s); std::ostream& operator<<(std::ostream& os, const ChargingRateUnitEnum& charging_rate_unit_enum); // from: GetCompositeScheduleResponse -enum class GenericStatusEnum { - Accepted, - Rejected, +enum class OperationModeEnum { + Idle, + ChargingOnly, + CentralSetpoint, + ExternalSetpoint, + ExternalLimits, + CentralFrequency, + LocalFrequency, + LocalLoadBalancing, }; namespace conversions { -/// \brief Converts the given GenericStatusEnum \p e to human readable string -/// \returns a string representation of the GenericStatusEnum -std::string generic_status_enum_to_string(GenericStatusEnum e); +/// \brief Converts the given OperationModeEnum \p e to human readable string +/// \returns a string representation of the OperationModeEnum +std::string operation_mode_enum_to_string(OperationModeEnum e); -/// \brief Converts the given std::string \p s to GenericStatusEnum -/// \returns a GenericStatusEnum from a string representation -GenericStatusEnum string_to_generic_status_enum(const std::string& s); +/// \brief Converts the given std::string \p s to OperationModeEnum +/// \returns a OperationModeEnum from a string representation +OperationModeEnum string_to_operation_mode_enum(const std::string& s); } // namespace conversions -/// \brief Writes the string representation of the given GenericStatusEnum \p generic_status_enum to the given output -/// stream \p os \returns an output stream with the GenericStatusEnum written to -std::ostream& operator<<(std::ostream& os, const GenericStatusEnum& generic_status_enum); +/// \brief Writes the string representation of the given OperationModeEnum \p operation_mode_enum to the given output +/// stream \p os \returns an output stream with the OperationModeEnum written to +std::ostream& operator<<(std::ostream& os, const OperationModeEnum& operation_mode_enum); // from: GetDisplayMessagesRequest enum class MessagePriorityEnum { @@ -699,6 +926,8 @@ enum class MessageStateEnum { Faulted, Idle, Unavailable, + Suspended, + Discharging, }; namespace conversions { @@ -743,6 +972,7 @@ enum class GetCertificateIdUseEnum { CSMSRootCertificate, V2GCertificateChain, ManufacturerRootCertificate, + OEMRootCertificate, }; namespace conversions { @@ -785,6 +1015,7 @@ std::ostream& operator<<(std::ostream& os, enum class LogEnum { DiagnosticsLog, SecurityLog, + DataCollectorLog, }; namespace conversions { @@ -865,6 +1096,47 @@ ComponentCriterionEnum string_to_component_criterion_enum(const std::string& s); /// output stream \p os \returns an output stream with the ComponentCriterionEnum written to std::ostream& operator<<(std::ostream& os, const ComponentCriterionEnum& component_criterion_enum); +// from: GetTariffsResponse +enum class TariffGetStatusEnum { + Accepted, + Rejected, + NoTariff, +}; + +namespace conversions { +/// \brief Converts the given TariffGetStatusEnum \p e to human readable string +/// \returns a string representation of the TariffGetStatusEnum +std::string tariff_get_status_enum_to_string(TariffGetStatusEnum e); + +/// \brief Converts the given std::string \p s to TariffGetStatusEnum +/// \returns a TariffGetStatusEnum from a string representation +TariffGetStatusEnum string_to_tariff_get_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffGetStatusEnum \p tariff_get_status_enum to the given +/// output stream \p os \returns an output stream with the TariffGetStatusEnum written to +std::ostream& operator<<(std::ostream& os, const TariffGetStatusEnum& tariff_get_status_enum); + +// from: GetTariffsResponse +enum class TariffKindEnum { + DefaultTariff, + DriverTariff, +}; + +namespace conversions { +/// \brief Converts the given TariffKindEnum \p e to human readable string +/// \returns a string representation of the TariffKindEnum +std::string tariff_kind_enum_to_string(TariffKindEnum e); + +/// \brief Converts the given std::string \p s to TariffKindEnum +/// \returns a TariffKindEnum from a string representation +TariffKindEnum string_to_tariff_kind_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffKindEnum \p tariff_kind_enum to the given output stream +/// \p os \returns an output stream with the TariffKindEnum written to +std::ostream& operator<<(std::ostream& os, const TariffKindEnum& tariff_kind_enum); + // from: GetVariablesRequest enum class AttributeEnum { Actual, @@ -914,8 +1186,9 @@ std::ostream& operator<<(std::ostream& os, const GetVariableStatusEnum& get_vari enum class InstallCertificateUseEnum { V2GRootCertificate, MORootCertificate, - CSMSRootCertificate, ManufacturerRootCertificate, + CSMSRootCertificate, + OEMRootCertificate, }; namespace conversions { @@ -979,59 +1252,64 @@ UploadLogStatusEnum string_to_upload_log_status_enum(const std::string& s); /// output stream \p os \returns an output stream with the UploadLogStatusEnum written to std::ostream& operator<<(std::ostream& os, const UploadLogStatusEnum& upload_log_status_enum); -// from: MeterValuesRequest -enum class ReadingContextEnum { - Interruption_Begin, - Interruption_End, - Other, - Sample_Clock, - Sample_Periodic, - Transaction_Begin, - Transaction_End, - Trigger, -}; - -namespace conversions { -/// \brief Converts the given ReadingContextEnum \p e to human readable string -/// \returns a string representation of the ReadingContextEnum -std::string reading_context_enum_to_string(ReadingContextEnum e); - -/// \brief Converts the given std::string \p s to ReadingContextEnum -/// \returns a ReadingContextEnum from a string representation -ReadingContextEnum string_to_reading_context_enum(const std::string& s); -} // namespace conversions - -/// \brief Writes the string representation of the given ReadingContextEnum \p reading_context_enum to the given output -/// stream \p os \returns an output stream with the ReadingContextEnum written to -std::ostream& operator<<(std::ostream& os, const ReadingContextEnum& reading_context_enum); - // from: MeterValuesRequest enum class MeasurandEnum { Current_Export, + Current_Export_Offered, + Current_Export_Minimum, Current_Import, + Current_Import_Offered, + Current_Import_Minimum, Current_Offered, - Energy_Active_Export_Register, - Energy_Active_Import_Register, - Energy_Reactive_Export_Register, - Energy_Reactive_Import_Register, + Display_PresentSOC, + Display_MinimumSOC, + Display_TargetSOC, + Display_MaximumSOC, + Display_RemainingTimeToMinimumSOC, + Display_RemainingTimeToTargetSOC, + Display_RemainingTimeToMaximumSOC, + Display_ChargingComplete, + Display_BatteryEnergyCapacity, + Display_InletHot, Energy_Active_Export_Interval, + Energy_Active_Export_Register, Energy_Active_Import_Interval, + Energy_Active_Import_Register, + Energy_Active_Import_CableLoss, + Energy_Active_Import_LocalGeneration_Register, Energy_Active_Net, + Energy_Active_Setpoint_Interval, + Energy_Apparent_Export, + Energy_Apparent_Import, + Energy_Apparent_Net, Energy_Reactive_Export_Interval, + Energy_Reactive_Export_Register, Energy_Reactive_Import_Interval, + Energy_Reactive_Import_Register, Energy_Reactive_Net, - Energy_Apparent_Net, - Energy_Apparent_Import, - Energy_Apparent_Export, + EnergyRequest_Target, + EnergyRequest_Minimum, + EnergyRequest_Maximum, + EnergyRequest_Minimum_V2X, + EnergyRequest_Maximum_V2X, + EnergyRequest_Bulk, Frequency, Power_Active_Export, Power_Active_Import, + Power_Active_Setpoint, + Power_Active_Residual, + Power_Export_Minimum, + Power_Export_Offered, Power_Factor, + Power_Import_Offered, + Power_Import_Minimum, Power_Offered, Power_Reactive_Export, Power_Reactive_Import, SoC, Voltage, + Voltage_Minimum, + Voltage_Maximum, }; namespace conversions { @@ -1048,6 +1326,32 @@ MeasurandEnum string_to_measurand_enum(const std::string& s); /// os \returns an output stream with the MeasurandEnum written to std::ostream& operator<<(std::ostream& os, const MeasurandEnum& measurand_enum); +// from: MeterValuesRequest +enum class ReadingContextEnum { + Interruption_Begin, + Interruption_End, + Other, + Sample_Clock, + Sample_Periodic, + Transaction_Begin, + Transaction_End, + Trigger, +}; + +namespace conversions { +/// \brief Converts the given ReadingContextEnum \p e to human readable string +/// \returns a string representation of the ReadingContextEnum +std::string reading_context_enum_to_string(ReadingContextEnum e); + +/// \brief Converts the given std::string \p s to ReadingContextEnum +/// \returns a ReadingContextEnum from a string representation +ReadingContextEnum string_to_reading_context_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given ReadingContextEnum \p reading_context_enum to the given output +/// stream \p os \returns an output stream with the ReadingContextEnum written to +std::ostream& operator<<(std::ostream& os, const ReadingContextEnum& reading_context_enum); + // from: MeterValuesRequest enum class PhaseEnum { L1, @@ -1083,6 +1387,7 @@ enum class LocationEnum { EV, Inlet, Outlet, + Upstream, }; namespace conversions { @@ -1099,6 +1404,28 @@ LocationEnum string_to_location_enum(const std::string& s); /// \returns an output stream with the LocationEnum written to std::ostream& operator<<(std::ostream& os, const LocationEnum& location_enum); +// from: NotifyAllowedEnergyTransferResponse +enum class NotifyAllowedEnergyTransferStatusEnum { + Accepted, + Rejected, +}; + +namespace conversions { +/// \brief Converts the given NotifyAllowedEnergyTransferStatusEnum \p e to human readable string +/// \returns a string representation of the NotifyAllowedEnergyTransferStatusEnum +std::string notify_allowed_energy_transfer_status_enum_to_string(NotifyAllowedEnergyTransferStatusEnum e); + +/// \brief Converts the given std::string \p s to NotifyAllowedEnergyTransferStatusEnum +/// \returns a NotifyAllowedEnergyTransferStatusEnum from a string representation +NotifyAllowedEnergyTransferStatusEnum string_to_notify_allowed_energy_transfer_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given NotifyAllowedEnergyTransferStatusEnum \p +/// notify_allowed_energy_transfer_status_enum to the given output stream \p os \returns an output stream with the +/// NotifyAllowedEnergyTransferStatusEnum written to +std::ostream& operator<<(std::ostream& os, + const NotifyAllowedEnergyTransferStatusEnum& notify_allowed_energy_transfer_status_enum); + // from: NotifyChargingLimitRequest enum class CostKindEnum { CarbonDioxideEmission, @@ -1120,33 +1447,114 @@ CostKindEnum string_to_cost_kind_enum(const std::string& s); /// \returns an output stream with the CostKindEnum written to std::ostream& operator<<(std::ostream& os, const CostKindEnum& cost_kind_enum); +// from: NotifyDERAlarmRequest +enum class GridEventFaultEnum { + CurrentImbalance, + LocalEmergency, + LowInputPower, + OverCurrent, + OverFrequency, + OverVoltage, + PhaseRotation, + RemoteEmergency, + UnderFrequency, + UnderVoltage, + VoltageImbalance, +}; + +namespace conversions { +/// \brief Converts the given GridEventFaultEnum \p e to human readable string +/// \returns a string representation of the GridEventFaultEnum +std::string grid_event_fault_enum_to_string(GridEventFaultEnum e); + +/// \brief Converts the given std::string \p s to GridEventFaultEnum +/// \returns a GridEventFaultEnum from a string representation +GridEventFaultEnum string_to_grid_event_fault_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given GridEventFaultEnum \p grid_event_fault_enum to the given output +/// stream \p os \returns an output stream with the GridEventFaultEnum written to +std::ostream& operator<<(std::ostream& os, const GridEventFaultEnum& grid_event_fault_enum); + // from: NotifyEVChargingNeedsRequest -enum class EnergyTransferModeEnum { - DC, - AC_single_phase, - AC_two_phase, - AC_three_phase, +enum class IslandingDetectionEnum { + NoAntiIslandingSupport, + RoCoF, + UVP_OVP, + UFP_OFP, + VoltageVectorShift, + ZeroCrossingDetection, + OtherPassive, + ImpedanceMeasurement, + ImpedanceAtFrequency, + SlipModeFrequencyShift, + SandiaFrequencyShift, + SandiaVoltageShift, + FrequencyJump, + RCLQFactor, + OtherActive, +}; + +namespace conversions { +/// \brief Converts the given IslandingDetectionEnum \p e to human readable string +/// \returns a string representation of the IslandingDetectionEnum +std::string islanding_detection_enum_to_string(IslandingDetectionEnum e); + +/// \brief Converts the given std::string \p s to IslandingDetectionEnum +/// \returns a IslandingDetectionEnum from a string representation +IslandingDetectionEnum string_to_islanding_detection_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given IslandingDetectionEnum \p islanding_detection_enum to the given +/// output stream \p os \returns an output stream with the IslandingDetectionEnum written to +std::ostream& operator<<(std::ostream& os, const IslandingDetectionEnum& islanding_detection_enum); + +// from: NotifyEVChargingNeedsRequest +enum class ControlModeEnum { + ScheduledControl, + DynamicControl, }; namespace conversions { -/// \brief Converts the given EnergyTransferModeEnum \p e to human readable string -/// \returns a string representation of the EnergyTransferModeEnum -std::string energy_transfer_mode_enum_to_string(EnergyTransferModeEnum e); +/// \brief Converts the given ControlModeEnum \p e to human readable string +/// \returns a string representation of the ControlModeEnum +std::string control_mode_enum_to_string(ControlModeEnum e); -/// \brief Converts the given std::string \p s to EnergyTransferModeEnum -/// \returns a EnergyTransferModeEnum from a string representation -EnergyTransferModeEnum string_to_energy_transfer_mode_enum(const std::string& s); +/// \brief Converts the given std::string \p s to ControlModeEnum +/// \returns a ControlModeEnum from a string representation +ControlModeEnum string_to_control_mode_enum(const std::string& s); } // namespace conversions -/// \brief Writes the string representation of the given EnergyTransferModeEnum \p energy_transfer_mode_enum to the -/// given output stream \p os \returns an output stream with the EnergyTransferModeEnum written to -std::ostream& operator<<(std::ostream& os, const EnergyTransferModeEnum& energy_transfer_mode_enum); +/// \brief Writes the string representation of the given ControlModeEnum \p control_mode_enum to the given output stream +/// \p os \returns an output stream with the ControlModeEnum written to +std::ostream& operator<<(std::ostream& os, const ControlModeEnum& control_mode_enum); + +// from: NotifyEVChargingNeedsRequest +enum class MobilityNeedsModeEnum { + EVCC, + EVCC_SECC, +}; + +namespace conversions { +/// \brief Converts the given MobilityNeedsModeEnum \p e to human readable string +/// \returns a string representation of the MobilityNeedsModeEnum +std::string mobility_needs_mode_enum_to_string(MobilityNeedsModeEnum e); + +/// \brief Converts the given std::string \p s to MobilityNeedsModeEnum +/// \returns a MobilityNeedsModeEnum from a string representation +MobilityNeedsModeEnum string_to_mobility_needs_mode_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given MobilityNeedsModeEnum \p mobility_needs_mode_enum to the given +/// output stream \p os \returns an output stream with the MobilityNeedsModeEnum written to +std::ostream& operator<<(std::ostream& os, const MobilityNeedsModeEnum& mobility_needs_mode_enum); // from: NotifyEVChargingNeedsResponse enum class NotifyEVChargingNeedsStatusEnum { Accepted, Rejected, Processing, + NoChargingProfile, }; namespace conversions { @@ -1214,6 +1622,8 @@ enum class MonitorEnum { Delta, Periodic, PeriodicClockAligned, + TargetDelta, + TargetDeltaRelative, }; namespace conversions { @@ -1277,6 +1687,28 @@ DataEnum string_to_data_enum(const std::string& s); /// \returns an output stream with the DataEnum written to std::ostream& operator<<(std::ostream& os, const DataEnum& data_enum); +// from: NotifySettlementRequest +enum class PaymentStatusEnum { + Settled, + Canceled, + Rejected, + Failed, +}; + +namespace conversions { +/// \brief Converts the given PaymentStatusEnum \p e to human readable string +/// \returns a string representation of the PaymentStatusEnum +std::string payment_status_enum_to_string(PaymentStatusEnum e); + +/// \brief Converts the given std::string \p s to PaymentStatusEnum +/// \returns a PaymentStatusEnum from a string representation +PaymentStatusEnum string_to_payment_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given PaymentStatusEnum \p payment_status_enum to the given output +/// stream \p os \returns an output stream with the PaymentStatusEnum written to +std::ostream& operator<<(std::ostream& os, const PaymentStatusEnum& payment_status_enum); + // from: PublishFirmwareStatusNotificationRequest enum class PublishFirmwareStatusEnum { Idle, @@ -1305,11 +1737,32 @@ PublishFirmwareStatusEnum string_to_publish_firmware_status_enum(const std::stri /// the given output stream \p os \returns an output stream with the PublishFirmwareStatusEnum written to std::ostream& operator<<(std::ostream& os, const PublishFirmwareStatusEnum& publish_firmware_status_enum); +// from: PullDynamicScheduleUpdateResponse +enum class ChargingProfileStatusEnum { + Accepted, + Rejected, +}; + +namespace conversions { +/// \brief Converts the given ChargingProfileStatusEnum \p e to human readable string +/// \returns a string representation of the ChargingProfileStatusEnum +std::string charging_profile_status_enum_to_string(ChargingProfileStatusEnum e); + +/// \brief Converts the given std::string \p s to ChargingProfileStatusEnum +/// \returns a ChargingProfileStatusEnum from a string representation +ChargingProfileStatusEnum string_to_charging_profile_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given ChargingProfileStatusEnum \p charging_profile_status_enum to +/// the given output stream \p os \returns an output stream with the ChargingProfileStatusEnum written to +std::ostream& operator<<(std::ostream& os, const ChargingProfileStatusEnum& charging_profile_status_enum); + // from: ReportChargingProfilesRequest enum class ChargingProfileKindEnum { Absolute, Recurring, Relative, + Dynamic, }; namespace conversions { @@ -1346,6 +1799,50 @@ RecurrencyKindEnum string_to_recurrency_kind_enum(const std::string& s); /// stream \p os \returns an output stream with the RecurrencyKindEnum written to std::ostream& operator<<(std::ostream& os, const RecurrencyKindEnum& recurrency_kind_enum); +// from: ReportDERControlRequest +enum class PowerDuringCessationEnum { + Active, + Reactive, +}; + +namespace conversions { +/// \brief Converts the given PowerDuringCessationEnum \p e to human readable string +/// \returns a string representation of the PowerDuringCessationEnum +std::string power_during_cessation_enum_to_string(PowerDuringCessationEnum e); + +/// \brief Converts the given std::string \p s to PowerDuringCessationEnum +/// \returns a PowerDuringCessationEnum from a string representation +PowerDuringCessationEnum string_to_power_during_cessation_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given PowerDuringCessationEnum \p power_during_cessation_enum to the +/// given output stream \p os \returns an output stream with the PowerDuringCessationEnum written to +std::ostream& operator<<(std::ostream& os, const PowerDuringCessationEnum& power_during_cessation_enum); + +// from: ReportDERControlRequest +enum class DERUnitEnum { + Not_Applicable, + PctMaxW, + PctMaxVar, + PctWAvail, + PctVarAvail, + PctEffectiveV, +}; + +namespace conversions { +/// \brief Converts the given DERUnitEnum \p e to human readable string +/// \returns a string representation of the DERUnitEnum +std::string derunit_enum_to_string(DERUnitEnum e); + +/// \brief Converts the given std::string \p s to DERUnitEnum +/// \returns a DERUnitEnum from a string representation +DERUnitEnum string_to_derunit_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given DERUnitEnum \p derunit_enum to the given output stream \p os +/// \returns an output stream with the DERUnitEnum written to +std::ostream& operator<<(std::ostream& os, const DERUnitEnum& derunit_enum); + // from: RequestStartTransactionResponse enum class RequestStartStopStatusEnum { Accepted, @@ -1370,6 +1867,7 @@ std::ostream& operator<<(std::ostream& os, const RequestStartStopStatusEnum& req enum class ReservationUpdateStatusEnum { Expired, Removed, + NoTransaction, }; namespace conversions { @@ -1386,46 +1884,6 @@ ReservationUpdateStatusEnum string_to_reservation_update_status_enum(const std:: /// to the given output stream \p os \returns an output stream with the ReservationUpdateStatusEnum written to std::ostream& operator<<(std::ostream& os, const ReservationUpdateStatusEnum& reservation_update_status_enum); -// from: ReserveNowRequest -enum class ConnectorEnum { - cCCS1, - cCCS2, - cG105, - cTesla, - cType1, - cType2, - s309_1P_16A, - s309_1P_32A, - s309_3P_16A, - s309_3P_32A, - sBS1361, - sCEE_7_7, - sType2, - sType3, - Other1PhMax16A, - Other1PhOver16A, - Other3Ph, - Pan, - wInductive, - wResonant, - Undetermined, - Unknown, -}; - -namespace conversions { -/// \brief Converts the given ConnectorEnum \p e to human readable string -/// \returns a string representation of the ConnectorEnum -std::string connector_enum_to_string(ConnectorEnum e); - -/// \brief Converts the given std::string \p s to ConnectorEnum -/// \returns a ConnectorEnum from a string representation -ConnectorEnum string_to_connector_enum(const std::string& s); -} // namespace conversions - -/// \brief Writes the string representation of the given ConnectorEnum \p connector_enum to the given output stream \p -/// os \returns an output stream with the ConnectorEnum written to -std::ostream& operator<<(std::ostream& os, const ConnectorEnum& connector_enum); - // from: ReserveNowResponse enum class ReserveNowStatusEnum { Accepted, @@ -1453,6 +1911,7 @@ std::ostream& operator<<(std::ostream& os, const ReserveNowStatusEnum& reserve_n enum class ResetEnum { Immediate, OnIdle, + ImmediateAndResume, }; namespace conversions { @@ -1531,25 +1990,28 @@ SendLocalListStatusEnum string_to_send_local_list_status_enum(const std::string& /// given output stream \p os \returns an output stream with the SendLocalListStatusEnum written to std::ostream& operator<<(std::ostream& os, const SendLocalListStatusEnum& send_local_list_status_enum); -// from: SetChargingProfileResponse -enum class ChargingProfileStatusEnum { +// from: SetDefaultTariffResponse +enum class TariffSetStatusEnum { Accepted, Rejected, + TooManyElements, + ConditionNotSupported, + DuplicateTariffId, }; namespace conversions { -/// \brief Converts the given ChargingProfileStatusEnum \p e to human readable string -/// \returns a string representation of the ChargingProfileStatusEnum -std::string charging_profile_status_enum_to_string(ChargingProfileStatusEnum e); +/// \brief Converts the given TariffSetStatusEnum \p e to human readable string +/// \returns a string representation of the TariffSetStatusEnum +std::string tariff_set_status_enum_to_string(TariffSetStatusEnum e); -/// \brief Converts the given std::string \p s to ChargingProfileStatusEnum -/// \returns a ChargingProfileStatusEnum from a string representation -ChargingProfileStatusEnum string_to_charging_profile_status_enum(const std::string& s); +/// \brief Converts the given std::string \p s to TariffSetStatusEnum +/// \returns a TariffSetStatusEnum from a string representation +TariffSetStatusEnum string_to_tariff_set_status_enum(const std::string& s); } // namespace conversions -/// \brief Writes the string representation of the given ChargingProfileStatusEnum \p charging_profile_status_enum to -/// the given output stream \p os \returns an output stream with the ChargingProfileStatusEnum written to -std::ostream& operator<<(std::ostream& os, const ChargingProfileStatusEnum& charging_profile_status_enum); +/// \brief Writes the string representation of the given TariffSetStatusEnum \p tariff_set_status_enum to the given +/// output stream \p os \returns an output stream with the TariffSetStatusEnum written to +std::ostream& operator<<(std::ostream& os, const TariffSetStatusEnum& tariff_set_status_enum); // from: SetDisplayMessageResponse enum class DisplayMessageStatusEnum { @@ -1559,6 +2021,7 @@ enum class DisplayMessageStatusEnum { NotSupportedPriority, NotSupportedState, UnknownTransaction, + LanguageNotSupported, }; namespace conversions { @@ -1598,9 +2061,9 @@ std::ostream& operator<<(std::ostream& os, const MonitoringBaseEnum& monitoring_ // from: SetNetworkProfileRequest enum class APNAuthenticationEnum { + PAP, CHAP, NONE, - PAP, AUTO, }; @@ -1624,6 +2087,8 @@ enum class OCPPVersionEnum { OCPP15, OCPP16, OCPP20, + OCPP201, + OCPP21, }; namespace conversions { @@ -1640,26 +2105,6 @@ OCPPVersionEnum string_to_ocppversion_enum(const std::string& s); /// \p os \returns an output stream with the OCPPVersionEnum written to std::ostream& operator<<(std::ostream& os, const OCPPVersionEnum& ocppversion_enum); -// from: SetNetworkProfileRequest -enum class OCPPTransportEnum { - JSON, - SOAP, -}; - -namespace conversions { -/// \brief Converts the given OCPPTransportEnum \p e to human readable string -/// \returns a string representation of the OCPPTransportEnum -std::string ocpptransport_enum_to_string(OCPPTransportEnum e); - -/// \brief Converts the given std::string \p s to OCPPTransportEnum -/// \returns a OCPPTransportEnum from a string representation -OCPPTransportEnum string_to_ocpptransport_enum(const std::string& s); -} // namespace conversions - -/// \brief Writes the string representation of the given OCPPTransportEnum \p ocpptransport_enum to the given output -/// stream \p os \returns an output stream with the OCPPTransportEnum written to -std::ostream& operator<<(std::ostream& os, const OCPPTransportEnum& ocpptransport_enum); - // from: SetNetworkProfileRequest enum class OCPPInterfaceEnum { Wired0, @@ -1670,6 +2115,7 @@ enum class OCPPInterfaceEnum { Wireless1, Wireless2, Wireless3, + Any, }; namespace conversions { @@ -1686,6 +2132,26 @@ OCPPInterfaceEnum string_to_ocppinterface_enum(const std::string& s); /// stream \p os \returns an output stream with the OCPPInterfaceEnum written to std::ostream& operator<<(std::ostream& os, const OCPPInterfaceEnum& ocppinterface_enum); +// from: SetNetworkProfileRequest +enum class OCPPTransportEnum { + SOAP, + JSON, +}; + +namespace conversions { +/// \brief Converts the given OCPPTransportEnum \p e to human readable string +/// \returns a string representation of the OCPPTransportEnum +std::string ocpptransport_enum_to_string(OCPPTransportEnum e); + +/// \brief Converts the given std::string \p s to OCPPTransportEnum +/// \returns a OCPPTransportEnum from a string representation +OCPPTransportEnum string_to_ocpptransport_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given OCPPTransportEnum \p ocpptransport_enum to the given output +/// stream \p os \returns an output stream with the OCPPTransportEnum written to +std::ostream& operator<<(std::ostream& os, const OCPPTransportEnum& ocpptransport_enum); + // from: SetNetworkProfileRequest enum class VPNEnum { IKEv2, @@ -1800,6 +2266,52 @@ ConnectorStatusEnum string_to_connector_status_enum(const std::string& s); /// output stream \p os \returns an output stream with the ConnectorStatusEnum written to std::ostream& operator<<(std::ostream& os, const ConnectorStatusEnum& connector_status_enum); +// from: TransactionEventRequest +enum class CostDimensionEnum { + Energy, + MaxCurrent, + MinCurrent, + MaxPower, + MinPower, + IdleTIme, + ChargingTime, +}; + +namespace conversions { +/// \brief Converts the given CostDimensionEnum \p e to human readable string +/// \returns a string representation of the CostDimensionEnum +std::string cost_dimension_enum_to_string(CostDimensionEnum e); + +/// \brief Converts the given std::string \p s to CostDimensionEnum +/// \returns a CostDimensionEnum from a string representation +CostDimensionEnum string_to_cost_dimension_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given CostDimensionEnum \p cost_dimension_enum to the given output +/// stream \p os \returns an output stream with the CostDimensionEnum written to +std::ostream& operator<<(std::ostream& os, const CostDimensionEnum& cost_dimension_enum); + +// from: TransactionEventRequest +enum class TariffCostEnum { + NormalCost, + MinCost, + MaxCost, +}; + +namespace conversions { +/// \brief Converts the given TariffCostEnum \p e to human readable string +/// \returns a string representation of the TariffCostEnum +std::string tariff_cost_enum_to_string(TariffCostEnum e); + +/// \brief Converts the given std::string \p s to TariffCostEnum +/// \returns a TariffCostEnum from a string representation +TariffCostEnum string_to_tariff_cost_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffCostEnum \p tariff_cost_enum to the given output stream +/// \p os \returns an output stream with the TariffCostEnum written to +std::ostream& operator<<(std::ostream& os, const TariffCostEnum& tariff_cost_enum); + // from: TransactionEventRequest enum class TransactionEventEnum { Ended, @@ -1823,27 +2335,35 @@ std::ostream& operator<<(std::ostream& os, const TransactionEventEnum& transacti // from: TransactionEventRequest enum class TriggerReasonEnum { + AbnormalCondition, Authorized, CablePluggedIn, ChargingRateChanged, ChargingStateChanged, + CostLimitReached, Deauthorized, EnergyLimitReached, EVCommunicationLost, EVConnectTimeout, + EVDeparted, + EVDetected, + LimitSet, MeterValueClock, MeterValuePeriodic, + OperationModeChanged, + RemoteStart, + RemoteStop, + ResetCommand, + RunningCost, + SignedDataReceived, + SoCLimitReached, + StopAuthorized, + TariffChanged, + TariffNotAccepted, TimeLimitReached, Trigger, + TxResumed, UnlockCommand, - StopAuthorized, - EVDeparted, - EVDetected, - RemoteStop, - RemoteStart, - AbnormalCondition, - SignedDataReceived, - ResetCommand, }; namespace conversions { @@ -1860,10 +2380,32 @@ TriggerReasonEnum string_to_trigger_reason_enum(const std::string& s); /// stream \p os \returns an output stream with the TriggerReasonEnum written to std::ostream& operator<<(std::ostream& os, const TriggerReasonEnum& trigger_reason_enum); +// from: TransactionEventRequest +enum class PreconditioningStatusEnum { + Unknown, + Ready, + NotReady, + Preconditioning, +}; + +namespace conversions { +/// \brief Converts the given PreconditioningStatusEnum \p e to human readable string +/// \returns a string representation of the PreconditioningStatusEnum +std::string preconditioning_status_enum_to_string(PreconditioningStatusEnum e); + +/// \brief Converts the given std::string \p s to PreconditioningStatusEnum +/// \returns a PreconditioningStatusEnum from a string representation +PreconditioningStatusEnum string_to_preconditioning_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given PreconditioningStatusEnum \p preconditioning_status_enum to the +/// given output stream \p os \returns an output stream with the PreconditioningStatusEnum written to +std::ostream& operator<<(std::ostream& os, const PreconditioningStatusEnum& preconditioning_status_enum); + // from: TransactionEventRequest enum class ChargingStateEnum { - Charging, EVConnected, + Charging, SuspendedEV, SuspendedEVSE, Idle, @@ -1891,9 +2433,9 @@ enum class ReasonEnum { EVDisconnected, GroundFault, ImmediateReset, + MasterPass, Local, LocalOutOfCredit, - MasterPass, Other, OvercurrentFault, PowerLoss, @@ -1904,6 +2446,7 @@ enum class ReasonEnum { StoppedByEV, TimeLimitReached, Timeout, + ReqEnergyTransferRejected, }; namespace conversions { @@ -1929,10 +2472,12 @@ enum class MessageTriggerEnum { MeterValues, SignChargingStationCertificate, SignV2GCertificate, + SignV2G20Certificate, StatusNotification, TransactionEvent, SignCombinedCertificate, PublishFirmwareStatusNotification, + CustomTrigger, }; namespace conversions { @@ -2036,6 +2581,27 @@ UpdateFirmwareStatusEnum string_to_update_firmware_status_enum(const std::string /// given output stream \p os \returns an output stream with the UpdateFirmwareStatusEnum written to std::ostream& operator<<(std::ostream& os, const UpdateFirmwareStatusEnum& update_firmware_status_enum); +// from: UsePriorityChargingResponse +enum class PriorityChargingStatusEnum { + Accepted, + Rejected, + NoProfile, +}; + +namespace conversions { +/// \brief Converts the given PriorityChargingStatusEnum \p e to human readable string +/// \returns a string representation of the PriorityChargingStatusEnum +std::string priority_charging_status_enum_to_string(PriorityChargingStatusEnum e); + +/// \brief Converts the given std::string \p s to PriorityChargingStatusEnum +/// \returns a PriorityChargingStatusEnum from a string representation +PriorityChargingStatusEnum string_to_priority_charging_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given PriorityChargingStatusEnum \p priority_charging_status_enum to +/// the given output stream \p os \returns an output stream with the PriorityChargingStatusEnum written to +std::ostream& operator<<(std::ostream& os, const PriorityChargingStatusEnum& priority_charging_status_enum); + } // namespace v2 } // namespace ocpp diff --git a/include/ocpp/v2/ocpp_types.hpp b/include/ocpp/v2/ocpp_types.hpp index 43f392fc9..545e8fad6 100644 --- a/include/ocpp/v2/ocpp_types.hpp +++ b/include/ocpp/v2/ocpp_types.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #ifndef OCPP_V2_OCPP_TYPES_HPP @@ -18,8 +18,38 @@ namespace v2 { using CustomData = nlohmann::json; +struct StatusInfo { + CiString<20> reasonCode; + std::optional> additionalInfo; + std::optional customData; +}; +/// \brief Conversion from a given StatusInfo \p k to a given json object \p j +void to_json(json& j, const StatusInfo& k); + +/// \brief Conversion from a given json object \p j to a given StatusInfo \p k +void from_json(const json& j, StatusInfo& k); + +/// \brief Writes the string representation of the given StatusInfo \p k to the given output stream \p os +/// \returns an output stream with the StatusInfo written to +std::ostream& operator<<(std::ostream& os, const StatusInfo& k); + +struct PeriodicEventStreamParams { + std::optional interval; + std::optional values; + std::optional customData; +}; +/// \brief Conversion from a given PeriodicEventStreamParams \p k to a given json object \p j +void to_json(json& j, const PeriodicEventStreamParams& k); + +/// \brief Conversion from a given json object \p j to a given PeriodicEventStreamParams \p k +void from_json(const json& j, PeriodicEventStreamParams& k); + +/// \brief Writes the string representation of the given PeriodicEventStreamParams \p k to the given output stream \p os +/// \returns an output stream with the PeriodicEventStreamParams written to +std::ostream& operator<<(std::ostream& os, const PeriodicEventStreamParams& k); + struct AdditionalInfo { - CiString<36> additionalIdToken; + CiString<255> additionalIdToken; CiString<50> type; std::optional customData; }; @@ -29,15 +59,15 @@ void to_json(json& j, const AdditionalInfo& k); /// \brief Conversion from a given json object \p j to a given AdditionalInfo \p k void from_json(const json& j, AdditionalInfo& k); -// \brief Writes the string representation of the given AdditionalInfo \p k to the given output stream \p os +/// \brief Writes the string representation of the given AdditionalInfo \p k to the given output stream \p os /// \returns an output stream with the AdditionalInfo written to std::ostream& operator<<(std::ostream& os, const AdditionalInfo& k); struct IdToken { - CiString<36> idToken; - IdTokenEnum type; - std::optional customData; + CiString<255> idToken; + CiString<20> type; std::optional> additionalInfo; + std::optional customData; }; /// \brief Conversion from a given IdToken \p k to a given json object \p j void to_json(json& j, const IdToken& k); @@ -45,7 +75,7 @@ void to_json(json& j, const IdToken& k); /// \brief Conversion from a given json object \p j to a given IdToken \p k void from_json(const json& j, IdToken& k); -// \brief Writes the string representation of the given IdToken \p k to the given output stream \p os +/// \brief Writes the string representation of the given IdToken \p k to the given output stream \p os /// \returns an output stream with the IdToken written to std::ostream& operator<<(std::ostream& os, const IdToken& k); @@ -54,7 +84,7 @@ struct OCSPRequestData { CiString<128> issuerNameHash; CiString<128> issuerKeyHash; CiString<40> serialNumber; - CiString<512> responderURL; + CiString<2000> responderURL; std::optional customData; }; /// \brief Conversion from a given OCSPRequestData \p k to a given json object \p j @@ -63,15 +93,15 @@ void to_json(json& j, const OCSPRequestData& k); /// \brief Conversion from a given json object \p j to a given OCSPRequestData \p k void from_json(const json& j, OCSPRequestData& k); -// \brief Writes the string representation of the given OCSPRequestData \p k to the given output stream \p os +/// \brief Writes the string representation of the given OCSPRequestData \p k to the given output stream \p os /// \returns an output stream with the OCSPRequestData written to std::ostream& operator<<(std::ostream& os, const OCSPRequestData& k); struct MessageContent { MessageFormatEnum format; - CiString<512> content; - std::optional customData; + CiString<1024> content; std::optional> language; + std::optional customData; }; /// \brief Conversion from a given MessageContent \p k to a given json object \p j void to_json(json& j, const MessageContent& k); @@ -79,20 +109,20 @@ void to_json(json& j, const MessageContent& k); /// \brief Conversion from a given json object \p j to a given MessageContent \p k void from_json(const json& j, MessageContent& k); -// \brief Writes the string representation of the given MessageContent \p k to the given output stream \p os +/// \brief Writes the string representation of the given MessageContent \p k to the given output stream \p os /// \returns an output stream with the MessageContent written to std::ostream& operator<<(std::ostream& os, const MessageContent& k); struct IdTokenInfo { AuthorizationStatusEnum status; - std::optional customData; std::optional cacheExpiryDateTime; std::optional chargingPriority; - std::optional> language1; - std::optional> evseId; std::optional groupIdToken; + std::optional> language1; std::optional> language2; + std::optional> evseId; std::optional personalMessage; + std::optional customData; }; /// \brief Conversion from a given IdTokenInfo \p k to a given json object \p j void to_json(json& j, const IdTokenInfo& k); @@ -100,14 +130,232 @@ void to_json(json& j, const IdTokenInfo& k); /// \brief Conversion from a given json object \p j to a given IdTokenInfo \p k void from_json(const json& j, IdTokenInfo& k); -// \brief Writes the string representation of the given IdTokenInfo \p k to the given output stream \p os +/// \brief Writes the string representation of the given IdTokenInfo \p k to the given output stream \p os /// \returns an output stream with the IdTokenInfo written to std::ostream& operator<<(std::ostream& os, const IdTokenInfo& k); -struct Modem { +struct TariffConditions { + std::optional startTimeOfDay; + std::optional endTimeOfDay; + std::optional> dayOfWeek; + std::optional validFromDate; + std::optional validToDate; + std::optional evseKind; + std::optional minEnergy; + std::optional maxEnergy; + std::optional minCurrent; + std::optional maxCurrent; + std::optional minPower; + std::optional maxPower; + std::optional minTime; + std::optional maxTime; + std::optional minChargingTime; + std::optional maxChargingTime; + std::optional minIdleTime; + std::optional maxIdleTime; + std::optional customData; +}; +/// \brief Conversion from a given TariffConditions \p k to a given json object \p j +void to_json(json& j, const TariffConditions& k); + +/// \brief Conversion from a given json object \p j to a given TariffConditions \p k +void from_json(const json& j, TariffConditions& k); + +/// \brief Writes the string representation of the given TariffConditions \p k to the given output stream \p os +/// \returns an output stream with the TariffConditions written to +std::ostream& operator<<(std::ostream& os, const TariffConditions& k); + +struct TariffEnergyPrice { + float priceKwh; + std::optional conditions; + std::optional customData; +}; +/// \brief Conversion from a given TariffEnergyPrice \p k to a given json object \p j +void to_json(json& j, const TariffEnergyPrice& k); + +/// \brief Conversion from a given json object \p j to a given TariffEnergyPrice \p k +void from_json(const json& j, TariffEnergyPrice& k); + +/// \brief Writes the string representation of the given TariffEnergyPrice \p k to the given output stream \p os +/// \returns an output stream with the TariffEnergyPrice written to +std::ostream& operator<<(std::ostream& os, const TariffEnergyPrice& k); + +struct TaxRate { + CiString<20> type; + float tax; + std::optional stack; std::optional customData; +}; +/// \brief Conversion from a given TaxRate \p k to a given json object \p j +void to_json(json& j, const TaxRate& k); + +/// \brief Conversion from a given json object \p j to a given TaxRate \p k +void from_json(const json& j, TaxRate& k); + +/// \brief Writes the string representation of the given TaxRate \p k to the given output stream \p os +/// \returns an output stream with the TaxRate written to +std::ostream& operator<<(std::ostream& os, const TaxRate& k); + +struct TariffEnergy { + std::vector prices; + std::optional> taxRates; + std::optional customData; +}; +/// \brief Conversion from a given TariffEnergy \p k to a given json object \p j +void to_json(json& j, const TariffEnergy& k); + +/// \brief Conversion from a given json object \p j to a given TariffEnergy \p k +void from_json(const json& j, TariffEnergy& k); + +/// \brief Writes the string representation of the given TariffEnergy \p k to the given output stream \p os +/// \returns an output stream with the TariffEnergy written to +std::ostream& operator<<(std::ostream& os, const TariffEnergy& k); + +struct TariffTimePrice { + float priceMinute; + std::optional conditions; + std::optional customData; +}; +/// \brief Conversion from a given TariffTimePrice \p k to a given json object \p j +void to_json(json& j, const TariffTimePrice& k); + +/// \brief Conversion from a given json object \p j to a given TariffTimePrice \p k +void from_json(const json& j, TariffTimePrice& k); + +/// \brief Writes the string representation of the given TariffTimePrice \p k to the given output stream \p os +/// \returns an output stream with the TariffTimePrice written to +std::ostream& operator<<(std::ostream& os, const TariffTimePrice& k); + +struct TariffTime { + std::vector prices; + std::optional> taxRates; + std::optional customData; +}; +/// \brief Conversion from a given TariffTime \p k to a given json object \p j +void to_json(json& j, const TariffTime& k); + +/// \brief Conversion from a given json object \p j to a given TariffTime \p k +void from_json(const json& j, TariffTime& k); + +/// \brief Writes the string representation of the given TariffTime \p k to the given output stream \p os +/// \returns an output stream with the TariffTime written to +std::ostream& operator<<(std::ostream& os, const TariffTime& k); + +struct TariffConditionsFixed { + std::optional startTimeOfDay; + std::optional endTimeOfDay; + std::optional> dayOfWeek; + std::optional validFromDate; + std::optional validToDate; + std::optional evseKind; + std::optional> paymentBrand; + std::optional> paymentRecognition; + std::optional customData; +}; +/// \brief Conversion from a given TariffConditionsFixed \p k to a given json object \p j +void to_json(json& j, const TariffConditionsFixed& k); + +/// \brief Conversion from a given json object \p j to a given TariffConditionsFixed \p k +void from_json(const json& j, TariffConditionsFixed& k); + +/// \brief Writes the string representation of the given TariffConditionsFixed \p k to the given output stream \p os +/// \returns an output stream with the TariffConditionsFixed written to +std::ostream& operator<<(std::ostream& os, const TariffConditionsFixed& k); + +struct TariffFixedPrice { + float priceFixed; + std::optional conditions; + std::optional customData; +}; +/// \brief Conversion from a given TariffFixedPrice \p k to a given json object \p j +void to_json(json& j, const TariffFixedPrice& k); + +/// \brief Conversion from a given json object \p j to a given TariffFixedPrice \p k +void from_json(const json& j, TariffFixedPrice& k); + +/// \brief Writes the string representation of the given TariffFixedPrice \p k to the given output stream \p os +/// \returns an output stream with the TariffFixedPrice written to +std::ostream& operator<<(std::ostream& os, const TariffFixedPrice& k); + +struct TariffFixed { + std::vector prices; + std::optional> taxRates; + std::optional customData; +}; +/// \brief Conversion from a given TariffFixed \p k to a given json object \p j +void to_json(json& j, const TariffFixed& k); + +/// \brief Conversion from a given json object \p j to a given TariffFixed \p k +void from_json(const json& j, TariffFixed& k); + +/// \brief Writes the string representation of the given TariffFixed \p k to the given output stream \p os +/// \returns an output stream with the TariffFixed written to +std::ostream& operator<<(std::ostream& os, const TariffFixed& k); + +struct Price { + std::optional exclTax; + std::optional inclTax; + std::optional> taxRates; + std::optional customData; +}; +/// \brief Conversion from a given Price \p k to a given json object \p j +void to_json(json& j, const Price& k); + +/// \brief Conversion from a given json object \p j to a given Price \p k +void from_json(const json& j, Price& k); + +/// \brief Writes the string representation of the given Price \p k to the given output stream \p os +/// \returns an output stream with the Price written to +std::ostream& operator<<(std::ostream& os, const Price& k); + +struct Tariff { + CiString<60> tariffId; + CiString<3> currency; + std::optional> description; + std::optional energy; + std::optional validFrom; + std::optional chargingTime; + std::optional idleTime; + std::optional fixedFee; + std::optional reservationTime; + std::optional reservationFixed; + std::optional minCost; + std::optional maxCost; + std::optional customData; +}; +/// \brief Conversion from a given Tariff \p k to a given json object \p j +void to_json(json& j, const Tariff& k); + +/// \brief Conversion from a given json object \p j to a given Tariff \p k +void from_json(const json& j, Tariff& k); + +/// \brief Writes the string representation of the given Tariff \p k to the given output stream \p os +/// \returns an output stream with the Tariff written to +std::ostream& operator<<(std::ostream& os, const Tariff& k); + +struct BatteryData { + int32_t evseId; + CiString<50> serialNumber; + float soC; + float soH; + std::optional productionDate; + std::optional> vendorInfo; + std::optional customData; +}; +/// \brief Conversion from a given BatteryData \p k to a given json object \p j +void to_json(json& j, const BatteryData& k); + +/// \brief Conversion from a given json object \p j to a given BatteryData \p k +void from_json(const json& j, BatteryData& k); + +/// \brief Writes the string representation of the given BatteryData \p k to the given output stream \p os +/// \returns an output stream with the BatteryData written to +std::ostream& operator<<(std::ostream& os, const BatteryData& k); + +struct Modem { std::optional> iccid; std::optional> imsi; + std::optional customData; }; /// \brief Conversion from a given Modem \p k to a given json object \p j void to_json(json& j, const Modem& k); @@ -115,17 +363,17 @@ void to_json(json& j, const Modem& k); /// \brief Conversion from a given json object \p j to a given Modem \p k void from_json(const json& j, Modem& k); -// \brief Writes the string representation of the given Modem \p k to the given output stream \p os +/// \brief Writes the string representation of the given Modem \p k to the given output stream \p os /// \returns an output stream with the Modem written to std::ostream& operator<<(std::ostream& os, const Modem& k); struct ChargingStation { CiString<20> model; CiString<50> vendorName; - std::optional customData; std::optional> serialNumber; std::optional modem; std::optional> firmwareVersion; + std::optional customData; }; /// \brief Conversion from a given ChargingStation \p k to a given json object \p j void to_json(json& j, const ChargingStation& k); @@ -133,29 +381,14 @@ void to_json(json& j, const ChargingStation& k); /// \brief Conversion from a given json object \p j to a given ChargingStation \p k void from_json(const json& j, ChargingStation& k); -// \brief Writes the string representation of the given ChargingStation \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingStation \p k to the given output stream \p os /// \returns an output stream with the ChargingStation written to std::ostream& operator<<(std::ostream& os, const ChargingStation& k); -struct StatusInfo { - CiString<20> reasonCode; - std::optional customData; - std::optional> additionalInfo; -}; -/// \brief Conversion from a given StatusInfo \p k to a given json object \p j -void to_json(json& j, const StatusInfo& k); - -/// \brief Conversion from a given json object \p j to a given StatusInfo \p k -void from_json(const json& j, StatusInfo& k); - -// \brief Writes the string representation of the given StatusInfo \p k to the given output stream \p os -/// \returns an output stream with the StatusInfo written to -std::ostream& operator<<(std::ostream& os, const StatusInfo& k); - struct EVSE { int32_t id; - std::optional customData; std::optional connectorId; + std::optional customData; }; /// \brief Conversion from a given EVSE \p k to a given json object \p j void to_json(json& j, const EVSE& k); @@ -163,15 +396,15 @@ void to_json(json& j, const EVSE& k); /// \brief Conversion from a given json object \p j to a given EVSE \p k void from_json(const json& j, EVSE& k); -// \brief Writes the string representation of the given EVSE \p k to the given output stream \p os +/// \brief Writes the string representation of the given EVSE \p k to the given output stream \p os /// \returns an output stream with the EVSE written to std::ostream& operator<<(std::ostream& os, const EVSE& k); struct ClearChargingProfile { - std::optional customData; std::optional evseId; std::optional chargingProfilePurpose; std::optional stackLevel; + std::optional customData; }; /// \brief Conversion from a given ClearChargingProfile \p k to a given json object \p j void to_json(json& j, const ClearChargingProfile& k); @@ -179,15 +412,31 @@ void to_json(json& j, const ClearChargingProfile& k); /// \brief Conversion from a given json object \p j to a given ClearChargingProfile \p k void from_json(const json& j, ClearChargingProfile& k); -// \brief Writes the string representation of the given ClearChargingProfile \p k to the given output stream \p os +/// \brief Writes the string representation of the given ClearChargingProfile \p k to the given output stream \p os /// \returns an output stream with the ClearChargingProfile written to std::ostream& operator<<(std::ostream& os, const ClearChargingProfile& k); +struct ClearTariffsResult { + TariffClearStatusEnum status; + std::optional statusInfo; + std::optional> tariffId; + std::optional customData; +}; +/// \brief Conversion from a given ClearTariffsResult \p k to a given json object \p j +void to_json(json& j, const ClearTariffsResult& k); + +/// \brief Conversion from a given json object \p j to a given ClearTariffsResult \p k +void from_json(const json& j, ClearTariffsResult& k); + +/// \brief Writes the string representation of the given ClearTariffsResult \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsResult written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsResult& k); + struct ClearMonitoringResult { ClearMonitoringStatusEnum status; int32_t id; - std::optional customData; std::optional statusInfo; + std::optional customData; }; /// \brief Conversion from a given ClearMonitoringResult \p k to a given json object \p j void to_json(json& j, const ClearMonitoringResult& k); @@ -195,7 +444,7 @@ void to_json(json& j, const ClearMonitoringResult& k); /// \brief Conversion from a given json object \p j to a given ClearMonitoringResult \p k void from_json(const json& j, ClearMonitoringResult& k); -// \brief Writes the string representation of the given ClearMonitoringResult \p k to the given output stream \p os +/// \brief Writes the string representation of the given ClearMonitoringResult \p k to the given output stream \p os /// \returns an output stream with the ClearMonitoringResult written to std::ostream& operator<<(std::ostream& os, const ClearMonitoringResult& k); @@ -212,16 +461,49 @@ void to_json(json& j, const CertificateHashDataType& k); /// \brief Conversion from a given json object \p j to a given CertificateHashDataType \p k void from_json(const json& j, CertificateHashDataType& k); -// \brief Writes the string representation of the given CertificateHashDataType \p k to the given output stream \p os +/// \brief Writes the string representation of the given CertificateHashDataType \p k to the given output stream \p os /// \returns an output stream with the CertificateHashDataType written to std::ostream& operator<<(std::ostream& os, const CertificateHashDataType& k); -struct ChargingProfileCriterion { +struct CertificateStatusRequestInfo { + CertificateHashDataType certificateHashData; + CertificateStatusSourceEnum source; + std::vector> urls; std::optional customData; +}; +/// \brief Conversion from a given CertificateStatusRequestInfo \p k to a given json object \p j +void to_json(json& j, const CertificateStatusRequestInfo& k); + +/// \brief Conversion from a given json object \p j to a given CertificateStatusRequestInfo \p k +void from_json(const json& j, CertificateStatusRequestInfo& k); + +/// \brief Writes the string representation of the given CertificateStatusRequestInfo \p k to the given output stream \p +/// os \returns an output stream with the CertificateStatusRequestInfo written to +std::ostream& operator<<(std::ostream& os, const CertificateStatusRequestInfo& k); + +struct CertificateStatus { + CertificateHashDataType certificateHashData; + CertificateStatusSourceEnum source; + CertificateStatusEnum status; + ocpp::DateTime nextUpdate; + std::optional customData; +}; +/// \brief Conversion from a given CertificateStatus \p k to a given json object \p j +void to_json(json& j, const CertificateStatus& k); + +/// \brief Conversion from a given json object \p j to a given CertificateStatus \p k +void from_json(const json& j, CertificateStatus& k); + +/// \brief Writes the string representation of the given CertificateStatus \p k to the given output stream \p os +/// \returns an output stream with the CertificateStatus written to +std::ostream& operator<<(std::ostream& os, const CertificateStatus& k); + +struct ChargingProfileCriterion { std::optional chargingProfilePurpose; std::optional stackLevel; std::optional> chargingProfileId; - std::optional> chargingLimitSource; + std::optional>> chargingLimitSource; + std::optional customData; }; /// \brief Conversion from a given ChargingProfileCriterion \p k to a given json object \p j void to_json(json& j, const ChargingProfileCriterion& k); @@ -229,16 +511,63 @@ void to_json(json& j, const ChargingProfileCriterion& k); /// \brief Conversion from a given json object \p j to a given ChargingProfileCriterion \p k void from_json(const json& j, ChargingProfileCriterion& k); -// \brief Writes the string representation of the given ChargingProfileCriterion \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingProfileCriterion \p k to the given output stream \p os /// \returns an output stream with the ChargingProfileCriterion written to std::ostream& operator<<(std::ostream& os, const ChargingProfileCriterion& k); +struct V2XFreqWattPoint { + float frequency; + float power; + std::optional customData; +}; +/// \brief Conversion from a given V2XFreqWattPoint \p k to a given json object \p j +void to_json(json& j, const V2XFreqWattPoint& k); + +/// \brief Conversion from a given json object \p j to a given V2XFreqWattPoint \p k +void from_json(const json& j, V2XFreqWattPoint& k); + +/// \brief Writes the string representation of the given V2XFreqWattPoint \p k to the given output stream \p os +/// \returns an output stream with the V2XFreqWattPoint written to +std::ostream& operator<<(std::ostream& os, const V2XFreqWattPoint& k); + +struct V2XSignalWattPoint { + int32_t signal; + float power; + std::optional customData; +}; +/// \brief Conversion from a given V2XSignalWattPoint \p k to a given json object \p j +void to_json(json& j, const V2XSignalWattPoint& k); + +/// \brief Conversion from a given json object \p j to a given V2XSignalWattPoint \p k +void from_json(const json& j, V2XSignalWattPoint& k); + +/// \brief Writes the string representation of the given V2XSignalWattPoint \p k to the given output stream \p os +/// \returns an output stream with the V2XSignalWattPoint written to +std::ostream& operator<<(std::ostream& os, const V2XSignalWattPoint& k); + struct ChargingSchedulePeriod { int32_t startPeriod; - float limit; - std::optional customData; + std::optional limit; + std::optional limit_L2; + std::optional limit_L3; std::optional numberPhases; std::optional phaseToUse; + std::optional dischargeLimit; + std::optional dischargeLimit_L2; + std::optional dischargeLimit_L3; + std::optional setpoint; + std::optional setpoint_L2; + std::optional setpoint_L3; + std::optional setpointReactive; + std::optional setpointReactive_L2; + std::optional setpointReactive_L3; + std::optional preconditioningRequest; + std::optional evseSleep; + std::optional v2xBaseline; + std::optional operationMode; + std::optional> v2xFreqWattCurve; + std::optional> v2xSignalWattCurve; + std::optional customData; }; /// \brief Conversion from a given ChargingSchedulePeriod \p k to a given json object \p j void to_json(json& j, const ChargingSchedulePeriod& k); @@ -246,16 +575,16 @@ void to_json(json& j, const ChargingSchedulePeriod& k); /// \brief Conversion from a given json object \p j to a given ChargingSchedulePeriod \p k void from_json(const json& j, ChargingSchedulePeriod& k); -// \brief Writes the string representation of the given ChargingSchedulePeriod \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingSchedulePeriod \p k to the given output stream \p os /// \returns an output stream with the ChargingSchedulePeriod written to std::ostream& operator<<(std::ostream& os, const ChargingSchedulePeriod& k); struct CompositeSchedule { - std::vector chargingSchedulePeriod; int32_t evseId; int32_t duration; ocpp::DateTime scheduleStart; ChargingRateUnitEnum chargingRateUnit; + std::vector chargingSchedulePeriod; std::optional customData; }; /// \brief Conversion from a given CompositeSchedule \p k to a given json object \p j @@ -264,15 +593,15 @@ void to_json(json& j, const CompositeSchedule& k); /// \brief Conversion from a given json object \p j to a given CompositeSchedule \p k void from_json(const json& j, CompositeSchedule& k); -// \brief Writes the string representation of the given CompositeSchedule \p k to the given output stream \p os +/// \brief Writes the string representation of the given CompositeSchedule \p k to the given output stream \p os /// \returns an output stream with the CompositeSchedule written to std::ostream& operator<<(std::ostream& os, const CompositeSchedule& k); struct CertificateHashDataChain { CertificateHashDataType certificateHashData; GetCertificateIdUseEnum certificateType; - std::optional customData; std::optional> childCertificateHashData; + std::optional customData; }; /// \brief Conversion from a given CertificateHashDataChain \p k to a given json object \p j void to_json(json& j, const CertificateHashDataChain& k); @@ -280,15 +609,15 @@ void to_json(json& j, const CertificateHashDataChain& k); /// \brief Conversion from a given json object \p j to a given CertificateHashDataChain \p k void from_json(const json& j, CertificateHashDataChain& k); -// \brief Writes the string representation of the given CertificateHashDataChain \p k to the given output stream \p os +/// \brief Writes the string representation of the given CertificateHashDataChain \p k to the given output stream \p os /// \returns an output stream with the CertificateHashDataChain written to std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k); struct LogParameters { - CiString<512> remoteLocation; - std::optional customData; + CiString<2000> remoteLocation; std::optional oldestTimestamp; std::optional latestTimestamp; + std::optional customData; }; /// \brief Conversion from a given LogParameters \p k to a given json object \p j void to_json(json& j, const LogParameters& k); @@ -296,15 +625,15 @@ void to_json(json& j, const LogParameters& k); /// \brief Conversion from a given json object \p j to a given LogParameters \p k void from_json(const json& j, LogParameters& k); -// \brief Writes the string representation of the given LogParameters \p k to the given output stream \p os +/// \brief Writes the string representation of the given LogParameters \p k to the given output stream \p os /// \returns an output stream with the LogParameters written to std::ostream& operator<<(std::ostream& os, const LogParameters& k); struct Component { CiString<50> name; - std::optional customData; std::optional evse; std::optional> instance; + std::optional customData; }; /// \brief Conversion from a given Component \p k to a given json object \p j void to_json(json& j, const Component& k); @@ -312,14 +641,14 @@ void to_json(json& j, const Component& k); /// \brief Conversion from a given json object \p j to a given Component \p k void from_json(const json& j, Component& k); -// \brief Writes the string representation of the given Component \p k to the given output stream \p os +/// \brief Writes the string representation of the given Component \p k to the given output stream \p os /// \returns an output stream with the Component written to std::ostream& operator<<(std::ostream& os, const Component& k); struct Variable { CiString<50> name; - std::optional customData; std::optional> instance; + std::optional customData; }; /// \brief Conversion from a given Variable \p k to a given json object \p j void to_json(json& j, const Variable& k); @@ -327,14 +656,14 @@ void to_json(json& j, const Variable& k); /// \brief Conversion from a given json object \p j to a given Variable \p k void from_json(const json& j, Variable& k); -// \brief Writes the string representation of the given Variable \p k to the given output stream \p os +/// \brief Writes the string representation of the given Variable \p k to the given output stream \p os /// \returns an output stream with the Variable written to std::ostream& operator<<(std::ostream& os, const Variable& k); struct ComponentVariable { Component component; - std::optional customData; std::optional variable; + std::optional customData; }; /// \brief Conversion from a given ComponentVariable \p k to a given json object \p j void to_json(json& j, const ComponentVariable& k); @@ -342,15 +671,49 @@ void to_json(json& j, const ComponentVariable& k); /// \brief Conversion from a given json object \p j to a given ComponentVariable \p k void from_json(const json& j, ComponentVariable& k); -// \brief Writes the string representation of the given ComponentVariable \p k to the given output stream \p os +/// \brief Writes the string representation of the given ComponentVariable \p k to the given output stream \p os /// \returns an output stream with the ComponentVariable written to std::ostream& operator<<(std::ostream& os, const ComponentVariable& k); +struct ConstantStreamData { + int32_t id; + PeriodicEventStreamParams params; + int32_t variableMonitoringId; + std::optional customData; +}; +/// \brief Conversion from a given ConstantStreamData \p k to a given json object \p j +void to_json(json& j, const ConstantStreamData& k); + +/// \brief Conversion from a given json object \p j to a given ConstantStreamData \p k +void from_json(const json& j, ConstantStreamData& k); + +/// \brief Writes the string representation of the given ConstantStreamData \p k to the given output stream \p os +/// \returns an output stream with the ConstantStreamData written to +std::ostream& operator<<(std::ostream& os, const ConstantStreamData& k); + +struct TariffAssignment { + CiString<60> tariffId; + TariffKindEnum tariffKind; + std::optional validFrom; + std::optional> evseIds; + std::optional>> idTokens; + std::optional customData; +}; +/// \brief Conversion from a given TariffAssignment \p k to a given json object \p j +void to_json(json& j, const TariffAssignment& k); + +/// \brief Conversion from a given json object \p j to a given TariffAssignment \p k +void from_json(const json& j, TariffAssignment& k); + +/// \brief Writes the string representation of the given TariffAssignment \p k to the given output stream \p os +/// \returns an output stream with the TariffAssignment written to +std::ostream& operator<<(std::ostream& os, const TariffAssignment& k); + struct GetVariableData { Component component; Variable variable; - std::optional customData; std::optional attributeType; + std::optional customData; }; /// \brief Conversion from a given GetVariableData \p k to a given json object \p j void to_json(json& j, const GetVariableData& k); @@ -358,7 +721,7 @@ void to_json(json& j, const GetVariableData& k); /// \brief Conversion from a given json object \p j to a given GetVariableData \p k void from_json(const json& j, GetVariableData& k); -// \brief Writes the string representation of the given GetVariableData \p k to the given output stream \p os +/// \brief Writes the string representation of the given GetVariableData \p k to the given output stream \p os /// \returns an output stream with the GetVariableData written to std::ostream& operator<<(std::ostream& os, const GetVariableData& k); @@ -366,10 +729,10 @@ struct GetVariableResult { GetVariableStatusEnum attributeStatus; Component component; Variable variable; - std::optional customData; std::optional attributeStatusInfo; std::optional attributeType; std::optional> attributeValue; + std::optional customData; }; /// \brief Conversion from a given GetVariableResult \p k to a given json object \p j void to_json(json& j, const GetVariableResult& k); @@ -377,15 +740,15 @@ void to_json(json& j, const GetVariableResult& k); /// \brief Conversion from a given json object \p j to a given GetVariableResult \p k void from_json(const json& j, GetVariableResult& k); -// \brief Writes the string representation of the given GetVariableResult \p k to the given output stream \p os +/// \brief Writes the string representation of the given GetVariableResult \p k to the given output stream \p os /// \returns an output stream with the GetVariableResult written to std::ostream& operator<<(std::ostream& os, const GetVariableResult& k); struct SignedMeterValue { - CiString<2500> signedMeterData; - CiString<50> signingMethod; + CiString<32768> signedMeterData; CiString<50> encodingMethod; - CiString<2500> publicKey; + std::optional> signingMethod; + std::optional> publicKey; std::optional customData; }; /// \brief Conversion from a given SignedMeterValue \p k to a given json object \p j @@ -394,14 +757,14 @@ void to_json(json& j, const SignedMeterValue& k); /// \brief Conversion from a given json object \p j to a given SignedMeterValue \p k void from_json(const json& j, SignedMeterValue& k); -// \brief Writes the string representation of the given SignedMeterValue \p k to the given output stream \p os +/// \brief Writes the string representation of the given SignedMeterValue \p k to the given output stream \p os /// \returns an output stream with the SignedMeterValue written to std::ostream& operator<<(std::ostream& os, const SignedMeterValue& k); struct UnitOfMeasure { - std::optional customData; std::optional> unit; std::optional multiplier; + std::optional customData; }; /// \brief Conversion from a given UnitOfMeasure \p k to a given json object \p j void to_json(json& j, const UnitOfMeasure& k); @@ -409,19 +772,19 @@ void to_json(json& j, const UnitOfMeasure& k); /// \brief Conversion from a given json object \p j to a given UnitOfMeasure \p k void from_json(const json& j, UnitOfMeasure& k); -// \brief Writes the string representation of the given UnitOfMeasure \p k to the given output stream \p os +/// \brief Writes the string representation of the given UnitOfMeasure \p k to the given output stream \p os /// \returns an output stream with the UnitOfMeasure written to std::ostream& operator<<(std::ostream& os, const UnitOfMeasure& k); struct SampledValue { float value; - std::optional customData; - std::optional context; std::optional measurand; + std::optional context; std::optional phase; std::optional location; std::optional signedMeterValue; std::optional unitOfMeasure; + std::optional customData; }; /// \brief Conversion from a given SampledValue \p k to a given json object \p j void to_json(json& j, const SampledValue& k); @@ -429,7 +792,7 @@ void to_json(json& j, const SampledValue& k); /// \brief Conversion from a given json object \p j to a given SampledValue \p k void from_json(const json& j, SampledValue& k); -// \brief Writes the string representation of the given SampledValue \p k to the given output stream \p os +/// \brief Writes the string representation of the given SampledValue \p k to the given output stream \p os /// \returns an output stream with the SampledValue written to std::ostream& operator<<(std::ostream& os, const SampledValue& k); @@ -444,14 +807,29 @@ void to_json(json& j, const MeterValue& k); /// \brief Conversion from a given json object \p j to a given MeterValue \p k void from_json(const json& j, MeterValue& k); -// \brief Writes the string representation of the given MeterValue \p k to the given output stream \p os +/// \brief Writes the string representation of the given MeterValue \p k to the given output stream \p os /// \returns an output stream with the MeterValue written to std::ostream& operator<<(std::ostream& os, const MeterValue& k); +struct LimitAtSoC { + int32_t soc; + float limit; + std::optional customData; +}; +/// \brief Conversion from a given LimitAtSoC \p k to a given json object \p j +void to_json(json& j, const LimitAtSoC& k); + +/// \brief Conversion from a given json object \p j to a given LimitAtSoC \p k +void from_json(const json& j, LimitAtSoC& k); + +/// \brief Writes the string representation of the given LimitAtSoC \p k to the given output stream \p os +/// \returns an output stream with the LimitAtSoC written to +std::ostream& operator<<(std::ostream& os, const LimitAtSoC& k); + struct RelativeTimeInterval { int32_t start; - std::optional customData; std::optional duration; + std::optional customData; }; /// \brief Conversion from a given RelativeTimeInterval \p k to a given json object \p j void to_json(json& j, const RelativeTimeInterval& k); @@ -459,15 +837,15 @@ void to_json(json& j, const RelativeTimeInterval& k); /// \brief Conversion from a given json object \p j to a given RelativeTimeInterval \p k void from_json(const json& j, RelativeTimeInterval& k); -// \brief Writes the string representation of the given RelativeTimeInterval \p k to the given output stream \p os +/// \brief Writes the string representation of the given RelativeTimeInterval \p k to the given output stream \p os /// \returns an output stream with the RelativeTimeInterval written to std::ostream& operator<<(std::ostream& os, const RelativeTimeInterval& k); struct Cost { CostKindEnum costKind; int32_t amount; - std::optional customData; std::optional amountMultiplier; + std::optional customData; }; /// \brief Conversion from a given Cost \p k to a given json object \p j void to_json(json& j, const Cost& k); @@ -475,7 +853,7 @@ void to_json(json& j, const Cost& k); /// \brief Conversion from a given json object \p j to a given Cost \p k void from_json(const json& j, Cost& k); -// \brief Writes the string representation of the given Cost \p k to the given output stream \p os +/// \brief Writes the string representation of the given Cost \p k to the given output stream \p os /// \returns an output stream with the Cost written to std::ostream& operator<<(std::ostream& os, const Cost& k); @@ -490,15 +868,15 @@ void to_json(json& j, const ConsumptionCost& k); /// \brief Conversion from a given json object \p j to a given ConsumptionCost \p k void from_json(const json& j, ConsumptionCost& k); -// \brief Writes the string representation of the given ConsumptionCost \p k to the given output stream \p os +/// \brief Writes the string representation of the given ConsumptionCost \p k to the given output stream \p os /// \returns an output stream with the ConsumptionCost written to std::ostream& operator<<(std::ostream& os, const ConsumptionCost& k); struct SalesTariffEntry { RelativeTimeInterval relativeTimeInterval; - std::optional customData; std::optional ePriceLevel; std::optional> consumptionCost; + std::optional customData; }; /// \brief Conversion from a given SalesTariffEntry \p k to a given json object \p j void to_json(json& j, const SalesTariffEntry& k); @@ -506,16 +884,16 @@ void to_json(json& j, const SalesTariffEntry& k); /// \brief Conversion from a given json object \p j to a given SalesTariffEntry \p k void from_json(const json& j, SalesTariffEntry& k); -// \brief Writes the string representation of the given SalesTariffEntry \p k to the given output stream \p os +/// \brief Writes the string representation of the given SalesTariffEntry \p k to the given output stream \p os /// \returns an output stream with the SalesTariffEntry written to std::ostream& operator<<(std::ostream& os, const SalesTariffEntry& k); struct SalesTariff { int32_t id; std::vector salesTariffEntry; - std::optional customData; std::optional> salesTariffDescription; std::optional numEPriceLevels; + std::optional customData; }; /// \brief Conversion from a given SalesTariff \p k to a given json object \p j void to_json(json& j, const SalesTariff& k); @@ -523,19 +901,203 @@ void to_json(json& j, const SalesTariff& k); /// \brief Conversion from a given json object \p j to a given SalesTariff \p k void from_json(const json& j, SalesTariff& k); -// \brief Writes the string representation of the given SalesTariff \p k to the given output stream \p os +/// \brief Writes the string representation of the given SalesTariff \p k to the given output stream \p os /// \returns an output stream with the SalesTariff written to std::ostream& operator<<(std::ostream& os, const SalesTariff& k); +struct RationalNumber { + int32_t exponent; + int32_t value; + std::optional customData; +}; +/// \brief Conversion from a given RationalNumber \p k to a given json object \p j +void to_json(json& j, const RationalNumber& k); + +/// \brief Conversion from a given json object \p j to a given RationalNumber \p k +void from_json(const json& j, RationalNumber& k); + +/// \brief Writes the string representation of the given RationalNumber \p k to the given output stream \p os +/// \returns an output stream with the RationalNumber written to +std::ostream& operator<<(std::ostream& os, const RationalNumber& k); + +struct PriceRule { + RationalNumber energyFee; + RationalNumber powerRangeStart; + std::optional parkingFeePeriod; + std::optional carbonDioxideEmission; + std::optional renewableGenerationPercentage; + std::optional parkingFee; + std::optional customData; +}; +/// \brief Conversion from a given PriceRule \p k to a given json object \p j +void to_json(json& j, const PriceRule& k); + +/// \brief Conversion from a given json object \p j to a given PriceRule \p k +void from_json(const json& j, PriceRule& k); + +/// \brief Writes the string representation of the given PriceRule \p k to the given output stream \p os +/// \returns an output stream with the PriceRule written to +std::ostream& operator<<(std::ostream& os, const PriceRule& k); + +struct PriceRuleStack { + int32_t duration; + std::vector priceRule; + std::optional customData; +}; +/// \brief Conversion from a given PriceRuleStack \p k to a given json object \p j +void to_json(json& j, const PriceRuleStack& k); + +/// \brief Conversion from a given json object \p j to a given PriceRuleStack \p k +void from_json(const json& j, PriceRuleStack& k); + +/// \brief Writes the string representation of the given PriceRuleStack \p k to the given output stream \p os +/// \returns an output stream with the PriceRuleStack written to +std::ostream& operator<<(std::ostream& os, const PriceRuleStack& k); + +struct TaxRule { + int32_t taxRuleID; + bool appliesToEnergyFee; + bool appliesToParkingFee; + bool appliesToOverstayFee; + bool appliesToMinimumMaximumCost; + RationalNumber taxRate; + std::optional> taxRuleName; + std::optional taxIncludedInPrice; + std::optional customData; +}; +/// \brief Conversion from a given TaxRule \p k to a given json object \p j +void to_json(json& j, const TaxRule& k); + +/// \brief Conversion from a given json object \p j to a given TaxRule \p k +void from_json(const json& j, TaxRule& k); + +/// \brief Writes the string representation of the given TaxRule \p k to the given output stream \p os +/// \returns an output stream with the TaxRule written to +std::ostream& operator<<(std::ostream& os, const TaxRule& k); + +struct OverstayRule { + RationalNumber overstayFee; + int32_t startTime; + int32_t overstayFeePeriod; + std::optional> overstayRuleDescription; + std::optional customData; +}; +/// \brief Conversion from a given OverstayRule \p k to a given json object \p j +void to_json(json& j, const OverstayRule& k); + +/// \brief Conversion from a given json object \p j to a given OverstayRule \p k +void from_json(const json& j, OverstayRule& k); + +/// \brief Writes the string representation of the given OverstayRule \p k to the given output stream \p os +/// \returns an output stream with the OverstayRule written to +std::ostream& operator<<(std::ostream& os, const OverstayRule& k); + +struct OverstayRuleList { + std::vector overstayRule; + std::optional overstayPowerThreshold; + std::optional overstayTimeThreshold; + std::optional customData; +}; +/// \brief Conversion from a given OverstayRuleList \p k to a given json object \p j +void to_json(json& j, const OverstayRuleList& k); + +/// \brief Conversion from a given json object \p j to a given OverstayRuleList \p k +void from_json(const json& j, OverstayRuleList& k); + +/// \brief Writes the string representation of the given OverstayRuleList \p k to the given output stream \p os +/// \returns an output stream with the OverstayRuleList written to +std::ostream& operator<<(std::ostream& os, const OverstayRuleList& k); + +struct AdditionalSelectedServices { + RationalNumber serviceFee; + CiString<80> serviceName; + std::optional customData; +}; +/// \brief Conversion from a given AdditionalSelectedServices \p k to a given json object \p j +void to_json(json& j, const AdditionalSelectedServices& k); + +/// \brief Conversion from a given json object \p j to a given AdditionalSelectedServices \p k +void from_json(const json& j, AdditionalSelectedServices& k); + +/// \brief Writes the string representation of the given AdditionalSelectedServices \p k to the given output stream \p +/// os \returns an output stream with the AdditionalSelectedServices written to +std::ostream& operator<<(std::ostream& os, const AdditionalSelectedServices& k); + +struct AbsolutePriceSchedule { + ocpp::DateTime timeAnchor; + int32_t priceScheduleID; + CiString<3> currency; + CiString<8> language; + CiString<2000> priceAlgorithm; + std::vector priceRuleStacks; + std::optional> priceScheduleDescription; + std::optional minimumCost; + std::optional maximumCost; + std::optional> taxRules; + std::optional overstayRuleList; + std::optional> additionalSelectedServices; + std::optional customData; +}; +/// \brief Conversion from a given AbsolutePriceSchedule \p k to a given json object \p j +void to_json(json& j, const AbsolutePriceSchedule& k); + +/// \brief Conversion from a given json object \p j to a given AbsolutePriceSchedule \p k +void from_json(const json& j, AbsolutePriceSchedule& k); + +/// \brief Writes the string representation of the given AbsolutePriceSchedule \p k to the given output stream \p os +/// \returns an output stream with the AbsolutePriceSchedule written to +std::ostream& operator<<(std::ostream& os, const AbsolutePriceSchedule& k); + +struct PriceLevelScheduleEntry { + int32_t duration; + int32_t priceLevel; + std::optional customData; +}; +/// \brief Conversion from a given PriceLevelScheduleEntry \p k to a given json object \p j +void to_json(json& j, const PriceLevelScheduleEntry& k); + +/// \brief Conversion from a given json object \p j to a given PriceLevelScheduleEntry \p k +void from_json(const json& j, PriceLevelScheduleEntry& k); + +/// \brief Writes the string representation of the given PriceLevelScheduleEntry \p k to the given output stream \p os +/// \returns an output stream with the PriceLevelScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const PriceLevelScheduleEntry& k); + +struct PriceLevelSchedule { + std::vector priceLevelScheduleEntries; + ocpp::DateTime timeAnchor; + int32_t priceScheduleId; + int32_t numberOfPriceLevels; + std::optional> priceScheduleDescription; + std::optional customData; +}; +/// \brief Conversion from a given PriceLevelSchedule \p k to a given json object \p j +void to_json(json& j, const PriceLevelSchedule& k); + +/// \brief Conversion from a given json object \p j to a given PriceLevelSchedule \p k +void from_json(const json& j, PriceLevelSchedule& k); + +/// \brief Writes the string representation of the given PriceLevelSchedule \p k to the given output stream \p os +/// \returns an output stream with the PriceLevelSchedule written to +std::ostream& operator<<(std::ostream& os, const PriceLevelSchedule& k); + struct ChargingSchedule { int32_t id; ChargingRateUnitEnum chargingRateUnit; std::vector chargingSchedulePeriod; - std::optional customData; + std::optional limitAtSoC; std::optional startSchedule; std::optional duration; std::optional minChargingRate; + std::optional powerTolerance; + std::optional signatureId; + std::optional> digestValue; + std::optional useLocalTime; + std::optional randomizedDelay; std::optional salesTariff; + std::optional absolutePriceSchedule; + std::optional priceLevelSchedule; + std::optional customData; }; /// \brief Conversion from a given ChargingSchedule \p k to a given json object \p j void to_json(json& j, const ChargingSchedule& k); @@ -543,14 +1105,15 @@ void to_json(json& j, const ChargingSchedule& k); /// \brief Conversion from a given json object \p j to a given ChargingSchedule \p k void from_json(const json& j, ChargingSchedule& k); -// \brief Writes the string representation of the given ChargingSchedule \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingSchedule \p k to the given output stream \p os /// \returns an output stream with the ChargingSchedule written to std::ostream& operator<<(std::ostream& os, const ChargingSchedule& k); struct ChargingLimit { - ChargingLimitSourceEnum chargingLimitSource; - std::optional customData; + CiString<20> chargingLimitSource; + std::optional isLocalGeneration; std::optional isGridCritical; + std::optional customData; }; /// \brief Conversion from a given ChargingLimit \p k to a given json object \p j void to_json(json& j, const ChargingLimit& k); @@ -558,7 +1121,7 @@ void to_json(json& j, const ChargingLimit& k); /// \brief Conversion from a given json object \p j to a given ChargingLimit \p k void from_json(const json& j, ChargingLimit& k); -// \brief Writes the string representation of the given ChargingLimit \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingLimit \p k to the given output stream \p os /// \returns an output stream with the ChargingLimit written to std::ostream& operator<<(std::ostream& os, const ChargingLimit& k); @@ -566,12 +1129,13 @@ struct MessageInfo { int32_t id; MessagePriorityEnum priority; MessageContent message; - std::optional customData; std::optional display; std::optional state; std::optional startDateTime; std::optional endDateTime; std::optional> transactionId; + std::optional> messageExtra; + std::optional customData; }; /// \brief Conversion from a given MessageInfo \p k to a given json object \p j void to_json(json& j, const MessageInfo& k); @@ -579,15 +1143,15 @@ void to_json(json& j, const MessageInfo& k); /// \brief Conversion from a given json object \p j to a given MessageInfo \p k void from_json(const json& j, MessageInfo& k); -// \brief Writes the string representation of the given MessageInfo \p k to the given output stream \p os +/// \brief Writes the string representation of the given MessageInfo \p k to the given output stream \p os /// \returns an output stream with the MessageInfo written to std::ostream& operator<<(std::ostream& os, const MessageInfo& k); struct ACChargingParameters { - int32_t energyAmount; - int32_t evMinCurrent; - int32_t evMaxCurrent; - int32_t evMaxVoltage; + float energyAmount; + float evMinCurrent; + float evMaxCurrent; + float evMaxVoltage; std::optional customData; }; /// \brief Conversion from a given ACChargingParameters \p k to a given json object \p j @@ -596,20 +1160,166 @@ void to_json(json& j, const ACChargingParameters& k); /// \brief Conversion from a given json object \p j to a given ACChargingParameters \p k void from_json(const json& j, ACChargingParameters& k); -// \brief Writes the string representation of the given ACChargingParameters \p k to the given output stream \p os +/// \brief Writes the string representation of the given ACChargingParameters \p k to the given output stream \p os /// \returns an output stream with the ACChargingParameters written to std::ostream& operator<<(std::ostream& os, const ACChargingParameters& k); -struct DCChargingParameters { - int32_t evMaxCurrent; - int32_t evMaxVoltage; +struct DERChargingParameters { + std::optional> evSupportedDERControl; + std::optional evOverExcitedMaxDischargePower; + std::optional evOverExcitedPowerFactor; + std::optional evUnderExcitedMaxDischargePower; + std::optional evUnderExcitedPowerFactor; + std::optional maxApparentPower; + std::optional maxChargeApparentPower; + std::optional maxChargeApparentPower_L2; + std::optional maxChargeApparentPower_L3; + std::optional maxDischargeApparentPower; + std::optional maxDischargeApparentPower_L2; + std::optional maxDischargeApparentPower_L3; + std::optional maxChargeReactivePower; + std::optional maxChargeReactivePower_L2; + std::optional maxChargeReactivePower_L3; + std::optional minChargeReactivePower; + std::optional minChargeReactivePower_L2; + std::optional minChargeReactivePower_L3; + std::optional maxDischargeReactivePower; + std::optional maxDischargeReactivePower_L2; + std::optional maxDischargeReactivePower_L3; + std::optional minDischargeReactivePower; + std::optional minDischargeReactivePower_L2; + std::optional minDischargeReactivePower_L3; + std::optional nominalVoltage; + std::optional nominalVoltageOffset; + std::optional maxNominalVoltage; + std::optional minNominalVoltage; + std::optional> evInverterManufacturer; + std::optional> evInverterModel; + std::optional> evInverterSerialNumber; + std::optional> evInverterSwVersion; + std::optional> evInverterHwVersion; + std::optional> evIslandingDetectionMethod; + std::optional evIslandingTripTime; + std::optional evMaximumLevel1DCInjection; + std::optional evDurationLevel1DCInjection; + std::optional evMaximumLevel2DCInjection; + std::optional evDurationLevel2DCInjection; + std::optional evReactiveSusceptance; + std::optional evSessionTotalDischargeEnergyAvailable; + std::optional customData; +}; +/// \brief Conversion from a given DERChargingParameters \p k to a given json object \p j +void to_json(json& j, const DERChargingParameters& k); + +/// \brief Conversion from a given json object \p j to a given DERChargingParameters \p k +void from_json(const json& j, DERChargingParameters& k); + +/// \brief Writes the string representation of the given DERChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the DERChargingParameters written to +std::ostream& operator<<(std::ostream& os, const DERChargingParameters& k); + +struct EVPriceRule { + float energyFee; + float powerRangeStart; + std::optional customData; +}; +/// \brief Conversion from a given EVPriceRule \p k to a given json object \p j +void to_json(json& j, const EVPriceRule& k); + +/// \brief Conversion from a given json object \p j to a given EVPriceRule \p k +void from_json(const json& j, EVPriceRule& k); + +/// \brief Writes the string representation of the given EVPriceRule \p k to the given output stream \p os +/// \returns an output stream with the EVPriceRule written to +std::ostream& operator<<(std::ostream& os, const EVPriceRule& k); + +struct EVAbsolutePriceScheduleEntry { + int32_t duration; + std::vector evPriceRule; + std::optional customData; +}; +/// \brief Conversion from a given EVAbsolutePriceScheduleEntry \p k to a given json object \p j +void to_json(json& j, const EVAbsolutePriceScheduleEntry& k); + +/// \brief Conversion from a given json object \p j to a given EVAbsolutePriceScheduleEntry \p k +void from_json(const json& j, EVAbsolutePriceScheduleEntry& k); + +/// \brief Writes the string representation of the given EVAbsolutePriceScheduleEntry \p k to the given output stream \p +/// os \returns an output stream with the EVAbsolutePriceScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const EVAbsolutePriceScheduleEntry& k); + +struct EVAbsolutePriceSchedule { + ocpp::DateTime timeAnchor; + CiString<3> currency; + std::vector evAbsolutePriceScheduleEntries; + CiString<2000> priceAlgorithm; std::optional customData; - std::optional energyAmount; - std::optional evMaxPower; +}; +/// \brief Conversion from a given EVAbsolutePriceSchedule \p k to a given json object \p j +void to_json(json& j, const EVAbsolutePriceSchedule& k); + +/// \brief Conversion from a given json object \p j to a given EVAbsolutePriceSchedule \p k +void from_json(const json& j, EVAbsolutePriceSchedule& k); + +/// \brief Writes the string representation of the given EVAbsolutePriceSchedule \p k to the given output stream \p os +/// \returns an output stream with the EVAbsolutePriceSchedule written to +std::ostream& operator<<(std::ostream& os, const EVAbsolutePriceSchedule& k); + +struct EVPowerScheduleEntry { + int32_t duration; + float power; + std::optional customData; +}; +/// \brief Conversion from a given EVPowerScheduleEntry \p k to a given json object \p j +void to_json(json& j, const EVPowerScheduleEntry& k); + +/// \brief Conversion from a given json object \p j to a given EVPowerScheduleEntry \p k +void from_json(const json& j, EVPowerScheduleEntry& k); + +/// \brief Writes the string representation of the given EVPowerScheduleEntry \p k to the given output stream \p os +/// \returns an output stream with the EVPowerScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const EVPowerScheduleEntry& k); + +struct EVPowerSchedule { + std::vector evPowerScheduleEntries; + ocpp::DateTime timeAnchor; + std::optional customData; +}; +/// \brief Conversion from a given EVPowerSchedule \p k to a given json object \p j +void to_json(json& j, const EVPowerSchedule& k); + +/// \brief Conversion from a given json object \p j to a given EVPowerSchedule \p k +void from_json(const json& j, EVPowerSchedule& k); + +/// \brief Writes the string representation of the given EVPowerSchedule \p k to the given output stream \p os +/// \returns an output stream with the EVPowerSchedule written to +std::ostream& operator<<(std::ostream& os, const EVPowerSchedule& k); + +struct EVEnergyOffer { + EVPowerSchedule evPowerSchedule; + std::optional evAbsolutePriceSchedule; + std::optional customData; +}; +/// \brief Conversion from a given EVEnergyOffer \p k to a given json object \p j +void to_json(json& j, const EVEnergyOffer& k); + +/// \brief Conversion from a given json object \p j to a given EVEnergyOffer \p k +void from_json(const json& j, EVEnergyOffer& k); + +/// \brief Writes the string representation of the given EVEnergyOffer \p k to the given output stream \p os +/// \returns an output stream with the EVEnergyOffer written to +std::ostream& operator<<(std::ostream& os, const EVEnergyOffer& k); + +struct DCChargingParameters { + float evMaxCurrent; + float evMaxVoltage; + std::optional evMaxPower; + std::optional evEnergyCapacity; + std::optional energyAmount; std::optional stateOfCharge; - std::optional evEnergyCapacity; std::optional fullSoC; std::optional bulkSoC; + std::optional customData; }; /// \brief Conversion from a given DCChargingParameters \p k to a given json object \p j void to_json(json& j, const DCChargingParameters& k); @@ -617,16 +1327,59 @@ void to_json(json& j, const DCChargingParameters& k); /// \brief Conversion from a given json object \p j to a given DCChargingParameters \p k void from_json(const json& j, DCChargingParameters& k); -// \brief Writes the string representation of the given DCChargingParameters \p k to the given output stream \p os +/// \brief Writes the string representation of the given DCChargingParameters \p k to the given output stream \p os /// \returns an output stream with the DCChargingParameters written to std::ostream& operator<<(std::ostream& os, const DCChargingParameters& k); +struct V2XChargingParameters { + std::optional minChargePower; + std::optional minChargePower_L2; + std::optional minChargePower_L3; + std::optional maxChargePower; + std::optional maxChargePower_L2; + std::optional maxChargePower_L3; + std::optional minDischargePower; + std::optional minDischargePower_L2; + std::optional minDischargePower_L3; + std::optional maxDischargePower; + std::optional maxDischargePower_L2; + std::optional maxDischargePower_L3; + std::optional minChargeCurrent; + std::optional maxChargeCurrent; + std::optional minDischargeCurrent; + std::optional maxDischargeCurrent; + std::optional minVoltage; + std::optional maxVoltage; + std::optional evTargetEnergyRequest; + std::optional evMinEnergyRequest; + std::optional evMaxEnergyRequest; + std::optional evMinV2XEnergyRequest; + std::optional evMaxV2XEnergyRequest; + std::optional targetSoC; + std::optional customData; +}; +/// \brief Conversion from a given V2XChargingParameters \p k to a given json object \p j +void to_json(json& j, const V2XChargingParameters& k); + +/// \brief Conversion from a given json object \p j to a given V2XChargingParameters \p k +void from_json(const json& j, V2XChargingParameters& k); + +/// \brief Writes the string representation of the given V2XChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the V2XChargingParameters written to +std::ostream& operator<<(std::ostream& os, const V2XChargingParameters& k); + struct ChargingNeeds { EnergyTransferModeEnum requestedEnergyTransfer; - std::optional customData; std::optional acChargingParameters; + std::optional derChargingParameters; + std::optional evEnergyOffer; std::optional dcChargingParameters; + std::optional v2xChargingParameters; + std::optional> availableEnergyTransfer; + std::optional controlMode; + std::optional mobilityNeedsMode; std::optional departureTime; + std::optional customData; }; /// \brief Conversion from a given ChargingNeeds \p k to a given json object \p j void to_json(json& j, const ChargingNeeds& k); @@ -634,7 +1387,7 @@ void to_json(json& j, const ChargingNeeds& k); /// \brief Conversion from a given json object \p j to a given ChargingNeeds \p k void from_json(const json& j, ChargingNeeds& k); -// \brief Writes the string representation of the given ChargingNeeds \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingNeeds \p k to the given output stream \p os /// \returns an output stream with the ChargingNeeds written to std::ostream& operator<<(std::ostream& os, const ChargingNeeds& k); @@ -646,13 +1399,14 @@ struct EventData { Component component; EventNotificationEnum eventNotificationType; Variable variable; - std::optional customData; std::optional cause; std::optional> techCode; std::optional> techInfo; std::optional cleared; std::optional> transactionId; std::optional variableMonitoringId; + std::optional severity; + std::optional customData; }; /// \brief Conversion from a given EventData \p k to a given json object \p j void to_json(json& j, const EventData& k); @@ -660,7 +1414,7 @@ void to_json(json& j, const EventData& k); /// \brief Conversion from a given json object \p j to a given EventData \p k void from_json(const json& j, EventData& k); -// \brief Writes the string representation of the given EventData \p k to the given output stream \p os +/// \brief Writes the string representation of the given EventData \p k to the given output stream \p os /// \returns an output stream with the EventData written to std::ostream& operator<<(std::ostream& os, const EventData& k); @@ -670,6 +1424,7 @@ struct VariableMonitoring { float value; MonitorEnum type; int32_t severity; + EventNotificationEnum eventNotificationType; std::optional customData; }; /// \brief Conversion from a given VariableMonitoring \p k to a given json object \p j @@ -678,7 +1433,7 @@ void to_json(json& j, const VariableMonitoring& k); /// \brief Conversion from a given json object \p j to a given VariableMonitoring \p k void from_json(const json& j, VariableMonitoring& k); -// \brief Writes the string representation of the given VariableMonitoring \p k to the given output stream \p os +/// \brief Writes the string representation of the given VariableMonitoring \p k to the given output stream \p os /// \returns an output stream with the VariableMonitoring written to std::ostream& operator<<(std::ostream& os, const VariableMonitoring& k); @@ -694,17 +1449,49 @@ void to_json(json& j, const MonitoringData& k); /// \brief Conversion from a given json object \p j to a given MonitoringData \p k void from_json(const json& j, MonitoringData& k); -// \brief Writes the string representation of the given MonitoringData \p k to the given output stream \p os +/// \brief Writes the string representation of the given MonitoringData \p k to the given output stream \p os /// \returns an output stream with the MonitoringData written to std::ostream& operator<<(std::ostream& os, const MonitoringData& k); -struct VariableAttribute { +struct StreamDataElement { + float t; + CiString<2500> v; std::optional customData; +}; +/// \brief Conversion from a given StreamDataElement \p k to a given json object \p j +void to_json(json& j, const StreamDataElement& k); + +/// \brief Conversion from a given json object \p j to a given StreamDataElement \p k +void from_json(const json& j, StreamDataElement& k); + +/// \brief Writes the string representation of the given StreamDataElement \p k to the given output stream \p os +/// \returns an output stream with the StreamDataElement written to +std::ostream& operator<<(std::ostream& os, const StreamDataElement& k); + +struct NotifyPeriodicEventStream { + std::vector data; + int32_t id; + int32_t pending; + ocpp::DateTime basetime; + std::optional customData; +}; +/// \brief Conversion from a given NotifyPeriodicEventStream \p k to a given json object \p j +void to_json(json& j, const NotifyPeriodicEventStream& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPeriodicEventStream \p k +void from_json(const json& j, NotifyPeriodicEventStream& k); + +/// \brief Writes the string representation of the given NotifyPeriodicEventStream \p k to the given output stream \p os +/// \returns an output stream with the NotifyPeriodicEventStream written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStream& k); + +struct VariableAttribute { std::optional type; std::optional> value; std::optional mutability; std::optional persistent; std::optional constant; + std::optional customData; }; /// \brief Conversion from a given VariableAttribute \p k to a given json object \p j void to_json(json& j, const VariableAttribute& k); @@ -712,18 +1499,19 @@ void to_json(json& j, const VariableAttribute& k); /// \brief Conversion from a given json object \p j to a given VariableAttribute \p k void from_json(const json& j, VariableAttribute& k); -// \brief Writes the string representation of the given VariableAttribute \p k to the given output stream \p os +/// \brief Writes the string representation of the given VariableAttribute \p k to the given output stream \p os /// \returns an output stream with the VariableAttribute written to std::ostream& operator<<(std::ostream& os, const VariableAttribute& k); struct VariableCharacteristics { DataEnum dataType; bool supportsMonitoring; - std::optional customData; std::optional> unit; std::optional minLimit; std::optional maxLimit; + std::optional maxElements; std::optional> valuesList; + std::optional customData; }; /// \brief Conversion from a given VariableCharacteristics \p k to a given json object \p j void to_json(json& j, const VariableCharacteristics& k); @@ -731,7 +1519,7 @@ void to_json(json& j, const VariableCharacteristics& k); /// \brief Conversion from a given json object \p j to a given VariableCharacteristics \p k void from_json(const json& j, VariableCharacteristics& k); -// \brief Writes the string representation of the given VariableCharacteristics \p k to the given output stream \p os +/// \brief Writes the string representation of the given VariableCharacteristics \p k to the given output stream \p os /// \returns an output stream with the VariableCharacteristics written to std::ostream& operator<<(std::ostream& os, const VariableCharacteristics& k); @@ -739,8 +1527,8 @@ struct ReportData { Component component; Variable variable; std::vector variableAttribute; - std::optional customData; std::optional variableCharacteristics; + std::optional customData; }; /// \brief Conversion from a given ReportData \p k to a given json object \p j void to_json(json& j, const ReportData& k); @@ -748,21 +1536,70 @@ void to_json(json& j, const ReportData& k); /// \brief Conversion from a given json object \p j to a given ReportData \p k void from_json(const json& j, ReportData& k); -// \brief Writes the string representation of the given ReportData \p k to the given output stream \p os +/// \brief Writes the string representation of the given ReportData \p k to the given output stream \p os /// \returns an output stream with the ReportData written to std::ostream& operator<<(std::ostream& os, const ReportData& k); +struct Address { + CiString<50> name; + CiString<100> address1; + CiString<100> city; + CiString<50> country; + std::optional> address2; + std::optional> postalCode; + std::optional customData; +}; +/// \brief Conversion from a given Address \p k to a given json object \p j +void to_json(json& j, const Address& k); + +/// \brief Conversion from a given json object \p j to a given Address \p k +void from_json(const json& j, Address& k); + +/// \brief Writes the string representation of the given Address \p k to the given output stream \p os +/// \returns an output stream with the Address written to +std::ostream& operator<<(std::ostream& os, const Address& k); + +struct ChargingScheduleUpdate { + std::optional limit; + std::optional limit_L2; + std::optional limit_L3; + std::optional dischargeLimit; + std::optional dischargeLimit_L2; + std::optional dischargeLimit_L3; + std::optional setpoint; + std::optional setpoint_L2; + std::optional setpoint_L3; + std::optional setpointReactive; + std::optional setpointReactive_L2; + std::optional setpointReactive_L3; + std::optional customData; +}; +/// \brief Conversion from a given ChargingScheduleUpdate \p k to a given json object \p j +void to_json(json& j, const ChargingScheduleUpdate& k); + +/// \brief Conversion from a given json object \p j to a given ChargingScheduleUpdate \p k +void from_json(const json& j, ChargingScheduleUpdate& k); + +/// \brief Writes the string representation of the given ChargingScheduleUpdate \p k to the given output stream \p os +/// \returns an output stream with the ChargingScheduleUpdate written to +std::ostream& operator<<(std::ostream& os, const ChargingScheduleUpdate& k); + struct ChargingProfile { int32_t id; int32_t stackLevel; ChargingProfilePurposeEnum chargingProfilePurpose; ChargingProfileKindEnum chargingProfileKind; std::vector chargingSchedule; - std::optional customData; std::optional recurrencyKind; std::optional validFrom; std::optional validTo; std::optional> transactionId; + std::optional maxOfflineDuration; + std::optional invalidAfterOfflineDuration; + std::optional dynUpdateInterval; + std::optional dynUpdateTime; + std::optional> priceScheduleSignature; + std::optional customData; }; /// \brief Conversion from a given ChargingProfile \p k to a given json object \p j void to_json(json& j, const ChargingProfile& k); @@ -770,14 +1607,328 @@ void to_json(json& j, const ChargingProfile& k); /// \brief Conversion from a given json object \p j to a given ChargingProfile \p k void from_json(const json& j, ChargingProfile& k); -// \brief Writes the string representation of the given ChargingProfile \p k to the given output stream \p os +/// \brief Writes the string representation of the given ChargingProfile \p k to the given output stream \p os /// \returns an output stream with the ChargingProfile written to std::ostream& operator<<(std::ostream& os, const ChargingProfile& k); +struct DERCurvePoints { + float x; + float y; + std::optional customData; +}; +/// \brief Conversion from a given DERCurvePoints \p k to a given json object \p j +void to_json(json& j, const DERCurvePoints& k); + +/// \brief Conversion from a given json object \p j to a given DERCurvePoints \p k +void from_json(const json& j, DERCurvePoints& k); + +/// \brief Writes the string representation of the given DERCurvePoints \p k to the given output stream \p os +/// \returns an output stream with the DERCurvePoints written to +std::ostream& operator<<(std::ostream& os, const DERCurvePoints& k); + +struct Hysteresis { + std::optional hysteresisHigh; + std::optional hysteresisLow; + std::optional hysteresisDelay; + std::optional hysteresisGradient; + std::optional customData; +}; +/// \brief Conversion from a given Hysteresis \p k to a given json object \p j +void to_json(json& j, const Hysteresis& k); + +/// \brief Conversion from a given json object \p j to a given Hysteresis \p k +void from_json(const json& j, Hysteresis& k); + +/// \brief Writes the string representation of the given Hysteresis \p k to the given output stream \p os +/// \returns an output stream with the Hysteresis written to +std::ostream& operator<<(std::ostream& os, const Hysteresis& k); + +struct ReactivePowerParams { + std::optional vRef; + std::optional autonomousVRefEnable; + std::optional autonomousVRefTimeConstant; + std::optional customData; +}; +/// \brief Conversion from a given ReactivePowerParams \p k to a given json object \p j +void to_json(json& j, const ReactivePowerParams& k); + +/// \brief Conversion from a given json object \p j to a given ReactivePowerParams \p k +void from_json(const json& j, ReactivePowerParams& k); + +/// \brief Writes the string representation of the given ReactivePowerParams \p k to the given output stream \p os +/// \returns an output stream with the ReactivePowerParams written to +std::ostream& operator<<(std::ostream& os, const ReactivePowerParams& k); + +struct VoltageParams { + std::optional hv10MinMeanValue; + std::optional hv10MinMeanTripDelay; + std::optional powerDuringCessation; + std::optional customData; +}; +/// \brief Conversion from a given VoltageParams \p k to a given json object \p j +void to_json(json& j, const VoltageParams& k); + +/// \brief Conversion from a given json object \p j to a given VoltageParams \p k +void from_json(const json& j, VoltageParams& k); + +/// \brief Writes the string representation of the given VoltageParams \p k to the given output stream \p os +/// \returns an output stream with the VoltageParams written to +std::ostream& operator<<(std::ostream& os, const VoltageParams& k); + +struct DERCurve { + std::vector curveData; + int32_t priority; + DERUnitEnum yUnit; + std::optional hysteresis; + std::optional reactivePowerParams; + std::optional voltageParams; + std::optional responseTime; + std::optional startTime; + std::optional duration; + std::optional customData; +}; +/// \brief Conversion from a given DERCurve \p k to a given json object \p j +void to_json(json& j, const DERCurve& k); + +/// \brief Conversion from a given json object \p j to a given DERCurve \p k +void from_json(const json& j, DERCurve& k); + +/// \brief Writes the string representation of the given DERCurve \p k to the given output stream \p os +/// \returns an output stream with the DERCurve written to +std::ostream& operator<<(std::ostream& os, const DERCurve& k); + +struct DERCurveGet { + DERCurve curve; + CiString<36> id; + DERControlEnum curveType; + bool isDefault; + bool isSuperseded; + std::optional customData; +}; +/// \brief Conversion from a given DERCurveGet \p k to a given json object \p j +void to_json(json& j, const DERCurveGet& k); + +/// \brief Conversion from a given json object \p j to a given DERCurveGet \p k +void from_json(const json& j, DERCurveGet& k); + +/// \brief Writes the string representation of the given DERCurveGet \p k to the given output stream \p os +/// \returns an output stream with the DERCurveGet written to +std::ostream& operator<<(std::ostream& os, const DERCurveGet& k); + +struct EnterService { + int32_t priority; + float highVoltage; + float lowVoltage; + float highFreq; + float lowFreq; + std::optional delay; + std::optional randomDelay; + std::optional rampRate; + std::optional customData; +}; +/// \brief Conversion from a given EnterService \p k to a given json object \p j +void to_json(json& j, const EnterService& k); + +/// \brief Conversion from a given json object \p j to a given EnterService \p k +void from_json(const json& j, EnterService& k); + +/// \brief Writes the string representation of the given EnterService \p k to the given output stream \p os +/// \returns an output stream with the EnterService written to +std::ostream& operator<<(std::ostream& os, const EnterService& k); + +struct EnterServiceGet { + EnterService enterService; + CiString<36> id; + std::optional customData; +}; +/// \brief Conversion from a given EnterServiceGet \p k to a given json object \p j +void to_json(json& j, const EnterServiceGet& k); + +/// \brief Conversion from a given json object \p j to a given EnterServiceGet \p k +void from_json(const json& j, EnterServiceGet& k); + +/// \brief Writes the string representation of the given EnterServiceGet \p k to the given output stream \p os +/// \returns an output stream with the EnterServiceGet written to +std::ostream& operator<<(std::ostream& os, const EnterServiceGet& k); + +struct FixedPF { + int32_t priority; + float displacement; + bool excitation; + std::optional startTime; + std::optional duration; + std::optional customData; +}; +/// \brief Conversion from a given FixedPF \p k to a given json object \p j +void to_json(json& j, const FixedPF& k); + +/// \brief Conversion from a given json object \p j to a given FixedPF \p k +void from_json(const json& j, FixedPF& k); + +/// \brief Writes the string representation of the given FixedPF \p k to the given output stream \p os +/// \returns an output stream with the FixedPF written to +std::ostream& operator<<(std::ostream& os, const FixedPF& k); + +struct FixedPFGet { + FixedPF fixedPF; + CiString<36> id; + bool isDefault; + bool isSuperseded; + std::optional customData; +}; +/// \brief Conversion from a given FixedPFGet \p k to a given json object \p j +void to_json(json& j, const FixedPFGet& k); + +/// \brief Conversion from a given json object \p j to a given FixedPFGet \p k +void from_json(const json& j, FixedPFGet& k); + +/// \brief Writes the string representation of the given FixedPFGet \p k to the given output stream \p os +/// \returns an output stream with the FixedPFGet written to +std::ostream& operator<<(std::ostream& os, const FixedPFGet& k); + +struct FixedVar { + int32_t priority; + float setpoint; + DERUnitEnum unit; + std::optional startTime; + std::optional duration; + std::optional customData; +}; +/// \brief Conversion from a given FixedVar \p k to a given json object \p j +void to_json(json& j, const FixedVar& k); + +/// \brief Conversion from a given json object \p j to a given FixedVar \p k +void from_json(const json& j, FixedVar& k); + +/// \brief Writes the string representation of the given FixedVar \p k to the given output stream \p os +/// \returns an output stream with the FixedVar written to +std::ostream& operator<<(std::ostream& os, const FixedVar& k); + +struct FixedVarGet { + FixedVar fixedVar; + CiString<36> id; + bool isDefault; + bool isSuperseded; + std::optional customData; +}; +/// \brief Conversion from a given FixedVarGet \p k to a given json object \p j +void to_json(json& j, const FixedVarGet& k); + +/// \brief Conversion from a given json object \p j to a given FixedVarGet \p k +void from_json(const json& j, FixedVarGet& k); + +/// \brief Writes the string representation of the given FixedVarGet \p k to the given output stream \p os +/// \returns an output stream with the FixedVarGet written to +std::ostream& operator<<(std::ostream& os, const FixedVarGet& k); + +struct FreqDroop { + int32_t priority; + float overFreq; + float underFreq; + float overDroop; + float underDroop; + float responseTime; + std::optional startTime; + std::optional duration; + std::optional customData; +}; +/// \brief Conversion from a given FreqDroop \p k to a given json object \p j +void to_json(json& j, const FreqDroop& k); + +/// \brief Conversion from a given json object \p j to a given FreqDroop \p k +void from_json(const json& j, FreqDroop& k); + +/// \brief Writes the string representation of the given FreqDroop \p k to the given output stream \p os +/// \returns an output stream with the FreqDroop written to +std::ostream& operator<<(std::ostream& os, const FreqDroop& k); + +struct FreqDroopGet { + FreqDroop freqDroop; + CiString<36> id; + bool isDefault; + bool isSuperseded; + std::optional customData; +}; +/// \brief Conversion from a given FreqDroopGet \p k to a given json object \p j +void to_json(json& j, const FreqDroopGet& k); + +/// \brief Conversion from a given json object \p j to a given FreqDroopGet \p k +void from_json(const json& j, FreqDroopGet& k); + +/// \brief Writes the string representation of the given FreqDroopGet \p k to the given output stream \p os +/// \returns an output stream with the FreqDroopGet written to +std::ostream& operator<<(std::ostream& os, const FreqDroopGet& k); + +struct Gradient { + int32_t priority; + float gradient; + float softGradient; + std::optional customData; +}; +/// \brief Conversion from a given Gradient \p k to a given json object \p j +void to_json(json& j, const Gradient& k); + +/// \brief Conversion from a given json object \p j to a given Gradient \p k +void from_json(const json& j, Gradient& k); + +/// \brief Writes the string representation of the given Gradient \p k to the given output stream \p os +/// \returns an output stream with the Gradient written to +std::ostream& operator<<(std::ostream& os, const Gradient& k); + +struct GradientGet { + Gradient gradient; + CiString<36> id; + std::optional customData; +}; +/// \brief Conversion from a given GradientGet \p k to a given json object \p j +void to_json(json& j, const GradientGet& k); + +/// \brief Conversion from a given json object \p j to a given GradientGet \p k +void from_json(const json& j, GradientGet& k); + +/// \brief Writes the string representation of the given GradientGet \p k to the given output stream \p os +/// \returns an output stream with the GradientGet written to +std::ostream& operator<<(std::ostream& os, const GradientGet& k); + +struct LimitMaxDischarge { + int32_t priority; + std::optional pctMaxDischargePower; + std::optional powerMonitoringMustTrip; + std::optional startTime; + std::optional duration; + std::optional customData; +}; +/// \brief Conversion from a given LimitMaxDischarge \p k to a given json object \p j +void to_json(json& j, const LimitMaxDischarge& k); + +/// \brief Conversion from a given json object \p j to a given LimitMaxDischarge \p k +void from_json(const json& j, LimitMaxDischarge& k); + +/// \brief Writes the string representation of the given LimitMaxDischarge \p k to the given output stream \p os +/// \returns an output stream with the LimitMaxDischarge written to +std::ostream& operator<<(std::ostream& os, const LimitMaxDischarge& k); + +struct LimitMaxDischargeGet { + CiString<36> id; + bool isDefault; + bool isSuperseded; + LimitMaxDischarge limitMaxDischarge; + std::optional customData; +}; +/// \brief Conversion from a given LimitMaxDischargeGet \p k to a given json object \p j +void to_json(json& j, const LimitMaxDischargeGet& k); + +/// \brief Conversion from a given json object \p j to a given LimitMaxDischargeGet \p k +void from_json(const json& j, LimitMaxDischargeGet& k); + +/// \brief Writes the string representation of the given LimitMaxDischargeGet \p k to the given output stream \p os +/// \returns an output stream with the LimitMaxDischargeGet written to +std::ostream& operator<<(std::ostream& os, const LimitMaxDischargeGet& k); + struct AuthorizationData { IdToken idToken; - std::optional customData; std::optional idTokenInfo; + std::optional customData; }; /// \brief Conversion from a given AuthorizationData \p k to a given json object \p j void to_json(json& j, const AuthorizationData& k); @@ -785,19 +1936,19 @@ void to_json(json& j, const AuthorizationData& k); /// \brief Conversion from a given json object \p j to a given AuthorizationData \p k void from_json(const json& j, AuthorizationData& k); -// \brief Writes the string representation of the given AuthorizationData \p k to the given output stream \p os +/// \brief Writes the string representation of the given AuthorizationData \p k to the given output stream \p os /// \returns an output stream with the AuthorizationData written to std::ostream& operator<<(std::ostream& os, const AuthorizationData& k); struct APN { - CiString<512> apn; + CiString<2000> apn; APNAuthenticationEnum apnAuthentication; - std::optional customData; - std::optional> apnUserName; - std::optional> apnPassword; + std::optional> apnUserName; + std::optional> apnPassword; std::optional simPin; std::optional> preferredNetwork; std::optional useOnlyPreferredNetwork; + std::optional customData; }; /// \brief Conversion from a given APN \p k to a given json object \p j void to_json(json& j, const APN& k); @@ -805,18 +1956,18 @@ void to_json(json& j, const APN& k); /// \brief Conversion from a given json object \p j to a given APN \p k void from_json(const json& j, APN& k); -// \brief Writes the string representation of the given APN \p k to the given output stream \p os +/// \brief Writes the string representation of the given APN \p k to the given output stream \p os /// \returns an output stream with the APN written to std::ostream& operator<<(std::ostream& os, const APN& k); struct VPN { - CiString<512> server; - CiString<20> user; - CiString<20> password; + CiString<2000> server; + CiString<50> user; + CiString<64> password; CiString<255> key; VPNEnum type; + std::optional> group; std::optional customData; - std::optional> group; }; /// \brief Conversion from a given VPN \p k to a given json object \p j void to_json(json& j, const VPN& k); @@ -824,20 +1975,22 @@ void to_json(json& j, const VPN& k); /// \brief Conversion from a given json object \p j to a given VPN \p k void from_json(const json& j, VPN& k); -// \brief Writes the string representation of the given VPN \p k to the given output stream \p os +/// \brief Writes the string representation of the given VPN \p k to the given output stream \p os /// \returns an output stream with the VPN written to std::ostream& operator<<(std::ostream& os, const VPN& k); struct NetworkConnectionProfile { - OCPPVersionEnum ocppVersion; + OCPPInterfaceEnum ocppInterface; OCPPTransportEnum ocppTransport; - CiString<512> ocppCsmsUrl; int32_t messageTimeout; + CiString<2000> ocppCsmsUrl; int32_t securityProfile; - OCPPInterfaceEnum ocppInterface; - std::optional customData; std::optional apn; + std::optional ocppVersion; + std::optional> identity; + std::optional> basicAuthPassword; std::optional vpn; + std::optional customData; }; /// \brief Conversion from a given NetworkConnectionProfile \p k to a given json object \p j void to_json(json& j, const NetworkConnectionProfile& k); @@ -845,7 +1998,7 @@ void to_json(json& j, const NetworkConnectionProfile& k); /// \brief Conversion from a given json object \p j to a given NetworkConnectionProfile \p k void from_json(const json& j, NetworkConnectionProfile& k); -// \brief Writes the string representation of the given NetworkConnectionProfile \p k to the given output stream \p os +/// \brief Writes the string representation of the given NetworkConnectionProfile \p k to the given output stream \p os /// \returns an output stream with the NetworkConnectionProfile written to std::ostream& operator<<(std::ostream& os, const NetworkConnectionProfile& k); @@ -855,9 +2008,10 @@ struct SetMonitoringData { int32_t severity; Component component; Variable variable; - std::optional customData; std::optional id; + std::optional periodicEventStream; std::optional transaction; + std::optional customData; }; /// \brief Conversion from a given SetMonitoringData \p k to a given json object \p j void to_json(json& j, const SetMonitoringData& k); @@ -865,7 +2019,7 @@ void to_json(json& j, const SetMonitoringData& k); /// \brief Conversion from a given json object \p j to a given SetMonitoringData \p k void from_json(const json& j, SetMonitoringData& k); -// \brief Writes the string representation of the given SetMonitoringData \p k to the given output stream \p os +/// \brief Writes the string representation of the given SetMonitoringData \p k to the given output stream \p os /// \returns an output stream with the SetMonitoringData written to std::ostream& operator<<(std::ostream& os, const SetMonitoringData& k); @@ -875,9 +2029,9 @@ struct SetMonitoringResult { Component component; Variable variable; int32_t severity; - std::optional customData; std::optional id; std::optional statusInfo; + std::optional customData; }; /// \brief Conversion from a given SetMonitoringResult \p k to a given json object \p j void to_json(json& j, const SetMonitoringResult& k); @@ -885,22 +2039,16 @@ void to_json(json& j, const SetMonitoringResult& k); /// \brief Conversion from a given json object \p j to a given SetMonitoringResult \p k void from_json(const json& j, SetMonitoringResult& k); -// \brief Writes the string representation of the given SetMonitoringResult \p k to the given output stream \p os +/// \brief Writes the string representation of the given SetMonitoringResult \p k to the given output stream \p os /// \returns an output stream with the SetMonitoringResult written to std::ostream& operator<<(std::ostream& os, const SetMonitoringResult& k); -/// @brief The result of a configuration of a network profile. -struct ConfigNetworkResult { - std::optional interface_address; ///< ip address or interface string - bool success; ///< true if the configuration was successful -}; - struct SetVariableData { - CiString<1000> attributeValue; + CiString<2500> attributeValue; Component component; Variable variable; - std::optional customData; std::optional attributeType; + std::optional customData; }; /// \brief Conversion from a given SetVariableData \p k to a given json object \p j void to_json(json& j, const SetVariableData& k); @@ -908,7 +2056,7 @@ void to_json(json& j, const SetVariableData& k); /// \brief Conversion from a given json object \p j to a given SetVariableData \p k void from_json(const json& j, SetVariableData& k); -// \brief Writes the string representation of the given SetVariableData \p k to the given output stream \p os +/// \brief Writes the string representation of the given SetVariableData \p k to the given output stream \p os /// \returns an output stream with the SetVariableData written to std::ostream& operator<<(std::ostream& os, const SetVariableData& k); @@ -916,9 +2064,9 @@ struct SetVariableResult { SetVariableStatusEnum attributeStatus; Component component; Variable variable; - std::optional customData; std::optional attributeType; std::optional attributeStatusInfo; + std::optional customData; }; /// \brief Conversion from a given SetVariableResult \p k to a given json object \p j void to_json(json& j, const SetVariableResult& k); @@ -926,17 +2074,140 @@ void to_json(json& j, const SetVariableResult& k); /// \brief Conversion from a given json object \p j to a given SetVariableResult \p k void from_json(const json& j, SetVariableResult& k); -// \brief Writes the string representation of the given SetVariableResult \p k to the given output stream \p os +/// \brief Writes the string representation of the given SetVariableResult \p k to the given output stream \p os /// \returns an output stream with the SetVariableResult written to std::ostream& operator<<(std::ostream& os, const SetVariableResult& k); +struct CostDimension { + CostDimensionEnum type; + float volume; + std::optional customData; +}; +/// \brief Conversion from a given CostDimension \p k to a given json object \p j +void to_json(json& j, const CostDimension& k); + +/// \brief Conversion from a given json object \p j to a given CostDimension \p k +void from_json(const json& j, CostDimension& k); + +/// \brief Writes the string representation of the given CostDimension \p k to the given output stream \p os +/// \returns an output stream with the CostDimension written to +std::ostream& operator<<(std::ostream& os, const CostDimension& k); + +struct ChargingPeriod { + ocpp::DateTime startPeriod; + std::optional> dimensions; + std::optional> tariffId; + std::optional customData; +}; +/// \brief Conversion from a given ChargingPeriod \p k to a given json object \p j +void to_json(json& j, const ChargingPeriod& k); + +/// \brief Conversion from a given json object \p j to a given ChargingPeriod \p k +void from_json(const json& j, ChargingPeriod& k); + +/// \brief Writes the string representation of the given ChargingPeriod \p k to the given output stream \p os +/// \returns an output stream with the ChargingPeriod written to +std::ostream& operator<<(std::ostream& os, const ChargingPeriod& k); + +struct TotalPrice { + std::optional exclTax; + std::optional inclTax; + std::optional customData; +}; +/// \brief Conversion from a given TotalPrice \p k to a given json object \p j +void to_json(json& j, const TotalPrice& k); + +/// \brief Conversion from a given json object \p j to a given TotalPrice \p k +void from_json(const json& j, TotalPrice& k); + +/// \brief Writes the string representation of the given TotalPrice \p k to the given output stream \p os +/// \returns an output stream with the TotalPrice written to +std::ostream& operator<<(std::ostream& os, const TotalPrice& k); + +struct TotalCost { + CiString<3> currency; + TariffCostEnum typeOfCost; + TotalPrice total; + std::optional fixed; + std::optional energy; + std::optional chargingTime; + std::optional idleTime; + std::optional reservationTime; + std::optional reservationFixed; + std::optional customData; +}; +/// \brief Conversion from a given TotalCost \p k to a given json object \p j +void to_json(json& j, const TotalCost& k); + +/// \brief Conversion from a given json object \p j to a given TotalCost \p k +void from_json(const json& j, TotalCost& k); + +/// \brief Writes the string representation of the given TotalCost \p k to the given output stream \p os +/// \returns an output stream with the TotalCost written to +std::ostream& operator<<(std::ostream& os, const TotalCost& k); + +struct TotalUsage { + float energy; + int32_t chargingTime; + int32_t idleTime; + std::optional reservationTime; + std::optional customData; +}; +/// \brief Conversion from a given TotalUsage \p k to a given json object \p j +void to_json(json& j, const TotalUsage& k); + +/// \brief Conversion from a given json object \p j to a given TotalUsage \p k +void from_json(const json& j, TotalUsage& k); + +/// \brief Writes the string representation of the given TotalUsage \p k to the given output stream \p os +/// \returns an output stream with the TotalUsage written to +std::ostream& operator<<(std::ostream& os, const TotalUsage& k); + +struct CostDetails { + TotalCost totalCost; + TotalUsage totalUsage; + std::optional> chargingPeriods; + std::optional failureToCalculate; + std::optional> failureReason; + std::optional customData; +}; +/// \brief Conversion from a given CostDetails \p k to a given json object \p j +void to_json(json& j, const CostDetails& k); + +/// \brief Conversion from a given json object \p j to a given CostDetails \p k +void from_json(const json& j, CostDetails& k); + +/// \brief Writes the string representation of the given CostDetails \p k to the given output stream \p os +/// \returns an output stream with the CostDetails written to +std::ostream& operator<<(std::ostream& os, const CostDetails& k); + +struct TransactionLimit { + std::optional maxCost; + std::optional maxEnergy; + std::optional maxTime; + std::optional maxSoC; + std::optional customData; +}; +/// \brief Conversion from a given TransactionLimit \p k to a given json object \p j +void to_json(json& j, const TransactionLimit& k); + +/// \brief Conversion from a given json object \p j to a given TransactionLimit \p k +void from_json(const json& j, TransactionLimit& k); + +/// \brief Writes the string representation of the given TransactionLimit \p k to the given output stream \p os +/// \returns an output stream with the TransactionLimit written to +std::ostream& operator<<(std::ostream& os, const TransactionLimit& k); + struct Transaction { CiString<36> transactionId; - std::optional customData; std::optional chargingState; std::optional timeSpentCharging; std::optional stoppedReason; std::optional remoteStartId; + std::optional operationMode; + std::optional> tariffId; + std::optional transactionLimit; + std::optional customData; }; /// \brief Conversion from a given Transaction \p k to a given json object \p j void to_json(json& j, const Transaction& k); @@ -944,17 +2215,17 @@ void to_json(json& j, const Transaction& k); /// \brief Conversion from a given json object \p j to a given Transaction \p k void from_json(const json& j, Transaction& k); -// \brief Writes the string representation of the given Transaction \p k to the given output stream \p os +/// \brief Writes the string representation of the given Transaction \p k to the given output stream \p os /// \returns an output stream with the Transaction written to std::ostream& operator<<(std::ostream& os, const Transaction& k); struct Firmware { - CiString<512> location; + CiString<2000> location; ocpp::DateTime retrieveDateTime; - std::optional customData; std::optional installDateTime; std::optional> signingCertificate; std::optional> signature; + std::optional customData; }; /// \brief Conversion from a given Firmware \p k to a given json object \p j void to_json(json& j, const Firmware& k); @@ -962,11 +2233,10 @@ void to_json(json& j, const Firmware& k); /// \brief Conversion from a given json object \p j to a given Firmware \p k void from_json(const json& j, Firmware& k); -// \brief Writes the string representation of the given Firmware \p k to the given output stream \p os +/// \brief Writes the string representation of the given Firmware \p k to the given output stream \p os /// \returns an output stream with the Firmware written to std::ostream& operator<<(std::ostream& os, const Firmware& k); -struct RequiredComponentVariable : ComponentVariable {}; } // namespace v2 } // namespace ocpp diff --git a/include/ocpp/v2/types.hpp b/include/ocpp/v2/types.hpp index 854c45c0d..00cf18014 100644 --- a/include/ocpp/v2/types.hpp +++ b/include/ocpp/v2/types.hpp @@ -141,18 +141,71 @@ enum class MessageType { UnpublishFirmwareResponse, UpdateFirmware, UpdateFirmwareResponse, + AdjustPeriodicEventStream, + AdjustPeriodicEventStreamResponse, + AFRRSignal, + AFRRSignalResponse, + BatterySwap, + BatterySwapResponse, + ChangeTransactionTariff, + ChangeTransactionTariffResponse, + ClearDERControl, + ClearDERControlResponse, + ClearTariffs, + ClearTariffsResponse, + ClosePeriodicEventStream, + ClosePeriodicEventStreamResponse, + GetCRL, + GetCRLResponse, + GetDERControl, + GetDERControlResponse, + GetPeriodicEventStream, + GetPeriodicEventStreamResponse, + GetTariffs, + GetTariffsResponse, + NotifyAllowedEnergyTransfer, + NotifyAllowedEnergyTransferResponse, + NotifyCRL, + NotifyCRLResponse, + NotifyDERAlarm, + NotifyDERAlarmResponse, + NotifyDERStartStop, + NotifyDERStartStopResponse, + NotifyPeriodicEventStream, + NotifyPeriodicEventStreamResponse, + NotifyPriorityCharging, + NotifyPriorityChargingResponse, + NotifyQRCodeScanned, + NotifyQRCodeScannedResponse, + NotifySettlement, + NotifySettlementResponse, + OpenPeriodicEventStream, + OpenPeriodicEventStreamResponse, + PullDynamicScheduleUpdate, + PullDynamicScheduleUpdateResponse, + RequestBatterySwap, + RequestBatterySwapResponse, + SetDefaultTariff, + SetDefaultTariffResponse, + SetDERControl, + SetDERControlResponse, + UpdateDynamicSchedule, + UpdateDynamicScheduleResponse, + UsePriorityCharging, + UsePriorityChargingResponse, + VatNumberValidation, + VatNumberValidationResponse, InternalError, // not in spec, for internal use }; /// \brief This enhances the ChargingProfile type by additional paramaters that are required in the -/// ReportChargingProfilesRequest (EvseId, ChargingLimitSourceEnum) +/// ReportChargingProfilesRequest (EvseId, ChargingLimitSource) struct ReportedChargingProfile { ChargingProfile profile; int32_t evse_id; - ChargingLimitSourceEnum source; + CiString<20> source; - ReportedChargingProfile(const ChargingProfile& profile, const int32_t evse_id, - const ChargingLimitSourceEnum source) : + ReportedChargingProfile(const ChargingProfile& profile, const int32_t evse_id, const CiString<20> source) : profile(profile), evse_id(evse_id), source(source) { } }; @@ -172,6 +225,63 @@ MessageType string_to_messagetype(const std::string& s); /// \returns an output stream with the MessageType written to std::ostream& operator<<(std::ostream& os, const MessageType& message_type); +namespace ChargingLimitSourceEnumStringType { +inline const CiString<20> EMS = "EMS"; +inline const CiString<20> OTHER = "Other"; +inline const CiString<20> SO = "SO"; +inline const CiString<20> CSO = "CSO"; +} // namespace ChargingLimitSourceEnumStringType + +namespace IdTokenEnumStringType { +inline const CiString<20> Value = "Value"; +inline const CiString<20> Central = "Central"; +inline const CiString<20> DirectPayment = "DirectPayment"; +inline const CiString<20> eMAID = "eMAID"; +inline const CiString<20> EVCCID = "EVCCID"; +inline const CiString<20> ISO14443 = "ISO14443"; +inline const CiString<20> ISO15693 = "ISO15693"; +inline const CiString<20> KeyCode = "KeyCode"; +inline const CiString<20> Local = "Local"; +inline const CiString<20> MacAddress = "MacAddress"; +inline const CiString<20> NEMA = "NEMA"; +inline const CiString<20> NoAuthorization = "NoAuthorization"; +inline const CiString<20> VIN = "VIN"; +} // namespace IdTokenEnumStringType + +namespace ConnectorEnumStringType { +inline const CiString<20> cCCS1 = "cCCS1"; // Combined Charging System 1 (captive cabled) a.k.a. Combo 1 +inline const CiString<20> cCCS2 = "cCCS2"; // Combined Charging System 2 (captive cabled) a.k.a. Combo 2 +inline const CiString<20> cChaoJi = "cChaoJi"; // ChaoJi (captive cabled) a.k.a. CHAdeMO 3.0 +inline const CiString<20> cG105 = "cG105"; // JARI G105-1993 (captive cabled) a.k.a. CHAdeMO (captive cabled) +inline const CiString<20> cGBT_DC = "cGBT-DC"; // GB/T 20234.3 DC connector (captive cabled) +inline const CiString<20> cLECCS = "cLECCS"; // Light Equipment Combined Charging System IS17017 (captive cabled) +inline const CiString<20> cMCS = "cMCS"; // Megawatt Charging System (captive cabled) +inline const CiString<20> cNACS = "cNACS"; // North American Charging Standard (captive cabled) +inline const CiString<20> cNACS_CCS1 = "cNACS-CCS1"; // Tesla MagicDock with built-in NACS to CCS1 adapter +inline const CiString<20> cTesla = "cTesla"; // Tesla Connector (captive cabled) +inline const CiString<20> cType1 = "cType1"; // IEC62196-2 Type 1 connector (captive cabled) a.k.a. J1772 +inline const CiString<20> cType2 = "cType2"; // IEC62196-2 Type 2 connector (captive cabled) a.k.a. Mennekes connector +inline const CiString<20> cUltraChaoJi = "cUltraChaoJi"; // Ultra-ChaoJi for megawatt charging +inline const CiString<20> s309_1P_16A = "s309-1P-16A "; // 16A 1 phase IEC60309 socket +inline const CiString<20> s309_1P_32A = "s309-1P-32A "; // 32A 1 phase IEC60309 socket +inline const CiString<20> s309_3P_16A = "s309-3P-16A"; // 16A 3 phase IEC60309 socket +inline const CiString<20> s309_3P_32A = "s309-3P-32A"; // 32A 3 phase IEC60309 socket +inline const CiString<20> sBS1361 = "sBS1361"; // UK domestic socket a.k.a. 13Amp +inline const CiString<20> sCEE_7_7 = "sCEE-7-7"; // CEE 7/7 16A socket. May represent 7/4 and 7/5 a.k.a Schuko +inline const CiString<20> sType2 = "sType2"; // IEC62196-2 Type 2 socket a.k.a. Mennekes connector +inline const CiString<20> sType3 = "sType3"; // IEC62196-2 Type 3 socket a.k.a. Scame +inline const CiString<20> wInductive = "wInductive"; // Wireless inductively coupled connection (generic) +inline const CiString<20> wResonant = "wResonant"; // Wireless resonant coupled connection (generic) +inline const CiString<20> Other1PhMax16A = + "Other1PhMax16A"; // Other single phase (domestic) sockets not mentioned above, rated at no more than 16A. CEE7/17, + // AS3112, NEMA 5-15, NEMA 5-20, JISC8303, TIS166, SI 32, CPCS-CCC, SEV1011, etc. +inline const CiString<20> Other1PhOver16A = + "Other1PhOver16A"; // Other single phase sockets not mentioned above (over 16A) +inline const CiString<20> Other3Ph = "Other3Ph"; // Other 3 phase sockets not mentioned above. NEMA14-30, NEMA14-50. +inline const CiString<20> Pan = "Pan"; // Pantograph connector +inline const CiString<20> Undetermined = "Undetermined"; // Yet to be determined (e.g. before plugged in) +inline const CiString<20> Unknown = "Unknown"; // Unknown/not determinable +} // namespace ConnectorEnumStringType } // namespace v2 } // namespace ocpp diff --git a/include/ocpp/v2/utils.hpp b/include/ocpp/v2/utils.hpp index 5281c3e18..6a6998bea 100644 --- a/include/ocpp/v2/utils.hpp +++ b/include/ocpp/v2/utils.hpp @@ -74,6 +74,9 @@ bool is_critical(const std::string& security_event); /// \brief Converts the given \p csl of ChargingProfilePurpose strings into a std::vector std::vector get_purposes_to_ignore(const std::string& csl, const bool is_offline); +/// \brief Converts the given \p csl of OcppProtocolVersion strings into a std::vector +std::vector get_ocpp_protocol_versions(const std::string& csl); + } // namespace utils } // namespace v2 } // namespace ocpp diff --git a/include/ocpp/v21/messages/AFRRSignal.hpp b/include/ocpp/v21/messages/AFRRSignal.hpp new file mode 100644 index 000000000..e4618b458 --- /dev/null +++ b/include/ocpp/v21/messages/AFRRSignal.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_AFRRSIGNAL_HPP +#define OCPP_V21_AFRRSIGNAL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP AFRRSignal message +struct AFRRSignalRequest : public ocpp::Message { + ocpp::DateTime timestamp; + int32_t signal; + std::optional customData; + + /// \brief Provides the type of this AFRRSignal message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given AFRRSignalRequest \p k to a given json object \p j +void to_json(json& j, const AFRRSignalRequest& k); + +/// \brief Conversion from a given json object \p j to a given AFRRSignalRequest \p k +void from_json(const json& j, AFRRSignalRequest& k); + +/// \brief Writes the string representation of the given AFRRSignalRequest \p k to the given output stream \p os +/// \returns an output stream with the AFRRSignalRequest written to +std::ostream& operator<<(std::ostream& os, const AFRRSignalRequest& k); + +/// \brief Contains a OCPP AFRRSignalResponse message +struct AFRRSignalResponse : public ocpp::Message { + GenericStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this AFRRSignalResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given AFRRSignalResponse \p k to a given json object \p j +void to_json(json& j, const AFRRSignalResponse& k); + +/// \brief Conversion from a given json object \p j to a given AFRRSignalResponse \p k +void from_json(const json& j, AFRRSignalResponse& k); + +/// \brief Writes the string representation of the given AFRRSignalResponse \p k to the given output stream \p os +/// \returns an output stream with the AFRRSignalResponse written to +std::ostream& operator<<(std::ostream& os, const AFRRSignalResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_AFRRSIGNAL_HPP diff --git a/include/ocpp/v21/messages/AdjustPeriodicEventStream.hpp b/include/ocpp/v21/messages/AdjustPeriodicEventStream.hpp new file mode 100644 index 000000000..9a167c523 --- /dev/null +++ b/include/ocpp/v21/messages/AdjustPeriodicEventStream.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_ADJUSTPERIODICEVENTSTREAM_HPP +#define OCPP_V21_ADJUSTPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP AdjustPeriodicEventStream message +struct AdjustPeriodicEventStreamRequest : public ocpp::Message { + int32_t id; + PeriodicEventStreamParams params; + std::optional customData; + + /// \brief Provides the type of this AdjustPeriodicEventStream message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given AdjustPeriodicEventStreamRequest \p k to a given json object \p j +void to_json(json& j, const AdjustPeriodicEventStreamRequest& k); + +/// \brief Conversion from a given json object \p j to a given AdjustPeriodicEventStreamRequest \p k +void from_json(const json& j, AdjustPeriodicEventStreamRequest& k); + +/// \brief Writes the string representation of the given AdjustPeriodicEventStreamRequest \p k to the given output +/// stream \p os \returns an output stream with the AdjustPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const AdjustPeriodicEventStreamRequest& k); + +/// \brief Contains a OCPP AdjustPeriodicEventStreamResponse message +struct AdjustPeriodicEventStreamResponse : public ocpp::Message { + GenericStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this AdjustPeriodicEventStreamResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given AdjustPeriodicEventStreamResponse \p k to a given json object \p j +void to_json(json& j, const AdjustPeriodicEventStreamResponse& k); + +/// \brief Conversion from a given json object \p j to a given AdjustPeriodicEventStreamResponse \p k +void from_json(const json& j, AdjustPeriodicEventStreamResponse& k); + +/// \brief Writes the string representation of the given AdjustPeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the AdjustPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const AdjustPeriodicEventStreamResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_ADJUSTPERIODICEVENTSTREAM_HPP diff --git a/include/ocpp/v21/messages/BatterySwap.hpp b/include/ocpp/v21/messages/BatterySwap.hpp new file mode 100644 index 000000000..070ffe061 --- /dev/null +++ b/include/ocpp/v21/messages/BatterySwap.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_BATTERYSWAP_HPP +#define OCPP_V21_BATTERYSWAP_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP BatterySwap message +struct BatterySwapRequest : public ocpp::Message { + std::vector batteryData; + BatterySwapEventEnum eventType; + IdToken idToken; + int32_t requestId; + std::optional customData; + + /// \brief Provides the type of this BatterySwap message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given BatterySwapRequest \p k to a given json object \p j +void to_json(json& j, const BatterySwapRequest& k); + +/// \brief Conversion from a given json object \p j to a given BatterySwapRequest \p k +void from_json(const json& j, BatterySwapRequest& k); + +/// \brief Writes the string representation of the given BatterySwapRequest \p k to the given output stream \p os +/// \returns an output stream with the BatterySwapRequest written to +std::ostream& operator<<(std::ostream& os, const BatterySwapRequest& k); + +/// \brief Contains a OCPP BatterySwapResponse message +struct BatterySwapResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this BatterySwapResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given BatterySwapResponse \p k to a given json object \p j +void to_json(json& j, const BatterySwapResponse& k); + +/// \brief Conversion from a given json object \p j to a given BatterySwapResponse \p k +void from_json(const json& j, BatterySwapResponse& k); + +/// \brief Writes the string representation of the given BatterySwapResponse \p k to the given output stream \p os +/// \returns an output stream with the BatterySwapResponse written to +std::ostream& operator<<(std::ostream& os, const BatterySwapResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_BATTERYSWAP_HPP diff --git a/include/ocpp/v21/messages/ChangeTransactionTariff.hpp b/include/ocpp/v21/messages/ChangeTransactionTariff.hpp new file mode 100644 index 000000000..ccfd13a7b --- /dev/null +++ b/include/ocpp/v21/messages/ChangeTransactionTariff.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_CHANGETRANSACTIONTARIFF_HPP +#define OCPP_V21_CHANGETRANSACTIONTARIFF_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP ChangeTransactionTariff message +struct ChangeTransactionTariffRequest : public ocpp::Message { + Tariff tariff; + CiString<36> transactionId; + std::optional customData; + + /// \brief Provides the type of this ChangeTransactionTariff message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ChangeTransactionTariffRequest \p k to a given json object \p j +void to_json(json& j, const ChangeTransactionTariffRequest& k); + +/// \brief Conversion from a given json object \p j to a given ChangeTransactionTariffRequest \p k +void from_json(const json& j, ChangeTransactionTariffRequest& k); + +/// \brief Writes the string representation of the given ChangeTransactionTariffRequest \p k to the given output stream +/// \p os \returns an output stream with the ChangeTransactionTariffRequest written to +std::ostream& operator<<(std::ostream& os, const ChangeTransactionTariffRequest& k); + +/// \brief Contains a OCPP ChangeTransactionTariffResponse message +struct ChangeTransactionTariffResponse : public ocpp::Message { + TariffChangeStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this ChangeTransactionTariffResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ChangeTransactionTariffResponse \p k to a given json object \p j +void to_json(json& j, const ChangeTransactionTariffResponse& k); + +/// \brief Conversion from a given json object \p j to a given ChangeTransactionTariffResponse \p k +void from_json(const json& j, ChangeTransactionTariffResponse& k); + +/// \brief Writes the string representation of the given ChangeTransactionTariffResponse \p k to the given output stream +/// \p os \returns an output stream with the ChangeTransactionTariffResponse written to +std::ostream& operator<<(std::ostream& os, const ChangeTransactionTariffResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_CHANGETRANSACTIONTARIFF_HPP diff --git a/include/ocpp/v21/messages/ClearDERControl.hpp b/include/ocpp/v21/messages/ClearDERControl.hpp new file mode 100644 index 000000000..9c020e9e2 --- /dev/null +++ b/include/ocpp/v21/messages/ClearDERControl.hpp @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_CLEARDERCONTROL_HPP +#define OCPP_V21_CLEARDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP ClearDERControl message +struct ClearDERControlRequest : public ocpp::Message { + bool isDefault; + std::optional controlType; + std::optional> controlId; + std::optional customData; + + /// \brief Provides the type of this ClearDERControl message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClearDERControlRequest \p k to a given json object \p j +void to_json(json& j, const ClearDERControlRequest& k); + +/// \brief Conversion from a given json object \p j to a given ClearDERControlRequest \p k +void from_json(const json& j, ClearDERControlRequest& k); + +/// \brief Writes the string representation of the given ClearDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the ClearDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const ClearDERControlRequest& k); + +/// \brief Contains a OCPP ClearDERControlResponse message +struct ClearDERControlResponse : public ocpp::Message { + DERControlStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this ClearDERControlResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClearDERControlResponse \p k to a given json object \p j +void to_json(json& j, const ClearDERControlResponse& k); + +/// \brief Conversion from a given json object \p j to a given ClearDERControlResponse \p k +void from_json(const json& j, ClearDERControlResponse& k); + +/// \brief Writes the string representation of the given ClearDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the ClearDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const ClearDERControlResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_CLEARDERCONTROL_HPP diff --git a/include/ocpp/v21/messages/ClearTariffs.hpp b/include/ocpp/v21/messages/ClearTariffs.hpp new file mode 100644 index 000000000..700a0741c --- /dev/null +++ b/include/ocpp/v21/messages/ClearTariffs.hpp @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_CLEARTARIFFS_HPP +#define OCPP_V21_CLEARTARIFFS_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP ClearTariffs message +struct ClearTariffsRequest : public ocpp::Message { + std::optional>> tariffIds; + std::optional evseId; + std::optional customData; + + /// \brief Provides the type of this ClearTariffs message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClearTariffsRequest \p k to a given json object \p j +void to_json(json& j, const ClearTariffsRequest& k); + +/// \brief Conversion from a given json object \p j to a given ClearTariffsRequest \p k +void from_json(const json& j, ClearTariffsRequest& k); + +/// \brief Writes the string representation of the given ClearTariffsRequest \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsRequest written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsRequest& k); + +/// \brief Contains a OCPP ClearTariffsResponse message +struct ClearTariffsResponse : public ocpp::Message { + std::vector clearTariffsResult; + std::optional customData; + + /// \brief Provides the type of this ClearTariffsResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClearTariffsResponse \p k to a given json object \p j +void to_json(json& j, const ClearTariffsResponse& k); + +/// \brief Conversion from a given json object \p j to a given ClearTariffsResponse \p k +void from_json(const json& j, ClearTariffsResponse& k); + +/// \brief Writes the string representation of the given ClearTariffsResponse \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsResponse written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_CLEARTARIFFS_HPP diff --git a/include/ocpp/v21/messages/ClosePeriodicEventStream.hpp b/include/ocpp/v21/messages/ClosePeriodicEventStream.hpp new file mode 100644 index 000000000..e6185fb9d --- /dev/null +++ b/include/ocpp/v21/messages/ClosePeriodicEventStream.hpp @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_CLOSEPERIODICEVENTSTREAM_HPP +#define OCPP_V21_CLOSEPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP ClosePeriodicEventStream message +struct ClosePeriodicEventStreamRequest : public ocpp::Message { + int32_t id; + std::optional customData; + + /// \brief Provides the type of this ClosePeriodicEventStream message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClosePeriodicEventStreamRequest \p k to a given json object \p j +void to_json(json& j, const ClosePeriodicEventStreamRequest& k); + +/// \brief Conversion from a given json object \p j to a given ClosePeriodicEventStreamRequest \p k +void from_json(const json& j, ClosePeriodicEventStreamRequest& k); + +/// \brief Writes the string representation of the given ClosePeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the ClosePeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const ClosePeriodicEventStreamRequest& k); + +/// \brief Contains a OCPP ClosePeriodicEventStreamResponse message +struct ClosePeriodicEventStreamResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this ClosePeriodicEventStreamResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ClosePeriodicEventStreamResponse \p k to a given json object \p j +void to_json(json& j, const ClosePeriodicEventStreamResponse& k); + +/// \brief Conversion from a given json object \p j to a given ClosePeriodicEventStreamResponse \p k +void from_json(const json& j, ClosePeriodicEventStreamResponse& k); + +/// \brief Writes the string representation of the given ClosePeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the ClosePeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const ClosePeriodicEventStreamResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_CLOSEPERIODICEVENTSTREAM_HPP diff --git a/include/ocpp/v21/messages/GetCertificateChainStatus.hpp b/include/ocpp/v21/messages/GetCertificateChainStatus.hpp new file mode 100644 index 000000000..eba00d9f5 --- /dev/null +++ b/include/ocpp/v21/messages/GetCertificateChainStatus.hpp @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_GETCERTIFICATECHAINSTATUS_HPP +#define OCPP_V21_GETCERTIFICATECHAINSTATUS_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP GetCertificateChainStatus message +struct GetCertificateChainStatusRequest : public ocpp::Message { + std::vector certificateStatusRequests; + std::optional customData; + + /// \brief Provides the type of this GetCertificateChainStatus message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetCertificateChainStatusRequest \p k to a given json object \p j +void to_json(json& j, const GetCertificateChainStatusRequest& k); + +/// \brief Conversion from a given json object \p j to a given GetCertificateChainStatusRequest \p k +void from_json(const json& j, GetCertificateChainStatusRequest& k); + +/// \brief Writes the string representation of the given GetCertificateChainStatusRequest \p k to the given output +/// stream \p os \returns an output stream with the GetCertificateChainStatusRequest written to +std::ostream& operator<<(std::ostream& os, const GetCertificateChainStatusRequest& k); + +/// \brief Contains a OCPP GetCertificateChainStatusResponse message +struct GetCertificateChainStatusResponse : public ocpp::Message { + std::vector certificateStatus; + std::optional customData; + + /// \brief Provides the type of this GetCertificateChainStatusResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetCertificateChainStatusResponse \p k to a given json object \p j +void to_json(json& j, const GetCertificateChainStatusResponse& k); + +/// \brief Conversion from a given json object \p j to a given GetCertificateChainStatusResponse \p k +void from_json(const json& j, GetCertificateChainStatusResponse& k); + +/// \brief Writes the string representation of the given GetCertificateChainStatusResponse \p k to the given output +/// stream \p os \returns an output stream with the GetCertificateChainStatusResponse written to +std::ostream& operator<<(std::ostream& os, const GetCertificateChainStatusResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_GETCERTIFICATECHAINSTATUS_HPP diff --git a/include/ocpp/v21/messages/GetDERControl.hpp b/include/ocpp/v21/messages/GetDERControl.hpp new file mode 100644 index 000000000..fa9f39603 --- /dev/null +++ b/include/ocpp/v21/messages/GetDERControl.hpp @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_GETDERCONTROL_HPP +#define OCPP_V21_GETDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP GetDERControl message +struct GetDERControlRequest : public ocpp::Message { + int32_t requestId; + std::optional isDefault; + std::optional controlType; + std::optional> controlId; + std::optional customData; + + /// \brief Provides the type of this GetDERControl message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetDERControlRequest \p k to a given json object \p j +void to_json(json& j, const GetDERControlRequest& k); + +/// \brief Conversion from a given json object \p j to a given GetDERControlRequest \p k +void from_json(const json& j, GetDERControlRequest& k); + +/// \brief Writes the string representation of the given GetDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the GetDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const GetDERControlRequest& k); + +/// \brief Contains a OCPP GetDERControlResponse message +struct GetDERControlResponse : public ocpp::Message { + DERControlStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this GetDERControlResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetDERControlResponse \p k to a given json object \p j +void to_json(json& j, const GetDERControlResponse& k); + +/// \brief Conversion from a given json object \p j to a given GetDERControlResponse \p k +void from_json(const json& j, GetDERControlResponse& k); + +/// \brief Writes the string representation of the given GetDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the GetDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const GetDERControlResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_GETDERCONTROL_HPP diff --git a/include/ocpp/v21/messages/GetPeriodicEventStream.hpp b/include/ocpp/v21/messages/GetPeriodicEventStream.hpp new file mode 100644 index 000000000..3763e71be --- /dev/null +++ b/include/ocpp/v21/messages/GetPeriodicEventStream.hpp @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_GETPERIODICEVENTSTREAM_HPP +#define OCPP_V21_GETPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP GetPeriodicEventStream message +struct GetPeriodicEventStreamRequest : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this GetPeriodicEventStream message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetPeriodicEventStreamRequest \p k to a given json object \p j +void to_json(json& j, const GetPeriodicEventStreamRequest& k); + +/// \brief Conversion from a given json object \p j to a given GetPeriodicEventStreamRequest \p k +void from_json(const json& j, GetPeriodicEventStreamRequest& k); + +/// \brief Writes the string representation of the given GetPeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the GetPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const GetPeriodicEventStreamRequest& k); + +/// \brief Contains a OCPP GetPeriodicEventStreamResponse message +struct GetPeriodicEventStreamResponse : public ocpp::Message { + std::optional> constantStreamData; + std::optional customData; + + /// \brief Provides the type of this GetPeriodicEventStreamResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetPeriodicEventStreamResponse \p k to a given json object \p j +void to_json(json& j, const GetPeriodicEventStreamResponse& k); + +/// \brief Conversion from a given json object \p j to a given GetPeriodicEventStreamResponse \p k +void from_json(const json& j, GetPeriodicEventStreamResponse& k); + +/// \brief Writes the string representation of the given GetPeriodicEventStreamResponse \p k to the given output stream +/// \p os \returns an output stream with the GetPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const GetPeriodicEventStreamResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_GETPERIODICEVENTSTREAM_HPP diff --git a/include/ocpp/v21/messages/GetTariffs.hpp b/include/ocpp/v21/messages/GetTariffs.hpp new file mode 100644 index 000000000..e28807fa5 --- /dev/null +++ b/include/ocpp/v21/messages/GetTariffs.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_GETTARIFFS_HPP +#define OCPP_V21_GETTARIFFS_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP GetTariffs message +struct GetTariffsRequest : public ocpp::Message { + int32_t evseId; + std::optional customData; + + /// \brief Provides the type of this GetTariffs message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetTariffsRequest \p k to a given json object \p j +void to_json(json& j, const GetTariffsRequest& k); + +/// \brief Conversion from a given json object \p j to a given GetTariffsRequest \p k +void from_json(const json& j, GetTariffsRequest& k); + +/// \brief Writes the string representation of the given GetTariffsRequest \p k to the given output stream \p os +/// \returns an output stream with the GetTariffsRequest written to +std::ostream& operator<<(std::ostream& os, const GetTariffsRequest& k); + +/// \brief Contains a OCPP GetTariffsResponse message +struct GetTariffsResponse : public ocpp::Message { + TariffGetStatusEnum status; + std::optional statusInfo; + std::optional> tariffAssignments; + std::optional customData; + + /// \brief Provides the type of this GetTariffsResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given GetTariffsResponse \p k to a given json object \p j +void to_json(json& j, const GetTariffsResponse& k); + +/// \brief Conversion from a given json object \p j to a given GetTariffsResponse \p k +void from_json(const json& j, GetTariffsResponse& k); + +/// \brief Writes the string representation of the given GetTariffsResponse \p k to the given output stream \p os +/// \returns an output stream with the GetTariffsResponse written to +std::ostream& operator<<(std::ostream& os, const GetTariffsResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_GETTARIFFS_HPP diff --git a/include/ocpp/v21/messages/NotifyAllowedEnergyTransfer.hpp b/include/ocpp/v21/messages/NotifyAllowedEnergyTransfer.hpp new file mode 100644 index 000000000..5d1cefee1 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyAllowedEnergyTransfer.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYALLOWEDENERGYTRANSFER_HPP +#define OCPP_V21_NOTIFYALLOWEDENERGYTRANSFER_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyAllowedEnergyTransfer message +struct NotifyAllowedEnergyTransferRequest : public ocpp::Message { + CiString<36> transactionId; + std::vector allowedEnergyTransfer; + std::optional customData; + + /// \brief Provides the type of this NotifyAllowedEnergyTransfer message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyAllowedEnergyTransferRequest \p k to a given json object \p j +void to_json(json& j, const NotifyAllowedEnergyTransferRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyAllowedEnergyTransferRequest \p k +void from_json(const json& j, NotifyAllowedEnergyTransferRequest& k); + +/// \brief Writes the string representation of the given NotifyAllowedEnergyTransferRequest \p k to the given output +/// stream \p os \returns an output stream with the NotifyAllowedEnergyTransferRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyAllowedEnergyTransferRequest& k); + +/// \brief Contains a OCPP NotifyAllowedEnergyTransferResponse message +struct NotifyAllowedEnergyTransferResponse : public ocpp::Message { + NotifyAllowedEnergyTransferStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this NotifyAllowedEnergyTransferResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyAllowedEnergyTransferResponse \p k to a given json object \p j +void to_json(json& j, const NotifyAllowedEnergyTransferResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyAllowedEnergyTransferResponse \p k +void from_json(const json& j, NotifyAllowedEnergyTransferResponse& k); + +/// \brief Writes the string representation of the given NotifyAllowedEnergyTransferResponse \p k to the given output +/// stream \p os \returns an output stream with the NotifyAllowedEnergyTransferResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyAllowedEnergyTransferResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYALLOWEDENERGYTRANSFER_HPP diff --git a/include/ocpp/v21/messages/NotifyCRL.hpp b/include/ocpp/v21/messages/NotifyCRL.hpp new file mode 100644 index 000000000..c46bcea17 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyCRL.hpp @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYCRL_HPP +#define OCPP_V21_NOTIFYCRL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyCRL message +struct NotifyCRLRequest : public ocpp::Message { + int32_t requestId; + NotifyCRLStatusEnum status; + std::optional> location; + std::optional customData; + + /// \brief Provides the type of this NotifyCRL message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyCRLRequest \p k to a given json object \p j +void to_json(json& j, const NotifyCRLRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyCRLRequest \p k +void from_json(const json& j, NotifyCRLRequest& k); + +/// \brief Writes the string representation of the given NotifyCRLRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyCRLRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyCRLRequest& k); + +/// \brief Contains a OCPP NotifyCRLResponse message +struct NotifyCRLResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyCRLResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyCRLResponse \p k to a given json object \p j +void to_json(json& j, const NotifyCRLResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyCRLResponse \p k +void from_json(const json& j, NotifyCRLResponse& k); + +/// \brief Writes the string representation of the given NotifyCRLResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifyCRLResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyCRLResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYCRL_HPP diff --git a/include/ocpp/v21/messages/NotifyDERAlarm.hpp b/include/ocpp/v21/messages/NotifyDERAlarm.hpp new file mode 100644 index 000000000..387e42c10 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyDERAlarm.hpp @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYDERALARM_HPP +#define OCPP_V21_NOTIFYDERALARM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyDERAlarm message +struct NotifyDERAlarmRequest : public ocpp::Message { + DERControlEnum controlType; + ocpp::DateTime timestamp; + std::optional gridEventFault; + std::optional alarmEnded; + std::optional> extraInfo; + std::optional customData; + + /// \brief Provides the type of this NotifyDERAlarm message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyDERAlarmRequest \p k to a given json object \p j +void to_json(json& j, const NotifyDERAlarmRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyDERAlarmRequest \p k +void from_json(const json& j, NotifyDERAlarmRequest& k); + +/// \brief Writes the string representation of the given NotifyDERAlarmRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERAlarmRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyDERAlarmRequest& k); + +/// \brief Contains a OCPP NotifyDERAlarmResponse message +struct NotifyDERAlarmResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyDERAlarmResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyDERAlarmResponse \p k to a given json object \p j +void to_json(json& j, const NotifyDERAlarmResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyDERAlarmResponse \p k +void from_json(const json& j, NotifyDERAlarmResponse& k); + +/// \brief Writes the string representation of the given NotifyDERAlarmResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERAlarmResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyDERAlarmResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYDERALARM_HPP diff --git a/include/ocpp/v21/messages/NotifyDERStartStop.hpp b/include/ocpp/v21/messages/NotifyDERStartStop.hpp new file mode 100644 index 000000000..cd2816427 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyDERStartStop.hpp @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYDERSTARTSTOP_HPP +#define OCPP_V21_NOTIFYDERSTARTSTOP_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyDERStartStop message +struct NotifyDERStartStopRequest : public ocpp::Message { + CiString<36> controlId; + bool started; + ocpp::DateTime timestamp; + std::optional>> supersededIds; + std::optional customData; + + /// \brief Provides the type of this NotifyDERStartStop message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyDERStartStopRequest \p k to a given json object \p j +void to_json(json& j, const NotifyDERStartStopRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyDERStartStopRequest \p k +void from_json(const json& j, NotifyDERStartStopRequest& k); + +/// \brief Writes the string representation of the given NotifyDERStartStopRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERStartStopRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyDERStartStopRequest& k); + +/// \brief Contains a OCPP NotifyDERStartStopResponse message +struct NotifyDERStartStopResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyDERStartStopResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyDERStartStopResponse \p k to a given json object \p j +void to_json(json& j, const NotifyDERStartStopResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyDERStartStopResponse \p k +void from_json(const json& j, NotifyDERStartStopResponse& k); + +/// \brief Writes the string representation of the given NotifyDERStartStopResponse \p k to the given output stream \p +/// os \returns an output stream with the NotifyDERStartStopResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyDERStartStopResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYDERSTARTSTOP_HPP diff --git a/include/ocpp/v21/messages/NotifyPeriodicEventStream.hpp b/include/ocpp/v21/messages/NotifyPeriodicEventStream.hpp new file mode 100644 index 000000000..3b6c4eebf --- /dev/null +++ b/include/ocpp/v21/messages/NotifyPeriodicEventStream.hpp @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYPERIODICEVENTSTREAM_HPP +#define OCPP_V21_NOTIFYPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyPeriodicEventStream message +struct NotifyPeriodicEventStream : public ocpp::Message { + std::vector data; + int32_t id; + int32_t pending; + ocpp::DateTime basetime; + std::optional customData; + + /// \brief Provides the type of this NotifyPeriodicEventStream message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyPeriodicEventStream \p k to a given json object \p j +void to_json(json& j, const NotifyPeriodicEventStream& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPeriodicEventStream \p k +void from_json(const json& j, NotifyPeriodicEventStream& k); + +/// \brief Writes the string representation of the given NotifyPeriodicEventStream \p k to the given output stream \p os +/// \returns an output stream with the NotifyPeriodicEventStream written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStream& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYPERIODICEVENTSTREAM_HPP diff --git a/include/ocpp/v21/messages/NotifyPriorityCharging.hpp b/include/ocpp/v21/messages/NotifyPriorityCharging.hpp new file mode 100644 index 000000000..88275ce26 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyPriorityCharging.hpp @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYPRIORITYCHARGING_HPP +#define OCPP_V21_NOTIFYPRIORITYCHARGING_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyPriorityCharging message +struct NotifyPriorityChargingRequest : public ocpp::Message { + CiString<36> transactionId; + bool activated; + std::optional customData; + + /// \brief Provides the type of this NotifyPriorityCharging message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyPriorityChargingRequest \p k to a given json object \p j +void to_json(json& j, const NotifyPriorityChargingRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPriorityChargingRequest \p k +void from_json(const json& j, NotifyPriorityChargingRequest& k); + +/// \brief Writes the string representation of the given NotifyPriorityChargingRequest \p k to the given output stream +/// \p os \returns an output stream with the NotifyPriorityChargingRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyPriorityChargingRequest& k); + +/// \brief Contains a OCPP NotifyPriorityChargingResponse message +struct NotifyPriorityChargingResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyPriorityChargingResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyPriorityChargingResponse \p k to a given json object \p j +void to_json(json& j, const NotifyPriorityChargingResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPriorityChargingResponse \p k +void from_json(const json& j, NotifyPriorityChargingResponse& k); + +/// \brief Writes the string representation of the given NotifyPriorityChargingResponse \p k to the given output stream +/// \p os \returns an output stream with the NotifyPriorityChargingResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyPriorityChargingResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYPRIORITYCHARGING_HPP diff --git a/include/ocpp/v21/messages/NotifyQRCodeScanned.hpp b/include/ocpp/v21/messages/NotifyQRCodeScanned.hpp new file mode 100644 index 000000000..8aed0192e --- /dev/null +++ b/include/ocpp/v21/messages/NotifyQRCodeScanned.hpp @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYQRCODESCANNED_HPP +#define OCPP_V21_NOTIFYQRCODESCANNED_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyQRCodeScanned message +struct NotifyQRCodeScannedRequest : public ocpp::Message { + int32_t evseId; + int32_t timeout; + std::optional customData; + + /// \brief Provides the type of this NotifyQRCodeScanned message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyQRCodeScannedRequest \p k to a given json object \p j +void to_json(json& j, const NotifyQRCodeScannedRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyQRCodeScannedRequest \p k +void from_json(const json& j, NotifyQRCodeScannedRequest& k); + +/// \brief Writes the string representation of the given NotifyQRCodeScannedRequest \p k to the given output stream \p +/// os \returns an output stream with the NotifyQRCodeScannedRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyQRCodeScannedRequest& k); + +/// \brief Contains a OCPP NotifyQRCodeScannedResponse message +struct NotifyQRCodeScannedResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyQRCodeScannedResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyQRCodeScannedResponse \p k to a given json object \p j +void to_json(json& j, const NotifyQRCodeScannedResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyQRCodeScannedResponse \p k +void from_json(const json& j, NotifyQRCodeScannedResponse& k); + +/// \brief Writes the string representation of the given NotifyQRCodeScannedResponse \p k to the given output stream \p +/// os \returns an output stream with the NotifyQRCodeScannedResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyQRCodeScannedResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYQRCODESCANNED_HPP diff --git a/include/ocpp/v21/messages/NotifySettlement.hpp b/include/ocpp/v21/messages/NotifySettlement.hpp new file mode 100644 index 000000000..da24ce7bc --- /dev/null +++ b/include/ocpp/v21/messages/NotifySettlement.hpp @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYSETTLEMENT_HPP +#define OCPP_V21_NOTIFYSETTLEMENT_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifySettlement message +struct NotifySettlementRequest : public ocpp::Message { + CiString<255> pspRef; + PaymentStatusEnum status; + float settlementAmount; + ocpp::DateTime settlementTime; + std::optional> transactionId; + std::optional> statusInfo; + std::optional> receiptId; + std::optional> receiptUrl; + std::optional
vatCompany; + std::optional> vatNumber; + std::optional customData; + + /// \brief Provides the type of this NotifySettlement message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifySettlementRequest \p k to a given json object \p j +void to_json(json& j, const NotifySettlementRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifySettlementRequest \p k +void from_json(const json& j, NotifySettlementRequest& k); + +/// \brief Writes the string representation of the given NotifySettlementRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifySettlementRequest written to +std::ostream& operator<<(std::ostream& os, const NotifySettlementRequest& k); + +/// \brief Contains a OCPP NotifySettlementResponse message +struct NotifySettlementResponse : public ocpp::Message { + std::optional> receiptUrl; + std::optional> receiptId; + std::optional customData; + + /// \brief Provides the type of this NotifySettlementResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifySettlementResponse \p k to a given json object \p j +void to_json(json& j, const NotifySettlementResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifySettlementResponse \p k +void from_json(const json& j, NotifySettlementResponse& k); + +/// \brief Writes the string representation of the given NotifySettlementResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifySettlementResponse written to +std::ostream& operator<<(std::ostream& os, const NotifySettlementResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYSETTLEMENT_HPP diff --git a/include/ocpp/v21/messages/NotifyWebPaymentStarted.hpp b/include/ocpp/v21/messages/NotifyWebPaymentStarted.hpp new file mode 100644 index 000000000..574e0e7ce --- /dev/null +++ b/include/ocpp/v21/messages/NotifyWebPaymentStarted.hpp @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_NOTIFYWEBPAYMENTSTARTED_HPP +#define OCPP_V21_NOTIFYWEBPAYMENTSTARTED_HPP + +#include +#include + +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyWebPaymentStarted message +struct NotifyWebPaymentStartedRequest : public ocpp::Message { + int32_t evseId; + int32_t timeout; + std::optional customData; + + /// \brief Provides the type of this NotifyWebPaymentStarted message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyWebPaymentStartedRequest \p k to a given json object \p j +void to_json(json& j, const NotifyWebPaymentStartedRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyWebPaymentStartedRequest \p k +void from_json(const json& j, NotifyWebPaymentStartedRequest& k); + +/// \brief Writes the string representation of the given NotifyWebPaymentStartedRequest \p k to the given output stream +/// \p os \returns an output stream with the NotifyWebPaymentStartedRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyWebPaymentStartedRequest& k); + +/// \brief Contains a OCPP NotifyWebPaymentStartedResponse message +struct NotifyWebPaymentStartedResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this NotifyWebPaymentStartedResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given NotifyWebPaymentStartedResponse \p k to a given json object \p j +void to_json(json& j, const NotifyWebPaymentStartedResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyWebPaymentStartedResponse \p k +void from_json(const json& j, NotifyWebPaymentStartedResponse& k); + +/// \brief Writes the string representation of the given NotifyWebPaymentStartedResponse \p k to the given output stream +/// \p os \returns an output stream with the NotifyWebPaymentStartedResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyWebPaymentStartedResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_NOTIFYWEBPAYMENTSTARTED_HPP diff --git a/include/ocpp/v21/messages/OpenPeriodicEventStream.hpp b/include/ocpp/v21/messages/OpenPeriodicEventStream.hpp new file mode 100644 index 000000000..140e4b6b4 --- /dev/null +++ b/include/ocpp/v21/messages/OpenPeriodicEventStream.hpp @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_OPENPERIODICEVENTSTREAM_HPP +#define OCPP_V21_OPENPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP OpenPeriodicEventStream message +struct OpenPeriodicEventStreamRequest : public ocpp::Message { + ConstantStreamData constantStreamData; + std::optional customData; + + /// \brief Provides the type of this OpenPeriodicEventStream message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given OpenPeriodicEventStreamRequest \p k to a given json object \p j +void to_json(json& j, const OpenPeriodicEventStreamRequest& k); + +/// \brief Conversion from a given json object \p j to a given OpenPeriodicEventStreamRequest \p k +void from_json(const json& j, OpenPeriodicEventStreamRequest& k); + +/// \brief Writes the string representation of the given OpenPeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the OpenPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const OpenPeriodicEventStreamRequest& k); + +/// \brief Contains a OCPP OpenPeriodicEventStreamResponse message +struct OpenPeriodicEventStreamResponse : public ocpp::Message { + GenericStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this OpenPeriodicEventStreamResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given OpenPeriodicEventStreamResponse \p k to a given json object \p j +void to_json(json& j, const OpenPeriodicEventStreamResponse& k); + +/// \brief Conversion from a given json object \p j to a given OpenPeriodicEventStreamResponse \p k +void from_json(const json& j, OpenPeriodicEventStreamResponse& k); + +/// \brief Writes the string representation of the given OpenPeriodicEventStreamResponse \p k to the given output stream +/// \p os \returns an output stream with the OpenPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const OpenPeriodicEventStreamResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_OPENPERIODICEVENTSTREAM_HPP diff --git a/include/ocpp/v21/messages/PullDynamicScheduleUpdate.hpp b/include/ocpp/v21/messages/PullDynamicScheduleUpdate.hpp new file mode 100644 index 000000000..65125e7e6 --- /dev/null +++ b/include/ocpp/v21/messages/PullDynamicScheduleUpdate.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_PULLDYNAMICSCHEDULEUPDATE_HPP +#define OCPP_V21_PULLDYNAMICSCHEDULEUPDATE_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP PullDynamicScheduleUpdate message +struct PullDynamicScheduleUpdateRequest : public ocpp::Message { + int32_t chargingProfileId; + std::optional customData; + + /// \brief Provides the type of this PullDynamicScheduleUpdate message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given PullDynamicScheduleUpdateRequest \p k to a given json object \p j +void to_json(json& j, const PullDynamicScheduleUpdateRequest& k); + +/// \brief Conversion from a given json object \p j to a given PullDynamicScheduleUpdateRequest \p k +void from_json(const json& j, PullDynamicScheduleUpdateRequest& k); + +/// \brief Writes the string representation of the given PullDynamicScheduleUpdateRequest \p k to the given output +/// stream \p os \returns an output stream with the PullDynamicScheduleUpdateRequest written to +std::ostream& operator<<(std::ostream& os, const PullDynamicScheduleUpdateRequest& k); + +/// \brief Contains a OCPP PullDynamicScheduleUpdateResponse message +struct PullDynamicScheduleUpdateResponse : public ocpp::Message { + ChargingProfileStatusEnum status; + std::optional scheduleUpdate; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this PullDynamicScheduleUpdateResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given PullDynamicScheduleUpdateResponse \p k to a given json object \p j +void to_json(json& j, const PullDynamicScheduleUpdateResponse& k); + +/// \brief Conversion from a given json object \p j to a given PullDynamicScheduleUpdateResponse \p k +void from_json(const json& j, PullDynamicScheduleUpdateResponse& k); + +/// \brief Writes the string representation of the given PullDynamicScheduleUpdateResponse \p k to the given output +/// stream \p os \returns an output stream with the PullDynamicScheduleUpdateResponse written to +std::ostream& operator<<(std::ostream& os, const PullDynamicScheduleUpdateResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_PULLDYNAMICSCHEDULEUPDATE_HPP diff --git a/include/ocpp/v21/messages/ReportDERControl.hpp b/include/ocpp/v21/messages/ReportDERControl.hpp new file mode 100644 index 000000000..63adc3bfe --- /dev/null +++ b/include/ocpp/v21/messages/ReportDERControl.hpp @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_REPORTDERCONTROL_HPP +#define OCPP_V21_REPORTDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP ReportDERControl message +struct ReportDERControlRequest : public ocpp::Message { + int32_t requestId; + std::optional> curve; + std::optional> enterService; + std::optional> fixedPFAbsorb; + std::optional> fixedPFInject; + std::optional> fixedVar; + std::optional> freqDroop; + std::optional> gradient; + std::optional> limitMaxDischarge; + std::optional tbc; + std::optional customData; + + /// \brief Provides the type of this ReportDERControl message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ReportDERControlRequest \p k to a given json object \p j +void to_json(json& j, const ReportDERControlRequest& k); + +/// \brief Conversion from a given json object \p j to a given ReportDERControlRequest \p k +void from_json(const json& j, ReportDERControlRequest& k); + +/// \brief Writes the string representation of the given ReportDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the ReportDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const ReportDERControlRequest& k); + +/// \brief Contains a OCPP ReportDERControlResponse message +struct ReportDERControlResponse : public ocpp::Message { + std::optional customData; + + /// \brief Provides the type of this ReportDERControlResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given ReportDERControlResponse \p k to a given json object \p j +void to_json(json& j, const ReportDERControlResponse& k); + +/// \brief Conversion from a given json object \p j to a given ReportDERControlResponse \p k +void from_json(const json& j, ReportDERControlResponse& k); + +/// \brief Writes the string representation of the given ReportDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the ReportDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const ReportDERControlResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_REPORTDERCONTROL_HPP diff --git a/include/ocpp/v21/messages/RequestBatterySwap.hpp b/include/ocpp/v21/messages/RequestBatterySwap.hpp new file mode 100644 index 000000000..cee9e78e1 --- /dev/null +++ b/include/ocpp/v21/messages/RequestBatterySwap.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_REQUESTBATTERYSWAP_HPP +#define OCPP_V21_REQUESTBATTERYSWAP_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP BatterySwap message +struct RequestBatterySwapRequest : public ocpp::Message { + IdToken idToken; + int32_t requestId; + std::optional customData; + + /// \brief Provides the type of this BatterySwap message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given RequestBatterySwapRequest \p k to a given json object \p j +void to_json(json& j, const RequestBatterySwapRequest& k); + +/// \brief Conversion from a given json object \p j to a given RequestBatterySwapRequest \p k +void from_json(const json& j, RequestBatterySwapRequest& k); + +/// \brief Writes the string representation of the given RequestBatterySwapRequest \p k to the given output stream \p os +/// \returns an output stream with the RequestBatterySwapRequest written to +std::ostream& operator<<(std::ostream& os, const RequestBatterySwapRequest& k); + +/// \brief Contains a OCPP BatterySwapResponse message +struct RequestBatterySwapResponse : public ocpp::Message { + GenericStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this BatterySwapResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given RequestBatterySwapResponse \p k to a given json object \p j +void to_json(json& j, const RequestBatterySwapResponse& k); + +/// \brief Conversion from a given json object \p j to a given RequestBatterySwapResponse \p k +void from_json(const json& j, RequestBatterySwapResponse& k); + +/// \brief Writes the string representation of the given RequestBatterySwapResponse \p k to the given output stream \p +/// os \returns an output stream with the RequestBatterySwapResponse written to +std::ostream& operator<<(std::ostream& os, const RequestBatterySwapResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_REQUESTBATTERYSWAP_HPP diff --git a/include/ocpp/v21/messages/SetDERControl.hpp b/include/ocpp/v21/messages/SetDERControl.hpp new file mode 100644 index 000000000..7c355823f --- /dev/null +++ b/include/ocpp/v21/messages/SetDERControl.hpp @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_SETDERCONTROL_HPP +#define OCPP_V21_SETDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP SetDERControl message +struct SetDERControlRequest : public ocpp::Message { + bool isDefault; + CiString<36> controlId; + DERControlEnum controlType; + std::optional curve; + std::optional enterService; + std::optional fixedPFAbsorb; + std::optional fixedPFInject; + std::optional fixedVar; + std::optional freqDroop; + std::optional gradient; + std::optional limitMaxDischarge; + std::optional customData; + + /// \brief Provides the type of this SetDERControl message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given SetDERControlRequest \p k to a given json object \p j +void to_json(json& j, const SetDERControlRequest& k); + +/// \brief Conversion from a given json object \p j to a given SetDERControlRequest \p k +void from_json(const json& j, SetDERControlRequest& k); + +/// \brief Writes the string representation of the given SetDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the SetDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const SetDERControlRequest& k); + +/// \brief Contains a OCPP SetDERControlResponse message +struct SetDERControlResponse : public ocpp::Message { + DERControlStatusEnum status; + std::optional statusInfo; + std::optional>> supersededIds; + std::optional customData; + + /// \brief Provides the type of this SetDERControlResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given SetDERControlResponse \p k to a given json object \p j +void to_json(json& j, const SetDERControlResponse& k); + +/// \brief Conversion from a given json object \p j to a given SetDERControlResponse \p k +void from_json(const json& j, SetDERControlResponse& k); + +/// \brief Writes the string representation of the given SetDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the SetDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const SetDERControlResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_SETDERCONTROL_HPP diff --git a/include/ocpp/v21/messages/SetDefaultTariff.hpp b/include/ocpp/v21/messages/SetDefaultTariff.hpp new file mode 100644 index 000000000..5ac9a2ab4 --- /dev/null +++ b/include/ocpp/v21/messages/SetDefaultTariff.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_SETDEFAULTTARIFF_HPP +#define OCPP_V21_SETDEFAULTTARIFF_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP SetDefaultTariff message +struct SetDefaultTariffRequest : public ocpp::Message { + int32_t evseId; + Tariff tariff; + std::optional customData; + + /// \brief Provides the type of this SetDefaultTariff message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given SetDefaultTariffRequest \p k to a given json object \p j +void to_json(json& j, const SetDefaultTariffRequest& k); + +/// \brief Conversion from a given json object \p j to a given SetDefaultTariffRequest \p k +void from_json(const json& j, SetDefaultTariffRequest& k); + +/// \brief Writes the string representation of the given SetDefaultTariffRequest \p k to the given output stream \p os +/// \returns an output stream with the SetDefaultTariffRequest written to +std::ostream& operator<<(std::ostream& os, const SetDefaultTariffRequest& k); + +/// \brief Contains a OCPP SetDefaultTariffResponse message +struct SetDefaultTariffResponse : public ocpp::Message { + TariffSetStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this SetDefaultTariffResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given SetDefaultTariffResponse \p k to a given json object \p j +void to_json(json& j, const SetDefaultTariffResponse& k); + +/// \brief Conversion from a given json object \p j to a given SetDefaultTariffResponse \p k +void from_json(const json& j, SetDefaultTariffResponse& k); + +/// \brief Writes the string representation of the given SetDefaultTariffResponse \p k to the given output stream \p os +/// \returns an output stream with the SetDefaultTariffResponse written to +std::ostream& operator<<(std::ostream& os, const SetDefaultTariffResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_SETDEFAULTTARIFF_HPP diff --git a/include/ocpp/v21/messages/UpdateDynamicSchedule.hpp b/include/ocpp/v21/messages/UpdateDynamicSchedule.hpp new file mode 100644 index 000000000..f1400c68f --- /dev/null +++ b/include/ocpp/v21/messages/UpdateDynamicSchedule.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_UPDATEDYNAMICSCHEDULE_HPP +#define OCPP_V21_UPDATEDYNAMICSCHEDULE_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP UpdateDynamicSchedule message +struct UpdateDynamicScheduleRequest : public ocpp::Message { + int32_t chargingProfileId; + ChargingScheduleUpdate scheduleUpdate; + std::optional customData; + + /// \brief Provides the type of this UpdateDynamicSchedule message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given UpdateDynamicScheduleRequest \p k to a given json object \p j +void to_json(json& j, const UpdateDynamicScheduleRequest& k); + +/// \brief Conversion from a given json object \p j to a given UpdateDynamicScheduleRequest \p k +void from_json(const json& j, UpdateDynamicScheduleRequest& k); + +/// \brief Writes the string representation of the given UpdateDynamicScheduleRequest \p k to the given output stream \p +/// os \returns an output stream with the UpdateDynamicScheduleRequest written to +std::ostream& operator<<(std::ostream& os, const UpdateDynamicScheduleRequest& k); + +/// \brief Contains a OCPP UpdateDynamicScheduleResponse message +struct UpdateDynamicScheduleResponse : public ocpp::Message { + ChargingProfileStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this UpdateDynamicScheduleResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given UpdateDynamicScheduleResponse \p k to a given json object \p j +void to_json(json& j, const UpdateDynamicScheduleResponse& k); + +/// \brief Conversion from a given json object \p j to a given UpdateDynamicScheduleResponse \p k +void from_json(const json& j, UpdateDynamicScheduleResponse& k); + +/// \brief Writes the string representation of the given UpdateDynamicScheduleResponse \p k to the given output stream +/// \p os \returns an output stream with the UpdateDynamicScheduleResponse written to +std::ostream& operator<<(std::ostream& os, const UpdateDynamicScheduleResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_UPDATEDYNAMICSCHEDULE_HPP diff --git a/include/ocpp/v21/messages/UsePriorityCharging.hpp b/include/ocpp/v21/messages/UsePriorityCharging.hpp new file mode 100644 index 000000000..19e2a9965 --- /dev/null +++ b/include/ocpp/v21/messages/UsePriorityCharging.hpp @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_USEPRIORITYCHARGING_HPP +#define OCPP_V21_USEPRIORITYCHARGING_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP UsePriorityCharging message +struct UsePriorityChargingRequest : public ocpp::Message { + CiString<36> transactionId; + bool activate; + std::optional customData; + + /// \brief Provides the type of this UsePriorityCharging message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given UsePriorityChargingRequest \p k to a given json object \p j +void to_json(json& j, const UsePriorityChargingRequest& k); + +/// \brief Conversion from a given json object \p j to a given UsePriorityChargingRequest \p k +void from_json(const json& j, UsePriorityChargingRequest& k); + +/// \brief Writes the string representation of the given UsePriorityChargingRequest \p k to the given output stream \p +/// os \returns an output stream with the UsePriorityChargingRequest written to +std::ostream& operator<<(std::ostream& os, const UsePriorityChargingRequest& k); + +/// \brief Contains a OCPP UsePriorityChargingResponse message +struct UsePriorityChargingResponse : public ocpp::Message { + PriorityChargingStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this UsePriorityChargingResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given UsePriorityChargingResponse \p k to a given json object \p j +void to_json(json& j, const UsePriorityChargingResponse& k); + +/// \brief Conversion from a given json object \p j to a given UsePriorityChargingResponse \p k +void from_json(const json& j, UsePriorityChargingResponse& k); + +/// \brief Writes the string representation of the given UsePriorityChargingResponse \p k to the given output stream \p +/// os \returns an output stream with the UsePriorityChargingResponse written to +std::ostream& operator<<(std::ostream& os, const UsePriorityChargingResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_USEPRIORITYCHARGING_HPP diff --git a/include/ocpp/v21/messages/VatNumberValidation.hpp b/include/ocpp/v21/messages/VatNumberValidation.hpp new file mode 100644 index 000000000..219c6f8e8 --- /dev/null +++ b/include/ocpp/v21/messages/VatNumberValidation.hpp @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#ifndef OCPP_V21_VATNUMBERVALIDATION_HPP +#define OCPP_V21_VATNUMBERVALIDATION_HPP + +#include +#include + +#include +#include +using namespace ocpp::v2; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP VatNumberValidation message +struct VatNumberValidationRequest : public ocpp::Message { + CiString<20> vatNumber; + std::optional evseId; + std::optional customData; + + /// \brief Provides the type of this VatNumberValidation message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given VatNumberValidationRequest \p k to a given json object \p j +void to_json(json& j, const VatNumberValidationRequest& k); + +/// \brief Conversion from a given json object \p j to a given VatNumberValidationRequest \p k +void from_json(const json& j, VatNumberValidationRequest& k); + +/// \brief Writes the string representation of the given VatNumberValidationRequest \p k to the given output stream \p +/// os \returns an output stream with the VatNumberValidationRequest written to +std::ostream& operator<<(std::ostream& os, const VatNumberValidationRequest& k); + +/// \brief Contains a OCPP VatNumberValidationResponse message +struct VatNumberValidationResponse : public ocpp::Message { + CiString<20> vatNumber; + GenericStatusEnum status; + std::optional
company; + std::optional statusInfo; + std::optional evseId; + std::optional customData; + + /// \brief Provides the type of this VatNumberValidationResponse message as a human readable string + /// \returns the message type as a human readable string + std::string get_type() const override; +}; + +/// \brief Conversion from a given VatNumberValidationResponse \p k to a given json object \p j +void to_json(json& j, const VatNumberValidationResponse& k); + +/// \brief Conversion from a given json object \p j to a given VatNumberValidationResponse \p k +void from_json(const json& j, VatNumberValidationResponse& k); + +/// \brief Writes the string representation of the given VatNumberValidationResponse \p k to the given output stream \p +/// os \returns an output stream with the VatNumberValidationResponse written to +std::ostream& operator<<(std::ostream& os, const VatNumberValidationResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_VATNUMBERVALIDATION_HPP diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8f6cac32d..b48a62299 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -110,6 +110,7 @@ if(LIBOCPP_ENABLE_V2) ocpp/v2/functional_blocks/transaction.cpp ) add_subdirectory(ocpp/v2/messages) + add_subdirectory(ocpp/v21/messages) endif() add_subdirectory(ocpp/common/websocket) diff --git a/lib/ocpp/common/evse_security.cpp b/lib/ocpp/common/evse_security.cpp index 982b208c3..0fc5dac81 100644 --- a/lib/ocpp/common/evse_security.cpp +++ b/lib/ocpp/common/evse_security.cpp @@ -19,6 +19,8 @@ ocpp::v2::GetCertificateIdUseEnum to_ocpp_v2(ocpp::CertificateType other) { return ocpp::v2::GetCertificateIdUseEnum::V2GCertificateChain; case ocpp::CertificateType::MFRootCertificate: return ocpp::v2::GetCertificateIdUseEnum::ManufacturerRootCertificate; + case ocpp::CertificateType::OEMRootCertificate: + return ocpp::v2::GetCertificateIdUseEnum::OEMRootCertificate; } throw EnumConversionException("Could not convert CertificateType to GetCertificateIdUseEnum"); @@ -34,6 +36,8 @@ ocpp::v2::InstallCertificateUseEnum to_ocpp_v2(ocpp::CaCertificateType other) { return ocpp::v2::InstallCertificateUseEnum::CSMSRootCertificate; case ocpp::CaCertificateType::MF: return ocpp::v2::InstallCertificateUseEnum::ManufacturerRootCertificate; + case ocpp::CaCertificateType::OEM: + return ocpp::v2::InstallCertificateUseEnum::OEMRootCertificate; } throw EnumConversionException("Could not convert CaCertificateType to InstallCertificateUseEnum"); @@ -144,6 +148,8 @@ ocpp::CertificateType from_ocpp_v2(ocpp::v2::GetCertificateIdUseEnum other) { return ocpp::CertificateType::CSMSRootCertificate; case ocpp::v2::GetCertificateIdUseEnum::ManufacturerRootCertificate: return ocpp::CertificateType::MFRootCertificate; + case ocpp::v2::GetCertificateIdUseEnum::OEMRootCertificate: + return ocpp::CertificateType::OEMRootCertificate; } throw EnumConversionException("Could not convert GetCertificateIdUseEnum to CertificateType"); @@ -167,6 +173,8 @@ ocpp::CaCertificateType from_ocpp_v2(ocpp::v2::InstallCertificateUseEnum other) return ocpp::CaCertificateType::CSMS; case ocpp::v2::InstallCertificateUseEnum::ManufacturerRootCertificate: return ocpp::CaCertificateType::MF; + case ocpp::v2::InstallCertificateUseEnum::OEMRootCertificate: + return ocpp::CaCertificateType::OEM; } throw EnumConversionException("Could not convert CaCertificateType to InstallCertificateUseEnum"); @@ -178,6 +186,8 @@ ocpp::CertificateSigningUseEnum from_ocpp_v2(ocpp::v2::CertificateSigningUseEnum return ocpp::CertificateSigningUseEnum::ChargingStationCertificate; case ocpp::v2::CertificateSigningUseEnum::V2GCertificate: return ocpp::CertificateSigningUseEnum::V2GCertificate; + case ocpp::v2::CertificateSigningUseEnum::V2G20Certificate: + return ocpp::CertificateSigningUseEnum::V2G20Certificate; } throw EnumConversionException("Could not convert CertificateSigningUseEnum to CertificateSigningUseEnum"); diff --git a/lib/ocpp/common/evse_security_impl.cpp b/lib/ocpp/common/evse_security_impl.cpp index 8dcc25a55..48752924d 100644 --- a/lib/ocpp/common/evse_security_impl.cpp +++ b/lib/ocpp/common/evse_security_impl.cpp @@ -349,8 +349,11 @@ evse_security::CaCertificateType from_ocpp(CaCertificateType other) { return evse_security::CaCertificateType::CSMS; case CaCertificateType::MF: return evse_security::CaCertificateType::MF; + case CaCertificateType::OEM: + // FIXME: Add OEM to evse_security::CaCertificateType + throw EnumConversionException("Could not convert CaCertificateType::OEM to evse_security::CaCertificateType"); } - throw EnumConversionException("Could not convert evse_security::CaCertificateType to CaCertificateType"); + throw EnumConversionException("Could not convert CaCertificateType to evse_security::CaCertificateType"); } evse_security::LeafCertificateType from_ocpp(LeafCertificateType other) { @@ -375,6 +378,10 @@ evse_security::LeafCertificateType from_ocpp(CertificateSigningUseEnum other) { return evse_security::LeafCertificateType::V2G; case CertificateSigningUseEnum::ManufacturerCertificate: return evse_security::LeafCertificateType::MF; + case CertificateSigningUseEnum::V2G20Certificate: + // FIXME: Add V2G20Certificate to evse_security::LeafCertificateType + throw EnumConversionException( + "Could not convert CertificateSigningUseEnum::V2G20Certificate to evse_security::LeafCertificateType"); } throw EnumConversionException("Could not convert CertificateSigningUseEnum to evse_security::LeafCertificateType"); } @@ -391,6 +398,9 @@ evse_security::CertificateType from_ocpp(CertificateType other) { return evse_security::CertificateType::V2GCertificateChain; case CertificateType::MFRootCertificate: return evse_security::CertificateType::MFRootCertificate; + case CertificateType::OEMRootCertificate: + throw EnumConversionException( + "Could not convert CertificateType::OEMRootCertificate to evse_security::CertificateType"); } throw EnumConversionException("Could not convert CertificateType to evse_security::CertificateType"); } diff --git a/lib/ocpp/common/types.cpp b/lib/ocpp/common/types.cpp index 9b46aa603..46f15a639 100644 --- a/lib/ocpp/common/types.cpp +++ b/lib/ocpp/common/types.cpp @@ -777,6 +777,8 @@ std::string ca_certificate_type_to_string(CaCertificateType e) { return "CSMS"; case CaCertificateType::MF: return "MF"; + case CaCertificateType::OEM: + return "OEM"; } throw EnumToStringException{e, "CaCertificateType"}; @@ -791,6 +793,8 @@ CaCertificateType string_to_ca_certificate_type(const std::string& s) { return CaCertificateType::CSMS; } else if (s == "MF") { return CaCertificateType::MF; + } else if (s == "OEM") { + return CaCertificateType::OEM; } throw StringToEnumException{s, "CertificateType"}; } @@ -1103,6 +1107,8 @@ std::string certificate_signing_use_enum_to_string(CertificateSigningUseEnum e) return "V2GCertificate"; case CertificateSigningUseEnum::ManufacturerCertificate: return "ManufacturerCertificate"; + case CertificateSigningUseEnum::V2G20Certificate: + return "V2G20Certificate"; } throw EnumToStringException{e, "CertificateSigningUseEnum"}; @@ -1118,6 +1124,9 @@ CertificateSigningUseEnum string_to_certificate_signing_use_enum(const std::stri if (s == "ManufacturerCertificate") { return CertificateSigningUseEnum::ManufacturerCertificate; } + if (s == "V2G20Certificate") { + return CertificateSigningUseEnum::V2G20Certificate; + } throw StringToEnumException{s, "CertificateSigningUseEnum"}; } @@ -1141,6 +1150,8 @@ std::string certificate_type_to_string(CertificateType e) { return "V2GCertificateChain"; case CertificateType::MFRootCertificate: return "MFRootCertificate"; + case CertificateType::OEMRootCertificate: + return "OEMRootCertificate"; } throw EnumToStringException{e, "CertificateType"}; @@ -1162,6 +1173,9 @@ CertificateType string_to_certificate_type(const std::string& s) { if (s == "MFRootCertificate") { return CertificateType::MFRootCertificate; } + if (s == "OEMRootCertificate") { + return CertificateType::OEMRootCertificate; + } throw StringToEnumException{s, "CertificateType"}; } diff --git a/lib/ocpp/v16/charge_point_impl.cpp b/lib/ocpp/v16/charge_point_impl.cpp index 5f1b792f6..8c5cbdb6b 100644 --- a/lib/ocpp/v16/charge_point_impl.cpp +++ b/lib/ocpp/v16/charge_point_impl.cpp @@ -3483,7 +3483,7 @@ ocpp::v2::AuthorizeResponse ChargePointImpl::data_transfer_pnc_authorize( ocpp::v2::AuthorizeRequest authorize_req; ocpp::v2::IdToken id_token; - id_token.type = ocpp::v2::IdTokenEnum::eMAID; + id_token.type = v2::IdTokenEnumStringType::eMAID; id_token.idToken = emaid; authorize_req.idToken = id_token; diff --git a/lib/ocpp/v2/charge_point.cpp b/lib/ocpp/v2/charge_point.cpp index 48decdf61..1056b5b23 100644 --- a/lib/ocpp/v2/charge_point.cpp +++ b/lib/ocpp/v2/charge_point.cpp @@ -119,6 +119,7 @@ void ChargePoint::start(BootReasonEnum bootreason, bool start_connecting) { this->provisioning->boot_notification_req(bootreason); // call clear_invalid_charging_profiles when system boots this->clear_invalid_charging_profiles(); + if (start_connecting) { this->connectivity_manager->connect(); } @@ -344,7 +345,7 @@ std::optional ChargePoint::get_evse_transaction_id(int32_t evse_id) return std::nullopt; } -AuthorizeResponse ChargePoint::validate_token(const IdToken id_token, const std::optional>& certificate, +AuthorizeResponse ChargePoint::validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) { return this->authorization->validate_token(id_token, certificate, ocsp_request_data); } @@ -453,8 +454,9 @@ void ChargePoint::initialize(const std::map& evse_connector_st std::bind(&ChargePoint::message_callback, this, std::placeholders::_1)); this->connectivity_manager->set_websocket_connected_callback( - [this](int configuration_slot, const NetworkConnectionProfile& network_connection_profile, auto) { - this->websocket_connected_callback(configuration_slot, network_connection_profile); + [this](int configuration_slot, const NetworkConnectionProfile& network_connection_profile, + const OcppProtocolVersion ocpp_version) { + this->websocket_connected_callback(configuration_slot, network_connection_profile, ocpp_version); }); this->connectivity_manager->set_websocket_disconnected_callback( [this](int configuration_slot, const NetworkConnectionProfile& network_connection_profile, auto) { @@ -648,7 +650,11 @@ void ChargePoint::handle_message(const EnhancedMessage& message case MessageType::ClearChargingProfile: case MessageType::GetChargingProfiles: case MessageType::GetCompositeSchedule: - this->smart_charging->handle_message(message); + if (this->smart_charging != nullptr) { + this->smart_charging->handle_message(message); + } else { + send_not_implemented_error(message.uniqueId, message.messageTypeId); + } break; case MessageType::GetDisplayMessages: case MessageType::SetDisplayMessage: @@ -660,7 +666,12 @@ void ChargePoint::handle_message(const EnhancedMessage& message } break; case MessageType::CostUpdated: - this->tariff_and_cost->handle_message(message); + if (this->tariff_and_cost != nullptr) { + this->tariff_and_cost->handle_message(message); + } else { + send_not_implemented_error(message.uniqueId, message.messageTypeId); + } + break; case MessageType::Authorize: case MessageType::AuthorizeResponse: @@ -748,6 +759,60 @@ void ChargePoint::handle_message(const EnhancedMessage& message case MessageType::UnpublishFirmware: case MessageType::UnpublishFirmwareResponse: case MessageType::UpdateFirmwareResponse: + case MessageType::AdjustPeriodicEventStream: + case MessageType::AdjustPeriodicEventStreamResponse: + case MessageType::AFRRSignal: + case MessageType::AFRRSignalResponse: + case MessageType::BatterySwap: + case MessageType::BatterySwapResponse: + case MessageType::ChangeTransactionTariff: + case MessageType::ChangeTransactionTariffResponse: + case MessageType::ClearDERControl: + case MessageType::ClearDERControlResponse: + case MessageType::ClearTariffs: + case MessageType::ClearTariffsResponse: + case MessageType::ClosePeriodicEventStream: + case MessageType::ClosePeriodicEventStreamResponse: + case MessageType::GetCRL: + case MessageType::GetCRLResponse: + case MessageType::GetDERControl: + case MessageType::GetDERControlResponse: + case MessageType::GetPeriodicEventStream: + case MessageType::GetPeriodicEventStreamResponse: + case MessageType::GetTariffs: + case MessageType::GetTariffsResponse: + case MessageType::NotifyAllowedEnergyTransfer: + case MessageType::NotifyAllowedEnergyTransferResponse: + case MessageType::NotifyCRL: + case MessageType::NotifyCRLResponse: + case MessageType::NotifyDERAlarm: + case MessageType::NotifyDERAlarmResponse: + case MessageType::NotifyDERStartStop: + case MessageType::NotifyDERStartStopResponse: + case MessageType::NotifyPeriodicEventStream: + case MessageType::NotifyPeriodicEventStreamResponse: + case MessageType::NotifyPriorityCharging: + case MessageType::NotifyPriorityChargingResponse: + case MessageType::NotifyQRCodeScanned: + case MessageType::NotifyQRCodeScannedResponse: + case MessageType::NotifySettlement: + case MessageType::NotifySettlementResponse: + case MessageType::OpenPeriodicEventStream: + case MessageType::OpenPeriodicEventStreamResponse: + case MessageType::PullDynamicScheduleUpdate: + case MessageType::PullDynamicScheduleUpdateResponse: + case MessageType::RequestBatterySwap: + case MessageType::RequestBatterySwapResponse: + case MessageType::SetDefaultTariff: + case MessageType::SetDefaultTariffResponse: + case MessageType::SetDERControl: + case MessageType::SetDERControlResponse: + case MessageType::UpdateDynamicSchedule: + case MessageType::UpdateDynamicScheduleResponse: + case MessageType::UsePriorityCharging: + case MessageType::UsePriorityChargingResponse: + case MessageType::VatNumberValidation: + case MessageType::VatNumberValidationResponse: case MessageType::InternalError: send_not_implemented_error(message.uniqueId, message.messageTypeId); break; @@ -888,6 +953,10 @@ void ChargePoint::message_callback(const std::string& message) { } auto call_error = CallError(enhanced_message.uniqueId, "FormationViolation", e.what(), json({})); this->message_dispatcher->dispatch_call_error(call_error); + } catch (const DeviceModelError& e) { + EVLOG_error << "DeviceModelError during handling of message: " << e.what(); + auto call_error = CallError(enhanced_message.uniqueId, "GenericError", e.what(), json({})); + this->message_dispatcher->dispatch_call_error(call_error); } catch (json::exception& e) { EVLOG_error << "JSON exception during handling of message: " << e.what(); if (enhanced_message.messageTypeId != MessageTypeId::CALL) { @@ -903,7 +972,6 @@ void ChargePoint::message_callback(const std::string& message) { bool ChargePoint::is_offline() { return !this->connectivity_manager->is_websocket_connected(); } - std::optional ChargePoint::data_transfer_req(const CiString<255>& vendorId, const std::optional>& messageId, const std::optional& data) { @@ -915,9 +983,10 @@ std::optional ChargePoint::data_transfer_req(const DataTra } void ChargePoint::websocket_connected_callback(const int configuration_slot, - const NetworkConnectionProfile& network_connection_profile) { + const NetworkConnectionProfile& network_connection_profile, + const OcppProtocolVersion ocpp_version) { this->message_queue->resume(this->message_queue_resume_delay); - + this->ocpp_version = ocpp_version; if (this->registration_status == RegistrationStatusEnum::Accepted) { this->connectivity_manager->confirm_successful_connection(); @@ -948,7 +1017,8 @@ void ChargePoint::websocket_connected_callback(const int configuration_slot, this->skip_invalid_csms_certificate_notifications = false; if (this->callbacks.connection_state_changed_callback.has_value()) { - this->callbacks.connection_state_changed_callback.value()(true, configuration_slot, network_connection_profile); + this->callbacks.connection_state_changed_callback.value()(true, configuration_slot, network_connection_profile, + ocpp_version); } } @@ -964,8 +1034,8 @@ void ChargePoint::websocket_disconnected_callback(const int configuration_slot, this->security->stop_certificate_expiration_check_timers(); if (this->callbacks.connection_state_changed_callback.has_value()) { - this->callbacks.connection_state_changed_callback.value()(false, configuration_slot, - network_connection_profile); + this->callbacks.connection_state_changed_callback.value()(false, configuration_slot, network_connection_profile, + this->ocpp_version); } } @@ -1020,8 +1090,9 @@ void ChargePoint::clear_invalid_charging_profiles() { for (const auto& [evse_id, profiles] : evses) { for (auto profile : profiles) { try { - if (this->smart_charging->conform_and_validate_profile(profile, evse_id) != - ProfileValidationResultEnum::Valid) { + if (this->smart_charging != nullptr && + this->smart_charging->conform_and_validate_profile(profile, evse_id) != + ProfileValidationResultEnum::Valid) { this->database_handler->delete_charging_profile(profile.id); } } catch (const QueryExecutionException& e) { @@ -1046,16 +1117,27 @@ ChargePoint::set_variables(const std::vector& set_variable_data } GetCompositeScheduleResponse ChargePoint::get_composite_schedule(const GetCompositeScheduleRequest& request) { + if (this->smart_charging == nullptr) { + GetCompositeScheduleResponse response; + response.status = GenericStatusEnum::Rejected; + return response; + } return this->smart_charging->get_composite_schedule(request); } std::optional ChargePoint::get_composite_schedule(int32_t evse_id, std::chrono::seconds duration, ChargingRateUnitEnum unit) { + if (this->smart_charging == nullptr) { + return std::nullopt; + } return this->smart_charging->get_composite_schedule(evse_id, duration, unit); } std::vector ChargePoint::get_all_composite_schedules(const int32_t duration_s, const ChargingRateUnitEnum& unit) { + if (this->smart_charging == nullptr) { + return {}; + } return this->smart_charging->get_all_composite_schedules(duration_s, unit); } diff --git a/lib/ocpp/v2/connectivity_manager.cpp b/lib/ocpp/v2/connectivity_manager.cpp index 1de6e46dd..38732f307 100644 --- a/lib/ocpp/v2/connectivity_manager.cpp +++ b/lib/ocpp/v2/connectivity_manager.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace { const auto WEBSOCKET_INIT_DELAY = std::chrono::seconds(2); @@ -336,8 +337,11 @@ ConnectivityManager::get_ws_connection_options(const int32_t configuration_slot) this->device_model.get_value(ControllerComponentVariables::SecurityCtrlrIdentity), network_connection_profile.securityProfile); + const auto ocpp_versions = utils::get_ocpp_protocol_versions( + this->device_model.get_value(ControllerComponentVariables::SupportedOcppVersions)); + WebsocketConnectionOptions connection_options{ - {OcppProtocolVersion::v201}, + ocpp_versions, uri, network_connection_profile.securityProfile, this->device_model.get_optional_value(ControllerComponentVariables::BasicAuthPassword), diff --git a/lib/ocpp/v2/ctrlr_component_variables.cpp b/lib/ocpp/v2/ctrlr_component_variables.cpp index 5c51544bc..095ab57de 100644 --- a/lib/ocpp/v2/ctrlr_component_variables.cpp +++ b/lib/ocpp/v2/ctrlr_component_variables.cpp @@ -36,1314 +36,1121 @@ const Variable Fallback = {"Fallback"}; }; // namespace StandardizedVariables namespace ControllerComponentVariables { - const ComponentVariable InternalCtrlrEnabled = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const RequiredComponentVariable ChargePointId = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ChargePointId", }), }; const RequiredComponentVariable NetworkConnectionProfiles = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "NetworkConnectionProfiles", }), }; const RequiredComponentVariable ChargeBoxSerialNumber = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ChargeBoxSerialNumber", }), }; const RequiredComponentVariable ChargePointModel = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ChargePointModel", }), }; const ComponentVariable ChargePointSerialNumber = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ChargePointSerialNumber", }), }; const RequiredComponentVariable ChargePointVendor = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ChargePointVendor", }), }; const RequiredComponentVariable FirmwareVersion = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "FirmwareVersion", }), }; const ComponentVariable ICCID = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ICCID", }), }; const ComponentVariable IMSI = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "IMSI", }), }; const ComponentVariable MeterSerialNumber = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MeterSerialNumber", }), }; const ComponentVariable MeterType = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MeterType", }), }; const RequiredComponentVariable SupportedCiphers12 = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "SupportedCiphers12", }), }; const RequiredComponentVariable SupportedCiphers13 = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "SupportedCiphers13", }), }; const ComponentVariable AuthorizeConnectorZeroOnConnectorOne = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "AuthorizeConnectorZeroOnConnectorOne", }), }; const ComponentVariable LogMessages = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogMessages", }), }; const RequiredComponentVariable LogMessagesFormat = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogMessagesFormat", }), }; const ComponentVariable LogRotation = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogRotation", }), }; const ComponentVariable LogRotationDateSuffix = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogRotationDateSuffix", }), }; const ComponentVariable LogRotationMaximumFileSize = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogRotationMaximumFileSize", }), }; const ComponentVariable LogRotationMaximumFileCount = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "LogRotationMaximumFileCount", }), }; const ComponentVariable SupportedCriteria = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "SupportedCriteria", }), }; const ComponentVariable RoundClockAlignedTimestamps = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "RoundClockAlignedTimestamps", }), }; const ComponentVariable NetworkConfigTimeout = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "NetworkConfigTimeout", }), }; const ComponentVariable SupportedChargingProfilePurposeTypes = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "SupportedChargingProfilePurposeTypes", }), }; const ComponentVariable MaxCompositeScheduleDuration = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MaxCompositeScheduleDuration", }), }; const RequiredComponentVariable NumberOfConnectors = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "NumberOfConnectors", }), }; const ComponentVariable UseSslDefaultVerifyPaths = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "UseSslDefaultVerifyPaths", }), }; const ComponentVariable VerifyCsmsCommonName = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "VerifyCsmsCommonName", }), }; const ComponentVariable UseTPM = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "UseTPM", }), }; const ComponentVariable UseTPMSeccLeafCertificate = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "UseTPMSeccLeafCertificate", }), }; const ComponentVariable VerifyCsmsAllowWildcards = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "VerifyCsmsAllowWildcards", }), }; const ComponentVariable IFace = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "IFace", }), }; const ComponentVariable EnableTLSKeylog = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "EnableTLSKeylog", }), }; const ComponentVariable TLSKeylogFile = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "TLSKeylogFile", }), }; const ComponentVariable OcspRequestInterval = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "OcspRequestInterval", }), }; const ComponentVariable WebsocketPingPayload = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "WebsocketPingPayload", }), }; const ComponentVariable WebsocketPongTimeout = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "WebsocketPongTimeout", }), }; const ComponentVariable MonitorsProcessingInterval = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MonitorsProcessingInterval", }), }; const ComponentVariable MaxCustomerInformationDataLength = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MaxCustomerInformationDataLength", }), }; const ComponentVariable V2GCertificateExpireCheckInitialDelaySeconds = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "V2GCertificateExpireCheckInitialDelaySeconds", }), }; const ComponentVariable V2GCertificateExpireCheckIntervalSeconds = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "V2GCertificateExpireCheckIntervalSeconds", }), }; const ComponentVariable ClientCertificateExpireCheckInitialDelaySeconds = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ClientCertificateExpireCheckInitialDelaySeconds", }), }; const ComponentVariable ClientCertificateExpireCheckIntervalSeconds = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ClientCertificateExpireCheckIntervalSeconds", }), }; const ComponentVariable MessageQueueSizeThreshold = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MessageQueueSizeThreshold", }), }; const ComponentVariable MaxMessageSize = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "MaxMessageSize", }), }; const ComponentVariable ResumeTransactionsOnBoot = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "ResumeTransactionsOnBoot", }), }; const ComponentVariable AllowCSMSRootCertInstallWithUnsecureConnection = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "AllowCSMSRootCertInstallWithUnsecureConnection", }), }; const ComponentVariable AllowMFRootCertInstallWithUnsecureConnection = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "AllowMFRootCertInstallWithUnsecureConnection", }), }; const ComponentVariable AllowSecurityLevelZeroConnections = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "AllowSecurityLevelZeroConnections", }), }; +const RequiredComponentVariable SupportedOcppVersions = { + ControllerComponents::InternalCtrlr, + std::optional({"SupportedOcppVersions"}), +}; const ComponentVariable AlignedDataCtrlrEnabled = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable AlignedDataCtrlrAvailable = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "Available", }), }; const RequiredComponentVariable AlignedDataInterval = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "Interval", }), }; const RequiredComponentVariable AlignedDataMeasurands = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "Measurands", }), }; const ComponentVariable AlignedDataSendDuringIdle = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "SendDuringIdle", }), }; const ComponentVariable AlignedDataSignReadings = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "SignReadings", }), }; const RequiredComponentVariable AlignedDataTxEndedInterval = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "TxEndedInterval", }), }; const RequiredComponentVariable AlignedDataTxEndedMeasurands = { ControllerComponents::AlignedDataCtrlr, - std::nullopt, std::optional({ "TxEndedMeasurands", }), }; const ComponentVariable AuthCacheCtrlrAvailable = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "Available", }), }; const ComponentVariable AuthCacheDisablePostAuthorize = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "DisablePostAuthorize", }), }; const ComponentVariable AuthCacheCtrlrEnabled = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable AuthCacheLifeTime = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "LifeTime", }), }; const ComponentVariable AuthCachePolicy = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "Policy", }), }; const ComponentVariable AuthCacheStorage = { ControllerComponents::AuthCacheCtrlr, - std::nullopt, std::optional({ "Storage", }), }; const ComponentVariable AuthCtrlrEnabled = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable AdditionalInfoItemsPerMessage = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "AdditionalInfoItemsPerMessage", }), }; const RequiredComponentVariable AuthorizeRemoteStart = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "AuthorizeRemoteStart", }), }; const RequiredComponentVariable LocalAuthorizeOffline = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "LocalAuthorizeOffline", }), }; const RequiredComponentVariable LocalPreAuthorize = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "LocalPreAuthorize", }), }; const ComponentVariable DisableRemoteAuthorization = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "DisableRemoteAuthorization", }), }; const ComponentVariable MasterPassGroupId = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "MasterPassGroupId", }), }; const ComponentVariable OfflineTxForUnknownIdEnabled = { ControllerComponents::AuthCtrlr, - std::nullopt, std::optional({ "OfflineTxForUnknownIdEnabled", }), }; const ComponentVariable AllowNewSessionsPendingFirmwareUpdate = { ControllerComponents::ChargingStation, - std::nullopt, - std::optional({"AllowNewSessionsPendingFirmwareUpdate", std::nullopt, "BytesPerMessage"}), + std::optional({"AllowNewSessionsPendingFirmwareUpdate", "BytesPerMessage"}), }; const RequiredComponentVariable ChargingStationAvailabilityState = { ControllerComponents::ChargingStation, - std::nullopt, std::optional({ "AvailabilityState", }), }; const RequiredComponentVariable ChargingStationAvailable = { ControllerComponents::ChargingStation, - std::nullopt, std::optional({ "Available", }), }; const RequiredComponentVariable ChargingStationSupplyPhases = { ControllerComponents::ChargingStation, - std::nullopt, std::optional({ "SupplyPhases", }), }; const RequiredComponentVariable ClockCtrlrDateTime = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "DateTime", }), }; const ComponentVariable NextTimeOffsetTransitionDateTime = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "NextTimeOffsetTransitionDateTime", }), }; const ComponentVariable NtpServerUri = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "NtpServerUri", }), }; const ComponentVariable NtpSource = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "NtpSource", }), }; const ComponentVariable TimeAdjustmentReportingThreshold = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "TimeAdjustmentReportingThreshold", }), }; const ComponentVariable TimeOffset = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "TimeOffset", }), }; const ComponentVariable TimeOffsetNextTransition = { ControllerComponents::ClockCtrlr, - std::nullopt, - std::optional({"TimeOffset", std::nullopt, "NextTransition"}), + std::optional({"TimeOffset", "NextTransition"}), }; const RequiredComponentVariable TimeSource = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "TimeSource", }), }; const ComponentVariable TimeZone = { ControllerComponents::ClockCtrlr, - std::nullopt, std::optional({ "TimeZone", }), }; const ComponentVariable CustomImplementationEnabled = { ControllerComponents::CustomizationCtrlr, - std::nullopt, std::optional({ "CustomImplementationEnabled", }), }; const ComponentVariable CustomImplementationCaliforniaPricingEnabled = { ControllerComponents::CustomizationCtrlr, - std::nullopt, - std::optional({"CustomImplementationEnabled", std::nullopt, "org.openchargealliance.costmsg"}), + std::optional({"CustomImplementationEnabled", "org.openchargealliance.costmsg"}), }; const ComponentVariable CustomImplementationMultiLanguageEnabled = { ControllerComponents::CustomizationCtrlr, - std::nullopt, - std::optional({"CustomImplementationEnabled", std::nullopt, "org.openchargealliance.multilanguage"}), + std::optional({"CustomImplementationEnabled", "org.openchargealliance.multilanguage"}), }; const RequiredComponentVariable BytesPerMessageGetReport = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"BytesPerMessage", std::nullopt, "GetReport"}), + std::optional({"BytesPerMessage", "GetReport"}), }; const RequiredComponentVariable BytesPerMessageGetVariables = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"BytesPerMessage", std::nullopt, "GetVariables"}), + std::optional({"BytesPerMessage", "GetVariables"}), }; const RequiredComponentVariable BytesPerMessageSetVariables = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"BytesPerMessage", std::nullopt, "SetVariables"}), + std::optional({"BytesPerMessage", "SetVariables"}), }; const ComponentVariable ConfigurationValueSize = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, std::optional({ "ConfigurationValueSize", }), }; const RequiredComponentVariable ItemsPerMessageGetReport = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"ItemsPerMessage", std::nullopt, "GetReport"}), + std::optional({"ItemsPerMessage", "GetReport"}), }; const RequiredComponentVariable ItemsPerMessageGetVariables = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"ItemsPerMessage", std::nullopt, "GetVariables"}), + std::optional({"ItemsPerMessage", "GetVariables"}), }; const RequiredComponentVariable ItemsPerMessageSetVariables = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, - std::optional({"ItemsPerMessage", std::nullopt, "SetVariables"}), + std::optional({"ItemsPerMessage", "SetVariables"}), }; const ComponentVariable ReportingValueSize = { ControllerComponents::DeviceDataCtrlr, - std::nullopt, std::optional({ "ReportingValueSize", }), }; const ComponentVariable DisplayMessageCtrlrAvailable = { ControllerComponents::DisplayMessageCtrlr, - std::nullopt, std::optional({ "Available", }), }; const RequiredComponentVariable NumberOfDisplayMessages = { ControllerComponents::DisplayMessageCtrlr, - std::nullopt, std::optional({ - "NumberOfDisplayMessages", + "DisplayMessages", }), }; const RequiredComponentVariable DisplayMessageSupportedFormats = { ControllerComponents::DisplayMessageCtrlr, - std::nullopt, std::optional({ "SupportedFormats", }), }; const RequiredComponentVariable DisplayMessageSupportedPriorities = { ControllerComponents::DisplayMessageCtrlr, - std::nullopt, std::optional({ "SupportedPriorities", }), }; -const ComponentVariable DisplayMessageSupportedStates = { - ControllerComponents::DisplayMessageCtrlr, std::nullopt, - std::optional({"SupportedStates", std::nullopt, std::nullopt})}; +const ComponentVariable DisplayMessageSupportedStates = {ControllerComponents::DisplayMessageCtrlr, + std::optional({"SupportedStates"})}; -const ComponentVariable DisplayMessageQRCodeDisplayCapable = { - ControllerComponents::DisplayMessageCtrlr, std::nullopt, - std::optional({"QRCodeDisplayCapable", std::nullopt, std::nullopt})}; +const ComponentVariable DisplayMessageQRCodeDisplayCapable = {ControllerComponents::DisplayMessageCtrlr, + std::optional({"QRCodeDisplayCapable"})}; -const ComponentVariable DisplayMessageLanguage = {ControllerComponents::DisplayMessageCtrlr, std::nullopt, - std::optional({"Language", std::nullopt, std::nullopt})}; +const ComponentVariable DisplayMessageLanguage = {ControllerComponents::DisplayMessageCtrlr, + std::optional({"Language"})}; const ComponentVariable CentralContractValidationAllowed = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "CentralContractValidationAllowed", }), }; const RequiredComponentVariable ContractValidationOffline = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "ContractValidationOffline", }), }; const ComponentVariable RequestMeteringReceipt = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "RequestMeteringReceipt", }), }; const ComponentVariable ISO15118CtrlrSeccId = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "SeccId", }), }; const ComponentVariable ISO15118CtrlrCountryName = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "CountryName", }), }; const ComponentVariable ISO15118CtrlrOrganizationName = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "OrganizationName", }), }; const ComponentVariable PnCEnabled = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "PnCEnabled", }), }; const ComponentVariable V2GCertificateInstallationEnabled = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "V2GCertificateInstallationEnabled", }), }; const ComponentVariable ContractCertificateInstallationEnabled = { ControllerComponents::ISO15118Ctrlr, - std::nullopt, std::optional({ "ContractCertificateInstallationEnabled", }), }; const ComponentVariable LocalAuthListCtrlrAvailable = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "Available", }), }; const RequiredComponentVariable BytesPerMessageSendLocalList = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "BytesPerMessage", }), }; const ComponentVariable LocalAuthListCtrlrEnabled = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const RequiredComponentVariable LocalAuthListCtrlrEntries = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "Entries", }), }; const RequiredComponentVariable ItemsPerMessageSendLocalList = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "ItemsPerMessage", }), }; const ComponentVariable LocalAuthListCtrlrStorage = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "Storage", }), }; const ComponentVariable LocalAuthListDisablePostAuthorize = { ControllerComponents::LocalAuthListCtrlr, - std::nullopt, std::optional({ "DisablePostAuthorize", }), }; const ComponentVariable MonitoringCtrlrAvailable = { ControllerComponents::MonitoringCtrlr, - std::nullopt, std::optional({ "Available", }), }; const ComponentVariable BytesPerMessageClearVariableMonitoring = { ControllerComponents::MonitoringCtrlr, - std::nullopt, - std::optional({"BytesPerMessage", std::nullopt, "ClearVariableMonitoring"}), + std::optional({"BytesPerMessage", "ClearVariableMonitoring"}), }; const RequiredComponentVariable BytesPerMessageSetVariableMonitoring = { ControllerComponents::MonitoringCtrlr, - std::nullopt, - std::optional({"BytesPerMessage", std::nullopt, "SetVariableMonitoring"}), + std::optional({"BytesPerMessage", "SetVariableMonitoring"}), }; const ComponentVariable MonitoringCtrlrEnabled = { ControllerComponents::MonitoringCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable ActiveMonitoringBase = { ControllerComponents::MonitoringCtrlr, - std::nullopt, std::optional({"ActiveMonitoringBase"}), }; const ComponentVariable ActiveMonitoringLevel = { ControllerComponents::MonitoringCtrlr, - std::nullopt, std::optional({"ActiveMonitoringLevel"}), }; const ComponentVariable ItemsPerMessageClearVariableMonitoring = { ControllerComponents::MonitoringCtrlr, - std::nullopt, - std::optional({"ItemsPerMessage", std::nullopt, "ClearVariableMonitoring"}), + std::optional({"ItemsPerMessage", "ClearVariableMonitoring"}), }; const RequiredComponentVariable ItemsPerMessageSetVariableMonitoring = { ControllerComponents::MonitoringCtrlr, - std::nullopt, - std::optional({"ItemsPerMessage", std::nullopt, "SetVariableMonitoring"}), + std::optional({"ItemsPerMessage", "SetVariableMonitoring"}), }; const ComponentVariable OfflineQueuingSeverity = { ControllerComponents::MonitoringCtrlr, - std::nullopt, std::optional({ "OfflineQueuingSeverity", }), }; const ComponentVariable ActiveNetworkProfile = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "ActiveNetworkProfile", }), }; const RequiredComponentVariable FileTransferProtocols = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "FileTransferProtocols", }), }; const ComponentVariable HeartbeatInterval = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "HeartbeatInterval", }), }; const RequiredComponentVariable MessageTimeout = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, - std::optional({"MessageTimeout", std::nullopt, "Default"}), + std::optional({"MessageTimeout", "Default"}), }; const RequiredComponentVariable MessageAttemptInterval = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, - std::optional({"MessageAttemptInterval", std::nullopt, "TransactionEvent"}), + std::optional({"MessageAttemptInterval", "TransactionEvent"}), }; const RequiredComponentVariable MessageAttempts = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, - std::optional({"MessageAttempts", std::nullopt, "TransactionEvent"}), + std::optional({"MessageAttempts", "TransactionEvent"}), }; const RequiredComponentVariable NetworkConfigurationPriority = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "NetworkConfigurationPriority", }), }; const RequiredComponentVariable NetworkProfileConnectionAttempts = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "NetworkProfileConnectionAttempts", }), }; const RequiredComponentVariable OfflineThreshold = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "OfflineThreshold", }), }; const ComponentVariable QueueAllMessages = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "QueueAllMessages", }), }; const ComponentVariable MessageTypesDiscardForQueueing = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "MessageTypesDiscardForQueueing", }), }; const RequiredComponentVariable ResetRetries = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "ResetRetries", }), }; const RequiredComponentVariable RetryBackOffRandomRange = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "RetryBackOffRandomRange", }), }; const RequiredComponentVariable RetryBackOffRepeatTimes = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "RetryBackOffRepeatTimes", }), }; const RequiredComponentVariable RetryBackOffWaitMinimum = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "RetryBackOffWaitMinimum", }), }; const RequiredComponentVariable UnlockOnEVSideDisconnect = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "UnlockOnEVSideDisconnect", }), }; const RequiredComponentVariable WebSocketPingInterval = { ControllerComponents::OCPPCommCtrlr, - std::nullopt, std::optional({ "WebSocketPingInterval", }), }; const ComponentVariable ReservationCtrlrAvailable = { ControllerComponents::ReservationCtrlr, - std::nullopt, std::optional({ "Available", }), }; const ComponentVariable ReservationCtrlrEnabled = { ControllerComponents::ReservationCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable ReservationCtrlrNonEvseSpecific = { ControllerComponents::ReservationCtrlr, - std::nullopt, std::optional({ "NonEvseSpecific", }), }; const ComponentVariable SampledDataCtrlrAvailable = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "Available", }), }; const ComponentVariable SampledDataCtrlrEnabled = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const ComponentVariable SampledDataSignReadings = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "SignReadings", }), }; const RequiredComponentVariable SampledDataTxEndedInterval = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "TxEndedInterval", }), }; const RequiredComponentVariable SampledDataTxEndedMeasurands = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "TxEndedMeasurands", }), }; const RequiredComponentVariable SampledDataTxStartedMeasurands = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "TxStartedMeasurands", }), }; const RequiredComponentVariable SampledDataTxUpdatedInterval = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "TxUpdatedInterval", }), }; const RequiredComponentVariable SampledDataTxUpdatedMeasurands = { ControllerComponents::SampledDataCtrlr, - std::nullopt, std::optional({ "TxUpdatedMeasurands", }), }; const ComponentVariable AdditionalRootCertificateCheck = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "AdditionalRootCertificateCheck", }), }; const ComponentVariable BasicAuthPassword = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "BasicAuthPassword", }), }; const RequiredComponentVariable CertificateEntries = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "CertificateEntries", }), }; const ComponentVariable CertSigningRepeatTimes = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "CertSigningRepeatTimes", }), }; const ComponentVariable CertSigningWaitMinimum = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "CertSigningWaitMinimum", }), }; const RequiredComponentVariable SecurityCtrlrIdentity = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "Identity", }), }; const ComponentVariable MaxCertificateChainSize = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "MaxCertificateChainSize", }), }; const ComponentVariable UpdateCertificateSymlinks = { ControllerComponents::InternalCtrlr, - std::nullopt, std::optional({ "UpdateCertificateSymlinks", }), }; const RequiredComponentVariable OrganizationName = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "OrganizationName", }), }; const RequiredComponentVariable SecurityProfile = { ControllerComponents::SecurityCtrlr, - std::nullopt, std::optional({ "SecurityProfile", }), }; const ComponentVariable ACPhaseSwitchingSupported = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "ACPhaseSwitchingSupported", }), }; const ComponentVariable SmartChargingCtrlrAvailable = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "Available", }), }; const ComponentVariable SmartChargingCtrlrEnabled = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "Enabled", }), }; const RequiredComponentVariable EntriesChargingProfiles = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, - std::optional({"Entries", std::nullopt, "ChargingProfiles"}), + std::optional({"Entries", "ChargingProfiles"}), }; const ComponentVariable ExternalControlSignalsEnabled = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "ExternalControlSignalsEnabled", }), }; const RequiredComponentVariable LimitChangeSignificance = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "LimitChangeSignificance", }), }; const ComponentVariable NotifyChargingLimitWithSchedules = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "NotifyChargingLimitWithSchedules", }), }; const RequiredComponentVariable PeriodsPerSchedule = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "PeriodsPerSchedule", }), }; const RequiredComponentVariable CompositeScheduleDefaultLimitAmps = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({"CompositeScheduleDefaultLimitAmps"}), }; const RequiredComponentVariable CompositeScheduleDefaultLimitWatts = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({"CompositeScheduleDefaultLimitWatts"}), }; const RequiredComponentVariable CompositeScheduleDefaultNumberPhases = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({"CompositeScheduleDefaultNumberPhases"}), }; const RequiredComponentVariable SupplyVoltage = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({"SupplyVoltage"}), }; const ComponentVariable Phases3to1 = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "Phases3to1", }), }; const RequiredComponentVariable ChargingProfileMaxStackLevel = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "ProfileStackLevel", }), }; const RequiredComponentVariable ChargingScheduleChargingRateUnit = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "RateUnit", }), }; const ComponentVariable IgnoredProfilePurposesOffline = { ControllerComponents::SmartChargingCtrlr, - std::nullopt, std::optional({ "IgnoredProfilePurposesOffline", }), }; const ComponentVariable TariffCostCtrlrAvailableTariff = { ControllerComponents::TariffCostCtrlr, - std::nullopt, - std::optional({"Available", std::nullopt, "Tariff"}), + std::optional({"Available", "Tariff"}), }; const ComponentVariable TariffCostCtrlrAvailableCost = { ControllerComponents::TariffCostCtrlr, - std::nullopt, - std::optional({"Available", std::nullopt, "Cost"}), + std::optional({"Available", "Cost"}), }; const RequiredComponentVariable TariffCostCtrlrCurrency = { ControllerComponents::TariffCostCtrlr, - std::nullopt, std::optional({ "Currency", }), }; const ComponentVariable TariffCostCtrlrEnabledTariff = { ControllerComponents::TariffCostCtrlr, - std::nullopt, - std::optional({"Enabled", std::nullopt, "Tariff"}), + std::optional({"Enabled", "Tariff"}), }; const ComponentVariable TariffCostCtrlrEnabledCost = { ControllerComponents::TariffCostCtrlr, - std::nullopt, - std::optional({"Enabled", std::nullopt, "Cost"}), + std::optional({"Enabled", "Cost"}), }; const RequiredComponentVariable TariffFallbackMessage = { ControllerComponents::TariffCostCtrlr, - std::nullopt, std::optional({ "TariffFallbackMessage", }), }; const RequiredComponentVariable TotalCostFallbackMessage = { ControllerComponents::TariffCostCtrlr, - std::nullopt, std::optional({ "TotalCostFallbackMessage", }), }; -const ComponentVariable NumberOfDecimalsForCostValues = { - ControllerComponents::TariffCostCtrlr, std::nullopt, - std::optional({"NumberOfDecimalsForCostValues", std::nullopt, std::nullopt})}; +const ComponentVariable NumberOfDecimalsForCostValues = {ControllerComponents::TariffCostCtrlr, + std::optional({"NumberOfDecimalsForCostValues"})}; const RequiredComponentVariable EVConnectionTimeOut = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "EVConnectionTimeOut", }), }; const ComponentVariable MaxEnergyOnInvalidId = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "MaxEnergyOnInvalidId", }), }; const RequiredComponentVariable StopTxOnEVSideDisconnect = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "StopTxOnEVSideDisconnect", }), }; const RequiredComponentVariable StopTxOnInvalidId = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "StopTxOnInvalidId", }), }; const ComponentVariable TxBeforeAcceptedEnabled = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "TxBeforeAcceptedEnabled", }), }; const RequiredComponentVariable TxStartPoint = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "TxStartPoint", }), }; const RequiredComponentVariable TxStopPoint = { ControllerComponents::TxCtrlr, - std::nullopt, std::optional({ "TxStopPoint", }), @@ -1361,8 +1168,11 @@ const Variable Power = {"Power"}; ComponentVariable get_component_variable(const int32_t evse_id, const Variable& variable) { EVSE evse = {evse_id}; - Component component = {"EVSE", std::nullopt, evse}; - return {component, std::nullopt, variable}; + Component component = {"EVSE", evse}; + ComponentVariable component_variable; + component_variable.component = component; + component_variable.variable = variable; + return component_variable; } } // namespace EvseComponentVariables @@ -1370,15 +1180,115 @@ namespace ConnectorComponentVariables { const Variable Available = {"Available"}; const Variable AvailabilityState = {"AvailabilityState"}; -const Variable Type = {"Type"}; +const Variable Type = {"ConnectorType"}; const Variable SupplyPhases = {"SupplyPhases"}; ComponentVariable get_component_variable(const int32_t evse_id, const int32_t connector_id, const Variable& variable) { - EVSE evse = {evse_id, std::nullopt, connector_id}; - Component component = {"Connector", std::nullopt, evse}; - return {component, std::nullopt, variable}; + EVSE evse = {evse_id, connector_id}; + Component component = {"Connector", evse}; + ComponentVariable component_variable; + component_variable.component = component; + component_variable.variable = variable; + return component_variable; } } // namespace ConnectorComponentVariables +const std::vector>> + required_component_available_variables{ + {ControllerComponentVariables::LocalAuthListCtrlrAvailable, + {ControllerComponentVariables::LocalAuthListCtrlrEntries, + ControllerComponentVariables::ItemsPerMessageSendLocalList, + ControllerComponentVariables::BytesPerMessageSendLocalList}}, + {ControllerComponentVariables::SmartChargingCtrlrAvailable, + {ControllerComponentVariables::ChargingProfileMaxStackLevel, + ControllerComponentVariables::ChargingScheduleChargingRateUnit, + ControllerComponentVariables::PeriodsPerSchedule, ControllerComponentVariables::EntriesChargingProfiles, + ControllerComponentVariables::LimitChangeSignificance, + ControllerComponentVariables::CompositeScheduleDefaultLimitAmps, + ControllerComponentVariables::CompositeScheduleDefaultLimitWatts, + ControllerComponentVariables::CompositeScheduleDefaultNumberPhases, + ControllerComponentVariables::SupplyVoltage}}, + {ControllerComponentVariables::TariffCostCtrlrAvailableTariff, + {ControllerComponentVariables::TariffFallbackMessage}}, + {ControllerComponentVariables::TariffCostCtrlrAvailableCost, + {ControllerComponentVariables::TotalCostFallbackMessage, + ControllerComponentVariables::TariffCostCtrlrCurrency}}, + {ControllerComponentVariables::MonitoringCtrlrAvailable, + {ControllerComponentVariables::ItemsPerMessageSetVariableMonitoring, + ControllerComponentVariables::BytesPerMessageSetVariableMonitoring}}, + {ControllerComponentVariables::DisplayMessageCtrlrAvailable, + {ControllerComponentVariables::NumberOfDisplayMessages, + ControllerComponentVariables::DisplayMessageSupportedFormats, + ControllerComponentVariables::DisplayMessageSupportedPriorities}}}; + +const std::vector required_variables{ + ControllerComponentVariables::AlignedDataInterval, + ControllerComponentVariables::AlignedDataMeasurands, + ControllerComponentVariables::AlignedDataTxEndedInterval, + ControllerComponentVariables::AlignedDataTxEndedMeasurands, + ControllerComponentVariables::SampledDataTxEndedMeasurands, + ControllerComponentVariables::SampledDataTxEndedInterval, + ControllerComponentVariables::SampledDataTxStartedMeasurands, + ControllerComponentVariables::SampledDataTxUpdatedMeasurands, + ControllerComponentVariables::SampledDataTxUpdatedInterval, + ControllerComponentVariables::ChargePointId, + ControllerComponentVariables::NetworkConnectionProfiles, + ControllerComponentVariables::ChargeBoxSerialNumber, + ControllerComponentVariables::ChargePointModel, + ControllerComponentVariables::ChargePointVendor, + ControllerComponentVariables::FirmwareVersion, + ControllerComponentVariables::SupportedCiphers12, + ControllerComponentVariables::SupportedCiphers13, + ControllerComponentVariables::LogMessagesFormat, + ControllerComponentVariables::NumberOfConnectors, + ControllerComponentVariables::SupportedOcppVersions, + ControllerComponentVariables::AuthorizeRemoteStart, + ControllerComponentVariables::LocalAuthorizeOffline, + ControllerComponentVariables::LocalPreAuthorize, + ControllerComponentVariables::ChargingStationAvailabilityState, + ControllerComponentVariables::ChargingStationAvailable, + ControllerComponentVariables::ChargingStationSupplyPhases, + ControllerComponentVariables::ClockCtrlrDateTime, + ControllerComponentVariables::TimeSource, + ControllerComponentVariables::BytesPerMessageGetReport, + ControllerComponentVariables::BytesPerMessageGetVariables, + ControllerComponentVariables::BytesPerMessageSetVariables, + ControllerComponentVariables::ItemsPerMessageGetReport, + ControllerComponentVariables::ItemsPerMessageGetVariables, + ControllerComponentVariables::ItemsPerMessageSetVariables, + ControllerComponentVariables::ContractValidationOffline, + ControllerComponentVariables::FileTransferProtocols, + ControllerComponentVariables::MessageTimeout, + ControllerComponentVariables::MessageAttemptInterval, + ControllerComponentVariables::MessageAttempts, + ControllerComponentVariables::NetworkConfigurationPriority, + ControllerComponentVariables::NetworkProfileConnectionAttempts, + ControllerComponentVariables::OfflineThreshold, + ControllerComponentVariables::ResetRetries, + ControllerComponentVariables::RetryBackOffRandomRange, + ControllerComponentVariables::RetryBackOffRepeatTimes, + ControllerComponentVariables::RetryBackOffWaitMinimum, + ControllerComponentVariables::UnlockOnEVSideDisconnect, + ControllerComponentVariables::WebSocketPingInterval, + ControllerComponentVariables::CertificateEntries, + ControllerComponentVariables::SecurityCtrlrIdentity, + ControllerComponentVariables::OrganizationName, + ControllerComponentVariables::SecurityProfile, + ControllerComponentVariables::EVConnectionTimeOut, + ControllerComponentVariables::StopTxOnEVSideDisconnect, + ControllerComponentVariables::StopTxOnInvalidId, + ControllerComponentVariables::TxStartPoint, + ControllerComponentVariables::TxStopPoint, + ControllerComponentVariables::TxStartPoint, + ControllerComponentVariables::TxStopPoint}; + +// Note: Power is also required, but the value is not required but the maxLimit. So that is why it is not added here. +const std::vector required_evse_variables{ + EvseComponentVariables::Available, EvseComponentVariables::AvailabilityState, EvseComponentVariables::SupplyPhases}; + +const std::vector required_connector_variables{ + ConnectorComponentVariables::Available, ConnectorComponentVariables::AvailabilityState, + ConnectorComponentVariables::SupplyPhases, ConnectorComponentVariables::Type}; + } // namespace v2 } // namespace ocpp diff --git a/lib/ocpp/v2/database_handler.cpp b/lib/ocpp/v2/database_handler.cpp index b0ae454d1..a74d47c1c 100644 --- a/lib/ocpp/v2/database_handler.cpp +++ b/lib/ocpp/v2/database_handler.cpp @@ -453,9 +453,19 @@ void DatabaseHandler::transaction_metervalues_insert(const std::string& transact insert_stmt->bind_text("@signed_meter_data", signedMeterValue.signedMeterData.get(), SQLiteString::Transient); - insert_stmt->bind_text("@signing_method", signedMeterValue.signingMethod.get(), SQLiteString::Transient); + if (signedMeterValue.signingMethod.has_value()) { + insert_stmt->bind_text("@signing_method", signedMeterValue.signingMethod.value().get(), + SQLiteString::Transient); + } else { + insert_stmt->bind_null("@signing_method"); + } insert_stmt->bind_text("@encoding_method", signedMeterValue.encodingMethod.get(), SQLiteString::Transient); - insert_stmt->bind_text("@public_key", signedMeterValue.publicKey.get(), SQLiteString::Transient); + if (signedMeterValue.publicKey.has_value()) { + insert_stmt->bind_text("@public_key", signedMeterValue.publicKey.value().get(), + SQLiteString::Transient); + } else { + insert_stmt->bind_null("@public_key"); + } } else { insert_stmt->bind_null("@signed_meter_data"); insert_stmt->bind_null("@signing_method"); @@ -730,7 +740,7 @@ void DatabaseHandler::transaction_delete(const std::string& transaction_id) { } void DatabaseHandler::insert_or_update_charging_profile(const int evse_id, const v2::ChargingProfile& profile, - const ChargingLimitSourceEnum charging_limit_source) { + const CiString<20> charging_limit_source) { // add or replace std::string sql = "INSERT OR REPLACE INTO CHARGING_PROFILES (ID, EVSE_ID, STACK_LEVEL, CHARGING_PROFILE_PURPOSE, " @@ -753,7 +763,7 @@ void DatabaseHandler::insert_or_update_charging_profile(const int evse_id, const } stmt->bind_text("@profile", json_profile.dump(), SQLiteString::Transient); - stmt->bind_text("@charging_limit_source", conversions::charging_limit_source_enum_to_string(charging_limit_source)); + stmt->bind_text("@charging_limit_source", charging_limit_source.get()); if (stmt->step() != SQLITE_DONE) { throw QueryExecutionException(this->database->get_error_message()); @@ -873,11 +883,10 @@ DatabaseHandler::get_charging_profiles_matching_criteria(const std::optionalstep() != SQLITE_DONE) { - results.push_back(ReportedChargingProfile( - json::parse(stmt->column_text(1)), // profile - stmt->column_int(0), // EVSE ID - conversions::string_to_charging_limit_source_enum(stmt->column_text(2)) // source - )); + results.push_back(ReportedChargingProfile(json::parse(stmt->column_text(1)), // profile + stmt->column_int(0), // EVSE ID + CiString<20>(stmt->column_text(2)) // source + )); } return results; } @@ -892,9 +901,8 @@ DatabaseHandler::get_charging_profiles_matching_criteria(const std::optionalempty()) { std::string sources = boost::algorithm::join( - criteria.chargingLimitSource.value() | boost::adaptors::transformed([](ChargingLimitSourceEnum source) { - return "'" + conversions::charging_limit_source_enum_to_string(source) + "'"; - }), + criteria.chargingLimitSource.value() | + boost::adaptors::transformed([](CiString<20> source) { return "'" + source.get() + "'"; }), ", "); where_clauses.push_back("CHARGING_LIMIT_SOURCE IN (" + sources + ")"); @@ -921,11 +929,10 @@ DatabaseHandler::get_charging_profiles_matching_criteria(const std::optionalstep() != SQLITE_DONE) { - results.push_back( - ReportedChargingProfile(json::parse(stmt->column_text(1)), // profile - stmt->column_int(0), // EVSE ID - conversions::string_to_charging_limit_source_enum(stmt->column_text(2)) // source - )); + results.push_back(ReportedChargingProfile(json::parse(stmt->column_text(1)), // profile + stmt->column_int(0), // EVSE ID + CiString<20>(stmt->column_text(2)) // source + )); } return results; @@ -983,7 +990,7 @@ std::map> DatabaseHandler::get_all_cha return map; } -ChargingLimitSourceEnum DatabaseHandler::get_charging_limit_source_for_profile(const int profile_id) { +CiString<20> DatabaseHandler::get_charging_limit_source_for_profile(const int profile_id) { std::string sql = "SELECT CHARGING_LIMIT_SOURCE FROM CHARGING_PROFILES WHERE ID = @profile_id;"; auto stmnt = this->database->new_statement(sql); @@ -994,7 +1001,7 @@ ChargingLimitSourceEnum DatabaseHandler::get_charging_limit_source_for_profile(c EVLOG_warning << "No record found for " << profile_id; } - auto res = conversions::string_to_charging_limit_source_enum(stmnt->column_text(0)); + auto res = CiString<20>(stmnt->column_text(0)); if (stmnt->step() != SQLITE_DONE) { throw QueryExecutionException(this->database->get_error_message()); diff --git a/lib/ocpp/v2/device_model.cpp b/lib/ocpp/v2/device_model.cpp index 050690e4f..192e6005b 100644 --- a/lib/ocpp/v2/device_model.cpp +++ b/lib/ocpp/v2/device_model.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace ocpp { @@ -15,7 +16,9 @@ using DatabaseException = ocpp::common::DatabaseException; /// \brief For AlignedDataInterval, SampledDataTxUpdatedInterval and SampledDataTxEndedInterval, zero is allowed static bool allow_zero(const Component& component, const Variable& variable) { - ComponentVariable component_variable = {component, std::nullopt, variable}; + ComponentVariable component_variable; + component_variable.component = component; + component_variable.variable = variable; return component_variable == ControllerComponentVariables::AlignedDataInterval or component_variable == ControllerComponentVariables::SampledDataTxUpdatedInterval or component_variable == ControllerComponentVariables::SampledDataTxEndedInterval; @@ -88,7 +91,8 @@ bool DeviceModel::component_criteria_match(const Component& component, return false; } for (const auto& criteria : component_criteria) { - const Variable variable = {conversions::component_criterion_enum_to_string(criteria)}; + Variable variable; + variable.name = conversions::component_criterion_enum_to_string(criteria); const auto response = this->request_value(component, variable, AttributeEnum::Actual); auto value = response.value; @@ -119,6 +123,67 @@ bool DeviceModel::component_variables_match(const std::vector }) != component_variables.end(); } +void DeviceModel::check_variable_has_value(const ComponentVariable& component_variable, const AttributeEnum attribute) { + std::string value; + const auto response = this->request_value_internal(component_variable.component, + component_variable.variable.value(), attribute, value, true); + + if (response != GetVariableStatusEnum::Accepted) { + throw DeviceModelError("Required variable " + component_variable.variable->name.get() + " of component " + + component_variable.component.name.get() + " does not have a value in the device model"); + } +} + +void DeviceModel::check_required_variable(const RequiredComponentVariable& required_variable, + const std::vector& supported_versions) { + if (supported_versions.empty()) { + throw DeviceModelError("Could not find supported ocpp versions in the InternalCtrlr."); + } + + bool required = false; + for (auto& supported_version : supported_versions) { + if (required_variable.required_for.count(supported_version) > 0) { + required = true; + } + } + + // For the current supported ocpp protocol versions, this variable is not required. So skip further checks. + if (!required) { + return; + } + + if (!required_variable.variable.has_value()) { + throw DeviceModelError("Required variable does not exist."); + } + + check_variable_has_value(required_variable); +} + +void DeviceModel::check_required_variables() { + const auto supported_versions = utils::get_ocpp_protocol_versions( + this->get_value(ControllerComponentVariables::SupportedOcppVersions)); + + if (supported_versions.empty()) { + throw DeviceModelError("Could not find supported ocpp versions in the InternalCtrlr."); + } + + for (const auto& required_variable : required_variables) { + check_required_variable(required_variable, supported_versions); + } + + for (const auto& available_required : required_component_available_variables) { + std::optional available = this->get_optional_value(available_required.first); + if (!available.value_or(false)) { + // Component not available, skip required checks. + continue; + } + + for (const auto& required_variable : available_required.second) { + check_required_variable(required_variable, supported_versions); + } + } +} + bool validate_value(const VariableCharacteristics& characteristics, const std::string& value, bool allow_zero) { switch (characteristics.dataType) { case DataEnum::string: @@ -356,7 +421,9 @@ std::vector DeviceModel::get_base_report_data(const ReportBaseEnum& report_data.component = component; report_data.variable = variable; - ComponentVariable cv = {component, std::nullopt, variable}; + ComponentVariable cv; + cv.component = component; + cv.variable = variable; // request the variable attribute from the device model const auto variable_attributes = this->device_model->get_variable_attributes(component, variable); @@ -423,6 +490,7 @@ DeviceModel::get_custom_report_data(const std::optional& evse_connector_structure) { EVLOG_debug << "Checking integrity of device model in storage"; try { + this->check_required_variables(); this->device_model->check_integrity(); int32_t nr_evse_components = 0; @@ -454,21 +522,47 @@ void DeviceModel::check_integrity(const std::map& evse_connect } // check if all relevant EVSE and Connector components can be found - EVSE evse = {evse_id}; - Component evse_component = {"EVSE", std::nullopt, evse}; + EVSE evse; + evse.id = evse_id; + Component evse_component; + evse_component.name = "EVSE"; + evse_component.evse = evse; if (!this->device_model_map.count(evse_component)) { throw DeviceModelError("Could not find required EVSE component in device model"); } + + for (const auto& required_variable : required_evse_variables) { + const auto& variable = EvseComponentVariables::get_component_variable(evse_id, required_variable); + check_variable_has_value(variable); + } + + const auto& variable = + EvseComponentVariables::get_component_variable(evse_id, EvseComponentVariables::Power); + std::map& v = device_model_map[evse_component]; + if (!v.count(EvseComponentVariables::Power)) { + throw DeviceModelError("Could not find required 'Power' variable in EVSE component in device model"); + } + + if (!v[EvseComponentVariables::Power].characteristics.maxLimit.has_value()) { + throw DeviceModelError("maxLimit of 'Power' not set"); + } + for (size_t connector_id = 1; connector_id <= nr_of_connectors; connector_id++) { evse_component.name = "Connector"; evse_component.evse.value().connectorId = connector_id; if (!this->device_model_map.count(evse_component)) { throw DeviceModelError("Could not find required Connector component in device model"); } + + for (const auto& required_variable : required_connector_variables) { + const auto& variable = + ConnectorComponentVariables::get_component_variable(evse_id, connector_id, required_variable); + check_variable_has_value(variable); + } } } } catch (const DeviceModelError& e) { - EVLOG_error << "Integrity check in Device Model failed:" << e.what(); + EVLOG_error << "Integrity check in Device Model failed: " << e.what(); throw e; } } diff --git a/lib/ocpp/v2/device_model_storage_sqlite.cpp b/lib/ocpp/v2/device_model_storage_sqlite.cpp index b4df2a2b0..d7184f885 100644 --- a/lib/ocpp/v2/device_model_storage_sqlite.cpp +++ b/lib/ocpp/v2/device_model_storage_sqlite.cpp @@ -456,36 +456,7 @@ int32_t DeviceModelStorageSqlite::clear_custom_variable_monitors() { } void DeviceModelStorageSqlite::check_integrity() { - - // Check for required variables without actual values - std::stringstream query_stream; - query_stream << "SELECT c.NAME as 'COMPONENT_NAME', " - "c.EVSE_ID as 'EVSE_ID', " - "c.CONNECTOR_ID as 'CONNECTOR_ID', " - "v.NAME as 'VARIABLE_NAME', " - "v.INSTANCE as 'VARIABLE_INSTANCE' " - "FROM VARIABLE_ATTRIBUTE va " - "JOIN VARIABLE v ON v.ID = va.VARIABLE_ID " - "JOIN COMPONENT c ON v.COMPONENT_ID = c.ID " - "WHERE va.TYPE_ID = " - << static_cast(AttributeEnum::Actual) - << " AND va.VALUE IS NULL" - " AND v.REQUIRED = 1"; - auto select_stmt = this->db->new_statement(query_stream.str()); - - if (select_stmt->step() != SQLITE_DONE) { - std::stringstream error; - error << "Corrupted device model: Missing the following required values for 'Actual' Variable Attributes:" - << std::endl; - do { - error << "(Component/EvseId/ConnectorId/Variable/Instance: " << select_stmt->column_text(0) << "/" - << select_stmt->column_text_nullable(1).value_or("") << "/" - << select_stmt->column_text_nullable(2).value_or("") << "/" << select_stmt->column_text(3) - << "/" << select_stmt->column_text_nullable(4).value_or("") << ")" << std::endl; - } while (select_stmt->step() == SQLITE_ROW); - - throw DeviceModelError(error.str()); - } + // Function is now empty because checks are already done elsewhere (for example the check for 'required' variables). } } // namespace v2 diff --git a/lib/ocpp/v2/evse.cpp b/lib/ocpp/v2/evse.cpp index 37baadac4..8e4c62ba4 100644 --- a/lib/ocpp/v2/evse.cpp +++ b/lib/ocpp/v2/evse.cpp @@ -86,13 +86,13 @@ uint32_t Evse::get_number_of_connectors() const { return static_cast(this->id_connector_map.size()); } -bool Evse::does_connector_exist(const ConnectorEnum connector_type) const { +bool Evse::does_connector_exist(const CiString<20> connector_type) const { const uint32_t number_of_connectors = this->get_number_of_connectors(); if (number_of_connectors == 0) { return false; } - if (connector_type == ConnectorEnum::Unknown) { + if (connector_type == ConnectorEnumStringType::Unknown) { return true; } @@ -110,8 +110,8 @@ bool Evse::does_connector_exist(const ConnectorEnum connector_type) const { continue; } - const ConnectorEnum type = this->get_evse_connector_type(i).value_or(ConnectorEnum::Unknown); - if (type == ConnectorEnum::Unknown || type == connector_type) { + const CiString<20> type = this->get_evse_connector_type(i).value_or(ConnectorEnumStringType::Unknown); + if (type == ConnectorEnumStringType::Unknown || type == connector_type) { return true; } } @@ -119,7 +119,7 @@ bool Evse::does_connector_exist(const ConnectorEnum connector_type) const { return false; } -std::optional Evse::get_connector_status(std::optional connector_type) { +std::optional Evse::get_connector_status(std::optional> connector_type) { bool type_found = false; ConnectorStatusEnum found_status = ConnectorStatusEnum::Unavailable; const uint32_t number_of_connectors = this->get_number_of_connectors(); @@ -143,10 +143,11 @@ std::optional Evse::get_connector_status(std::optionalget_effective_connector_status(); - const ConnectorEnum evse_connector_type = this->get_evse_connector_type(i).value_or(ConnectorEnum::Unknown); - const ConnectorEnum input_connector_type = connector_type.value_or(ConnectorEnum::Unknown); - const bool connector_type_unknown = - evse_connector_type == ConnectorEnum::Unknown || input_connector_type == ConnectorEnum::Unknown; + const CiString<20> evse_connector_type = + this->get_evse_connector_type(i).value_or(ConnectorEnumStringType::Unknown); + const CiString<20> input_connector_type = connector_type.value_or(ConnectorEnumStringType::Unknown); + const bool connector_type_unknown = evse_connector_type == ConnectorEnumStringType::Unknown || + input_connector_type == ConnectorEnumStringType::Unknown; if (connector_type_unknown || evse_connector_type == input_connector_type) { type_found = true; @@ -205,7 +206,7 @@ void Evse::delete_database_transaction() { } } -std::optional Evse::get_evse_connector_type(const uint32_t connector_id) const { +std::optional> Evse::get_evse_connector_type(const uint32_t connector_id) const { auto connector = this->get_connector(static_cast(connector_id)); if (connector == nullptr) { @@ -221,12 +222,7 @@ std::optional Evse::get_evse_connector_type(const uint32_t connec return std::nullopt; } - try { - return conversions::string_to_connector_enum(connector_type.value()); - } catch (const StringToEnumException& e) { - EVLOG_warning << "Could not convert to ConnectorEnum: " << connector_type.value(); - return std::nullopt; - } + return connector_type.value(); } void Evse::open_transaction(const std::string& transaction_id, const int32_t connector_id, const DateTime& timestamp, diff --git a/lib/ocpp/v2/evse_manager.cpp b/lib/ocpp/v2/evse_manager.cpp index 62d1ffd51..7c5d475b3 100644 --- a/lib/ocpp/v2/evse_manager.cpp +++ b/lib/ocpp/v2/evse_manager.cpp @@ -43,7 +43,7 @@ const EvseInterface& EvseManager::get_evse(const int32_t id) const { return *this->evses.at(id - 1); } -bool EvseManager::does_connector_exist(const int32_t evse_id, const ConnectorEnum connector_type) const { +bool EvseManager::does_connector_exist(const int32_t evse_id, const CiString<20> connector_type) const { const EvseInterface* evse; try { evse = &this->get_evse(evse_id); diff --git a/lib/ocpp/v2/functional_blocks/authorization.cpp b/lib/ocpp/v2/functional_blocks/authorization.cpp index 6a9bff0e1..e2051b79f 100644 --- a/lib/ocpp/v2/functional_blocks/authorization.cpp +++ b/lib/ocpp/v2/functional_blocks/authorization.cpp @@ -55,7 +55,7 @@ void ocpp::v2::Authorization::handle_message(const ocpp::EnhancedMessage>& certificate, +ocpp::v2::Authorization::authorize_req(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) { AuthorizeRequest req; req.idToken = id_token; @@ -146,7 +146,7 @@ void ocpp::v2::Authorization::authorization_cache_delete_entry(const std::string } ocpp::v2::AuthorizeResponse -ocpp::v2::Authorization::validate_token(const IdToken id_token, const std::optional>& certificate, +ocpp::v2::Authorization::validate_token(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) { // TODO(piet): C01.FR.14 // TODO(piet): C01.FR.15 @@ -158,7 +158,7 @@ ocpp::v2::Authorization::validate_token(const IdToken id_token, const std::optio AuthorizeResponse response; // C03.FR.01 && C05.FR.01: We SHALL NOT send an authorize reqeust for IdTokenType Central - if (id_token.type == IdTokenEnum::Central or + if (id_token.type == IdTokenEnumStringType::Central or !this->context.device_model.get_optional_value(ControllerComponentVariables::AuthCtrlrEnabled) .value_or(true)) { response.idTokenInfo.status = AuthorizationStatusEnum::Accepted; @@ -166,7 +166,7 @@ ocpp::v2::Authorization::validate_token(const IdToken id_token, const std::optio } // C07: Authorization using contract certificates - if (id_token.type == IdTokenEnum::eMAID) { + if (id_token.type == IdTokenEnumStringType::eMAID) { // Temporary variable that is set to true to avoid immediate response to allow the local auth list // or auth cache to be tried bool try_local_auth_list_or_cache = false; diff --git a/lib/ocpp/v2/functional_blocks/diagnostics.cpp b/lib/ocpp/v2/functional_blocks/diagnostics.cpp index 3db2a85bd..2797451ed 100644 --- a/lib/ocpp/v2/functional_blocks/diagnostics.cpp +++ b/lib/ocpp/v2/functional_blocks/diagnostics.cpp @@ -38,7 +38,10 @@ Diagnostics::Diagnostics(const FunctionalBlockContext& context, AuthorizationInt [this]() { return !this->context.connectivity_manager.is_websocket_connected(); }), get_log_request_callback(get_log_request_callback), get_customer_information_callback(get_customer_information_callback), - clear_customer_information_callback(clear_customer_information_callback) { + clear_customer_information_callback(clear_customer_information_callback), + is_monitoring_available( + this->context.device_model.get_optional_value(ControllerComponentVariables::MonitoringCtrlrAvailable) + .value_or(false)) { } void Diagnostics::handle_message(const ocpp::EnhancedMessage& message) { @@ -49,14 +52,19 @@ void Diagnostics::handle_message(const ocpp::EnhancedMessage& messa } else if (message.messageType == MessageType::CustomerInformation) { this->handle_customer_information_req(json_message); } else if (message.messageType == MessageType::SetMonitoringBase) { + this->throw_when_monitoring_not_available(message.messageType); this->handle_set_monitoring_base_req(json_message); } else if (message.messageType == MessageType::SetMonitoringLevel) { + this->throw_when_monitoring_not_available(message.messageType); this->handle_set_monitoring_level_req(json_message); } else if (message.messageType == MessageType::SetVariableMonitoring) { + this->throw_when_monitoring_not_available(message.messageType); this->handle_set_variable_monitoring_req(message); } else if (message.messageType == MessageType::GetMonitoringReport) { + this->throw_when_monitoring_not_available(message.messageType); this->handle_get_monitoring_report_req(json_message); } else if (message.messageType == MessageType::ClearVariableMonitoring) { + this->throw_when_monitoring_not_available(message.messageType); this->handle_clear_variable_monitoring_req(json_message); } else { throw MessageTypeNotImplementedException(message.messageType); @@ -395,4 +403,10 @@ void Diagnostics::clear_customer_information(const std::optionalcontext.evse_manager.get_transaction_evseid(call.msg.message.transactionId.value()) != std::nullopt); // Check if display messages are available. - if (!display_message_available.has_value() or !display_message_available.value()) { + if (!display_message_available.value_or(false)) { error = true; response.status = DisplayMessageStatusEnum::Rejected; } diff --git a/lib/ocpp/v2/functional_blocks/provisioning.cpp b/lib/ocpp/v2/functional_blocks/provisioning.cpp index b8fb97adc..c80bacabd 100644 --- a/lib/ocpp/v2/functional_blocks/provisioning.cpp +++ b/lib/ocpp/v2/functional_blocks/provisioning.cpp @@ -379,7 +379,7 @@ void Provisioning::handle_set_network_profile_req(Call int index_to_override = -1; int index = 0; - for (const SetNetworkProfileRequest network_profile : network_connection_profiles) { + for (const SetNetworkProfileRequest& network_profile : network_connection_profiles) { if (network_profile.configurationSlot == msg.configurationSlot) { index_to_override = index; } @@ -506,7 +506,7 @@ void Provisioning::handle_reset_req(Call call) { } void Provisioning::handle_variable_changed(const SetVariableData& set_variable_data) { - ComponentVariable component_variable = {set_variable_data.component, std::nullopt, set_variable_data.variable}; + ComponentVariable component_variable = {set_variable_data.component, set_variable_data.variable, std::nullopt}; if (set_variable_data.attributeType.has_value() and set_variable_data.attributeType.value() != AttributeEnum::Actual) { @@ -593,7 +593,7 @@ void Provisioning::handle_variables_changed(const std::mapsmart_charging.conform_validate_and_add_profile( - msg.chargingProfile.value(), evse_id, ChargingLimitSourceEnum::CSO, + msg.chargingProfile.value(), evse_id, ChargingLimitSourceEnumStringType::CSO, AddChargingProfileSource::RequestStartTransactionRequest); if (add_profile_response.status == ChargingProfileStatusEnum::Accepted) { EVLOG_debug << "Accepting SetChargingProfileRequest"; @@ -287,6 +287,8 @@ void RemoteTransactionControl::handle_trigger_message(Call& group_id_token) const { - const std::optional> no = std::nullopt; - const std::optional> groupIdToken = group_id_token.has_value() ? group_id_token.value().idToken : no; + const std::optional> no = std::nullopt; + const std::optional> groupIdToken = group_id_token.has_value() ? group_id_token.value().idToken : no; return this->is_reservation_for_token_callback(evse.get_id(), id_token.idToken, groupIdToken); } @@ -116,11 +116,12 @@ void Reservation::handle_reserve_now_request(Call call) { } // Check if there is a connector available for this evse id. - if (!this->context.evse_manager.does_connector_exist(static_cast(evse_id.value()), - request.connectorType.value_or(ConnectorEnum::Unknown))) { + if (!this->context.evse_manager.does_connector_exist( + static_cast(evse_id.value()), + request.connectorType.value_or(ConnectorEnumStringType::Unknown))) { EVLOG_info << "Trying to make a reservation for connector type " - << conversions::connector_enum_to_string(request.connectorType.value_or(ConnectorEnum::Unknown)) - << " for evse " << evse_id.value() << ", but this connector type does not exist."; + << request.connectorType.value_or(ConnectorEnumStringType::Unknown) << " for evse " + << evse_id.value() << ", but this connector type does not exist."; send_reserve_now_rejected_response(call.uniqueId, "Connector type does not exist"); return; } @@ -136,7 +137,7 @@ void Reservation::handle_reserve_now_request(Call call) { bool connector_exists = false; for (uint64_t i = 1; i <= number_of_evses; i++) { if (this->context.evse_manager.does_connector_exist( - i, request.connectorType.value_or(ConnectorEnum::Unknown))) { + i, request.connectorType.value_or(ConnectorEnumStringType::Unknown))) { connector_exists = true; break; } diff --git a/lib/ocpp/v2/functional_blocks/security.cpp b/lib/ocpp/v2/functional_blocks/security.cpp index db09f8743..119d4360d 100644 --- a/lib/ocpp/v2/functional_blocks/security.cpp +++ b/lib/ocpp/v2/functional_blocks/security.cpp @@ -444,7 +444,11 @@ bool Security::should_allow_certificate_install(InstallCertificateUseEnum cert_t case InstallCertificateUseEnum::MORootCertificate: case InstallCertificateUseEnum::V2GRootCertificate: return true; + case InstallCertificateUseEnum::OEMRootCertificate: + // FIXME: Implement OEMRootCertificate + return false; } + return false; } void Security::scheduled_check_client_certificate_expiration() { diff --git a/lib/ocpp/v2/functional_blocks/smart_charging.cpp b/lib/ocpp/v2/functional_blocks/smart_charging.cpp index 3b03d5c98..32ca9f1e2 100644 --- a/lib/ocpp/v2/functional_blocks/smart_charging.cpp +++ b/lib/ocpp/v2/functional_blocks/smart_charging.cpp @@ -197,10 +197,9 @@ void SmartCharging::delete_transaction_tx_profiles(const std::string& transactio this->context.database_handler.delete_charging_profile_by_transaction_id(transaction_id); } -SetChargingProfileResponse -SmartCharging::conform_validate_and_add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source, - AddChargingProfileSource source_of_request) { +SetChargingProfileResponse SmartCharging::conform_validate_and_add_profile(ChargingProfile& profile, int32_t evse_id, + CiString<20> charging_limit_source, + AddChargingProfileSource source_of_request) { SetChargingProfileResponse response; response.status = ChargingProfileStatusEnum::Rejected; @@ -267,6 +266,11 @@ ProfileValidationResultEnum SmartCharging::conform_and_validate_profile(Charging // invalid. K01.FR.05 is the only thing that seems relevant. result = ProfileValidationResultEnum::Valid; break; + case ChargingProfilePurposeEnum::PriorityCharging: + case ChargingProfilePurposeEnum::LocalGeneration: + // FIXME: handle missing cases + result = ProfileValidationResultEnum::InvalidProfileType; + break; } return result; @@ -613,7 +617,7 @@ SmartCharging::verify_no_conflicting_external_constraints_id(const ChargingProfi } SetChargingProfileResponse SmartCharging::add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source) { + CiString<20> charging_limit_source) { SetChargingProfileResponse response; response.status = ChargingProfileStatusEnum::Accepted; @@ -662,8 +666,8 @@ SmartCharging::get_valid_profiles(int32_t evse_id, const std::vector& profiles, const bool tbc) { + const CiString<20> source, const std::vector& profiles, + const bool tbc) { ReportChargingProfilesRequest req; req.requestId = request_id; req.evseId = evse_id; @@ -775,11 +779,11 @@ void SmartCharging::handle_get_charging_profiles_req(Call evse_ids; // will contain all evse_ids of the profiles - std::set sources; // will contain all sources of the profiles + // ChargingLimitSourceEnumStringType as required, so we can not report all profiles in a single + // ReportChargingProfilesRequest. We need to prepare a single ReportChargingProfilesRequest for each combination of + // evseId and ChargingLimitSourceEnumStringType + std::set evse_ids; // will contain all evse_ids of the profiles + std::set> sources; // will contain all sources of the profiles // fill evse_ids and sources sets for (const auto& profile : profiles_to_report) { diff --git a/lib/ocpp/v2/functional_blocks/transaction.cpp b/lib/ocpp/v2/functional_blocks/transaction.cpp index 7c46c24bf..814838541 100644 --- a/lib/ocpp/v2/functional_blocks/transaction.cpp +++ b/lib/ocpp/v2/functional_blocks/transaction.cpp @@ -298,7 +298,7 @@ void TransactionBlock::handle_transaction_event_response(const EnhancedMessageauthorization.is_auth_cache_ctrlr_enabled()) { + if (id_token.type != IdTokenEnumStringType::Central and this->authorization.is_auth_cache_ctrlr_enabled()) { try { this->authorization.authorization_cache_insert_entry(utils::generate_token_hash(id_token), msg.idTokenInfo.value()); diff --git a/lib/ocpp/v2/init_device_model_db.cpp b/lib/ocpp/v2/init_device_model_db.cpp index 366f33c10..e28696e84 100644 --- a/lib/ocpp/v2/init_device_model_db.cpp +++ b/lib/ocpp/v2/init_device_model_db.cpp @@ -18,7 +18,6 @@ namespace ocpp::v2 { // Forward declarations. static void check_integrity(const std::map>& component_configs); -static std::optional check_integrity_required_value(const DeviceModelVariable& variable); static std::vector check_integrity_value_type(const DeviceModelVariable& variable); static bool value_is_of_type(const std::string& value, const DataEnum& type); static bool is_same_component_key(const ComponentKey& component_key1, const ComponentKey& component_key2); @@ -65,7 +64,7 @@ void InitDeviceModelDb::initialize_database(const std::filesystem::path& config_ // Get component config files from the filesystem. std::map> component_configs = get_all_component_configs(config_path); - // Check if the config is consistent (fe has a value when required). + // Check if the config is consistent. check_integrity(component_configs); // Remove components from db if they do not exist in the component config @@ -217,8 +216,7 @@ InitDeviceModelDb::read_component_config(const std::vector variables = - get_all_component_properties(data.at("properties"), p.required); + std::vector variables = get_all_component_properties(data.at("properties")); components.insert({p, variables}); } else { EVLOG_warning << "Component " << data.at("name") << " does not contain any properties"; @@ -233,20 +231,13 @@ InitDeviceModelDb::read_component_config(const std::vector -InitDeviceModelDb::get_all_component_properties(const json& component_properties, - std::vector required_properties) { +std::vector InitDeviceModelDb::get_all_component_properties(const json& component_properties) { std::vector variables; for (const auto& variable : component_properties.items()) { DeviceModelVariable v = variable.value(); const std::string variable_key_name = variable.key(); - // Check if this is a required variable and if it is, add that to the variable struct. - if (std::find(required_properties.begin(), required_properties.end(), variable_key_name) != - required_properties.end()) { - v.required = true; - } variables.push_back(v); } @@ -362,8 +353,8 @@ void InitDeviceModelDb::update_variable_characteristics(const VariableCharacteri void InitDeviceModelDb::insert_variable(const DeviceModelVariable& variable, const uint64_t& component_id) { static const std::string statement = - "INSERT OR REPLACE INTO VARIABLE (NAME, INSTANCE, COMPONENT_ID, REQUIRED, SOURCE) VALUES " - "(@name, @instance, @component_id, @required, @source)"; + "INSERT OR REPLACE INTO VARIABLE (NAME, INSTANCE, COMPONENT_ID, SOURCE) VALUES " + "(@name, @instance, @component_id, @source)"; std::unique_ptr insert_variable_statement; try { @@ -382,9 +373,6 @@ void InitDeviceModelDb::insert_variable(const DeviceModelVariable& variable, con insert_variable_statement->bind_null("@instance"); } - const uint8_t required_int = (variable.required ? 1 : 0); - insert_variable_statement->bind_int("@required", required_int); - if (variable.source.has_value()) { insert_variable_statement->bind_text("@source", variable.source.value()); } else { @@ -411,7 +399,7 @@ void InitDeviceModelDb::update_variable(const DeviceModelVariable& variable, con } static const std::string update_variable_statement = - "UPDATE VARIABLE SET NAME=@name, INSTANCE=@instance, COMPONENT_ID=@component_id, REQUIRED=@required, " + "UPDATE VARIABLE SET NAME=@name, INSTANCE=@instance, COMPONENT_ID=@component_id, " "SOURCE=@source WHERE ID=@variable_id"; std::unique_ptr update_statement; @@ -431,9 +419,6 @@ void InitDeviceModelDb::update_variable(const DeviceModelVariable& variable, con update_statement->bind_null("@instance"); } - const uint8_t required_int = (variable.required ? 1 : 0); - update_statement->bind_int("@required", required_int); - if (variable.source.has_value()) { update_statement->bind_text("@source", variable.source.value(), ocpp::common::SQLiteString::Transient); } else { @@ -814,7 +799,7 @@ std::map> InitDeviceModelDb::get_ const std::string statement = "SELECT " "c.ID, c.NAME, c.INSTANCE, c.EVSE_ID, c.CONNECTOR_ID, " - "v.ID, v.NAME, v.INSTANCE, v.REQUIRED, " + "v.ID, v.NAME, v.INSTANCE, " "vc.ID, vc.DATATYPE_ID, vc.MAX_LIMIT, vc.MIN_LIMIT, vc.SUPPORTS_MONITORING, vc.UNIT, vc.VALUES_LIST, " "va.ID, va.MUTABILITY_ID, va.PERSISTENT, va.CONSTANT, va.TYPE_ID, va.VALUE, va.VALUE_SOURCE," "v.SOURCE " @@ -872,45 +857,42 @@ std::map> InitDeviceModelDb::get_ if (!variable_exists) { // Variable does not exist, add extra information from database. - if (select_statement->column_type(8) != SQLITE_NULL) { - new_variable.required = (select_statement->column_int(8) == 1 ? true : false); + new_variable.variable_characteristics_db_id = select_statement->column_int(8); + new_variable.characteristics.dataType = static_cast(select_statement->column_int(9)); + if (select_statement->column_type(10) != SQLITE_NULL) { + new_variable.characteristics.maxLimit = select_statement->column_double(10); } - new_variable.variable_characteristics_db_id = select_statement->column_int(9); - new_variable.characteristics.dataType = static_cast(select_statement->column_int(10)); if (select_statement->column_type(11) != SQLITE_NULL) { - new_variable.characteristics.maxLimit = select_statement->column_double(11); - } - if (select_statement->column_type(12) != SQLITE_NULL) { - new_variable.characteristics.minLimit = select_statement->column_double(12); + new_variable.characteristics.minLimit = select_statement->column_double(11); } - new_variable.characteristics.supportsMonitoring = (select_statement->column_int(13) == 1 ? true : false); - new_variable.characteristics.unit = select_statement->column_text_nullable(14); - new_variable.characteristics.valuesList = select_statement->column_text_nullable(15); + new_variable.characteristics.supportsMonitoring = (select_statement->column_int(12) == 1 ? true : false); + new_variable.characteristics.unit = select_statement->column_text_nullable(13); + new_variable.characteristics.valuesList = select_statement->column_text_nullable(14); // Variable is new, set variable pointer to this new variable. variable = &new_variable; } DbVariableAttribute attribute; - attribute.db_id = select_statement->column_int(16); + attribute.db_id = select_statement->column_int(15); + if (select_statement->column_type(16) != SQLITE_NULL) { + attribute.variable_attribute.mutability = static_cast(select_statement->column_int(16)); + } if (select_statement->column_type(17) != SQLITE_NULL) { - attribute.variable_attribute.mutability = static_cast(select_statement->column_int(17)); + attribute.variable_attribute.persistent = (select_statement->column_int(17) == 1 ? true : false); } if (select_statement->column_type(18) != SQLITE_NULL) { - attribute.variable_attribute.persistent = (select_statement->column_int(18) == 1 ? true : false); + attribute.variable_attribute.constant = (select_statement->column_int(18) == 1 ? true : false); } if (select_statement->column_type(19) != SQLITE_NULL) { - attribute.variable_attribute.constant = (select_statement->column_int(19) == 1 ? true : false); - } - if (select_statement->column_type(20) != SQLITE_NULL) { - attribute.variable_attribute.type = static_cast(select_statement->column_int(20)); + attribute.variable_attribute.type = static_cast(select_statement->column_int(19)); } - attribute.variable_attribute.value = select_statement->column_text_nullable(21); - attribute.value_source = select_statement->column_text_nullable(22); + attribute.variable_attribute.value = select_statement->column_text_nullable(20); + attribute.value_source = select_statement->column_text_nullable(21); - if (select_statement->column_type(23) != SQLITE_NULL) { + if (select_statement->column_type(22) != SQLITE_NULL) { try { - variable->source = select_statement->column_text(23); + variable->source = select_statement->column_text(22); } catch (const std::out_of_range& e) { EVLOG_error << e.what() << ": Variable Source will not be set (so default will be used)"; } @@ -1178,13 +1160,6 @@ void from_json(const json& j, ComponentKey& c) { if (j.contains("instance")) { c.instance = j.at("instance"); } - - if (j.contains("required")) { - json const& r = j.at("required"); - for (auto it = r.begin(); it != r.end(); ++it) { - c.required.push_back(it->get()); - } - } } void from_json(const json& j, VariableMonitoringMeta& c) { @@ -1218,12 +1193,6 @@ void from_json(const json& j, DeviceModelVariable& c) { c.instance = j.at("instance"); } - // Required is normally not in the config here but somewhere else, but well, if it is occasionally or just later - // on, it will be added here as well. - if (j.contains("required")) { - c.required = j.at("required"); - } - if (j.contains("default")) { // I want the default value as string here as it is stored in the db as a string as well. const json& default_value = j.at("default"); @@ -1249,14 +1218,13 @@ void from_json(const json& j, DeviceModelVariable& c) { } } -/* Below functions check the integrity of the component config, for example if the type is correct or if a value is set - * when a variable is required. +/* Below functions check the integrity of the component config, for example if the type is correct. */ /// /// \brief Check integrity of config. /// -/// This will do some checks if the config is correct, for example if all required attributes have a value. +/// This will do some checks if the config is correct. /// It will print all found integrity errors in the logging. /// /// \param component_configs Read config from the file system. @@ -1270,12 +1238,6 @@ static void check_integrity(const std::map error_messages; - if (variable.required) { - std::optional error_message = check_integrity_required_value(variable); - if (error_message.has_value()) { - error_messages.push_back(error_message.value()); - } - } std::vector value_type_errors = check_integrity_value_type(variable); for (const std::string& error : value_type_errors) { @@ -1303,46 +1265,6 @@ static void check_integrity(const std::map check_integrity_required_value(const DeviceModelVariable& variable) { - // Required value has a different source so it is correct that the value is not set here. - if (variable.source.has_value() && variable.source != "OCPP") { - return std::nullopt; - } - - // For now, we assume that if a variable is required, it should have an 'Actual' value. But the spec is not clear - // about this. There are some implicit signs in favor of having always at least an 'Actual' value, but it is not - // explicitly stated. Robert asked OCA about this. - const auto& actual_attribute = - std::find_if(variable.attributes.begin(), variable.attributes.end(), [](const DbVariableAttribute& attribute) { - if (attribute.variable_attribute.type.has_value() && - attribute.variable_attribute.type.value() == AttributeEnum::Actual) { - return true; - } - return false; - }); - - if (actual_attribute == variable.attributes.end()) { - return "Could not find required Actual attribute."; - } - - if (variable.default_actual_value.has_value()) { - // There is a default value set, so for this required variable, we have a value (maybe there is a - // value set as well but since we also have a default value, we don't have to check that) - return std::nullopt; - } - - if (!actual_attribute->variable_attribute.value.has_value()) { - return "No value set for Actual attribute for required variable."; - } - - return std::nullopt; -} - /// /// \brief Check if the variable attributes have the given type. /// \param variable Variable to check the attributes from. @@ -1423,7 +1345,6 @@ static bool is_same_component_key(const ComponentKey& component_key1, const Comp if ((component_key1.name == component_key2.name) && (component_key1.evse_id == component_key2.evse_id) && (component_key1.connector_id == component_key2.connector_id) && (component_key1.instance == component_key2.instance)) { - // We did not compare the 'required' here as that does not define a ComponentKey return true; } @@ -1575,8 +1496,7 @@ static bool is_same_variable(const DeviceModelVariable& v1, const DeviceModelVar /// \return True if they are different. /// static bool is_variable_different(const DeviceModelVariable& v1, const DeviceModelVariable& v2) { - if (is_same_variable(v1, v2) && (v1.required == v2.required) && - !is_characteristics_different(v1.characteristics, v2.characteristics) && + if (is_same_variable(v1, v2) && !is_characteristics_different(v1.characteristics, v2.characteristics) && variable_has_same_monitors(v1.monitors, v2.monitors) && variable_has_same_attributes(v1.attributes, v2.attributes)) { return false; diff --git a/lib/ocpp/v2/messages/Authorize.cpp b/lib/ocpp/v2/messages/Authorize.cpp index af95f1127..6bff67984 100644 --- a/lib/ocpp/v2/messages/Authorize.cpp +++ b/lib/ocpp/v2/messages/Authorize.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const AuthorizeRequest& k) { {"idToken", k.idToken}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.certificate) { j["certificate"] = k.certificate.value(); } @@ -35,6 +32,9 @@ void to_json(json& j, const AuthorizeRequest& k) { j["iso15118CertificateHashData"].push_back(val); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, AuthorizeRequest& k) { @@ -42,9 +42,6 @@ void from_json(const json& j, AuthorizeRequest& k) { k.idToken = j.at("idToken"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("certificate")) { k.certificate.emplace(j.at("certificate")); } @@ -56,6 +53,9 @@ void from_json(const json& j, AuthorizeRequest& k) { } k.iso15118CertificateHashData.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given AuthorizeRequest \p k to the given output stream \p os @@ -75,12 +75,21 @@ void to_json(json& j, const AuthorizeResponse& k) { {"idTokenInfo", k.idTokenInfo}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.certificateStatus) { j["certificateStatus"] = conversions::authorize_certificate_status_enum_to_string(k.certificateStatus.value()); } + if (k.allowedEnergyTransfer) { + j["allowedEnergyTransfer"] = json::array(); + for (auto val : k.allowedEnergyTransfer.value()) { + j["allowedEnergyTransfer"].push_back(conversions::energy_transfer_mode_enum_to_string(val)); + } + } + if (k.tariff) { + j["tariff"] = k.tariff.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, AuthorizeResponse& k) { @@ -88,13 +97,24 @@ void from_json(const json& j, AuthorizeResponse& k) { k.idTokenInfo = j.at("idTokenInfo"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("certificateStatus")) { k.certificateStatus.emplace( conversions::string_to_authorize_certificate_status_enum(j.at("certificateStatus"))); } + if (j.contains("allowedEnergyTransfer")) { + json arr = j.at("allowedEnergyTransfer"); + std::vector vec; + for (auto val : arr) { + vec.push_back(conversions::string_to_energy_transfer_mode_enum(val)); + } + k.allowedEnergyTransfer.emplace(vec); + } + if (j.contains("tariff")) { + k.tariff.emplace(j.at("tariff")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given AuthorizeResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/BootNotification.cpp b/lib/ocpp/v2/messages/BootNotification.cpp index 7350b63da..5dd4b8928 100644 --- a/lib/ocpp/v2/messages/BootNotification.cpp +++ b/lib/ocpp/v2/messages/BootNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -59,12 +59,12 @@ void to_json(json& j, const BootNotificationResponse& k) { {"status", conversions::registration_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, BootNotificationResponse& k) { @@ -74,12 +74,12 @@ void from_json(const json& j, BootNotificationResponse& k) { k.status = conversions::string_to_registration_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given BootNotificationResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/CancelReservation.cpp b/lib/ocpp/v2/messages/CancelReservation.cpp index c98c17c43..881c8942b 100644 --- a/lib/ocpp/v2/messages/CancelReservation.cpp +++ b/lib/ocpp/v2/messages/CancelReservation.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const CancelReservationResponse& k) { {"status", conversions::cancel_reservation_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, CancelReservationResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, CancelReservationResponse& k) { k.status = conversions::string_to_cancel_reservation_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given CancelReservationResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/CertificateSigned.cpp b/lib/ocpp/v2/messages/CertificateSigned.cpp index bb4001722..a99812324 100644 --- a/lib/ocpp/v2/messages/CertificateSigned.cpp +++ b/lib/ocpp/v2/messages/CertificateSigned.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,15 @@ void to_json(json& j, const CertificateSignedRequest& k) { {"certificateChain", k.certificateChain}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.certificateType) { j["certificateType"] = conversions::certificate_signing_use_enum_to_string(k.certificateType.value()); } + if (k.requestId) { + j["requestId"] = k.requestId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, CertificateSignedRequest& k) { @@ -36,12 +39,15 @@ void from_json(const json& j, CertificateSignedRequest& k) { k.certificateChain = j.at("certificateChain"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("certificateType")) { k.certificateType.emplace(conversions::string_to_certificate_signing_use_enum(j.at("certificateType"))); } + if (j.contains("requestId")) { + k.requestId.emplace(j.at("requestId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given CertificateSignedRequest \p k to the given output stream \p os @@ -61,12 +67,12 @@ void to_json(json& j, const CertificateSignedResponse& k) { {"status", conversions::certificate_signed_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, CertificateSignedResponse& k) { @@ -74,12 +80,12 @@ void from_json(const json& j, CertificateSignedResponse& k) { k.status = conversions::string_to_certificate_signed_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given CertificateSignedResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/ChangeAvailability.cpp b/lib/ocpp/v2/messages/ChangeAvailability.cpp index 2549f1bff..b532a84f3 100644 --- a/lib/ocpp/v2/messages/ChangeAvailability.cpp +++ b/lib/ocpp/v2/messages/ChangeAvailability.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,12 @@ void to_json(json& j, const ChangeAvailabilityRequest& k) { {"operationalStatus", conversions::operational_status_enum_to_string(k.operationalStatus)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evse) { j["evse"] = k.evse.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ChangeAvailabilityRequest& k) { @@ -36,12 +36,12 @@ void from_json(const json& j, ChangeAvailabilityRequest& k) { k.operationalStatus = conversions::string_to_operational_status_enum(j.at("operationalStatus")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evse")) { k.evse.emplace(j.at("evse")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ChangeAvailabilityRequest \p k to the given output stream \p os @@ -61,12 +61,12 @@ void to_json(json& j, const ChangeAvailabilityResponse& k) { {"status", conversions::change_availability_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ChangeAvailabilityResponse& k) { @@ -74,12 +74,12 @@ void from_json(const json& j, ChangeAvailabilityResponse& k) { k.status = conversions::string_to_change_availability_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ChangeAvailabilityResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/ClearCache.cpp b/lib/ocpp/v2/messages/ClearCache.cpp index e49c4983c..b815ac08b 100644 --- a/lib/ocpp/v2/messages/ClearCache.cpp +++ b/lib/ocpp/v2/messages/ClearCache.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -52,12 +52,12 @@ void to_json(json& j, const ClearCacheResponse& k) { {"status", conversions::clear_cache_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ClearCacheResponse& k) { @@ -65,12 +65,12 @@ void from_json(const json& j, ClearCacheResponse& k) { k.status = conversions::string_to_clear_cache_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ClearCacheResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/ClearChargingProfile.cpp b/lib/ocpp/v2/messages/ClearChargingProfile.cpp index a049d69d2..1e254e466 100644 --- a/lib/ocpp/v2/messages/ClearChargingProfile.cpp +++ b/lib/ocpp/v2/messages/ClearChargingProfile.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -21,30 +21,30 @@ void to_json(json& j, const ClearChargingProfileRequest& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.chargingProfileId) { j["chargingProfileId"] = k.chargingProfileId.value(); } if (k.chargingProfileCriteria) { j["chargingProfileCriteria"] = k.chargingProfileCriteria.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ClearChargingProfileRequest& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("chargingProfileId")) { k.chargingProfileId.emplace(j.at("chargingProfileId")); } if (j.contains("chargingProfileCriteria")) { k.chargingProfileCriteria.emplace(j.at("chargingProfileCriteria")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ClearChargingProfileRequest \p k to the given output stream \p @@ -64,12 +64,12 @@ void to_json(json& j, const ClearChargingProfileResponse& k) { {"status", conversions::clear_charging_profile_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ClearChargingProfileResponse& k) { @@ -77,12 +77,12 @@ void from_json(const json& j, ClearChargingProfileResponse& k) { k.status = conversions::string_to_clear_charging_profile_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ClearChargingProfileResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/ClearDisplayMessage.cpp b/lib/ocpp/v2/messages/ClearDisplayMessage.cpp index 548f7bc77..22f24780b 100644 --- a/lib/ocpp/v2/messages/ClearDisplayMessage.cpp +++ b/lib/ocpp/v2/messages/ClearDisplayMessage.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const ClearDisplayMessageResponse& k) { {"status", conversions::clear_message_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ClearDisplayMessageResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, ClearDisplayMessageResponse& k) { k.status = conversions::string_to_clear_message_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ClearDisplayMessageResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/ClearVariableMonitoring.cpp b/lib/ocpp/v2/messages/ClearVariableMonitoring.cpp index 9b582bde5..878eae92b 100644 --- a/lib/ocpp/v2/messages/ClearVariableMonitoring.cpp +++ b/lib/ocpp/v2/messages/ClearVariableMonitoring.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/ClearedChargingLimit.cpp b/lib/ocpp/v2/messages/ClearedChargingLimit.cpp index d2253b1d6..1da8c64a5 100644 --- a/lib/ocpp/v2/messages/ClearedChargingLimit.cpp +++ b/lib/ocpp/v2/messages/ClearedChargingLimit.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -20,28 +20,28 @@ std::string ClearedChargingLimitRequest::get_type() const { void to_json(json& j, const ClearedChargingLimitRequest& k) { // the required parts of the message j = json{ - {"chargingLimitSource", conversions::charging_limit_source_enum_to_string(k.chargingLimitSource)}, + {"chargingLimitSource", k.chargingLimitSource}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evseId) { j["evseId"] = k.evseId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ClearedChargingLimitRequest& k) { // the required parts of the message - k.chargingLimitSource = conversions::string_to_charging_limit_source_enum(j.at("chargingLimitSource")); + k.chargingLimitSource = j.at("chargingLimitSource"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ClearedChargingLimitRequest \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/CostUpdated.cpp b/lib/ocpp/v2/messages/CostUpdated.cpp index 76be1f224..561a252eb 100644 --- a/lib/ocpp/v2/messages/CostUpdated.cpp +++ b/lib/ocpp/v2/messages/CostUpdated.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/CustomerInformation.cpp b/lib/ocpp/v2/messages/CustomerInformation.cpp index 01c8695bd..5927d8c2f 100644 --- a/lib/ocpp/v2/messages/CustomerInformation.cpp +++ b/lib/ocpp/v2/messages/CustomerInformation.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,9 +25,6 @@ void to_json(json& j, const CustomerInformationRequest& k) { {"clear", k.clear}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.customerCertificate) { j["customerCertificate"] = k.customerCertificate.value(); } @@ -37,6 +34,9 @@ void to_json(json& j, const CustomerInformationRequest& k) { if (k.customerIdentifier) { j["customerIdentifier"] = k.customerIdentifier.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, CustomerInformationRequest& k) { @@ -46,9 +46,6 @@ void from_json(const json& j, CustomerInformationRequest& k) { k.clear = j.at("clear"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("customerCertificate")) { k.customerCertificate.emplace(j.at("customerCertificate")); } @@ -58,6 +55,9 @@ void from_json(const json& j, CustomerInformationRequest& k) { if (j.contains("customerIdentifier")) { k.customerIdentifier.emplace(j.at("customerIdentifier")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given CustomerInformationRequest \p k to the given output stream \p @@ -77,12 +77,12 @@ void to_json(json& j, const CustomerInformationResponse& k) { {"status", conversions::customer_information_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, CustomerInformationResponse& k) { @@ -90,12 +90,12 @@ void from_json(const json& j, CustomerInformationResponse& k) { k.status = conversions::string_to_customer_information_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given CustomerInformationResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/DataTransfer.cpp b/lib/ocpp/v2/messages/DataTransfer.cpp index a0bb95dd9..335c1970c 100644 --- a/lib/ocpp/v2/messages/DataTransfer.cpp +++ b/lib/ocpp/v2/messages/DataTransfer.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,15 +23,15 @@ void to_json(json& j, const DataTransferRequest& k) { {"vendorId", k.vendorId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.messageId) { j["messageId"] = k.messageId.value(); } if (k.data) { j["data"] = k.data.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, DataTransferRequest& k) { @@ -39,15 +39,15 @@ void from_json(const json& j, DataTransferRequest& k) { k.vendorId = j.at("vendorId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("messageId")) { k.messageId.emplace(j.at("messageId")); } if (j.contains("data")) { k.data.emplace(j.at("data")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given DataTransferRequest \p k to the given output stream \p os @@ -67,15 +67,15 @@ void to_json(json& j, const DataTransferResponse& k) { {"status", conversions::data_transfer_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } if (k.data) { j["data"] = k.data.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, DataTransferResponse& k) { @@ -83,15 +83,15 @@ void from_json(const json& j, DataTransferResponse& k) { k.status = conversions::string_to_data_transfer_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } if (j.contains("data")) { k.data.emplace(j.at("data")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given DataTransferResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/DeleteCertificate.cpp b/lib/ocpp/v2/messages/DeleteCertificate.cpp index 330e8fa68..f6cba1859 100644 --- a/lib/ocpp/v2/messages/DeleteCertificate.cpp +++ b/lib/ocpp/v2/messages/DeleteCertificate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const DeleteCertificateResponse& k) { {"status", conversions::delete_certificate_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, DeleteCertificateResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, DeleteCertificateResponse& k) { k.status = conversions::string_to_delete_certificate_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given DeleteCertificateResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/FirmwareStatusNotification.cpp b/lib/ocpp/v2/messages/FirmwareStatusNotification.cpp index abea2eb8d..081baba7f 100644 --- a/lib/ocpp/v2/messages/FirmwareStatusNotification.cpp +++ b/lib/ocpp/v2/messages/FirmwareStatusNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,15 @@ void to_json(json& j, const FirmwareStatusNotificationRequest& k) { {"status", conversions::firmware_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, FirmwareStatusNotificationRequest& k) { @@ -36,12 +39,15 @@ void from_json(const json& j, FirmwareStatusNotificationRequest& k) { k.status = conversions::string_to_firmware_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("requestId")) { k.requestId.emplace(j.at("requestId")); } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given FirmwareStatusNotificationRequest \p k to the given output diff --git a/lib/ocpp/v2/messages/Get15118EVCertificate.cpp b/lib/ocpp/v2/messages/Get15118EVCertificate.cpp index 924d9d365..c2542c12b 100644 --- a/lib/ocpp/v2/messages/Get15118EVCertificate.cpp +++ b/lib/ocpp/v2/messages/Get15118EVCertificate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,6 +25,15 @@ void to_json(json& j, const Get15118EVCertificateRequest& k) { {"exiRequest", k.exiRequest}, }; // the optional parts of the message + if (k.maximumContractCertificateChains) { + j["maximumContractCertificateChains"] = k.maximumContractCertificateChains.value(); + } + if (k.prioritizedEMAIDs) { + j["prioritizedEMAIDs"] = json::array(); + for (auto val : k.prioritizedEMAIDs.value()) { + j["prioritizedEMAIDs"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } @@ -37,6 +46,17 @@ void from_json(const json& j, Get15118EVCertificateRequest& k) { k.exiRequest = j.at("exiRequest"); // the optional parts of the message + if (j.contains("maximumContractCertificateChains")) { + k.maximumContractCertificateChains.emplace(j.at("maximumContractCertificateChains")); + } + if (j.contains("prioritizedEMAIDs")) { + json arr = j.at("prioritizedEMAIDs"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.prioritizedEMAIDs.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } @@ -60,12 +80,15 @@ void to_json(json& j, const Get15118EVCertificateResponse& k) { {"exiResponse", k.exiResponse}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.remainingContracts) { + j["remainingContracts"] = k.remainingContracts.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, Get15118EVCertificateResponse& k) { @@ -74,12 +97,15 @@ void from_json(const json& j, Get15118EVCertificateResponse& k) { k.exiResponse = j.at("exiResponse"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("remainingContracts")) { + k.remainingContracts.emplace(j.at("remainingContracts")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given Get15118EVCertificateResponse \p k to the given output stream diff --git a/lib/ocpp/v2/messages/GetBaseReport.cpp b/lib/ocpp/v2/messages/GetBaseReport.cpp index 9a93a7ae6..18e8b2f9d 100644 --- a/lib/ocpp/v2/messages/GetBaseReport.cpp +++ b/lib/ocpp/v2/messages/GetBaseReport.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -57,12 +57,12 @@ void to_json(json& j, const GetBaseReportResponse& k) { {"status", conversions::generic_device_model_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetBaseReportResponse& k) { @@ -70,12 +70,12 @@ void from_json(const json& j, GetBaseReportResponse& k) { k.status = conversions::string_to_generic_device_model_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetBaseReportResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/GetCertificateStatus.cpp b/lib/ocpp/v2/messages/GetCertificateStatus.cpp index 23cb8f4e6..2d1eea817 100644 --- a/lib/ocpp/v2/messages/GetCertificateStatus.cpp +++ b/lib/ocpp/v2/messages/GetCertificateStatus.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,15 +55,15 @@ void to_json(json& j, const GetCertificateStatusResponse& k) { {"status", conversions::get_certificate_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } if (k.ocspResult) { j["ocspResult"] = k.ocspResult.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetCertificateStatusResponse& k) { @@ -71,15 +71,15 @@ void from_json(const json& j, GetCertificateStatusResponse& k) { k.status = conversions::string_to_get_certificate_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } if (j.contains("ocspResult")) { k.ocspResult.emplace(j.at("ocspResult")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetCertificateStatusResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetChargingProfiles.cpp b/lib/ocpp/v2/messages/GetChargingProfiles.cpp index e9081ca4e..3c19608b7 100644 --- a/lib/ocpp/v2/messages/GetChargingProfiles.cpp +++ b/lib/ocpp/v2/messages/GetChargingProfiles.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,12 +24,12 @@ void to_json(json& j, const GetChargingProfilesRequest& k) { {"chargingProfile", k.chargingProfile}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evseId) { j["evseId"] = k.evseId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetChargingProfilesRequest& k) { @@ -38,12 +38,12 @@ void from_json(const json& j, GetChargingProfilesRequest& k) { k.chargingProfile = j.at("chargingProfile"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetChargingProfilesRequest \p k to the given output stream \p @@ -63,12 +63,12 @@ void to_json(json& j, const GetChargingProfilesResponse& k) { {"status", conversions::get_charging_profile_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetChargingProfilesResponse& k) { @@ -76,12 +76,12 @@ void from_json(const json& j, GetChargingProfilesResponse& k) { k.status = conversions::string_to_get_charging_profile_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetChargingProfilesResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetCompositeSchedule.cpp b/lib/ocpp/v2/messages/GetCompositeSchedule.cpp index ff2f5bcc7..c8791b2d6 100644 --- a/lib/ocpp/v2/messages/GetCompositeSchedule.cpp +++ b/lib/ocpp/v2/messages/GetCompositeSchedule.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,12 +24,12 @@ void to_json(json& j, const GetCompositeScheduleRequest& k) { {"evseId", k.evseId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.chargingRateUnit) { j["chargingRateUnit"] = conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit.value()); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetCompositeScheduleRequest& k) { @@ -38,12 +38,12 @@ void from_json(const json& j, GetCompositeScheduleRequest& k) { k.evseId = j.at("evseId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("chargingRateUnit")) { k.chargingRateUnit.emplace(conversions::string_to_charging_rate_unit_enum(j.at("chargingRateUnit"))); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetCompositeScheduleRequest \p k to the given output stream \p @@ -63,15 +63,15 @@ void to_json(json& j, const GetCompositeScheduleResponse& k) { {"status", conversions::generic_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } if (k.schedule) { j["schedule"] = k.schedule.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetCompositeScheduleResponse& k) { @@ -79,15 +79,15 @@ void from_json(const json& j, GetCompositeScheduleResponse& k) { k.status = conversions::string_to_generic_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } if (j.contains("schedule")) { k.schedule.emplace(j.at("schedule")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetCompositeScheduleResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetDisplayMessages.cpp b/lib/ocpp/v2/messages/GetDisplayMessages.cpp index 8237836f4..af2f63ad2 100644 --- a/lib/ocpp/v2/messages/GetDisplayMessages.cpp +++ b/lib/ocpp/v2/messages/GetDisplayMessages.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const GetDisplayMessagesRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.id) { j["id"] = json::array(); for (auto val : k.id.value()) { @@ -38,6 +35,9 @@ void to_json(json& j, const GetDisplayMessagesRequest& k) { if (k.state) { j["state"] = conversions::message_state_enum_to_string(k.state.value()); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetDisplayMessagesRequest& k) { @@ -45,9 +45,6 @@ void from_json(const json& j, GetDisplayMessagesRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("id")) { json arr = j.at("id"); std::vector vec; @@ -62,6 +59,9 @@ void from_json(const json& j, GetDisplayMessagesRequest& k) { if (j.contains("state")) { k.state.emplace(conversions::string_to_message_state_enum(j.at("state"))); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetDisplayMessagesRequest \p k to the given output stream \p os @@ -81,12 +81,12 @@ void to_json(json& j, const GetDisplayMessagesResponse& k) { {"status", conversions::get_display_messages_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetDisplayMessagesResponse& k) { @@ -94,12 +94,12 @@ void from_json(const json& j, GetDisplayMessagesResponse& k) { k.status = conversions::string_to_get_display_messages_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetDisplayMessagesResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetInstalledCertificateIds.cpp b/lib/ocpp/v2/messages/GetInstalledCertificateIds.cpp index aae17f033..990b45703 100644 --- a/lib/ocpp/v2/messages/GetInstalledCertificateIds.cpp +++ b/lib/ocpp/v2/messages/GetInstalledCertificateIds.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -21,9 +21,6 @@ void to_json(json& j, const GetInstalledCertificateIdsRequest& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.certificateType) { if (j.size() == 0) { j = json{{"certificateType", json::array()}}; @@ -34,15 +31,15 @@ void to_json(json& j, const GetInstalledCertificateIdsRequest& k) { j["certificateType"].push_back(conversions::get_certificate_id_use_enum_to_string(val)); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetInstalledCertificateIdsRequest& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("certificateType")) { json arr = j.at("certificateType"); std::vector vec; @@ -51,6 +48,9 @@ void from_json(const json& j, GetInstalledCertificateIdsRequest& k) { } k.certificateType.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetInstalledCertificateIdsRequest \p k to the given output @@ -70,9 +70,6 @@ void to_json(json& j, const GetInstalledCertificateIdsResponse& k) { {"status", conversions::get_installed_certificate_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } @@ -82,6 +79,9 @@ void to_json(json& j, const GetInstalledCertificateIdsResponse& k) { j["certificateHashDataChain"].push_back(val); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetInstalledCertificateIdsResponse& k) { @@ -89,9 +89,6 @@ void from_json(const json& j, GetInstalledCertificateIdsResponse& k) { k.status = conversions::string_to_get_installed_certificate_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } @@ -103,6 +100,9 @@ void from_json(const json& j, GetInstalledCertificateIdsResponse& k) { } k.certificateHashDataChain.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetInstalledCertificateIdsResponse \p k to the given output diff --git a/lib/ocpp/v2/messages/GetLocalListVersion.cpp b/lib/ocpp/v2/messages/GetLocalListVersion.cpp index 217089b06..03787225f 100644 --- a/lib/ocpp/v2/messages/GetLocalListVersion.cpp +++ b/lib/ocpp/v2/messages/GetLocalListVersion.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/GetLog.cpp b/lib/ocpp/v2/messages/GetLog.cpp index ae76c8094..e077b3573 100644 --- a/lib/ocpp/v2/messages/GetLog.cpp +++ b/lib/ocpp/v2/messages/GetLog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,15 +25,15 @@ void to_json(json& j, const GetLogRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.retries) { j["retries"] = k.retries.value(); } if (k.retryInterval) { j["retryInterval"] = k.retryInterval.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetLogRequest& k) { @@ -43,15 +43,15 @@ void from_json(const json& j, GetLogRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("retries")) { k.retries.emplace(j.at("retries")); } if (j.contains("retryInterval")) { k.retryInterval.emplace(j.at("retryInterval")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetLogRequest \p k to the given output stream \p os @@ -71,15 +71,15 @@ void to_json(json& j, const GetLogResponse& k) { {"status", conversions::log_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } if (k.filename) { j["filename"] = k.filename.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetLogResponse& k) { @@ -87,15 +87,15 @@ void from_json(const json& j, GetLogResponse& k) { k.status = conversions::string_to_log_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } if (j.contains("filename")) { k.filename.emplace(j.at("filename")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetLogResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/GetMonitoringReport.cpp b/lib/ocpp/v2/messages/GetMonitoringReport.cpp index 765e4a9ed..f159edd61 100644 --- a/lib/ocpp/v2/messages/GetMonitoringReport.cpp +++ b/lib/ocpp/v2/messages/GetMonitoringReport.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const GetMonitoringReportRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.componentVariable) { j["componentVariable"] = json::array(); for (auto val : k.componentVariable.value()) { @@ -38,6 +35,9 @@ void to_json(json& j, const GetMonitoringReportRequest& k) { j["monitoringCriteria"].push_back(conversions::monitoring_criterion_enum_to_string(val)); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetMonitoringReportRequest& k) { @@ -45,9 +45,6 @@ void from_json(const json& j, GetMonitoringReportRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("componentVariable")) { json arr = j.at("componentVariable"); std::vector vec; @@ -64,6 +61,9 @@ void from_json(const json& j, GetMonitoringReportRequest& k) { } k.monitoringCriteria.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetMonitoringReportRequest \p k to the given output stream \p @@ -83,12 +83,12 @@ void to_json(json& j, const GetMonitoringReportResponse& k) { {"status", conversions::generic_device_model_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetMonitoringReportResponse& k) { @@ -96,12 +96,12 @@ void from_json(const json& j, GetMonitoringReportResponse& k) { k.status = conversions::string_to_generic_device_model_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetMonitoringReportResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetReport.cpp b/lib/ocpp/v2/messages/GetReport.cpp index 63b76060f..cff5cf7ce 100644 --- a/lib/ocpp/v2/messages/GetReport.cpp +++ b/lib/ocpp/v2/messages/GetReport.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const GetReportRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.componentVariable) { j["componentVariable"] = json::array(); for (auto val : k.componentVariable.value()) { @@ -38,6 +35,9 @@ void to_json(json& j, const GetReportRequest& k) { j["componentCriteria"].push_back(conversions::component_criterion_enum_to_string(val)); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetReportRequest& k) { @@ -45,9 +45,6 @@ void from_json(const json& j, GetReportRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("componentVariable")) { json arr = j.at("componentVariable"); std::vector vec; @@ -64,6 +61,9 @@ void from_json(const json& j, GetReportRequest& k) { } k.componentCriteria.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetReportRequest \p k to the given output stream \p os @@ -83,12 +83,12 @@ void to_json(json& j, const GetReportResponse& k) { {"status", conversions::generic_device_model_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetReportResponse& k) { @@ -96,12 +96,12 @@ void from_json(const json& j, GetReportResponse& k) { k.status = conversions::string_to_generic_device_model_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetReportResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/GetTransactionStatus.cpp b/lib/ocpp/v2/messages/GetTransactionStatus.cpp index bff4ced7a..4327d9abb 100644 --- a/lib/ocpp/v2/messages/GetTransactionStatus.cpp +++ b/lib/ocpp/v2/messages/GetTransactionStatus.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -21,24 +21,24 @@ void to_json(json& j, const GetTransactionStatusRequest& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.transactionId) { j["transactionId"] = k.transactionId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetTransactionStatusRequest& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("transactionId")) { k.transactionId.emplace(j.at("transactionId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetTransactionStatusRequest \p k to the given output stream \p @@ -58,12 +58,12 @@ void to_json(json& j, const GetTransactionStatusResponse& k) { {"messagesInQueue", k.messagesInQueue}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.ongoingIndicator) { j["ongoingIndicator"] = k.ongoingIndicator.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, GetTransactionStatusResponse& k) { @@ -71,12 +71,12 @@ void from_json(const json& j, GetTransactionStatusResponse& k) { k.messagesInQueue = j.at("messagesInQueue"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("ongoingIndicator")) { k.ongoingIndicator.emplace(j.at("ongoingIndicator")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given GetTransactionStatusResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/GetVariables.cpp b/lib/ocpp/v2/messages/GetVariables.cpp index f574bf538..77a1acc62 100644 --- a/lib/ocpp/v2/messages/GetVariables.cpp +++ b/lib/ocpp/v2/messages/GetVariables.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/Heartbeat.cpp b/lib/ocpp/v2/messages/Heartbeat.cpp index 7b8538e1e..cfc0afc72 100644 --- a/lib/ocpp/v2/messages/Heartbeat.cpp +++ b/lib/ocpp/v2/messages/Heartbeat.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/InstallCertificate.cpp b/lib/ocpp/v2/messages/InstallCertificate.cpp index ac25ebb86..143d27343 100644 --- a/lib/ocpp/v2/messages/InstallCertificate.cpp +++ b/lib/ocpp/v2/messages/InstallCertificate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -57,12 +57,12 @@ void to_json(json& j, const InstallCertificateResponse& k) { {"status", conversions::install_certificate_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, InstallCertificateResponse& k) { @@ -70,12 +70,12 @@ void from_json(const json& j, InstallCertificateResponse& k) { k.status = conversions::string_to_install_certificate_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given InstallCertificateResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/LogStatusNotification.cpp b/lib/ocpp/v2/messages/LogStatusNotification.cpp index 917287916..81711e7d5 100644 --- a/lib/ocpp/v2/messages/LogStatusNotification.cpp +++ b/lib/ocpp/v2/messages/LogStatusNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,15 @@ void to_json(json& j, const LogStatusNotificationRequest& k) { {"status", conversions::upload_log_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, LogStatusNotificationRequest& k) { @@ -36,12 +39,15 @@ void from_json(const json& j, LogStatusNotificationRequest& k) { k.status = conversions::string_to_upload_log_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("requestId")) { k.requestId.emplace(j.at("requestId")); } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given LogStatusNotificationRequest \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/MeterValues.cpp b/lib/ocpp/v2/messages/MeterValues.cpp index 5d2fa98d9..c7aa2535d 100644 --- a/lib/ocpp/v2/messages/MeterValues.cpp +++ b/lib/ocpp/v2/messages/MeterValues.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/NotifyChargingLimit.cpp b/lib/ocpp/v2/messages/NotifyChargingLimit.cpp index 32a190e1c..dabeb7636 100644 --- a/lib/ocpp/v2/messages/NotifyChargingLimit.cpp +++ b/lib/ocpp/v2/messages/NotifyChargingLimit.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const NotifyChargingLimitRequest& k) { {"chargingLimit", k.chargingLimit}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.chargingSchedule) { j["chargingSchedule"] = json::array(); for (auto val : k.chargingSchedule.value()) { @@ -35,6 +32,9 @@ void to_json(json& j, const NotifyChargingLimitRequest& k) { if (k.evseId) { j["evseId"] = k.evseId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyChargingLimitRequest& k) { @@ -42,9 +42,6 @@ void from_json(const json& j, NotifyChargingLimitRequest& k) { k.chargingLimit = j.at("chargingLimit"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("chargingSchedule")) { json arr = j.at("chargingSchedule"); std::vector vec; @@ -56,6 +53,9 @@ void from_json(const json& j, NotifyChargingLimitRequest& k) { if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyChargingLimitRequest \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/NotifyCustomerInformation.cpp b/lib/ocpp/v2/messages/NotifyCustomerInformation.cpp index 0ce13a307..6b6bda7f7 100644 --- a/lib/ocpp/v2/messages/NotifyCustomerInformation.cpp +++ b/lib/ocpp/v2/messages/NotifyCustomerInformation.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -26,12 +26,12 @@ void to_json(json& j, const NotifyCustomerInformationRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyCustomerInformationRequest& k) { @@ -42,12 +42,12 @@ void from_json(const json& j, NotifyCustomerInformationRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyCustomerInformationRequest \p k to the given output diff --git a/lib/ocpp/v2/messages/NotifyDisplayMessages.cpp b/lib/ocpp/v2/messages/NotifyDisplayMessages.cpp index 1c474cee0..4d912e286 100644 --- a/lib/ocpp/v2/messages/NotifyDisplayMessages.cpp +++ b/lib/ocpp/v2/messages/NotifyDisplayMessages.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const NotifyDisplayMessagesRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.messageInfo) { j["messageInfo"] = json::array(); for (auto val : k.messageInfo.value()) { @@ -35,6 +32,9 @@ void to_json(json& j, const NotifyDisplayMessagesRequest& k) { if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyDisplayMessagesRequest& k) { @@ -42,9 +42,6 @@ void from_json(const json& j, NotifyDisplayMessagesRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("messageInfo")) { json arr = j.at("messageInfo"); std::vector vec; @@ -56,6 +53,9 @@ void from_json(const json& j, NotifyDisplayMessagesRequest& k) { if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyDisplayMessagesRequest \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/NotifyEVChargingNeeds.cpp b/lib/ocpp/v2/messages/NotifyEVChargingNeeds.cpp index 97cbf572a..dfdf24a6c 100644 --- a/lib/ocpp/v2/messages/NotifyEVChargingNeeds.cpp +++ b/lib/ocpp/v2/messages/NotifyEVChargingNeeds.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -20,30 +20,36 @@ std::string NotifyEVChargingNeedsRequest::get_type() const { void to_json(json& j, const NotifyEVChargingNeedsRequest& k) { // the required parts of the message j = json{ - {"chargingNeeds", k.chargingNeeds}, {"evseId", k.evseId}, + {"chargingNeeds", k.chargingNeeds}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.maxScheduleTuples) { j["maxScheduleTuples"] = k.maxScheduleTuples.value(); } + if (k.timestamp) { + j["timestamp"] = k.timestamp.value().to_rfc3339(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyEVChargingNeedsRequest& k) { // the required parts of the message - k.chargingNeeds = j.at("chargingNeeds"); k.evseId = j.at("evseId"); + k.chargingNeeds = j.at("chargingNeeds"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("maxScheduleTuples")) { k.maxScheduleTuples.emplace(j.at("maxScheduleTuples")); } + if (j.contains("timestamp")) { + k.timestamp.emplace(ocpp::DateTime(std::string(j.at("timestamp")))); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyEVChargingNeedsRequest \p k to the given output stream \p @@ -63,12 +69,12 @@ void to_json(json& j, const NotifyEVChargingNeedsResponse& k) { {"status", conversions::notify_evcharging_needs_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyEVChargingNeedsResponse& k) { @@ -76,12 +82,12 @@ void from_json(const json& j, NotifyEVChargingNeedsResponse& k) { k.status = conversions::string_to_notify_evcharging_needs_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyEVChargingNeedsResponse \p k to the given output stream diff --git a/lib/ocpp/v2/messages/NotifyEVChargingSchedule.cpp b/lib/ocpp/v2/messages/NotifyEVChargingSchedule.cpp index 993991080..0b9827113 100644 --- a/lib/ocpp/v2/messages/NotifyEVChargingSchedule.cpp +++ b/lib/ocpp/v2/messages/NotifyEVChargingSchedule.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,6 +25,12 @@ void to_json(json& j, const NotifyEVChargingScheduleRequest& k) { {"evseId", k.evseId}, }; // the optional parts of the message + if (k.selectedChargingScheduleId) { + j["selectedChargingScheduleId"] = k.selectedChargingScheduleId.value(); + } + if (k.powerToleranceAcceptance) { + j["powerToleranceAcceptance"] = k.powerToleranceAcceptance.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } @@ -37,6 +43,12 @@ void from_json(const json& j, NotifyEVChargingScheduleRequest& k) { k.evseId = j.at("evseId"); // the optional parts of the message + if (j.contains("selectedChargingScheduleId")) { + k.selectedChargingScheduleId.emplace(j.at("selectedChargingScheduleId")); + } + if (j.contains("powerToleranceAcceptance")) { + k.powerToleranceAcceptance.emplace(j.at("powerToleranceAcceptance")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } @@ -59,12 +71,12 @@ void to_json(json& j, const NotifyEVChargingScheduleResponse& k) { {"status", conversions::generic_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyEVChargingScheduleResponse& k) { @@ -72,12 +84,12 @@ void from_json(const json& j, NotifyEVChargingScheduleResponse& k) { k.status = conversions::string_to_generic_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyEVChargingScheduleResponse \p k to the given output diff --git a/lib/ocpp/v2/messages/NotifyEvent.cpp b/lib/ocpp/v2/messages/NotifyEvent.cpp index a8d0d826c..bbaa6b72a 100644 --- a/lib/ocpp/v2/messages/NotifyEvent.cpp +++ b/lib/ocpp/v2/messages/NotifyEvent.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,12 +25,12 @@ void to_json(json& j, const NotifyEventRequest& k) { {"eventData", k.eventData}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyEventRequest& k) { @@ -42,12 +42,12 @@ void from_json(const json& j, NotifyEventRequest& k) { } // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyEventRequest \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/NotifyMonitoringReport.cpp b/lib/ocpp/v2/messages/NotifyMonitoringReport.cpp index 26c227799..22086603d 100644 --- a/lib/ocpp/v2/messages/NotifyMonitoringReport.cpp +++ b/lib/ocpp/v2/messages/NotifyMonitoringReport.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,9 +25,6 @@ void to_json(json& j, const NotifyMonitoringReportRequest& k) { {"generatedAt", k.generatedAt.to_rfc3339()}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.monitor) { j["monitor"] = json::array(); for (auto val : k.monitor.value()) { @@ -37,6 +34,9 @@ void to_json(json& j, const NotifyMonitoringReportRequest& k) { if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyMonitoringReportRequest& k) { @@ -46,9 +46,6 @@ void from_json(const json& j, NotifyMonitoringReportRequest& k) { k.generatedAt = ocpp::DateTime(std::string(j.at("generatedAt"))); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("monitor")) { json arr = j.at("monitor"); std::vector vec; @@ -60,6 +57,9 @@ void from_json(const json& j, NotifyMonitoringReportRequest& k) { if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyMonitoringReportRequest \p k to the given output stream diff --git a/lib/ocpp/v2/messages/NotifyReport.cpp b/lib/ocpp/v2/messages/NotifyReport.cpp index 9f97a350e..5e1fe7f5b 100644 --- a/lib/ocpp/v2/messages/NotifyReport.cpp +++ b/lib/ocpp/v2/messages/NotifyReport.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,9 +25,6 @@ void to_json(json& j, const NotifyReportRequest& k) { {"seqNo", k.seqNo}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.reportData) { j["reportData"] = json::array(); for (auto val : k.reportData.value()) { @@ -37,6 +34,9 @@ void to_json(json& j, const NotifyReportRequest& k) { if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, NotifyReportRequest& k) { @@ -46,9 +46,6 @@ void from_json(const json& j, NotifyReportRequest& k) { k.seqNo = j.at("seqNo"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("reportData")) { json arr = j.at("reportData"); std::vector vec; @@ -60,6 +57,9 @@ void from_json(const json& j, NotifyReportRequest& k) { if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given NotifyReportRequest \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/PublishFirmware.cpp b/lib/ocpp/v2/messages/PublishFirmware.cpp index 2b9c0c6fe..b7a474f8e 100644 --- a/lib/ocpp/v2/messages/PublishFirmware.cpp +++ b/lib/ocpp/v2/messages/PublishFirmware.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,15 +25,15 @@ void to_json(json& j, const PublishFirmwareRequest& k) { {"requestId", k.requestId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.retries) { j["retries"] = k.retries.value(); } if (k.retryInterval) { j["retryInterval"] = k.retryInterval.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, PublishFirmwareRequest& k) { @@ -43,15 +43,15 @@ void from_json(const json& j, PublishFirmwareRequest& k) { k.requestId = j.at("requestId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("retries")) { k.retries.emplace(j.at("retries")); } if (j.contains("retryInterval")) { k.retryInterval.emplace(j.at("retryInterval")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given PublishFirmwareRequest \p k to the given output stream \p os @@ -71,12 +71,12 @@ void to_json(json& j, const PublishFirmwareResponse& k) { {"status", conversions::generic_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, PublishFirmwareResponse& k) { @@ -84,12 +84,12 @@ void from_json(const json& j, PublishFirmwareResponse& k) { k.status = conversions::string_to_generic_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given PublishFirmwareResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/PublishFirmwareStatusNotification.cpp b/lib/ocpp/v2/messages/PublishFirmwareStatusNotification.cpp index d2fd4839f..d38df3a61 100644 --- a/lib/ocpp/v2/messages/PublishFirmwareStatusNotification.cpp +++ b/lib/ocpp/v2/messages/PublishFirmwareStatusNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,9 +23,6 @@ void to_json(json& j, const PublishFirmwareStatusNotificationRequest& k) { {"status", conversions::publish_firmware_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.location) { j["location"] = json::array(); for (auto val : k.location.value()) { @@ -35,6 +32,12 @@ void to_json(json& j, const PublishFirmwareStatusNotificationRequest& k) { if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, PublishFirmwareStatusNotificationRequest& k) { @@ -42,12 +45,9 @@ void from_json(const json& j, PublishFirmwareStatusNotificationRequest& k) { k.status = conversions::string_to_publish_firmware_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("location")) { json arr = j.at("location"); - std::vector> vec; + std::vector> vec; for (auto val : arr) { vec.push_back(val); } @@ -56,6 +56,12 @@ void from_json(const json& j, PublishFirmwareStatusNotificationRequest& k) { if (j.contains("requestId")) { k.requestId.emplace(j.at("requestId")); } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given PublishFirmwareStatusNotificationRequest \p k to the given diff --git a/lib/ocpp/v2/messages/ReportChargingProfiles.cpp b/lib/ocpp/v2/messages/ReportChargingProfiles.cpp index c21d0199e..a3e089121 100644 --- a/lib/ocpp/v2/messages/ReportChargingProfiles.cpp +++ b/lib/ocpp/v2/messages/ReportChargingProfiles.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -21,35 +21,35 @@ void to_json(json& j, const ReportChargingProfilesRequest& k) { // the required parts of the message j = json{ {"requestId", k.requestId}, - {"chargingLimitSource", conversions::charging_limit_source_enum_to_string(k.chargingLimitSource)}, + {"chargingLimitSource", k.chargingLimitSource}, {"chargingProfile", k.chargingProfile}, {"evseId", k.evseId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.tbc) { j["tbc"] = k.tbc.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ReportChargingProfilesRequest& k) { // the required parts of the message k.requestId = j.at("requestId"); - k.chargingLimitSource = conversions::string_to_charging_limit_source_enum(j.at("chargingLimitSource")); + k.chargingLimitSource = j.at("chargingLimitSource"); for (auto val : j.at("chargingProfile")) { k.chargingProfile.push_back(val); } k.evseId = j.at("evseId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("tbc")) { k.tbc.emplace(j.at("tbc")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ReportChargingProfilesRequest \p k to the given output stream diff --git a/lib/ocpp/v2/messages/RequestStartTransaction.cpp b/lib/ocpp/v2/messages/RequestStartTransaction.cpp index 98bba3422..4a95ae3c9 100644 --- a/lib/ocpp/v2/messages/RequestStartTransaction.cpp +++ b/lib/ocpp/v2/messages/RequestStartTransaction.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,9 +24,6 @@ void to_json(json& j, const RequestStartTransactionRequest& k) { {"remoteStartId", k.remoteStartId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evseId) { j["evseId"] = k.evseId.value(); } @@ -36,6 +33,9 @@ void to_json(json& j, const RequestStartTransactionRequest& k) { if (k.chargingProfile) { j["chargingProfile"] = k.chargingProfile.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, RequestStartTransactionRequest& k) { @@ -44,9 +44,6 @@ void from_json(const json& j, RequestStartTransactionRequest& k) { k.remoteStartId = j.at("remoteStartId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); } @@ -56,6 +53,9 @@ void from_json(const json& j, RequestStartTransactionRequest& k) { if (j.contains("chargingProfile")) { k.chargingProfile.emplace(j.at("chargingProfile")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given RequestStartTransactionRequest \p k to the given output stream @@ -75,15 +75,15 @@ void to_json(json& j, const RequestStartTransactionResponse& k) { {"status", conversions::request_start_stop_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } if (k.transactionId) { j["transactionId"] = k.transactionId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, RequestStartTransactionResponse& k) { @@ -91,15 +91,15 @@ void from_json(const json& j, RequestStartTransactionResponse& k) { k.status = conversions::string_to_request_start_stop_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } if (j.contains("transactionId")) { k.transactionId.emplace(j.at("transactionId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given RequestStartTransactionResponse \p k to the given output stream diff --git a/lib/ocpp/v2/messages/RequestStopTransaction.cpp b/lib/ocpp/v2/messages/RequestStopTransaction.cpp index 402623af6..b053feef8 100644 --- a/lib/ocpp/v2/messages/RequestStopTransaction.cpp +++ b/lib/ocpp/v2/messages/RequestStopTransaction.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const RequestStopTransactionResponse& k) { {"status", conversions::request_start_stop_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, RequestStopTransactionResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, RequestStopTransactionResponse& k) { k.status = conversions::string_to_request_start_stop_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given RequestStopTransactionResponse \p k to the given output stream diff --git a/lib/ocpp/v2/messages/ReservationStatusUpdate.cpp b/lib/ocpp/v2/messages/ReservationStatusUpdate.cpp index d82a96faf..b69acc749 100644 --- a/lib/ocpp/v2/messages/ReservationStatusUpdate.cpp +++ b/lib/ocpp/v2/messages/ReservationStatusUpdate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/ReserveNow.cpp b/lib/ocpp/v2/messages/ReserveNow.cpp index dc80b3e2f..63982bad0 100644 --- a/lib/ocpp/v2/messages/ReserveNow.cpp +++ b/lib/ocpp/v2/messages/ReserveNow.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -25,11 +25,8 @@ void to_json(json& j, const ReserveNowRequest& k) { {"idToken", k.idToken}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.connectorType) { - j["connectorType"] = conversions::connector_enum_to_string(k.connectorType.value()); + j["connectorType"] = k.connectorType.value(); } if (k.evseId) { j["evseId"] = k.evseId.value(); @@ -37,6 +34,9 @@ void to_json(json& j, const ReserveNowRequest& k) { if (k.groupIdToken) { j["groupIdToken"] = k.groupIdToken.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ReserveNowRequest& k) { @@ -46,11 +46,8 @@ void from_json(const json& j, ReserveNowRequest& k) { k.idToken = j.at("idToken"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("connectorType")) { - k.connectorType.emplace(conversions::string_to_connector_enum(j.at("connectorType"))); + k.connectorType.emplace(j.at("connectorType")); } if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); @@ -58,6 +55,9 @@ void from_json(const json& j, ReserveNowRequest& k) { if (j.contains("groupIdToken")) { k.groupIdToken.emplace(j.at("groupIdToken")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ReserveNowRequest \p k to the given output stream \p os @@ -77,12 +77,12 @@ void to_json(json& j, const ReserveNowResponse& k) { {"status", conversions::reserve_now_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ReserveNowResponse& k) { @@ -90,12 +90,12 @@ void from_json(const json& j, ReserveNowResponse& k) { k.status = conversions::string_to_reserve_now_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ReserveNowResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/Reset.cpp b/lib/ocpp/v2/messages/Reset.cpp index 2e955486c..fbbd4d29f 100644 --- a/lib/ocpp/v2/messages/Reset.cpp +++ b/lib/ocpp/v2/messages/Reset.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,12 @@ void to_json(json& j, const ResetRequest& k) { {"type", conversions::reset_enum_to_string(k.type)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evseId) { j["evseId"] = k.evseId.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ResetRequest& k) { @@ -36,12 +36,12 @@ void from_json(const json& j, ResetRequest& k) { k.type = conversions::string_to_reset_enum(j.at("type")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evseId")) { k.evseId.emplace(j.at("evseId")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ResetRequest \p k to the given output stream \p os @@ -61,12 +61,12 @@ void to_json(json& j, const ResetResponse& k) { {"status", conversions::reset_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, ResetResponse& k) { @@ -74,12 +74,12 @@ void from_json(const json& j, ResetResponse& k) { k.status = conversions::string_to_reset_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given ResetResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/SecurityEventNotification.cpp b/lib/ocpp/v2/messages/SecurityEventNotification.cpp index 419f2f5ed..02a4b3b8b 100644 --- a/lib/ocpp/v2/messages/SecurityEventNotification.cpp +++ b/lib/ocpp/v2/messages/SecurityEventNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,12 +24,12 @@ void to_json(json& j, const SecurityEventNotificationRequest& k) { {"timestamp", k.timestamp.to_rfc3339()}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.techInfo) { j["techInfo"] = k.techInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SecurityEventNotificationRequest& k) { @@ -38,12 +38,12 @@ void from_json(const json& j, SecurityEventNotificationRequest& k) { k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("techInfo")) { k.techInfo.emplace(j.at("techInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SecurityEventNotificationRequest \p k to the given output diff --git a/lib/ocpp/v2/messages/SendLocalList.cpp b/lib/ocpp/v2/messages/SendLocalList.cpp index 00ed7fcbb..ae0c4894c 100644 --- a/lib/ocpp/v2/messages/SendLocalList.cpp +++ b/lib/ocpp/v2/messages/SendLocalList.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,15 +24,15 @@ void to_json(json& j, const SendLocalListRequest& k) { {"updateType", conversions::update_enum_to_string(k.updateType)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.localAuthorizationList) { j["localAuthorizationList"] = json::array(); for (auto val : k.localAuthorizationList.value()) { j["localAuthorizationList"].push_back(val); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SendLocalListRequest& k) { @@ -41,9 +41,6 @@ void from_json(const json& j, SendLocalListRequest& k) { k.updateType = conversions::string_to_update_enum(j.at("updateType")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("localAuthorizationList")) { json arr = j.at("localAuthorizationList"); std::vector vec; @@ -52,6 +49,9 @@ void from_json(const json& j, SendLocalListRequest& k) { } k.localAuthorizationList.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SendLocalListRequest \p k to the given output stream \p os @@ -71,12 +71,12 @@ void to_json(json& j, const SendLocalListResponse& k) { {"status", conversions::send_local_list_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SendLocalListResponse& k) { @@ -84,12 +84,12 @@ void from_json(const json& j, SendLocalListResponse& k) { k.status = conversions::string_to_send_local_list_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SendLocalListResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/SetChargingProfile.cpp b/lib/ocpp/v2/messages/SetChargingProfile.cpp index 9f0f03f16..1b30b6fe0 100644 --- a/lib/ocpp/v2/messages/SetChargingProfile.cpp +++ b/lib/ocpp/v2/messages/SetChargingProfile.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -57,12 +57,12 @@ void to_json(json& j, const SetChargingProfileResponse& k) { {"status", conversions::charging_profile_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SetChargingProfileResponse& k) { @@ -70,12 +70,12 @@ void from_json(const json& j, SetChargingProfileResponse& k) { k.status = conversions::string_to_charging_profile_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SetChargingProfileResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/SetDisplayMessage.cpp b/lib/ocpp/v2/messages/SetDisplayMessage.cpp index a37713d3a..4f2393642 100644 --- a/lib/ocpp/v2/messages/SetDisplayMessage.cpp +++ b/lib/ocpp/v2/messages/SetDisplayMessage.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const SetDisplayMessageResponse& k) { {"status", conversions::display_message_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SetDisplayMessageResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, SetDisplayMessageResponse& k) { k.status = conversions::string_to_display_message_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SetDisplayMessageResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/SetMonitoringBase.cpp b/lib/ocpp/v2/messages/SetMonitoringBase.cpp index f9301d071..6d50ff9fb 100644 --- a/lib/ocpp/v2/messages/SetMonitoringBase.cpp +++ b/lib/ocpp/v2/messages/SetMonitoringBase.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const SetMonitoringBaseResponse& k) { {"status", conversions::generic_device_model_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SetMonitoringBaseResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, SetMonitoringBaseResponse& k) { k.status = conversions::string_to_generic_device_model_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SetMonitoringBaseResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/SetMonitoringLevel.cpp b/lib/ocpp/v2/messages/SetMonitoringLevel.cpp index 7633531b1..c887333bf 100644 --- a/lib/ocpp/v2/messages/SetMonitoringLevel.cpp +++ b/lib/ocpp/v2/messages/SetMonitoringLevel.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -55,12 +55,12 @@ void to_json(json& j, const SetMonitoringLevelResponse& k) { {"status", conversions::generic_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SetMonitoringLevelResponse& k) { @@ -68,12 +68,12 @@ void from_json(const json& j, SetMonitoringLevelResponse& k) { k.status = conversions::string_to_generic_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SetMonitoringLevelResponse \p k to the given output stream \p diff --git a/lib/ocpp/v2/messages/SetNetworkProfile.cpp b/lib/ocpp/v2/messages/SetNetworkProfile.cpp index 1cccc2ef4..5175d3a74 100644 --- a/lib/ocpp/v2/messages/SetNetworkProfile.cpp +++ b/lib/ocpp/v2/messages/SetNetworkProfile.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -57,12 +57,12 @@ void to_json(json& j, const SetNetworkProfileResponse& k) { {"status", conversions::set_network_profile_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SetNetworkProfileResponse& k) { @@ -70,12 +70,12 @@ void from_json(const json& j, SetNetworkProfileResponse& k) { k.status = conversions::string_to_set_network_profile_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SetNetworkProfileResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/SetVariableMonitoring.cpp b/lib/ocpp/v2/messages/SetVariableMonitoring.cpp index 0de0cc67f..8750fd099 100644 --- a/lib/ocpp/v2/messages/SetVariableMonitoring.cpp +++ b/lib/ocpp/v2/messages/SetVariableMonitoring.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/SetVariables.cpp b/lib/ocpp/v2/messages/SetVariables.cpp index 6bf264c95..4f4cc0ef6 100644 --- a/lib/ocpp/v2/messages/SetVariables.cpp +++ b/lib/ocpp/v2/messages/SetVariables.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/SignCertificate.cpp b/lib/ocpp/v2/messages/SignCertificate.cpp index f8a529976..11bd2a9da 100644 --- a/lib/ocpp/v2/messages/SignCertificate.cpp +++ b/lib/ocpp/v2/messages/SignCertificate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,18 @@ void to_json(json& j, const SignCertificateRequest& k) { {"csr", k.csr}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.certificateType) { j["certificateType"] = conversions::certificate_signing_use_enum_to_string(k.certificateType.value()); } + if (k.hashRootCertificate) { + j["hashRootCertificate"] = k.hashRootCertificate.value(); + } + if (k.requestId) { + j["requestId"] = k.requestId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SignCertificateRequest& k) { @@ -36,12 +42,18 @@ void from_json(const json& j, SignCertificateRequest& k) { k.csr = j.at("csr"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("certificateType")) { k.certificateType.emplace(conversions::string_to_certificate_signing_use_enum(j.at("certificateType"))); } + if (j.contains("hashRootCertificate")) { + k.hashRootCertificate.emplace(j.at("hashRootCertificate")); + } + if (j.contains("requestId")) { + k.requestId.emplace(j.at("requestId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SignCertificateRequest \p k to the given output stream \p os @@ -61,12 +73,12 @@ void to_json(json& j, const SignCertificateResponse& k) { {"status", conversions::generic_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, SignCertificateResponse& k) { @@ -74,12 +86,12 @@ void from_json(const json& j, SignCertificateResponse& k) { k.status = conversions::string_to_generic_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given SignCertificateResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/StatusNotification.cpp b/lib/ocpp/v2/messages/StatusNotification.cpp index 921f2838b..64f6092d5 100644 --- a/lib/ocpp/v2/messages/StatusNotification.cpp +++ b/lib/ocpp/v2/messages/StatusNotification.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/TransactionEvent.cpp b/lib/ocpp/v2/messages/TransactionEvent.cpp index ccf0b4a31..58b067fd3 100644 --- a/lib/ocpp/v2/messages/TransactionEvent.cpp +++ b/lib/ocpp/v2/messages/TransactionEvent.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -27,8 +27,8 @@ void to_json(json& j, const TransactionEventRequest& k) { {"transactionInfo", k.transactionInfo}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.costDetails) { + j["costDetails"] = k.costDetails.value(); } if (k.meterValue) { j["meterValue"] = json::array(); @@ -48,12 +48,22 @@ void to_json(json& j, const TransactionEventRequest& k) { if (k.reservationId) { j["reservationId"] = k.reservationId.value(); } + if (k.preconditioningStatus) { + j["preconditioningStatus"] = + conversions::preconditioning_status_enum_to_string(k.preconditioningStatus.value()); + } + if (k.evseSleep) { + j["evseSleep"] = k.evseSleep.value(); + } if (k.evse) { j["evse"] = k.evse.value(); } if (k.idToken) { j["idToken"] = k.idToken.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, TransactionEventRequest& k) { @@ -65,8 +75,8 @@ void from_json(const json& j, TransactionEventRequest& k) { k.transactionInfo = j.at("transactionInfo"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("costDetails")) { + k.costDetails.emplace(j.at("costDetails")); } if (j.contains("meterValue")) { json arr = j.at("meterValue"); @@ -88,12 +98,22 @@ void from_json(const json& j, TransactionEventRequest& k) { if (j.contains("reservationId")) { k.reservationId.emplace(j.at("reservationId")); } + if (j.contains("preconditioningStatus")) { + k.preconditioningStatus.emplace( + conversions::string_to_preconditioning_status_enum(j.at("preconditioningStatus"))); + } + if (j.contains("evseSleep")) { + k.evseSleep.emplace(j.at("evseSleep")); + } if (j.contains("evse")) { k.evse.emplace(j.at("evse")); } if (j.contains("idToken")) { k.idToken.emplace(j.at("idToken")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given TransactionEventRequest \p k to the given output stream \p os @@ -111,9 +131,6 @@ void to_json(json& j, const TransactionEventResponse& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.totalCost) { j["totalCost"] = k.totalCost.value(); } @@ -123,18 +140,31 @@ void to_json(json& j, const TransactionEventResponse& k) { if (k.idTokenInfo) { j["idTokenInfo"] = k.idTokenInfo.value(); } + if (k.transactionLimit) { + j["transactionLimit"] = k.transactionLimit.value(); + } if (k.updatedPersonalMessage) { j["updatedPersonalMessage"] = k.updatedPersonalMessage.value(); } + if (k.updatedPersonalMessageExtra) { + if (j.size() == 0) { + j = json{{"updatedPersonalMessageExtra", json::array()}}; + } else { + j["updatedPersonalMessageExtra"] = json::array(); + } + for (auto val : k.updatedPersonalMessageExtra.value()) { + j["updatedPersonalMessageExtra"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, TransactionEventResponse& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("totalCost")) { k.totalCost.emplace(j.at("totalCost")); } @@ -144,9 +174,23 @@ void from_json(const json& j, TransactionEventResponse& k) { if (j.contains("idTokenInfo")) { k.idTokenInfo.emplace(j.at("idTokenInfo")); } + if (j.contains("transactionLimit")) { + k.transactionLimit.emplace(j.at("transactionLimit")); + } if (j.contains("updatedPersonalMessage")) { k.updatedPersonalMessage.emplace(j.at("updatedPersonalMessage")); } + if (j.contains("updatedPersonalMessageExtra")) { + json arr = j.at("updatedPersonalMessageExtra"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.updatedPersonalMessageExtra.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given TransactionEventResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/TriggerMessage.cpp b/lib/ocpp/v2/messages/TriggerMessage.cpp index adb6cfad1..02ffb6a77 100644 --- a/lib/ocpp/v2/messages/TriggerMessage.cpp +++ b/lib/ocpp/v2/messages/TriggerMessage.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -23,12 +23,15 @@ void to_json(json& j, const TriggerMessageRequest& k) { {"requestedMessage", conversions::message_trigger_enum_to_string(k.requestedMessage)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.evse) { j["evse"] = k.evse.value(); } + if (k.customTrigger) { + j["customTrigger"] = k.customTrigger.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, TriggerMessageRequest& k) { @@ -36,12 +39,15 @@ void from_json(const json& j, TriggerMessageRequest& k) { k.requestedMessage = conversions::string_to_message_trigger_enum(j.at("requestedMessage")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("evse")) { k.evse.emplace(j.at("evse")); } + if (j.contains("customTrigger")) { + k.customTrigger.emplace(j.at("customTrigger")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given TriggerMessageRequest \p k to the given output stream \p os @@ -61,12 +67,12 @@ void to_json(json& j, const TriggerMessageResponse& k) { {"status", conversions::trigger_message_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, TriggerMessageResponse& k) { @@ -74,12 +80,12 @@ void from_json(const json& j, TriggerMessageResponse& k) { k.status = conversions::string_to_trigger_message_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given TriggerMessageResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/UnlockConnector.cpp b/lib/ocpp/v2/messages/UnlockConnector.cpp index 238c189c1..3550a7319 100644 --- a/lib/ocpp/v2/messages/UnlockConnector.cpp +++ b/lib/ocpp/v2/messages/UnlockConnector.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -57,12 +57,12 @@ void to_json(json& j, const UnlockConnectorResponse& k) { {"status", conversions::unlock_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, UnlockConnectorResponse& k) { @@ -70,12 +70,12 @@ void from_json(const json& j, UnlockConnectorResponse& k) { k.status = conversions::string_to_unlock_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given UnlockConnectorResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/messages/UnpublishFirmware.cpp b/lib/ocpp/v2/messages/UnpublishFirmware.cpp index 409821872..bff89999c 100644 --- a/lib/ocpp/v2/messages/UnpublishFirmware.cpp +++ b/lib/ocpp/v2/messages/UnpublishFirmware.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include diff --git a/lib/ocpp/v2/messages/UpdateFirmware.cpp b/lib/ocpp/v2/messages/UpdateFirmware.cpp index ee10dd692..97e2dc126 100644 --- a/lib/ocpp/v2/messages/UpdateFirmware.cpp +++ b/lib/ocpp/v2/messages/UpdateFirmware.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -24,15 +24,15 @@ void to_json(json& j, const UpdateFirmwareRequest& k) { {"firmware", k.firmware}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.retries) { j["retries"] = k.retries.value(); } if (k.retryInterval) { j["retryInterval"] = k.retryInterval.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, UpdateFirmwareRequest& k) { @@ -41,15 +41,15 @@ void from_json(const json& j, UpdateFirmwareRequest& k) { k.firmware = j.at("firmware"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("retries")) { k.retries.emplace(j.at("retries")); } if (j.contains("retryInterval")) { k.retryInterval.emplace(j.at("retryInterval")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given UpdateFirmwareRequest \p k to the given output stream \p os @@ -69,12 +69,12 @@ void to_json(json& j, const UpdateFirmwareResponse& k) { {"status", conversions::update_firmware_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } void from_json(const json& j, UpdateFirmwareResponse& k) { @@ -82,12 +82,12 @@ void from_json(const json& j, UpdateFirmwareResponse& k) { k.status = conversions::string_to_update_firmware_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } /// \brief Writes the string representation of the given UpdateFirmwareResponse \p k to the given output stream \p os diff --git a/lib/ocpp/v2/ocpp_enums.cpp b/lib/ocpp/v2/ocpp_enums.cpp index 59e584758..06bcbe6f0 100644 --- a/lib/ocpp/v2/ocpp_enums.cpp +++ b/lib/ocpp/v2/ocpp_enums.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -11,63 +11,33 @@ namespace ocpp { namespace v2 { -// from: AuthorizeRequest +// from: AFRRSignalResponse namespace conversions { -std::string id_token_enum_to_string(IdTokenEnum e) { - switch (e) { - case IdTokenEnum::Central: - return "Central"; - case IdTokenEnum::eMAID: - return "eMAID"; - case IdTokenEnum::ISO14443: - return "ISO14443"; - case IdTokenEnum::ISO15693: - return "ISO15693"; - case IdTokenEnum::KeyCode: - return "KeyCode"; - case IdTokenEnum::Local: - return "Local"; - case IdTokenEnum::MacAddress: - return "MacAddress"; - case IdTokenEnum::NoAuthorization: - return "NoAuthorization"; +std::string generic_status_enum_to_string(GenericStatusEnum e) { + switch (e) { + case GenericStatusEnum::Accepted: + return "Accepted"; + case GenericStatusEnum::Rejected: + return "Rejected"; } - throw EnumToStringException{e, "IdTokenEnum"}; + throw EnumToStringException{e, "GenericStatusEnum"}; } -IdTokenEnum string_to_id_token_enum(const std::string& s) { - if (s == "Central") { - return IdTokenEnum::Central; - } - if (s == "eMAID") { - return IdTokenEnum::eMAID; - } - if (s == "ISO14443") { - return IdTokenEnum::ISO14443; - } - if (s == "ISO15693") { - return IdTokenEnum::ISO15693; - } - if (s == "KeyCode") { - return IdTokenEnum::KeyCode; - } - if (s == "Local") { - return IdTokenEnum::Local; - } - if (s == "MacAddress") { - return IdTokenEnum::MacAddress; +GenericStatusEnum string_to_generic_status_enum(const std::string& s) { + if (s == "Accepted") { + return GenericStatusEnum::Accepted; } - if (s == "NoAuthorization") { - return IdTokenEnum::NoAuthorization; + if (s == "Rejected") { + return GenericStatusEnum::Rejected; } - throw StringToEnumException{s, "IdTokenEnum"}; + throw StringToEnumException{s, "GenericStatusEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const IdTokenEnum& id_token_enum) { - os << conversions::id_token_enum_to_string(id_token_enum); +std::ostream& operator<<(std::ostream& os, const GenericStatusEnum& generic_status_enum) { + os << conversions::generic_status_enum_to_string(generic_status_enum); return os; } @@ -188,6 +158,8 @@ std::string message_format_enum_to_string(MessageFormatEnum e) { return "URI"; case MessageFormatEnum::UTF8: return "UTF8"; + case MessageFormatEnum::QRCODE: + return "QRCODE"; } throw EnumToStringException{e, "MessageFormatEnum"}; @@ -206,6 +178,9 @@ MessageFormatEnum string_to_message_format_enum(const std::string& s) { if (s == "UTF8") { return MessageFormatEnum::UTF8; } + if (s == "QRCODE") { + return MessageFormatEnum::QRCODE; + } throw StringToEnumException{s, "MessageFormatEnum"}; } @@ -271,6 +246,201 @@ std::ostream& operator<<(std::ostream& os, const AuthorizeCertificateStatusEnum& return os; } +// from: AuthorizeResponse +namespace conversions { +std::string energy_transfer_mode_enum_to_string(EnergyTransferModeEnum e) { + switch (e) { + case EnergyTransferModeEnum::AC_single_phase: + return "AC_single_phase"; + case EnergyTransferModeEnum::AC_two_phase: + return "AC_two_phase"; + case EnergyTransferModeEnum::AC_three_phase: + return "AC_three_phase"; + case EnergyTransferModeEnum::DC: + return "DC"; + case EnergyTransferModeEnum::AC_BPT: + return "AC_BPT"; + case EnergyTransferModeEnum::AC_BPT_DER: + return "AC_BPT_DER"; + case EnergyTransferModeEnum::AC_DER: + return "AC_DER"; + case EnergyTransferModeEnum::DC_BPT: + return "DC_BPT"; + case EnergyTransferModeEnum::DC_ACDP: + return "DC_ACDP"; + case EnergyTransferModeEnum::DC_ACDP_BPT: + return "DC_ACDP_BPT"; + case EnergyTransferModeEnum::WPT: + return "WPT"; + } + + throw EnumToStringException{e, "EnergyTransferModeEnum"}; +} + +EnergyTransferModeEnum string_to_energy_transfer_mode_enum(const std::string& s) { + if (s == "AC_single_phase") { + return EnergyTransferModeEnum::AC_single_phase; + } + if (s == "AC_two_phase") { + return EnergyTransferModeEnum::AC_two_phase; + } + if (s == "AC_three_phase") { + return EnergyTransferModeEnum::AC_three_phase; + } + if (s == "DC") { + return EnergyTransferModeEnum::DC; + } + if (s == "AC_BPT") { + return EnergyTransferModeEnum::AC_BPT; + } + if (s == "AC_BPT_DER") { + return EnergyTransferModeEnum::AC_BPT_DER; + } + if (s == "AC_DER") { + return EnergyTransferModeEnum::AC_DER; + } + if (s == "DC_BPT") { + return EnergyTransferModeEnum::DC_BPT; + } + if (s == "DC_ACDP") { + return EnergyTransferModeEnum::DC_ACDP; + } + if (s == "DC_ACDP_BPT") { + return EnergyTransferModeEnum::DC_ACDP_BPT; + } + if (s == "WPT") { + return EnergyTransferModeEnum::WPT; + } + + throw StringToEnumException{s, "EnergyTransferModeEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const EnergyTransferModeEnum& energy_transfer_mode_enum) { + os << conversions::energy_transfer_mode_enum_to_string(energy_transfer_mode_enum); + return os; +} + +// from: AuthorizeResponse +namespace conversions { +std::string day_of_week_enum_to_string(DayOfWeekEnum e) { + switch (e) { + case DayOfWeekEnum::Monday: + return "Monday"; + case DayOfWeekEnum::Tuesday: + return "Tuesday"; + case DayOfWeekEnum::Wednesday: + return "Wednesday"; + case DayOfWeekEnum::Thursday: + return "Thursday"; + case DayOfWeekEnum::Friday: + return "Friday"; + case DayOfWeekEnum::Saturday: + return "Saturday"; + case DayOfWeekEnum::Sunday: + return "Sunday"; + } + + throw EnumToStringException{e, "DayOfWeekEnum"}; +} + +DayOfWeekEnum string_to_day_of_week_enum(const std::string& s) { + if (s == "Monday") { + return DayOfWeekEnum::Monday; + } + if (s == "Tuesday") { + return DayOfWeekEnum::Tuesday; + } + if (s == "Wednesday") { + return DayOfWeekEnum::Wednesday; + } + if (s == "Thursday") { + return DayOfWeekEnum::Thursday; + } + if (s == "Friday") { + return DayOfWeekEnum::Friday; + } + if (s == "Saturday") { + return DayOfWeekEnum::Saturday; + } + if (s == "Sunday") { + return DayOfWeekEnum::Sunday; + } + + throw StringToEnumException{s, "DayOfWeekEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const DayOfWeekEnum& day_of_week_enum) { + os << conversions::day_of_week_enum_to_string(day_of_week_enum); + return os; +} + +// from: AuthorizeResponse +namespace conversions { +std::string evse_kind_enum_to_string(EvseKindEnum e) { + switch (e) { + case EvseKindEnum::AC: + return "AC"; + case EvseKindEnum::DC: + return "DC"; + } + + throw EnumToStringException{e, "EvseKindEnum"}; +} + +EvseKindEnum string_to_evse_kind_enum(const std::string& s) { + if (s == "AC") { + return EvseKindEnum::AC; + } + if (s == "DC") { + return EvseKindEnum::DC; + } + + throw StringToEnumException{s, "EvseKindEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const EvseKindEnum& evse_kind_enum) { + os << conversions::evse_kind_enum_to_string(evse_kind_enum); + return os; +} + +// from: BatterySwapRequest +namespace conversions { +std::string battery_swap_event_enum_to_string(BatterySwapEventEnum e) { + switch (e) { + case BatterySwapEventEnum::BatteryIn: + return "BatteryIn"; + case BatterySwapEventEnum::BatteryOut: + return "BatteryOut"; + case BatterySwapEventEnum::BatteryOutTimeout: + return "BatteryOutTimeout"; + } + + throw EnumToStringException{e, "BatterySwapEventEnum"}; +} + +BatterySwapEventEnum string_to_battery_swap_event_enum(const std::string& s) { + if (s == "BatteryIn") { + return BatterySwapEventEnum::BatteryIn; + } + if (s == "BatteryOut") { + return BatterySwapEventEnum::BatteryOut; + } + if (s == "BatteryOutTimeout") { + return BatterySwapEventEnum::BatteryOutTimeout; + } + + throw StringToEnumException{s, "BatterySwapEventEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const BatterySwapEventEnum& battery_swap_event_enum) { + os << conversions::battery_swap_event_enum_to_string(battery_swap_event_enum); + return os; +} + // from: BootNotificationRequest namespace conversions { std::string boot_reason_enum_to_string(BootReasonEnum e) { @@ -409,6 +579,8 @@ std::string certificate_signing_use_enum_to_string(CertificateSigningUseEnum e) return "ChargingStationCertificate"; case CertificateSigningUseEnum::V2GCertificate: return "V2GCertificate"; + case CertificateSigningUseEnum::V2G20Certificate: + return "V2G20Certificate"; } throw EnumToStringException{e, "CertificateSigningUseEnum"}; @@ -421,6 +593,9 @@ CertificateSigningUseEnum string_to_certificate_signing_use_enum(const std::stri if (s == "V2GCertificate") { return CertificateSigningUseEnum::V2GCertificate; } + if (s == "V2G20Certificate") { + return CertificateSigningUseEnum::V2G20Certificate; + } throw StringToEnumException{s, "CertificateSigningUseEnum"}; } @@ -526,6 +701,56 @@ std::ostream& operator<<(std::ostream& os, const ChangeAvailabilityStatusEnum& c return os; } +// from: ChangeTransactionTariffResponse +namespace conversions { +std::string tariff_change_status_enum_to_string(TariffChangeStatusEnum e) { + switch (e) { + case TariffChangeStatusEnum::Accepted: + return "Accepted"; + case TariffChangeStatusEnum::Rejected: + return "Rejected"; + case TariffChangeStatusEnum::TooManyElements: + return "TooManyElements"; + case TariffChangeStatusEnum::ConditionNotSupported: + return "ConditionNotSupported"; + case TariffChangeStatusEnum::TxNotFound: + return "TxNotFound"; + case TariffChangeStatusEnum::NoCurrencyChange: + return "NoCurrencyChange"; + } + + throw EnumToStringException{e, "TariffChangeStatusEnum"}; +} + +TariffChangeStatusEnum string_to_tariff_change_status_enum(const std::string& s) { + if (s == "Accepted") { + return TariffChangeStatusEnum::Accepted; + } + if (s == "Rejected") { + return TariffChangeStatusEnum::Rejected; + } + if (s == "TooManyElements") { + return TariffChangeStatusEnum::TooManyElements; + } + if (s == "ConditionNotSupported") { + return TariffChangeStatusEnum::ConditionNotSupported; + } + if (s == "TxNotFound") { + return TariffChangeStatusEnum::TxNotFound; + } + if (s == "NoCurrencyChange") { + return TariffChangeStatusEnum::NoCurrencyChange; + } + + throw StringToEnumException{s, "TariffChangeStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const TariffChangeStatusEnum& tariff_change_status_enum) { + os << conversions::tariff_change_status_enum_to_string(tariff_change_status_enum); + return os; +} + // from: ClearCacheResponse namespace conversions { std::string clear_cache_status_enum_to_string(ClearCacheStatusEnum e) { @@ -568,6 +793,10 @@ std::string charging_profile_purpose_enum_to_string(ChargingProfilePurposeEnum e return "TxDefaultProfile"; case ChargingProfilePurposeEnum::TxProfile: return "TxProfile"; + case ChargingProfilePurposeEnum::PriorityCharging: + return "PriorityCharging"; + case ChargingProfilePurposeEnum::LocalGeneration: + return "LocalGeneration"; } throw EnumToStringException{e, "ChargingProfilePurposeEnum"}; @@ -586,6 +815,12 @@ ChargingProfilePurposeEnum string_to_charging_profile_purpose_enum(const std::st if (s == "TxProfile") { return ChargingProfilePurposeEnum::TxProfile; } + if (s == "PriorityCharging") { + return ChargingProfilePurposeEnum::PriorityCharging; + } + if (s == "LocalGeneration") { + return ChargingProfilePurposeEnum::LocalGeneration; + } throw StringToEnumException{s, "ChargingProfilePurposeEnum"}; } @@ -626,6 +861,176 @@ std::ostream& operator<<(std::ostream& os, const ClearChargingProfileStatusEnum& return os; } +// from: ClearDERControlRequest +namespace conversions { +std::string dercontrol_enum_to_string(DERControlEnum e) { + switch (e) { + case DERControlEnum::EnterService: + return "EnterService"; + case DERControlEnum::FreqDroop: + return "FreqDroop"; + case DERControlEnum::FreqWatt: + return "FreqWatt"; + case DERControlEnum::FixedPFAbsorb: + return "FixedPFAbsorb"; + case DERControlEnum::FixedPFInject: + return "FixedPFInject"; + case DERControlEnum::FixedVar: + return "FixedVar"; + case DERControlEnum::Gradients: + return "Gradients"; + case DERControlEnum::HFMustTrip: + return "HFMustTrip"; + case DERControlEnum::HFMayTrip: + return "HFMayTrip"; + case DERControlEnum::HVMustTrip: + return "HVMustTrip"; + case DERControlEnum::HVMomCess: + return "HVMomCess"; + case DERControlEnum::HVMayTrip: + return "HVMayTrip"; + case DERControlEnum::LimitMaxDischarge: + return "LimitMaxDischarge"; + case DERControlEnum::LFMustTrip: + return "LFMustTrip"; + case DERControlEnum::LVMustTrip: + return "LVMustTrip"; + case DERControlEnum::LVMomCess: + return "LVMomCess"; + case DERControlEnum::LVMayTrip: + return "LVMayTrip"; + case DERControlEnum::PowerMonitoringMustTrip: + return "PowerMonitoringMustTrip"; + case DERControlEnum::VoltVar: + return "VoltVar"; + case DERControlEnum::VoltWatt: + return "VoltWatt"; + case DERControlEnum::WattPF: + return "WattPF"; + case DERControlEnum::WattVar: + return "WattVar"; + } + + throw EnumToStringException{e, "DERControlEnum"}; +} + +DERControlEnum string_to_dercontrol_enum(const std::string& s) { + if (s == "EnterService") { + return DERControlEnum::EnterService; + } + if (s == "FreqDroop") { + return DERControlEnum::FreqDroop; + } + if (s == "FreqWatt") { + return DERControlEnum::FreqWatt; + } + if (s == "FixedPFAbsorb") { + return DERControlEnum::FixedPFAbsorb; + } + if (s == "FixedPFInject") { + return DERControlEnum::FixedPFInject; + } + if (s == "FixedVar") { + return DERControlEnum::FixedVar; + } + if (s == "Gradients") { + return DERControlEnum::Gradients; + } + if (s == "HFMustTrip") { + return DERControlEnum::HFMustTrip; + } + if (s == "HFMayTrip") { + return DERControlEnum::HFMayTrip; + } + if (s == "HVMustTrip") { + return DERControlEnum::HVMustTrip; + } + if (s == "HVMomCess") { + return DERControlEnum::HVMomCess; + } + if (s == "HVMayTrip") { + return DERControlEnum::HVMayTrip; + } + if (s == "LimitMaxDischarge") { + return DERControlEnum::LimitMaxDischarge; + } + if (s == "LFMustTrip") { + return DERControlEnum::LFMustTrip; + } + if (s == "LVMustTrip") { + return DERControlEnum::LVMustTrip; + } + if (s == "LVMomCess") { + return DERControlEnum::LVMomCess; + } + if (s == "LVMayTrip") { + return DERControlEnum::LVMayTrip; + } + if (s == "PowerMonitoringMustTrip") { + return DERControlEnum::PowerMonitoringMustTrip; + } + if (s == "VoltVar") { + return DERControlEnum::VoltVar; + } + if (s == "VoltWatt") { + return DERControlEnum::VoltWatt; + } + if (s == "WattPF") { + return DERControlEnum::WattPF; + } + if (s == "WattVar") { + return DERControlEnum::WattVar; + } + + throw StringToEnumException{s, "DERControlEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const DERControlEnum& dercontrol_enum) { + os << conversions::dercontrol_enum_to_string(dercontrol_enum); + return os; +} + +// from: ClearDERControlResponse +namespace conversions { +std::string dercontrol_status_enum_to_string(DERControlStatusEnum e) { + switch (e) { + case DERControlStatusEnum::Accepted: + return "Accepted"; + case DERControlStatusEnum::Rejected: + return "Rejected"; + case DERControlStatusEnum::NotSupported: + return "NotSupported"; + case DERControlStatusEnum::NotFound: + return "NotFound"; + } + + throw EnumToStringException{e, "DERControlStatusEnum"}; +} + +DERControlStatusEnum string_to_dercontrol_status_enum(const std::string& s) { + if (s == "Accepted") { + return DERControlStatusEnum::Accepted; + } + if (s == "Rejected") { + return DERControlStatusEnum::Rejected; + } + if (s == "NotSupported") { + return DERControlStatusEnum::NotSupported; + } + if (s == "NotFound") { + return DERControlStatusEnum::NotFound; + } + + throw StringToEnumException{s, "DERControlStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const DERControlStatusEnum& dercontrol_status_enum) { + os << conversions::dercontrol_status_enum_to_string(dercontrol_status_enum); + return os; +} + // from: ClearDisplayMessageResponse namespace conversions { std::string clear_message_status_enum_to_string(ClearMessageStatusEnum e) { @@ -634,6 +1039,8 @@ std::string clear_message_status_enum_to_string(ClearMessageStatusEnum e) { return "Accepted"; case ClearMessageStatusEnum::Unknown: return "Unknown"; + case ClearMessageStatusEnum::Rejected: + return "Rejected"; } throw EnumToStringException{e, "ClearMessageStatusEnum"}; @@ -646,6 +1053,9 @@ ClearMessageStatusEnum string_to_clear_message_status_enum(const std::string& s) if (s == "Unknown") { return ClearMessageStatusEnum::Unknown; } + if (s == "Rejected") { + return ClearMessageStatusEnum::Rejected; + } throw StringToEnumException{s, "ClearMessageStatusEnum"}; } @@ -656,78 +1066,73 @@ std::ostream& operator<<(std::ostream& os, const ClearMessageStatusEnum& clear_m return os; } -// from: ClearVariableMonitoringResponse +// from: ClearTariffsResponse namespace conversions { -std::string clear_monitoring_status_enum_to_string(ClearMonitoringStatusEnum e) { +std::string tariff_clear_status_enum_to_string(TariffClearStatusEnum e) { switch (e) { - case ClearMonitoringStatusEnum::Accepted: + case TariffClearStatusEnum::Accepted: return "Accepted"; - case ClearMonitoringStatusEnum::Rejected: + case TariffClearStatusEnum::Rejected: return "Rejected"; - case ClearMonitoringStatusEnum::NotFound: - return "NotFound"; + case TariffClearStatusEnum::NoTariff: + return "NoTariff"; } - throw EnumToStringException{e, "ClearMonitoringStatusEnum"}; + throw EnumToStringException{e, "TariffClearStatusEnum"}; } -ClearMonitoringStatusEnum string_to_clear_monitoring_status_enum(const std::string& s) { +TariffClearStatusEnum string_to_tariff_clear_status_enum(const std::string& s) { if (s == "Accepted") { - return ClearMonitoringStatusEnum::Accepted; + return TariffClearStatusEnum::Accepted; } if (s == "Rejected") { - return ClearMonitoringStatusEnum::Rejected; + return TariffClearStatusEnum::Rejected; } - if (s == "NotFound") { - return ClearMonitoringStatusEnum::NotFound; + if (s == "NoTariff") { + return TariffClearStatusEnum::NoTariff; } - throw StringToEnumException{s, "ClearMonitoringStatusEnum"}; + throw StringToEnumException{s, "TariffClearStatusEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const ClearMonitoringStatusEnum& clear_monitoring_status_enum) { - os << conversions::clear_monitoring_status_enum_to_string(clear_monitoring_status_enum); +std::ostream& operator<<(std::ostream& os, const TariffClearStatusEnum& tariff_clear_status_enum) { + os << conversions::tariff_clear_status_enum_to_string(tariff_clear_status_enum); return os; } -// from: ClearedChargingLimitRequest +// from: ClearVariableMonitoringResponse namespace conversions { -std::string charging_limit_source_enum_to_string(ChargingLimitSourceEnum e) { +std::string clear_monitoring_status_enum_to_string(ClearMonitoringStatusEnum e) { switch (e) { - case ChargingLimitSourceEnum::EMS: - return "EMS"; - case ChargingLimitSourceEnum::Other: - return "Other"; - case ChargingLimitSourceEnum::SO: - return "SO"; - case ChargingLimitSourceEnum::CSO: - return "CSO"; + case ClearMonitoringStatusEnum::Accepted: + return "Accepted"; + case ClearMonitoringStatusEnum::Rejected: + return "Rejected"; + case ClearMonitoringStatusEnum::NotFound: + return "NotFound"; } - throw EnumToStringException{e, "ChargingLimitSourceEnum"}; + throw EnumToStringException{e, "ClearMonitoringStatusEnum"}; } -ChargingLimitSourceEnum string_to_charging_limit_source_enum(const std::string& s) { - if (s == "EMS") { - return ChargingLimitSourceEnum::EMS; - } - if (s == "Other") { - return ChargingLimitSourceEnum::Other; +ClearMonitoringStatusEnum string_to_clear_monitoring_status_enum(const std::string& s) { + if (s == "Accepted") { + return ClearMonitoringStatusEnum::Accepted; } - if (s == "SO") { - return ChargingLimitSourceEnum::SO; + if (s == "Rejected") { + return ClearMonitoringStatusEnum::Rejected; } - if (s == "CSO") { - return ChargingLimitSourceEnum::CSO; + if (s == "NotFound") { + return ClearMonitoringStatusEnum::NotFound; } - throw StringToEnumException{s, "ChargingLimitSourceEnum"}; + throw StringToEnumException{s, "ClearMonitoringStatusEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const ChargingLimitSourceEnum& charging_limit_source_enum) { - os << conversions::charging_limit_source_enum_to_string(charging_limit_source_enum); +std::ostream& operator<<(std::ostream& os, const ClearMonitoringStatusEnum& clear_monitoring_status_enum) { + os << conversions::clear_monitoring_status_enum_to_string(clear_monitoring_status_enum); return os; } @@ -1066,50 +1471,120 @@ std::ostream& operator<<(std::ostream& os, const GenericDeviceModelStatusEnum& g return os; } -// from: GetCertificateStatusResponse +// from: GetCertificateChainStatusRequest namespace conversions { -std::string get_certificate_status_enum_to_string(GetCertificateStatusEnum e) { +std::string certificate_status_source_enum_to_string(CertificateStatusSourceEnum e) { switch (e) { - case GetCertificateStatusEnum::Accepted: - return "Accepted"; - case GetCertificateStatusEnum::Failed: - return "Failed"; + case CertificateStatusSourceEnum::CRL: + return "CRL"; + case CertificateStatusSourceEnum::OCSP: + return "OCSP"; } - throw EnumToStringException{e, "GetCertificateStatusEnum"}; + throw EnumToStringException{e, "CertificateStatusSourceEnum"}; } -GetCertificateStatusEnum string_to_get_certificate_status_enum(const std::string& s) { - if (s == "Accepted") { - return GetCertificateStatusEnum::Accepted; +CertificateStatusSourceEnum string_to_certificate_status_source_enum(const std::string& s) { + if (s == "CRL") { + return CertificateStatusSourceEnum::CRL; } - if (s == "Failed") { - return GetCertificateStatusEnum::Failed; + if (s == "OCSP") { + return CertificateStatusSourceEnum::OCSP; } - throw StringToEnumException{s, "GetCertificateStatusEnum"}; + throw StringToEnumException{s, "CertificateStatusSourceEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const GetCertificateStatusEnum& get_certificate_status_enum) { - os << conversions::get_certificate_status_enum_to_string(get_certificate_status_enum); +std::ostream& operator<<(std::ostream& os, const CertificateStatusSourceEnum& certificate_status_source_enum) { + os << conversions::certificate_status_source_enum_to_string(certificate_status_source_enum); return os; } -// from: GetChargingProfilesResponse +// from: GetCertificateChainStatusResponse namespace conversions { -std::string get_charging_profile_status_enum_to_string(GetChargingProfileStatusEnum e) { +std::string certificate_status_enum_to_string(CertificateStatusEnum e) { switch (e) { - case GetChargingProfileStatusEnum::Accepted: - return "Accepted"; - case GetChargingProfileStatusEnum::NoProfiles: - return "NoProfiles"; + case CertificateStatusEnum::Good: + return "Good"; + case CertificateStatusEnum::Revoked: + return "Revoked"; + case CertificateStatusEnum::Unknown: + return "Unknown"; + case CertificateStatusEnum::Failed: + return "Failed"; } - throw EnumToStringException{e, "GetChargingProfileStatusEnum"}; + throw EnumToStringException{e, "CertificateStatusEnum"}; } -GetChargingProfileStatusEnum string_to_get_charging_profile_status_enum(const std::string& s) { +CertificateStatusEnum string_to_certificate_status_enum(const std::string& s) { + if (s == "Good") { + return CertificateStatusEnum::Good; + } + if (s == "Revoked") { + return CertificateStatusEnum::Revoked; + } + if (s == "Unknown") { + return CertificateStatusEnum::Unknown; + } + if (s == "Failed") { + return CertificateStatusEnum::Failed; + } + + throw StringToEnumException{s, "CertificateStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const CertificateStatusEnum& certificate_status_enum) { + os << conversions::certificate_status_enum_to_string(certificate_status_enum); + return os; +} + +// from: GetCertificateStatusResponse +namespace conversions { +std::string get_certificate_status_enum_to_string(GetCertificateStatusEnum e) { + switch (e) { + case GetCertificateStatusEnum::Accepted: + return "Accepted"; + case GetCertificateStatusEnum::Failed: + return "Failed"; + } + + throw EnumToStringException{e, "GetCertificateStatusEnum"}; +} + +GetCertificateStatusEnum string_to_get_certificate_status_enum(const std::string& s) { + if (s == "Accepted") { + return GetCertificateStatusEnum::Accepted; + } + if (s == "Failed") { + return GetCertificateStatusEnum::Failed; + } + + throw StringToEnumException{s, "GetCertificateStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const GetCertificateStatusEnum& get_certificate_status_enum) { + os << conversions::get_certificate_status_enum_to_string(get_certificate_status_enum); + return os; +} + +// from: GetChargingProfilesResponse +namespace conversions { +std::string get_charging_profile_status_enum_to_string(GetChargingProfileStatusEnum e) { + switch (e) { + case GetChargingProfileStatusEnum::Accepted: + return "Accepted"; + case GetChargingProfileStatusEnum::NoProfiles: + return "NoProfiles"; + } + + throw EnumToStringException{e, "GetChargingProfileStatusEnum"}; +} + +GetChargingProfileStatusEnum string_to_get_charging_profile_status_enum(const std::string& s) { if (s == "Accepted") { return GetChargingProfileStatusEnum::Accepted; } @@ -1158,31 +1633,61 @@ std::ostream& operator<<(std::ostream& os, const ChargingRateUnitEnum& charging_ // from: GetCompositeScheduleResponse namespace conversions { -std::string generic_status_enum_to_string(GenericStatusEnum e) { +std::string operation_mode_enum_to_string(OperationModeEnum e) { switch (e) { - case GenericStatusEnum::Accepted: - return "Accepted"; - case GenericStatusEnum::Rejected: - return "Rejected"; + case OperationModeEnum::Idle: + return "Idle"; + case OperationModeEnum::ChargingOnly: + return "ChargingOnly"; + case OperationModeEnum::CentralSetpoint: + return "CentralSetpoint"; + case OperationModeEnum::ExternalSetpoint: + return "ExternalSetpoint"; + case OperationModeEnum::ExternalLimits: + return "ExternalLimits"; + case OperationModeEnum::CentralFrequency: + return "CentralFrequency"; + case OperationModeEnum::LocalFrequency: + return "LocalFrequency"; + case OperationModeEnum::LocalLoadBalancing: + return "LocalLoadBalancing"; + } + + throw EnumToStringException{e, "OperationModeEnum"}; +} + +OperationModeEnum string_to_operation_mode_enum(const std::string& s) { + if (s == "Idle") { + return OperationModeEnum::Idle; } - - throw EnumToStringException{e, "GenericStatusEnum"}; -} - -GenericStatusEnum string_to_generic_status_enum(const std::string& s) { - if (s == "Accepted") { - return GenericStatusEnum::Accepted; + if (s == "ChargingOnly") { + return OperationModeEnum::ChargingOnly; } - if (s == "Rejected") { - return GenericStatusEnum::Rejected; + if (s == "CentralSetpoint") { + return OperationModeEnum::CentralSetpoint; + } + if (s == "ExternalSetpoint") { + return OperationModeEnum::ExternalSetpoint; + } + if (s == "ExternalLimits") { + return OperationModeEnum::ExternalLimits; + } + if (s == "CentralFrequency") { + return OperationModeEnum::CentralFrequency; + } + if (s == "LocalFrequency") { + return OperationModeEnum::LocalFrequency; + } + if (s == "LocalLoadBalancing") { + return OperationModeEnum::LocalLoadBalancing; } - throw StringToEnumException{s, "GenericStatusEnum"}; + throw StringToEnumException{s, "OperationModeEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const GenericStatusEnum& generic_status_enum) { - os << conversions::generic_status_enum_to_string(generic_status_enum); +std::ostream& operator<<(std::ostream& os, const OperationModeEnum& operation_mode_enum) { + os << conversions::operation_mode_enum_to_string(operation_mode_enum); return os; } @@ -1233,6 +1738,10 @@ std::string message_state_enum_to_string(MessageStateEnum e) { return "Idle"; case MessageStateEnum::Unavailable: return "Unavailable"; + case MessageStateEnum::Suspended: + return "Suspended"; + case MessageStateEnum::Discharging: + return "Discharging"; } throw EnumToStringException{e, "MessageStateEnum"}; @@ -1251,6 +1760,12 @@ MessageStateEnum string_to_message_state_enum(const std::string& s) { if (s == "Unavailable") { return MessageStateEnum::Unavailable; } + if (s == "Suspended") { + return MessageStateEnum::Suspended; + } + if (s == "Discharging") { + return MessageStateEnum::Discharging; + } throw StringToEnumException{s, "MessageStateEnum"}; } @@ -1305,6 +1820,8 @@ std::string get_certificate_id_use_enum_to_string(GetCertificateIdUseEnum e) { return "V2GCertificateChain"; case GetCertificateIdUseEnum::ManufacturerRootCertificate: return "ManufacturerRootCertificate"; + case GetCertificateIdUseEnum::OEMRootCertificate: + return "OEMRootCertificate"; } throw EnumToStringException{e, "GetCertificateIdUseEnum"}; @@ -1326,6 +1843,9 @@ GetCertificateIdUseEnum string_to_get_certificate_id_use_enum(const std::string& if (s == "ManufacturerRootCertificate") { return GetCertificateIdUseEnum::ManufacturerRootCertificate; } + if (s == "OEMRootCertificate") { + return GetCertificateIdUseEnum::OEMRootCertificate; + } throw StringToEnumException{s, "GetCertificateIdUseEnum"}; } @@ -1375,6 +1895,8 @@ std::string log_enum_to_string(LogEnum e) { return "DiagnosticsLog"; case LogEnum::SecurityLog: return "SecurityLog"; + case LogEnum::DataCollectorLog: + return "DataCollectorLog"; } throw EnumToStringException{e, "LogEnum"}; @@ -1387,6 +1909,9 @@ LogEnum string_to_log_enum(const std::string& s) { if (s == "SecurityLog") { return LogEnum::SecurityLog; } + if (s == "DataCollectorLog") { + return LogEnum::DataCollectorLog; + } throw StringToEnumException{s, "LogEnum"}; } @@ -1507,6 +2032,71 @@ std::ostream& operator<<(std::ostream& os, const ComponentCriterionEnum& compone return os; } +// from: GetTariffsResponse +namespace conversions { +std::string tariff_get_status_enum_to_string(TariffGetStatusEnum e) { + switch (e) { + case TariffGetStatusEnum::Accepted: + return "Accepted"; + case TariffGetStatusEnum::Rejected: + return "Rejected"; + case TariffGetStatusEnum::NoTariff: + return "NoTariff"; + } + + throw EnumToStringException{e, "TariffGetStatusEnum"}; +} + +TariffGetStatusEnum string_to_tariff_get_status_enum(const std::string& s) { + if (s == "Accepted") { + return TariffGetStatusEnum::Accepted; + } + if (s == "Rejected") { + return TariffGetStatusEnum::Rejected; + } + if (s == "NoTariff") { + return TariffGetStatusEnum::NoTariff; + } + + throw StringToEnumException{s, "TariffGetStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const TariffGetStatusEnum& tariff_get_status_enum) { + os << conversions::tariff_get_status_enum_to_string(tariff_get_status_enum); + return os; +} + +// from: GetTariffsResponse +namespace conversions { +std::string tariff_kind_enum_to_string(TariffKindEnum e) { + switch (e) { + case TariffKindEnum::DefaultTariff: + return "DefaultTariff"; + case TariffKindEnum::DriverTariff: + return "DriverTariff"; + } + + throw EnumToStringException{e, "TariffKindEnum"}; +} + +TariffKindEnum string_to_tariff_kind_enum(const std::string& s) { + if (s == "DefaultTariff") { + return TariffKindEnum::DefaultTariff; + } + if (s == "DriverTariff") { + return TariffKindEnum::DriverTariff; + } + + throw StringToEnumException{s, "TariffKindEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const TariffKindEnum& tariff_kind_enum) { + os << conversions::tariff_kind_enum_to_string(tariff_kind_enum); + return os; +} + // from: GetVariablesRequest namespace conversions { std::string attribute_enum_to_string(AttributeEnum e) { @@ -1600,10 +2190,12 @@ std::string install_certificate_use_enum_to_string(InstallCertificateUseEnum e) return "V2GRootCertificate"; case InstallCertificateUseEnum::MORootCertificate: return "MORootCertificate"; - case InstallCertificateUseEnum::CSMSRootCertificate: - return "CSMSRootCertificate"; case InstallCertificateUseEnum::ManufacturerRootCertificate: return "ManufacturerRootCertificate"; + case InstallCertificateUseEnum::CSMSRootCertificate: + return "CSMSRootCertificate"; + case InstallCertificateUseEnum::OEMRootCertificate: + return "OEMRootCertificate"; } throw EnumToStringException{e, "InstallCertificateUseEnum"}; @@ -1616,11 +2208,14 @@ InstallCertificateUseEnum string_to_install_certificate_use_enum(const std::stri if (s == "MORootCertificate") { return InstallCertificateUseEnum::MORootCertificate; } + if (s == "ManufacturerRootCertificate") { + return InstallCertificateUseEnum::ManufacturerRootCertificate; + } if (s == "CSMSRootCertificate") { return InstallCertificateUseEnum::CSMSRootCertificate; } - if (s == "ManufacturerRootCertificate") { - return InstallCertificateUseEnum::ManufacturerRootCertificate; + if (s == "OEMRootCertificate") { + return InstallCertificateUseEnum::OEMRootCertificate; } throw StringToEnumException{s, "InstallCertificateUseEnum"}; @@ -1727,110 +2322,108 @@ std::ostream& operator<<(std::ostream& os, const UploadLogStatusEnum& upload_log return os; } -// from: MeterValuesRequest -namespace conversions { -std::string reading_context_enum_to_string(ReadingContextEnum e) { - switch (e) { - case ReadingContextEnum::Interruption_Begin: - return "Interruption.Begin"; - case ReadingContextEnum::Interruption_End: - return "Interruption.End"; - case ReadingContextEnum::Other: - return "Other"; - case ReadingContextEnum::Sample_Clock: - return "Sample.Clock"; - case ReadingContextEnum::Sample_Periodic: - return "Sample.Periodic"; - case ReadingContextEnum::Transaction_Begin: - return "Transaction.Begin"; - case ReadingContextEnum::Transaction_End: - return "Transaction.End"; - case ReadingContextEnum::Trigger: - return "Trigger"; - } - - throw EnumToStringException{e, "ReadingContextEnum"}; -} - -ReadingContextEnum string_to_reading_context_enum(const std::string& s) { - if (s == "Interruption.Begin") { - return ReadingContextEnum::Interruption_Begin; - } - if (s == "Interruption.End") { - return ReadingContextEnum::Interruption_End; - } - if (s == "Other") { - return ReadingContextEnum::Other; - } - if (s == "Sample.Clock") { - return ReadingContextEnum::Sample_Clock; - } - if (s == "Sample.Periodic") { - return ReadingContextEnum::Sample_Periodic; - } - if (s == "Transaction.Begin") { - return ReadingContextEnum::Transaction_Begin; - } - if (s == "Transaction.End") { - return ReadingContextEnum::Transaction_End; - } - if (s == "Trigger") { - return ReadingContextEnum::Trigger; - } - - throw StringToEnumException{s, "ReadingContextEnum"}; -} -} // namespace conversions - -std::ostream& operator<<(std::ostream& os, const ReadingContextEnum& reading_context_enum) { - os << conversions::reading_context_enum_to_string(reading_context_enum); - return os; -} - // from: MeterValuesRequest namespace conversions { std::string measurand_enum_to_string(MeasurandEnum e) { switch (e) { case MeasurandEnum::Current_Export: return "Current.Export"; + case MeasurandEnum::Current_Export_Offered: + return "Current.Export.Offered"; + case MeasurandEnum::Current_Export_Minimum: + return "Current.Export.Minimum"; case MeasurandEnum::Current_Import: return "Current.Import"; + case MeasurandEnum::Current_Import_Offered: + return "Current.Import.Offered"; + case MeasurandEnum::Current_Import_Minimum: + return "Current.Import.Minimum"; case MeasurandEnum::Current_Offered: return "Current.Offered"; - case MeasurandEnum::Energy_Active_Export_Register: - return "Energy.Active.Export.Register"; - case MeasurandEnum::Energy_Active_Import_Register: - return "Energy.Active.Import.Register"; - case MeasurandEnum::Energy_Reactive_Export_Register: - return "Energy.Reactive.Export.Register"; - case MeasurandEnum::Energy_Reactive_Import_Register: - return "Energy.Reactive.Import.Register"; + case MeasurandEnum::Display_PresentSOC: + return "Display.PresentSOC"; + case MeasurandEnum::Display_MinimumSOC: + return "Display.MinimumSOC"; + case MeasurandEnum::Display_TargetSOC: + return "Display.TargetSOC"; + case MeasurandEnum::Display_MaximumSOC: + return "Display.MaximumSOC"; + case MeasurandEnum::Display_RemainingTimeToMinimumSOC: + return "Display.RemainingTimeToMinimumSOC"; + case MeasurandEnum::Display_RemainingTimeToTargetSOC: + return "Display.RemainingTimeToTargetSOC"; + case MeasurandEnum::Display_RemainingTimeToMaximumSOC: + return "Display.RemainingTimeToMaximumSOC"; + case MeasurandEnum::Display_ChargingComplete: + return "Display.ChargingComplete"; + case MeasurandEnum::Display_BatteryEnergyCapacity: + return "Display.BatteryEnergyCapacity"; + case MeasurandEnum::Display_InletHot: + return "Display.InletHot"; case MeasurandEnum::Energy_Active_Export_Interval: return "Energy.Active.Export.Interval"; + case MeasurandEnum::Energy_Active_Export_Register: + return "Energy.Active.Export.Register"; case MeasurandEnum::Energy_Active_Import_Interval: return "Energy.Active.Import.Interval"; + case MeasurandEnum::Energy_Active_Import_Register: + return "Energy.Active.Import.Register"; + case MeasurandEnum::Energy_Active_Import_CableLoss: + return "Energy.Active.Import.CableLoss"; + case MeasurandEnum::Energy_Active_Import_LocalGeneration_Register: + return "Energy.Active.Import.LocalGeneration.Register"; case MeasurandEnum::Energy_Active_Net: return "Energy.Active.Net"; + case MeasurandEnum::Energy_Active_Setpoint_Interval: + return "Energy.Active.Setpoint.Interval"; + case MeasurandEnum::Energy_Apparent_Export: + return "Energy.Apparent.Export"; + case MeasurandEnum::Energy_Apparent_Import: + return "Energy.Apparent.Import"; + case MeasurandEnum::Energy_Apparent_Net: + return "Energy.Apparent.Net"; case MeasurandEnum::Energy_Reactive_Export_Interval: return "Energy.Reactive.Export.Interval"; + case MeasurandEnum::Energy_Reactive_Export_Register: + return "Energy.Reactive.Export.Register"; case MeasurandEnum::Energy_Reactive_Import_Interval: return "Energy.Reactive.Import.Interval"; + case MeasurandEnum::Energy_Reactive_Import_Register: + return "Energy.Reactive.Import.Register"; case MeasurandEnum::Energy_Reactive_Net: return "Energy.Reactive.Net"; - case MeasurandEnum::Energy_Apparent_Net: - return "Energy.Apparent.Net"; - case MeasurandEnum::Energy_Apparent_Import: - return "Energy.Apparent.Import"; - case MeasurandEnum::Energy_Apparent_Export: - return "Energy.Apparent.Export"; + case MeasurandEnum::EnergyRequest_Target: + return "EnergyRequest.Target"; + case MeasurandEnum::EnergyRequest_Minimum: + return "EnergyRequest.Minimum"; + case MeasurandEnum::EnergyRequest_Maximum: + return "EnergyRequest.Maximum"; + case MeasurandEnum::EnergyRequest_Minimum_V2X: + return "EnergyRequest.Minimum.V2X"; + case MeasurandEnum::EnergyRequest_Maximum_V2X: + return "EnergyRequest.Maximum.V2X"; + case MeasurandEnum::EnergyRequest_Bulk: + return "EnergyRequest.Bulk"; case MeasurandEnum::Frequency: return "Frequency"; case MeasurandEnum::Power_Active_Export: return "Power.Active.Export"; case MeasurandEnum::Power_Active_Import: return "Power.Active.Import"; + case MeasurandEnum::Power_Active_Setpoint: + return "Power.Active.Setpoint"; + case MeasurandEnum::Power_Active_Residual: + return "Power.Active.Residual"; + case MeasurandEnum::Power_Export_Minimum: + return "Power.Export.Minimum"; + case MeasurandEnum::Power_Export_Offered: + return "Power.Export.Offered"; case MeasurandEnum::Power_Factor: return "Power.Factor"; + case MeasurandEnum::Power_Import_Offered: + return "Power.Import.Offered"; + case MeasurandEnum::Power_Import_Minimum: + return "Power.Import.Minimum"; case MeasurandEnum::Power_Offered: return "Power.Offered"; case MeasurandEnum::Power_Reactive_Export: @@ -1841,6 +2434,10 @@ std::string measurand_enum_to_string(MeasurandEnum e) { return "SoC"; case MeasurandEnum::Voltage: return "Voltage"; + case MeasurandEnum::Voltage_Minimum: + return "Voltage.Minimum"; + case MeasurandEnum::Voltage_Maximum: + return "Voltage.Maximum"; } throw EnumToStringException{e, "MeasurandEnum"}; @@ -1850,50 +2447,119 @@ MeasurandEnum string_to_measurand_enum(const std::string& s) { if (s == "Current.Export") { return MeasurandEnum::Current_Export; } + if (s == "Current.Export.Offered") { + return MeasurandEnum::Current_Export_Offered; + } + if (s == "Current.Export.Minimum") { + return MeasurandEnum::Current_Export_Minimum; + } if (s == "Current.Import") { return MeasurandEnum::Current_Import; } + if (s == "Current.Import.Offered") { + return MeasurandEnum::Current_Import_Offered; + } + if (s == "Current.Import.Minimum") { + return MeasurandEnum::Current_Import_Minimum; + } if (s == "Current.Offered") { return MeasurandEnum::Current_Offered; } - if (s == "Energy.Active.Export.Register") { - return MeasurandEnum::Energy_Active_Export_Register; + if (s == "Display.PresentSOC") { + return MeasurandEnum::Display_PresentSOC; } - if (s == "Energy.Active.Import.Register") { - return MeasurandEnum::Energy_Active_Import_Register; + if (s == "Display.MinimumSOC") { + return MeasurandEnum::Display_MinimumSOC; } - if (s == "Energy.Reactive.Export.Register") { - return MeasurandEnum::Energy_Reactive_Export_Register; + if (s == "Display.TargetSOC") { + return MeasurandEnum::Display_TargetSOC; } - if (s == "Energy.Reactive.Import.Register") { - return MeasurandEnum::Energy_Reactive_Import_Register; + if (s == "Display.MaximumSOC") { + return MeasurandEnum::Display_MaximumSOC; + } + if (s == "Display.RemainingTimeToMinimumSOC") { + return MeasurandEnum::Display_RemainingTimeToMinimumSOC; + } + if (s == "Display.RemainingTimeToTargetSOC") { + return MeasurandEnum::Display_RemainingTimeToTargetSOC; + } + if (s == "Display.RemainingTimeToMaximumSOC") { + return MeasurandEnum::Display_RemainingTimeToMaximumSOC; + } + if (s == "Display.ChargingComplete") { + return MeasurandEnum::Display_ChargingComplete; + } + if (s == "Display.BatteryEnergyCapacity") { + return MeasurandEnum::Display_BatteryEnergyCapacity; + } + if (s == "Display.InletHot") { + return MeasurandEnum::Display_InletHot; } if (s == "Energy.Active.Export.Interval") { return MeasurandEnum::Energy_Active_Export_Interval; } + if (s == "Energy.Active.Export.Register") { + return MeasurandEnum::Energy_Active_Export_Register; + } if (s == "Energy.Active.Import.Interval") { return MeasurandEnum::Energy_Active_Import_Interval; } + if (s == "Energy.Active.Import.Register") { + return MeasurandEnum::Energy_Active_Import_Register; + } + if (s == "Energy.Active.Import.CableLoss") { + return MeasurandEnum::Energy_Active_Import_CableLoss; + } + if (s == "Energy.Active.Import.LocalGeneration.Register") { + return MeasurandEnum::Energy_Active_Import_LocalGeneration_Register; + } if (s == "Energy.Active.Net") { return MeasurandEnum::Energy_Active_Net; } + if (s == "Energy.Active.Setpoint.Interval") { + return MeasurandEnum::Energy_Active_Setpoint_Interval; + } + if (s == "Energy.Apparent.Export") { + return MeasurandEnum::Energy_Apparent_Export; + } + if (s == "Energy.Apparent.Import") { + return MeasurandEnum::Energy_Apparent_Import; + } + if (s == "Energy.Apparent.Net") { + return MeasurandEnum::Energy_Apparent_Net; + } if (s == "Energy.Reactive.Export.Interval") { return MeasurandEnum::Energy_Reactive_Export_Interval; } + if (s == "Energy.Reactive.Export.Register") { + return MeasurandEnum::Energy_Reactive_Export_Register; + } if (s == "Energy.Reactive.Import.Interval") { return MeasurandEnum::Energy_Reactive_Import_Interval; } + if (s == "Energy.Reactive.Import.Register") { + return MeasurandEnum::Energy_Reactive_Import_Register; + } if (s == "Energy.Reactive.Net") { return MeasurandEnum::Energy_Reactive_Net; } - if (s == "Energy.Apparent.Net") { - return MeasurandEnum::Energy_Apparent_Net; + if (s == "EnergyRequest.Target") { + return MeasurandEnum::EnergyRequest_Target; } - if (s == "Energy.Apparent.Import") { - return MeasurandEnum::Energy_Apparent_Import; + if (s == "EnergyRequest.Minimum") { + return MeasurandEnum::EnergyRequest_Minimum; } - if (s == "Energy.Apparent.Export") { - return MeasurandEnum::Energy_Apparent_Export; + if (s == "EnergyRequest.Maximum") { + return MeasurandEnum::EnergyRequest_Maximum; + } + if (s == "EnergyRequest.Minimum.V2X") { + return MeasurandEnum::EnergyRequest_Minimum_V2X; + } + if (s == "EnergyRequest.Maximum.V2X") { + return MeasurandEnum::EnergyRequest_Maximum_V2X; + } + if (s == "EnergyRequest.Bulk") { + return MeasurandEnum::EnergyRequest_Bulk; } if (s == "Frequency") { return MeasurandEnum::Frequency; @@ -1904,9 +2570,27 @@ MeasurandEnum string_to_measurand_enum(const std::string& s) { if (s == "Power.Active.Import") { return MeasurandEnum::Power_Active_Import; } + if (s == "Power.Active.Setpoint") { + return MeasurandEnum::Power_Active_Setpoint; + } + if (s == "Power.Active.Residual") { + return MeasurandEnum::Power_Active_Residual; + } + if (s == "Power.Export.Minimum") { + return MeasurandEnum::Power_Export_Minimum; + } + if (s == "Power.Export.Offered") { + return MeasurandEnum::Power_Export_Offered; + } if (s == "Power.Factor") { return MeasurandEnum::Power_Factor; } + if (s == "Power.Import.Offered") { + return MeasurandEnum::Power_Import_Offered; + } + if (s == "Power.Import.Minimum") { + return MeasurandEnum::Power_Import_Minimum; + } if (s == "Power.Offered") { return MeasurandEnum::Power_Offered; } @@ -1922,13 +2606,79 @@ MeasurandEnum string_to_measurand_enum(const std::string& s) { if (s == "Voltage") { return MeasurandEnum::Voltage; } + if (s == "Voltage.Minimum") { + return MeasurandEnum::Voltage_Minimum; + } + if (s == "Voltage.Maximum") { + return MeasurandEnum::Voltage_Maximum; + } throw StringToEnumException{s, "MeasurandEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const MeasurandEnum& measurand_enum) { - os << conversions::measurand_enum_to_string(measurand_enum); +std::ostream& operator<<(std::ostream& os, const MeasurandEnum& measurand_enum) { + os << conversions::measurand_enum_to_string(measurand_enum); + return os; +} + +// from: MeterValuesRequest +namespace conversions { +std::string reading_context_enum_to_string(ReadingContextEnum e) { + switch (e) { + case ReadingContextEnum::Interruption_Begin: + return "Interruption.Begin"; + case ReadingContextEnum::Interruption_End: + return "Interruption.End"; + case ReadingContextEnum::Other: + return "Other"; + case ReadingContextEnum::Sample_Clock: + return "Sample.Clock"; + case ReadingContextEnum::Sample_Periodic: + return "Sample.Periodic"; + case ReadingContextEnum::Transaction_Begin: + return "Transaction.Begin"; + case ReadingContextEnum::Transaction_End: + return "Transaction.End"; + case ReadingContextEnum::Trigger: + return "Trigger"; + } + + throw EnumToStringException{e, "ReadingContextEnum"}; +} + +ReadingContextEnum string_to_reading_context_enum(const std::string& s) { + if (s == "Interruption.Begin") { + return ReadingContextEnum::Interruption_Begin; + } + if (s == "Interruption.End") { + return ReadingContextEnum::Interruption_End; + } + if (s == "Other") { + return ReadingContextEnum::Other; + } + if (s == "Sample.Clock") { + return ReadingContextEnum::Sample_Clock; + } + if (s == "Sample.Periodic") { + return ReadingContextEnum::Sample_Periodic; + } + if (s == "Transaction.Begin") { + return ReadingContextEnum::Transaction_Begin; + } + if (s == "Transaction.End") { + return ReadingContextEnum::Transaction_End; + } + if (s == "Trigger") { + return ReadingContextEnum::Trigger; + } + + throw StringToEnumException{s, "ReadingContextEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const ReadingContextEnum& reading_context_enum) { + os << conversions::reading_context_enum_to_string(reading_context_enum); return os; } @@ -2016,6 +2766,8 @@ std::string location_enum_to_string(LocationEnum e) { return "Inlet"; case LocationEnum::Outlet: return "Outlet"; + case LocationEnum::Upstream: + return "Upstream"; } throw EnumToStringException{e, "LocationEnum"}; @@ -2037,6 +2789,9 @@ LocationEnum string_to_location_enum(const std::string& s) { if (s == "Outlet") { return LocationEnum::Outlet; } + if (s == "Upstream") { + return LocationEnum::Upstream; + } throw StringToEnumException{s, "LocationEnum"}; } @@ -2047,6 +2802,37 @@ std::ostream& operator<<(std::ostream& os, const LocationEnum& location_enum) { return os; } +// from: NotifyAllowedEnergyTransferResponse +namespace conversions { +std::string notify_allowed_energy_transfer_status_enum_to_string(NotifyAllowedEnergyTransferStatusEnum e) { + switch (e) { + case NotifyAllowedEnergyTransferStatusEnum::Accepted: + return "Accepted"; + case NotifyAllowedEnergyTransferStatusEnum::Rejected: + return "Rejected"; + } + + throw EnumToStringException{e, "NotifyAllowedEnergyTransferStatusEnum"}; +} + +NotifyAllowedEnergyTransferStatusEnum string_to_notify_allowed_energy_transfer_status_enum(const std::string& s) { + if (s == "Accepted") { + return NotifyAllowedEnergyTransferStatusEnum::Accepted; + } + if (s == "Rejected") { + return NotifyAllowedEnergyTransferStatusEnum::Rejected; + } + + throw StringToEnumException{s, "NotifyAllowedEnergyTransferStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, + const NotifyAllowedEnergyTransferStatusEnum& notify_allowed_energy_transfer_status_enum) { + os << conversions::notify_allowed_energy_transfer_status_enum_to_string(notify_allowed_energy_transfer_status_enum); + return os; +} + // from: NotifyChargingLimitRequest namespace conversions { std::string cost_kind_enum_to_string(CostKindEnum e) { @@ -2082,43 +2868,233 @@ std::ostream& operator<<(std::ostream& os, const CostKindEnum& cost_kind_enum) { return os; } +// from: NotifyDERAlarmRequest +namespace conversions { +std::string grid_event_fault_enum_to_string(GridEventFaultEnum e) { + switch (e) { + case GridEventFaultEnum::CurrentImbalance: + return "CurrentImbalance"; + case GridEventFaultEnum::LocalEmergency: + return "LocalEmergency"; + case GridEventFaultEnum::LowInputPower: + return "LowInputPower"; + case GridEventFaultEnum::OverCurrent: + return "OverCurrent"; + case GridEventFaultEnum::OverFrequency: + return "OverFrequency"; + case GridEventFaultEnum::OverVoltage: + return "OverVoltage"; + case GridEventFaultEnum::PhaseRotation: + return "PhaseRotation"; + case GridEventFaultEnum::RemoteEmergency: + return "RemoteEmergency"; + case GridEventFaultEnum::UnderFrequency: + return "UnderFrequency"; + case GridEventFaultEnum::UnderVoltage: + return "UnderVoltage"; + case GridEventFaultEnum::VoltageImbalance: + return "VoltageImbalance"; + } + + throw EnumToStringException{e, "GridEventFaultEnum"}; +} + +GridEventFaultEnum string_to_grid_event_fault_enum(const std::string& s) { + if (s == "CurrentImbalance") { + return GridEventFaultEnum::CurrentImbalance; + } + if (s == "LocalEmergency") { + return GridEventFaultEnum::LocalEmergency; + } + if (s == "LowInputPower") { + return GridEventFaultEnum::LowInputPower; + } + if (s == "OverCurrent") { + return GridEventFaultEnum::OverCurrent; + } + if (s == "OverFrequency") { + return GridEventFaultEnum::OverFrequency; + } + if (s == "OverVoltage") { + return GridEventFaultEnum::OverVoltage; + } + if (s == "PhaseRotation") { + return GridEventFaultEnum::PhaseRotation; + } + if (s == "RemoteEmergency") { + return GridEventFaultEnum::RemoteEmergency; + } + if (s == "UnderFrequency") { + return GridEventFaultEnum::UnderFrequency; + } + if (s == "UnderVoltage") { + return GridEventFaultEnum::UnderVoltage; + } + if (s == "VoltageImbalance") { + return GridEventFaultEnum::VoltageImbalance; + } + + throw StringToEnumException{s, "GridEventFaultEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const GridEventFaultEnum& grid_event_fault_enum) { + os << conversions::grid_event_fault_enum_to_string(grid_event_fault_enum); + return os; +} + // from: NotifyEVChargingNeedsRequest namespace conversions { -std::string energy_transfer_mode_enum_to_string(EnergyTransferModeEnum e) { +std::string islanding_detection_enum_to_string(IslandingDetectionEnum e) { switch (e) { - case EnergyTransferModeEnum::DC: - return "DC"; - case EnergyTransferModeEnum::AC_single_phase: - return "AC_single_phase"; - case EnergyTransferModeEnum::AC_two_phase: - return "AC_two_phase"; - case EnergyTransferModeEnum::AC_three_phase: - return "AC_three_phase"; + case IslandingDetectionEnum::NoAntiIslandingSupport: + return "NoAntiIslandingSupport"; + case IslandingDetectionEnum::RoCoF: + return "RoCoF"; + case IslandingDetectionEnum::UVP_OVP: + return "UVP_OVP"; + case IslandingDetectionEnum::UFP_OFP: + return "UFP_OFP"; + case IslandingDetectionEnum::VoltageVectorShift: + return "VoltageVectorShift"; + case IslandingDetectionEnum::ZeroCrossingDetection: + return "ZeroCrossingDetection"; + case IslandingDetectionEnum::OtherPassive: + return "OtherPassive"; + case IslandingDetectionEnum::ImpedanceMeasurement: + return "ImpedanceMeasurement"; + case IslandingDetectionEnum::ImpedanceAtFrequency: + return "ImpedanceAtFrequency"; + case IslandingDetectionEnum::SlipModeFrequencyShift: + return "SlipModeFrequencyShift"; + case IslandingDetectionEnum::SandiaFrequencyShift: + return "SandiaFrequencyShift"; + case IslandingDetectionEnum::SandiaVoltageShift: + return "SandiaVoltageShift"; + case IslandingDetectionEnum::FrequencyJump: + return "FrequencyJump"; + case IslandingDetectionEnum::RCLQFactor: + return "RCLQFactor"; + case IslandingDetectionEnum::OtherActive: + return "OtherActive"; } - throw EnumToStringException{e, "EnergyTransferModeEnum"}; + throw EnumToStringException{e, "IslandingDetectionEnum"}; } -EnergyTransferModeEnum string_to_energy_transfer_mode_enum(const std::string& s) { - if (s == "DC") { - return EnergyTransferModeEnum::DC; +IslandingDetectionEnum string_to_islanding_detection_enum(const std::string& s) { + if (s == "NoAntiIslandingSupport") { + return IslandingDetectionEnum::NoAntiIslandingSupport; } - if (s == "AC_single_phase") { - return EnergyTransferModeEnum::AC_single_phase; + if (s == "RoCoF") { + return IslandingDetectionEnum::RoCoF; } - if (s == "AC_two_phase") { - return EnergyTransferModeEnum::AC_two_phase; + if (s == "UVP_OVP") { + return IslandingDetectionEnum::UVP_OVP; } - if (s == "AC_three_phase") { - return EnergyTransferModeEnum::AC_three_phase; + if (s == "UFP_OFP") { + return IslandingDetectionEnum::UFP_OFP; + } + if (s == "VoltageVectorShift") { + return IslandingDetectionEnum::VoltageVectorShift; + } + if (s == "ZeroCrossingDetection") { + return IslandingDetectionEnum::ZeroCrossingDetection; + } + if (s == "OtherPassive") { + return IslandingDetectionEnum::OtherPassive; + } + if (s == "ImpedanceMeasurement") { + return IslandingDetectionEnum::ImpedanceMeasurement; + } + if (s == "ImpedanceAtFrequency") { + return IslandingDetectionEnum::ImpedanceAtFrequency; + } + if (s == "SlipModeFrequencyShift") { + return IslandingDetectionEnum::SlipModeFrequencyShift; + } + if (s == "SandiaFrequencyShift") { + return IslandingDetectionEnum::SandiaFrequencyShift; + } + if (s == "SandiaVoltageShift") { + return IslandingDetectionEnum::SandiaVoltageShift; + } + if (s == "FrequencyJump") { + return IslandingDetectionEnum::FrequencyJump; + } + if (s == "RCLQFactor") { + return IslandingDetectionEnum::RCLQFactor; + } + if (s == "OtherActive") { + return IslandingDetectionEnum::OtherActive; } - throw StringToEnumException{s, "EnergyTransferModeEnum"}; + throw StringToEnumException{s, "IslandingDetectionEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const EnergyTransferModeEnum& energy_transfer_mode_enum) { - os << conversions::energy_transfer_mode_enum_to_string(energy_transfer_mode_enum); +std::ostream& operator<<(std::ostream& os, const IslandingDetectionEnum& islanding_detection_enum) { + os << conversions::islanding_detection_enum_to_string(islanding_detection_enum); + return os; +} + +// from: NotifyEVChargingNeedsRequest +namespace conversions { +std::string control_mode_enum_to_string(ControlModeEnum e) { + switch (e) { + case ControlModeEnum::ScheduledControl: + return "ScheduledControl"; + case ControlModeEnum::DynamicControl: + return "DynamicControl"; + } + + throw EnumToStringException{e, "ControlModeEnum"}; +} + +ControlModeEnum string_to_control_mode_enum(const std::string& s) { + if (s == "ScheduledControl") { + return ControlModeEnum::ScheduledControl; + } + if (s == "DynamicControl") { + return ControlModeEnum::DynamicControl; + } + + throw StringToEnumException{s, "ControlModeEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const ControlModeEnum& control_mode_enum) { + os << conversions::control_mode_enum_to_string(control_mode_enum); + return os; +} + +// from: NotifyEVChargingNeedsRequest +namespace conversions { +std::string mobility_needs_mode_enum_to_string(MobilityNeedsModeEnum e) { + switch (e) { + case MobilityNeedsModeEnum::EVCC: + return "EVCC"; + case MobilityNeedsModeEnum::EVCC_SECC: + return "EVCC_SECC"; + } + + throw EnumToStringException{e, "MobilityNeedsModeEnum"}; +} + +MobilityNeedsModeEnum string_to_mobility_needs_mode_enum(const std::string& s) { + if (s == "EVCC") { + return MobilityNeedsModeEnum::EVCC; + } + if (s == "EVCC_SECC") { + return MobilityNeedsModeEnum::EVCC_SECC; + } + + throw StringToEnumException{s, "MobilityNeedsModeEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const MobilityNeedsModeEnum& mobility_needs_mode_enum) { + os << conversions::mobility_needs_mode_enum_to_string(mobility_needs_mode_enum); return os; } @@ -2132,6 +3108,8 @@ std::string notify_evcharging_needs_status_enum_to_string(NotifyEVChargingNeedsS return "Rejected"; case NotifyEVChargingNeedsStatusEnum::Processing: return "Processing"; + case NotifyEVChargingNeedsStatusEnum::NoChargingProfile: + return "NoChargingProfile"; } throw EnumToStringException{e, "NotifyEVChargingNeedsStatusEnum"}; @@ -2147,6 +3125,9 @@ NotifyEVChargingNeedsStatusEnum string_to_notify_evcharging_needs_status_enum(co if (s == "Processing") { return NotifyEVChargingNeedsStatusEnum::Processing; } + if (s == "NoChargingProfile") { + return NotifyEVChargingNeedsStatusEnum::NoChargingProfile; + } throw StringToEnumException{s, "NotifyEVChargingNeedsStatusEnum"}; } @@ -2246,6 +3227,10 @@ std::string monitor_enum_to_string(MonitorEnum e) { return "Periodic"; case MonitorEnum::PeriodicClockAligned: return "PeriodicClockAligned"; + case MonitorEnum::TargetDelta: + return "TargetDelta"; + case MonitorEnum::TargetDeltaRelative: + return "TargetDeltaRelative"; } throw EnumToStringException{e, "MonitorEnum"}; @@ -2267,6 +3252,12 @@ MonitorEnum string_to_monitor_enum(const std::string& s) { if (s == "PeriodicClockAligned") { return MonitorEnum::PeriodicClockAligned; } + if (s == "TargetDelta") { + return MonitorEnum::TargetDelta; + } + if (s == "TargetDeltaRelative") { + return MonitorEnum::TargetDeltaRelative; + } throw StringToEnumException{s, "MonitorEnum"}; } @@ -2372,6 +3363,46 @@ std::ostream& operator<<(std::ostream& os, const DataEnum& data_enum) { return os; } +// from: NotifySettlementRequest +namespace conversions { +std::string payment_status_enum_to_string(PaymentStatusEnum e) { + switch (e) { + case PaymentStatusEnum::Settled: + return "Settled"; + case PaymentStatusEnum::Canceled: + return "Canceled"; + case PaymentStatusEnum::Rejected: + return "Rejected"; + case PaymentStatusEnum::Failed: + return "Failed"; + } + + throw EnumToStringException{e, "PaymentStatusEnum"}; +} + +PaymentStatusEnum string_to_payment_status_enum(const std::string& s) { + if (s == "Settled") { + return PaymentStatusEnum::Settled; + } + if (s == "Canceled") { + return PaymentStatusEnum::Canceled; + } + if (s == "Rejected") { + return PaymentStatusEnum::Rejected; + } + if (s == "Failed") { + return PaymentStatusEnum::Failed; + } + + throw StringToEnumException{s, "PaymentStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const PaymentStatusEnum& payment_status_enum) { + os << conversions::payment_status_enum_to_string(payment_status_enum); + return os; +} + // from: PublishFirmwareStatusNotificationRequest namespace conversions { std::string publish_firmware_status_enum_to_string(PublishFirmwareStatusEnum e) { @@ -2442,6 +3473,36 @@ std::ostream& operator<<(std::ostream& os, const PublishFirmwareStatusEnum& publ return os; } +// from: PullDynamicScheduleUpdateResponse +namespace conversions { +std::string charging_profile_status_enum_to_string(ChargingProfileStatusEnum e) { + switch (e) { + case ChargingProfileStatusEnum::Accepted: + return "Accepted"; + case ChargingProfileStatusEnum::Rejected: + return "Rejected"; + } + + throw EnumToStringException{e, "ChargingProfileStatusEnum"}; +} + +ChargingProfileStatusEnum string_to_charging_profile_status_enum(const std::string& s) { + if (s == "Accepted") { + return ChargingProfileStatusEnum::Accepted; + } + if (s == "Rejected") { + return ChargingProfileStatusEnum::Rejected; + } + + throw StringToEnumException{s, "ChargingProfileStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const ChargingProfileStatusEnum& charging_profile_status_enum) { + os << conversions::charging_profile_status_enum_to_string(charging_profile_status_enum); + return os; +} + // from: ReportChargingProfilesRequest namespace conversions { std::string charging_profile_kind_enum_to_string(ChargingProfileKindEnum e) { @@ -2452,6 +3513,8 @@ std::string charging_profile_kind_enum_to_string(ChargingProfileKindEnum e) { return "Recurring"; case ChargingProfileKindEnum::Relative: return "Relative"; + case ChargingProfileKindEnum::Dynamic: + return "Dynamic"; } throw EnumToStringException{e, "ChargingProfileKindEnum"}; @@ -2467,6 +3530,9 @@ ChargingProfileKindEnum string_to_charging_profile_kind_enum(const std::string& if (s == "Relative") { return ChargingProfileKindEnum::Relative; } + if (s == "Dynamic") { + return ChargingProfileKindEnum::Dynamic; + } throw StringToEnumException{s, "ChargingProfileKindEnum"}; } @@ -2507,6 +3573,86 @@ std::ostream& operator<<(std::ostream& os, const RecurrencyKindEnum& recurrency_ return os; } +// from: ReportDERControlRequest +namespace conversions { +std::string power_during_cessation_enum_to_string(PowerDuringCessationEnum e) { + switch (e) { + case PowerDuringCessationEnum::Active: + return "Active"; + case PowerDuringCessationEnum::Reactive: + return "Reactive"; + } + + throw EnumToStringException{e, "PowerDuringCessationEnum"}; +} + +PowerDuringCessationEnum string_to_power_during_cessation_enum(const std::string& s) { + if (s == "Active") { + return PowerDuringCessationEnum::Active; + } + if (s == "Reactive") { + return PowerDuringCessationEnum::Reactive; + } + + throw StringToEnumException{s, "PowerDuringCessationEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const PowerDuringCessationEnum& power_during_cessation_enum) { + os << conversions::power_during_cessation_enum_to_string(power_during_cessation_enum); + return os; +} + +// from: ReportDERControlRequest +namespace conversions { +std::string derunit_enum_to_string(DERUnitEnum e) { + switch (e) { + case DERUnitEnum::Not_Applicable: + return "Not_Applicable"; + case DERUnitEnum::PctMaxW: + return "PctMaxW"; + case DERUnitEnum::PctMaxVar: + return "PctMaxVar"; + case DERUnitEnum::PctWAvail: + return "PctWAvail"; + case DERUnitEnum::PctVarAvail: + return "PctVarAvail"; + case DERUnitEnum::PctEffectiveV: + return "PctEffectiveV"; + } + + throw EnumToStringException{e, "DERUnitEnum"}; +} + +DERUnitEnum string_to_derunit_enum(const std::string& s) { + if (s == "Not_Applicable") { + return DERUnitEnum::Not_Applicable; + } + if (s == "PctMaxW") { + return DERUnitEnum::PctMaxW; + } + if (s == "PctMaxVar") { + return DERUnitEnum::PctMaxVar; + } + if (s == "PctWAvail") { + return DERUnitEnum::PctWAvail; + } + if (s == "PctVarAvail") { + return DERUnitEnum::PctVarAvail; + } + if (s == "PctEffectiveV") { + return DERUnitEnum::PctEffectiveV; + } + + throw StringToEnumException{s, "DERUnitEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const DERUnitEnum& derunit_enum) { + os << conversions::derunit_enum_to_string(derunit_enum); + return os; +} + // from: RequestStartTransactionResponse namespace conversions { std::string request_start_stop_status_enum_to_string(RequestStartStopStatusEnum e) { @@ -2545,6 +3691,8 @@ std::string reservation_update_status_enum_to_string(ReservationUpdateStatusEnum return "Expired"; case ReservationUpdateStatusEnum::Removed: return "Removed"; + case ReservationUpdateStatusEnum::NoTransaction: + return "NoTransaction"; } throw EnumToStringException{e, "ReservationUpdateStatusEnum"}; @@ -2557,6 +3705,9 @@ ReservationUpdateStatusEnum string_to_reservation_update_status_enum(const std:: if (s == "Removed") { return ReservationUpdateStatusEnum::Removed; } + if (s == "NoTransaction") { + return ReservationUpdateStatusEnum::NoTransaction; + } throw StringToEnumException{s, "ReservationUpdateStatusEnum"}; } @@ -2567,136 +3718,6 @@ std::ostream& operator<<(std::ostream& os, const ReservationUpdateStatusEnum& re return os; } -// from: ReserveNowRequest -namespace conversions { -std::string connector_enum_to_string(ConnectorEnum e) { - switch (e) { - case ConnectorEnum::cCCS1: - return "cCCS1"; - case ConnectorEnum::cCCS2: - return "cCCS2"; - case ConnectorEnum::cG105: - return "cG105"; - case ConnectorEnum::cTesla: - return "cTesla"; - case ConnectorEnum::cType1: - return "cType1"; - case ConnectorEnum::cType2: - return "cType2"; - case ConnectorEnum::s309_1P_16A: - return "s309-1P-16A"; - case ConnectorEnum::s309_1P_32A: - return "s309-1P-32A"; - case ConnectorEnum::s309_3P_16A: - return "s309-3P-16A"; - case ConnectorEnum::s309_3P_32A: - return "s309-3P-32A"; - case ConnectorEnum::sBS1361: - return "sBS1361"; - case ConnectorEnum::sCEE_7_7: - return "sCEE-7-7"; - case ConnectorEnum::sType2: - return "sType2"; - case ConnectorEnum::sType3: - return "sType3"; - case ConnectorEnum::Other1PhMax16A: - return "Other1PhMax16A"; - case ConnectorEnum::Other1PhOver16A: - return "Other1PhOver16A"; - case ConnectorEnum::Other3Ph: - return "Other3Ph"; - case ConnectorEnum::Pan: - return "Pan"; - case ConnectorEnum::wInductive: - return "wInductive"; - case ConnectorEnum::wResonant: - return "wResonant"; - case ConnectorEnum::Undetermined: - return "Undetermined"; - case ConnectorEnum::Unknown: - return "Unknown"; - } - - throw EnumToStringException{e, "ConnectorEnum"}; -} - -ConnectorEnum string_to_connector_enum(const std::string& s) { - if (s == "cCCS1") { - return ConnectorEnum::cCCS1; - } - if (s == "cCCS2") { - return ConnectorEnum::cCCS2; - } - if (s == "cG105") { - return ConnectorEnum::cG105; - } - if (s == "cTesla") { - return ConnectorEnum::cTesla; - } - if (s == "cType1") { - return ConnectorEnum::cType1; - } - if (s == "cType2") { - return ConnectorEnum::cType2; - } - if (s == "s309-1P-16A") { - return ConnectorEnum::s309_1P_16A; - } - if (s == "s309-1P-32A") { - return ConnectorEnum::s309_1P_32A; - } - if (s == "s309-3P-16A") { - return ConnectorEnum::s309_3P_16A; - } - if (s == "s309-3P-32A") { - return ConnectorEnum::s309_3P_32A; - } - if (s == "sBS1361") { - return ConnectorEnum::sBS1361; - } - if (s == "sCEE-7-7") { - return ConnectorEnum::sCEE_7_7; - } - if (s == "sType2") { - return ConnectorEnum::sType2; - } - if (s == "sType3") { - return ConnectorEnum::sType3; - } - if (s == "Other1PhMax16A") { - return ConnectorEnum::Other1PhMax16A; - } - if (s == "Other1PhOver16A") { - return ConnectorEnum::Other1PhOver16A; - } - if (s == "Other3Ph") { - return ConnectorEnum::Other3Ph; - } - if (s == "Pan") { - return ConnectorEnum::Pan; - } - if (s == "wInductive") { - return ConnectorEnum::wInductive; - } - if (s == "wResonant") { - return ConnectorEnum::wResonant; - } - if (s == "Undetermined") { - return ConnectorEnum::Undetermined; - } - if (s == "Unknown") { - return ConnectorEnum::Unknown; - } - - throw StringToEnumException{s, "ConnectorEnum"}; -} -} // namespace conversions - -std::ostream& operator<<(std::ostream& os, const ConnectorEnum& connector_enum) { - os << conversions::connector_enum_to_string(connector_enum); - return os; -} - // from: ReserveNowResponse namespace conversions { std::string reserve_now_status_enum_to_string(ReserveNowStatusEnum e) { @@ -2750,6 +3771,8 @@ std::string reset_enum_to_string(ResetEnum e) { return "Immediate"; case ResetEnum::OnIdle: return "OnIdle"; + case ResetEnum::ImmediateAndResume: + return "ImmediateAndResume"; } throw EnumToStringException{e, "ResetEnum"}; @@ -2762,6 +3785,9 @@ ResetEnum string_to_reset_enum(const std::string& s) { if (s == "OnIdle") { return ResetEnum::OnIdle; } + if (s == "ImmediateAndResume") { + return ResetEnum::ImmediateAndResume; + } throw StringToEnumException{s, "ResetEnum"}; } @@ -2872,33 +3898,48 @@ std::ostream& operator<<(std::ostream& os, const SendLocalListStatusEnum& send_l return os; } -// from: SetChargingProfileResponse +// from: SetDefaultTariffResponse namespace conversions { -std::string charging_profile_status_enum_to_string(ChargingProfileStatusEnum e) { +std::string tariff_set_status_enum_to_string(TariffSetStatusEnum e) { switch (e) { - case ChargingProfileStatusEnum::Accepted: + case TariffSetStatusEnum::Accepted: return "Accepted"; - case ChargingProfileStatusEnum::Rejected: + case TariffSetStatusEnum::Rejected: return "Rejected"; + case TariffSetStatusEnum::TooManyElements: + return "TooManyElements"; + case TariffSetStatusEnum::ConditionNotSupported: + return "ConditionNotSupported"; + case TariffSetStatusEnum::DuplicateTariffId: + return "DuplicateTariffId"; } - throw EnumToStringException{e, "ChargingProfileStatusEnum"}; + throw EnumToStringException{e, "TariffSetStatusEnum"}; } -ChargingProfileStatusEnum string_to_charging_profile_status_enum(const std::string& s) { +TariffSetStatusEnum string_to_tariff_set_status_enum(const std::string& s) { if (s == "Accepted") { - return ChargingProfileStatusEnum::Accepted; + return TariffSetStatusEnum::Accepted; } if (s == "Rejected") { - return ChargingProfileStatusEnum::Rejected; + return TariffSetStatusEnum::Rejected; + } + if (s == "TooManyElements") { + return TariffSetStatusEnum::TooManyElements; + } + if (s == "ConditionNotSupported") { + return TariffSetStatusEnum::ConditionNotSupported; + } + if (s == "DuplicateTariffId") { + return TariffSetStatusEnum::DuplicateTariffId; } - throw StringToEnumException{s, "ChargingProfileStatusEnum"}; + throw StringToEnumException{s, "TariffSetStatusEnum"}; } } // namespace conversions -std::ostream& operator<<(std::ostream& os, const ChargingProfileStatusEnum& charging_profile_status_enum) { - os << conversions::charging_profile_status_enum_to_string(charging_profile_status_enum); +std::ostream& operator<<(std::ostream& os, const TariffSetStatusEnum& tariff_set_status_enum) { + os << conversions::tariff_set_status_enum_to_string(tariff_set_status_enum); return os; } @@ -2918,6 +3959,8 @@ std::string display_message_status_enum_to_string(DisplayMessageStatusEnum e) { return "NotSupportedState"; case DisplayMessageStatusEnum::UnknownTransaction: return "UnknownTransaction"; + case DisplayMessageStatusEnum::LanguageNotSupported: + return "LanguageNotSupported"; } throw EnumToStringException{e, "DisplayMessageStatusEnum"}; @@ -2942,6 +3985,9 @@ DisplayMessageStatusEnum string_to_display_message_status_enum(const std::string if (s == "UnknownTransaction") { return DisplayMessageStatusEnum::UnknownTransaction; } + if (s == "LanguageNotSupported") { + return DisplayMessageStatusEnum::LanguageNotSupported; + } throw StringToEnumException{s, "DisplayMessageStatusEnum"}; } @@ -2991,12 +4037,12 @@ std::ostream& operator<<(std::ostream& os, const MonitoringBaseEnum& monitoring_ namespace conversions { std::string apnauthentication_enum_to_string(APNAuthenticationEnum e) { switch (e) { + case APNAuthenticationEnum::PAP: + return "PAP"; case APNAuthenticationEnum::CHAP: return "CHAP"; case APNAuthenticationEnum::NONE: return "NONE"; - case APNAuthenticationEnum::PAP: - return "PAP"; case APNAuthenticationEnum::AUTO: return "AUTO"; } @@ -3005,15 +4051,15 @@ std::string apnauthentication_enum_to_string(APNAuthenticationEnum e) { } APNAuthenticationEnum string_to_apnauthentication_enum(const std::string& s) { + if (s == "PAP") { + return APNAuthenticationEnum::PAP; + } if (s == "CHAP") { return APNAuthenticationEnum::CHAP; } if (s == "NONE") { return APNAuthenticationEnum::NONE; } - if (s == "PAP") { - return APNAuthenticationEnum::PAP; - } if (s == "AUTO") { return APNAuthenticationEnum::AUTO; } @@ -3039,6 +4085,10 @@ std::string ocppversion_enum_to_string(OCPPVersionEnum e) { return "OCPP16"; case OCPPVersionEnum::OCPP20: return "OCPP20"; + case OCPPVersionEnum::OCPP201: + return "OCPP201"; + case OCPPVersionEnum::OCPP21: + return "OCPP21"; } throw EnumToStringException{e, "OCPPVersionEnum"}; @@ -3057,6 +4107,12 @@ OCPPVersionEnum string_to_ocppversion_enum(const std::string& s) { if (s == "OCPP20") { return OCPPVersionEnum::OCPP20; } + if (s == "OCPP201") { + return OCPPVersionEnum::OCPP201; + } + if (s == "OCPP21") { + return OCPPVersionEnum::OCPP21; + } throw StringToEnumException{s, "OCPPVersionEnum"}; } @@ -3067,36 +4123,6 @@ std::ostream& operator<<(std::ostream& os, const OCPPVersionEnum& ocppversion_en return os; } -// from: SetNetworkProfileRequest -namespace conversions { -std::string ocpptransport_enum_to_string(OCPPTransportEnum e) { - switch (e) { - case OCPPTransportEnum::JSON: - return "JSON"; - case OCPPTransportEnum::SOAP: - return "SOAP"; - } - - throw EnumToStringException{e, "OCPPTransportEnum"}; -} - -OCPPTransportEnum string_to_ocpptransport_enum(const std::string& s) { - if (s == "JSON") { - return OCPPTransportEnum::JSON; - } - if (s == "SOAP") { - return OCPPTransportEnum::SOAP; - } - - throw StringToEnumException{s, "OCPPTransportEnum"}; -} -} // namespace conversions - -std::ostream& operator<<(std::ostream& os, const OCPPTransportEnum& ocpptransport_enum) { - os << conversions::ocpptransport_enum_to_string(ocpptransport_enum); - return os; -} - // from: SetNetworkProfileRequest namespace conversions { std::string ocppinterface_enum_to_string(OCPPInterfaceEnum e) { @@ -3117,6 +4143,8 @@ std::string ocppinterface_enum_to_string(OCPPInterfaceEnum e) { return "Wireless2"; case OCPPInterfaceEnum::Wireless3: return "Wireless3"; + case OCPPInterfaceEnum::Any: + return "Any"; } throw EnumToStringException{e, "OCPPInterfaceEnum"}; @@ -3147,6 +4175,9 @@ OCPPInterfaceEnum string_to_ocppinterface_enum(const std::string& s) { if (s == "Wireless3") { return OCPPInterfaceEnum::Wireless3; } + if (s == "Any") { + return OCPPInterfaceEnum::Any; + } throw StringToEnumException{s, "OCPPInterfaceEnum"}; } @@ -3157,6 +4188,36 @@ std::ostream& operator<<(std::ostream& os, const OCPPInterfaceEnum& ocppinterfac return os; } +// from: SetNetworkProfileRequest +namespace conversions { +std::string ocpptransport_enum_to_string(OCPPTransportEnum e) { + switch (e) { + case OCPPTransportEnum::SOAP: + return "SOAP"; + case OCPPTransportEnum::JSON: + return "JSON"; + } + + throw EnumToStringException{e, "OCPPTransportEnum"}; +} + +OCPPTransportEnum string_to_ocpptransport_enum(const std::string& s) { + if (s == "SOAP") { + return OCPPTransportEnum::SOAP; + } + if (s == "JSON") { + return OCPPTransportEnum::JSON; + } + + throw StringToEnumException{s, "OCPPTransportEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const OCPPTransportEnum& ocpptransport_enum) { + os << conversions::ocpptransport_enum_to_string(ocpptransport_enum); + return os; +} + // from: SetNetworkProfileRequest namespace conversions { std::string vpnenum_to_string(VPNEnum e) { @@ -3377,6 +4438,96 @@ std::ostream& operator<<(std::ostream& os, const ConnectorStatusEnum& connector_ return os; } +// from: TransactionEventRequest +namespace conversions { +std::string cost_dimension_enum_to_string(CostDimensionEnum e) { + switch (e) { + case CostDimensionEnum::Energy: + return "Energy"; + case CostDimensionEnum::MaxCurrent: + return "MaxCurrent"; + case CostDimensionEnum::MinCurrent: + return "MinCurrent"; + case CostDimensionEnum::MaxPower: + return "MaxPower"; + case CostDimensionEnum::MinPower: + return "MinPower"; + case CostDimensionEnum::IdleTIme: + return "IdleTIme"; + case CostDimensionEnum::ChargingTime: + return "ChargingTime"; + } + + throw EnumToStringException{e, "CostDimensionEnum"}; +} + +CostDimensionEnum string_to_cost_dimension_enum(const std::string& s) { + if (s == "Energy") { + return CostDimensionEnum::Energy; + } + if (s == "MaxCurrent") { + return CostDimensionEnum::MaxCurrent; + } + if (s == "MinCurrent") { + return CostDimensionEnum::MinCurrent; + } + if (s == "MaxPower") { + return CostDimensionEnum::MaxPower; + } + if (s == "MinPower") { + return CostDimensionEnum::MinPower; + } + if (s == "IdleTIme") { + return CostDimensionEnum::IdleTIme; + } + if (s == "ChargingTime") { + return CostDimensionEnum::ChargingTime; + } + + throw StringToEnumException{s, "CostDimensionEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const CostDimensionEnum& cost_dimension_enum) { + os << conversions::cost_dimension_enum_to_string(cost_dimension_enum); + return os; +} + +// from: TransactionEventRequest +namespace conversions { +std::string tariff_cost_enum_to_string(TariffCostEnum e) { + switch (e) { + case TariffCostEnum::NormalCost: + return "NormalCost"; + case TariffCostEnum::MinCost: + return "MinCost"; + case TariffCostEnum::MaxCost: + return "MaxCost"; + } + + throw EnumToStringException{e, "TariffCostEnum"}; +} + +TariffCostEnum string_to_tariff_cost_enum(const std::string& s) { + if (s == "NormalCost") { + return TariffCostEnum::NormalCost; + } + if (s == "MinCost") { + return TariffCostEnum::MinCost; + } + if (s == "MaxCost") { + return TariffCostEnum::MaxCost; + } + + throw StringToEnumException{s, "TariffCostEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const TariffCostEnum& tariff_cost_enum) { + os << conversions::tariff_cost_enum_to_string(tariff_cost_enum); + return os; +} + // from: TransactionEventRequest namespace conversions { std::string transaction_event_enum_to_string(TransactionEventEnum e) { @@ -3416,6 +4567,8 @@ std::ostream& operator<<(std::ostream& os, const TransactionEventEnum& transacti namespace conversions { std::string trigger_reason_enum_to_string(TriggerReasonEnum e) { switch (e) { + case TriggerReasonEnum::AbnormalCondition: + return "AbnormalCondition"; case TriggerReasonEnum::Authorized: return "Authorized"; case TriggerReasonEnum::CablePluggedIn: @@ -3424,6 +4577,8 @@ std::string trigger_reason_enum_to_string(TriggerReasonEnum e) { return "ChargingRateChanged"; case TriggerReasonEnum::ChargingStateChanged: return "ChargingStateChanged"; + case TriggerReasonEnum::CostLimitReached: + return "CostLimitReached"; case TriggerReasonEnum::Deauthorized: return "Deauthorized"; case TriggerReasonEnum::EnergyLimitReached: @@ -3432,38 +4587,53 @@ std::string trigger_reason_enum_to_string(TriggerReasonEnum e) { return "EVCommunicationLost"; case TriggerReasonEnum::EVConnectTimeout: return "EVConnectTimeout"; + case TriggerReasonEnum::EVDeparted: + return "EVDeparted"; + case TriggerReasonEnum::EVDetected: + return "EVDetected"; + case TriggerReasonEnum::LimitSet: + return "LimitSet"; case TriggerReasonEnum::MeterValueClock: return "MeterValueClock"; case TriggerReasonEnum::MeterValuePeriodic: return "MeterValuePeriodic"; + case TriggerReasonEnum::OperationModeChanged: + return "OperationModeChanged"; + case TriggerReasonEnum::RemoteStart: + return "RemoteStart"; + case TriggerReasonEnum::RemoteStop: + return "RemoteStop"; + case TriggerReasonEnum::ResetCommand: + return "ResetCommand"; + case TriggerReasonEnum::RunningCost: + return "RunningCost"; + case TriggerReasonEnum::SignedDataReceived: + return "SignedDataReceived"; + case TriggerReasonEnum::SoCLimitReached: + return "SoCLimitReached"; + case TriggerReasonEnum::StopAuthorized: + return "StopAuthorized"; + case TriggerReasonEnum::TariffChanged: + return "TariffChanged"; + case TriggerReasonEnum::TariffNotAccepted: + return "TariffNotAccepted"; case TriggerReasonEnum::TimeLimitReached: return "TimeLimitReached"; case TriggerReasonEnum::Trigger: return "Trigger"; + case TriggerReasonEnum::TxResumed: + return "TxResumed"; case TriggerReasonEnum::UnlockCommand: return "UnlockCommand"; - case TriggerReasonEnum::StopAuthorized: - return "StopAuthorized"; - case TriggerReasonEnum::EVDeparted: - return "EVDeparted"; - case TriggerReasonEnum::EVDetected: - return "EVDetected"; - case TriggerReasonEnum::RemoteStop: - return "RemoteStop"; - case TriggerReasonEnum::RemoteStart: - return "RemoteStart"; - case TriggerReasonEnum::AbnormalCondition: - return "AbnormalCondition"; - case TriggerReasonEnum::SignedDataReceived: - return "SignedDataReceived"; - case TriggerReasonEnum::ResetCommand: - return "ResetCommand"; } throw EnumToStringException{e, "TriggerReasonEnum"}; } TriggerReasonEnum string_to_trigger_reason_enum(const std::string& s) { + if (s == "AbnormalCondition") { + return TriggerReasonEnum::AbnormalCondition; + } if (s == "Authorized") { return TriggerReasonEnum::Authorized; } @@ -3476,6 +4646,9 @@ TriggerReasonEnum string_to_trigger_reason_enum(const std::string& s) { if (s == "ChargingStateChanged") { return TriggerReasonEnum::ChargingStateChanged; } + if (s == "CostLimitReached") { + return TriggerReasonEnum::CostLimitReached; + } if (s == "Deauthorized") { return TriggerReasonEnum::Deauthorized; } @@ -3488,44 +4661,62 @@ TriggerReasonEnum string_to_trigger_reason_enum(const std::string& s) { if (s == "EVConnectTimeout") { return TriggerReasonEnum::EVConnectTimeout; } + if (s == "EVDeparted") { + return TriggerReasonEnum::EVDeparted; + } + if (s == "EVDetected") { + return TriggerReasonEnum::EVDetected; + } + if (s == "LimitSet") { + return TriggerReasonEnum::LimitSet; + } if (s == "MeterValueClock") { return TriggerReasonEnum::MeterValueClock; } if (s == "MeterValuePeriodic") { return TriggerReasonEnum::MeterValuePeriodic; } - if (s == "TimeLimitReached") { - return TriggerReasonEnum::TimeLimitReached; + if (s == "OperationModeChanged") { + return TriggerReasonEnum::OperationModeChanged; } - if (s == "Trigger") { - return TriggerReasonEnum::Trigger; + if (s == "RemoteStart") { + return TriggerReasonEnum::RemoteStart; } - if (s == "UnlockCommand") { - return TriggerReasonEnum::UnlockCommand; + if (s == "RemoteStop") { + return TriggerReasonEnum::RemoteStop; + } + if (s == "ResetCommand") { + return TriggerReasonEnum::ResetCommand; + } + if (s == "RunningCost") { + return TriggerReasonEnum::RunningCost; + } + if (s == "SignedDataReceived") { + return TriggerReasonEnum::SignedDataReceived; + } + if (s == "SoCLimitReached") { + return TriggerReasonEnum::SoCLimitReached; } if (s == "StopAuthorized") { return TriggerReasonEnum::StopAuthorized; } - if (s == "EVDeparted") { - return TriggerReasonEnum::EVDeparted; - } - if (s == "EVDetected") { - return TriggerReasonEnum::EVDetected; + if (s == "TariffChanged") { + return TriggerReasonEnum::TariffChanged; } - if (s == "RemoteStop") { - return TriggerReasonEnum::RemoteStop; + if (s == "TariffNotAccepted") { + return TriggerReasonEnum::TariffNotAccepted; } - if (s == "RemoteStart") { - return TriggerReasonEnum::RemoteStart; + if (s == "TimeLimitReached") { + return TriggerReasonEnum::TimeLimitReached; } - if (s == "AbnormalCondition") { - return TriggerReasonEnum::AbnormalCondition; + if (s == "Trigger") { + return TriggerReasonEnum::Trigger; } - if (s == "SignedDataReceived") { - return TriggerReasonEnum::SignedDataReceived; + if (s == "TxResumed") { + return TriggerReasonEnum::TxResumed; } - if (s == "ResetCommand") { - return TriggerReasonEnum::ResetCommand; + if (s == "UnlockCommand") { + return TriggerReasonEnum::UnlockCommand; } throw StringToEnumException{s, "TriggerReasonEnum"}; @@ -3537,14 +4728,54 @@ std::ostream& operator<<(std::ostream& os, const TriggerReasonEnum& trigger_reas return os; } +// from: TransactionEventRequest +namespace conversions { +std::string preconditioning_status_enum_to_string(PreconditioningStatusEnum e) { + switch (e) { + case PreconditioningStatusEnum::Unknown: + return "Unknown"; + case PreconditioningStatusEnum::Ready: + return "Ready"; + case PreconditioningStatusEnum::NotReady: + return "NotReady"; + case PreconditioningStatusEnum::Preconditioning: + return "Preconditioning"; + } + + throw EnumToStringException{e, "PreconditioningStatusEnum"}; +} + +PreconditioningStatusEnum string_to_preconditioning_status_enum(const std::string& s) { + if (s == "Unknown") { + return PreconditioningStatusEnum::Unknown; + } + if (s == "Ready") { + return PreconditioningStatusEnum::Ready; + } + if (s == "NotReady") { + return PreconditioningStatusEnum::NotReady; + } + if (s == "Preconditioning") { + return PreconditioningStatusEnum::Preconditioning; + } + + throw StringToEnumException{s, "PreconditioningStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const PreconditioningStatusEnum& preconditioning_status_enum) { + os << conversions::preconditioning_status_enum_to_string(preconditioning_status_enum); + return os; +} + // from: TransactionEventRequest namespace conversions { std::string charging_state_enum_to_string(ChargingStateEnum e) { switch (e) { - case ChargingStateEnum::Charging: - return "Charging"; case ChargingStateEnum::EVConnected: return "EVConnected"; + case ChargingStateEnum::Charging: + return "Charging"; case ChargingStateEnum::SuspendedEV: return "SuspendedEV"; case ChargingStateEnum::SuspendedEVSE: @@ -3557,12 +4788,12 @@ std::string charging_state_enum_to_string(ChargingStateEnum e) { } ChargingStateEnum string_to_charging_state_enum(const std::string& s) { - if (s == "Charging") { - return ChargingStateEnum::Charging; - } if (s == "EVConnected") { return ChargingStateEnum::EVConnected; } + if (s == "Charging") { + return ChargingStateEnum::Charging; + } if (s == "SuspendedEV") { return ChargingStateEnum::SuspendedEV; } @@ -3598,12 +4829,12 @@ std::string reason_enum_to_string(ReasonEnum e) { return "GroundFault"; case ReasonEnum::ImmediateReset: return "ImmediateReset"; + case ReasonEnum::MasterPass: + return "MasterPass"; case ReasonEnum::Local: return "Local"; case ReasonEnum::LocalOutOfCredit: return "LocalOutOfCredit"; - case ReasonEnum::MasterPass: - return "MasterPass"; case ReasonEnum::Other: return "Other"; case ReasonEnum::OvercurrentFault: @@ -3624,6 +4855,8 @@ std::string reason_enum_to_string(ReasonEnum e) { return "TimeLimitReached"; case ReasonEnum::Timeout: return "Timeout"; + case ReasonEnum::ReqEnergyTransferRejected: + return "ReqEnergyTransferRejected"; } throw EnumToStringException{e, "ReasonEnum"}; @@ -3648,15 +4881,15 @@ ReasonEnum string_to_reason_enum(const std::string& s) { if (s == "ImmediateReset") { return ReasonEnum::ImmediateReset; } + if (s == "MasterPass") { + return ReasonEnum::MasterPass; + } if (s == "Local") { return ReasonEnum::Local; } if (s == "LocalOutOfCredit") { return ReasonEnum::LocalOutOfCredit; } - if (s == "MasterPass") { - return ReasonEnum::MasterPass; - } if (s == "Other") { return ReasonEnum::Other; } @@ -3687,6 +4920,9 @@ ReasonEnum string_to_reason_enum(const std::string& s) { if (s == "Timeout") { return ReasonEnum::Timeout; } + if (s == "ReqEnergyTransferRejected") { + return ReasonEnum::ReqEnergyTransferRejected; + } throw StringToEnumException{s, "ReasonEnum"}; } @@ -3715,6 +4951,8 @@ std::string message_trigger_enum_to_string(MessageTriggerEnum e) { return "SignChargingStationCertificate"; case MessageTriggerEnum::SignV2GCertificate: return "SignV2GCertificate"; + case MessageTriggerEnum::SignV2G20Certificate: + return "SignV2G20Certificate"; case MessageTriggerEnum::StatusNotification: return "StatusNotification"; case MessageTriggerEnum::TransactionEvent: @@ -3723,6 +4961,8 @@ std::string message_trigger_enum_to_string(MessageTriggerEnum e) { return "SignCombinedCertificate"; case MessageTriggerEnum::PublishFirmwareStatusNotification: return "PublishFirmwareStatusNotification"; + case MessageTriggerEnum::CustomTrigger: + return "CustomTrigger"; } throw EnumToStringException{e, "MessageTriggerEnum"}; @@ -3750,6 +4990,9 @@ MessageTriggerEnum string_to_message_trigger_enum(const std::string& s) { if (s == "SignV2GCertificate") { return MessageTriggerEnum::SignV2GCertificate; } + if (s == "SignV2G20Certificate") { + return MessageTriggerEnum::SignV2G20Certificate; + } if (s == "StatusNotification") { return MessageTriggerEnum::StatusNotification; } @@ -3762,6 +5005,9 @@ MessageTriggerEnum string_to_message_trigger_enum(const std::string& s) { if (s == "PublishFirmwareStatusNotification") { return MessageTriggerEnum::PublishFirmwareStatusNotification; } + if (s == "CustomTrigger") { + return MessageTriggerEnum::CustomTrigger; + } throw StringToEnumException{s, "MessageTriggerEnum"}; } @@ -3927,5 +5173,40 @@ std::ostream& operator<<(std::ostream& os, const UpdateFirmwareStatusEnum& updat return os; } +// from: UsePriorityChargingResponse +namespace conversions { +std::string priority_charging_status_enum_to_string(PriorityChargingStatusEnum e) { + switch (e) { + case PriorityChargingStatusEnum::Accepted: + return "Accepted"; + case PriorityChargingStatusEnum::Rejected: + return "Rejected"; + case PriorityChargingStatusEnum::NoProfile: + return "NoProfile"; + } + + throw EnumToStringException{e, "PriorityChargingStatusEnum"}; +} + +PriorityChargingStatusEnum string_to_priority_charging_status_enum(const std::string& s) { + if (s == "Accepted") { + return PriorityChargingStatusEnum::Accepted; + } + if (s == "Rejected") { + return PriorityChargingStatusEnum::Rejected; + } + if (s == "NoProfile") { + return PriorityChargingStatusEnum::NoProfile; + } + + throw StringToEnumException{s, "PriorityChargingStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const PriorityChargingStatusEnum& priority_charging_status_enum) { + os << conversions::priority_charging_status_enum_to_string(priority_charging_status_enum); + return os; +} + } // namespace v2 } // namespace ocpp diff --git a/lib/ocpp/v2/ocpp_types.cpp b/lib/ocpp/v2/ocpp_types.cpp index f03fbfea9..5b466e915 100644 --- a/lib/ocpp/v2/ocpp_types.cpp +++ b/lib/ocpp/v2/ocpp_types.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually #include @@ -15,6 +15,81 @@ namespace ocpp { namespace v2 { +/// \brief Conversion from a given StatusInfo \p k to a given json object \p j +void to_json(json& j, const StatusInfo& k) { + // the required parts of the message + j = json{ + {"reasonCode", k.reasonCode}, + }; + // the optional parts of the message + if (k.additionalInfo) { + j["additionalInfo"] = k.additionalInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given StatusInfo \p k +void from_json(const json& j, StatusInfo& k) { + // the required parts of the message + k.reasonCode = j.at("reasonCode"); + + // the optional parts of the message + if (j.contains("additionalInfo")) { + k.additionalInfo.emplace(j.at("additionalInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given StatusInfo \p k to the given output stream \p os +/// \returns an output stream with the StatusInfo written to +std::ostream& operator<<(std::ostream& os, const StatusInfo& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given PeriodicEventStreamParams \p k to a given json object \p j +void to_json(json& j, const PeriodicEventStreamParams& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.interval) { + j["interval"] = k.interval.value(); + } + if (k.values) { + j["values"] = k.values.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given PeriodicEventStreamParams \p k +void from_json(const json& j, PeriodicEventStreamParams& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("interval")) { + k.interval.emplace(j.at("interval")); + } + if (j.contains("values")) { + k.values.emplace(j.at("values")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given PeriodicEventStreamParams \p k to the given output stream \p os +/// \returns an output stream with the PeriodicEventStreamParams written to +std::ostream& operator<<(std::ostream& os, const PeriodicEventStreamParams& k) { + os << json(k).dump(4); + return os; +} + /// \brief Conversion from a given AdditionalInfo \p k to a given json object \p j void to_json(json& j, const AdditionalInfo& k) { // the required parts of the message @@ -52,30 +127,27 @@ void to_json(json& j, const IdToken& k) { // the required parts of the message j = json{ {"idToken", k.idToken}, - {"type", conversions::id_token_enum_to_string(k.type)}, + {"type", k.type}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.additionalInfo) { j["additionalInfo"] = json::array(); for (auto val : k.additionalInfo.value()) { j["additionalInfo"].push_back(val); } } + if (k.customData) { + j["customData"] = k.customData.value(); + } } /// \brief Conversion from a given json object \p j to a given IdToken \p k void from_json(const json& j, IdToken& k) { // the required parts of the message k.idToken = j.at("idToken"); - k.type = conversions::string_to_id_token_enum(j.at("type")); + k.type = j.at("type"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("additionalInfo")) { json arr = j.at("additionalInfo"); std::vector vec; @@ -84,6 +156,9 @@ void from_json(const json& j, IdToken& k) { } k.additionalInfo.emplace(vec); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } // \brief Writes the string representation of the given IdToken \p k to the given output stream \p os @@ -139,12 +214,12 @@ void to_json(json& j, const MessageContent& k) { {"content", k.content}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.language) { j["language"] = k.language.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } /// \brief Conversion from a given json object \p j to a given MessageContent \p k @@ -154,12 +229,12 @@ void from_json(const json& j, MessageContent& k) { k.content = j.at("content"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("language")) { k.language.emplace(j.at("language")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } // \brief Writes the string representation of the given MessageContent \p k to the given output stream \p os @@ -176,33 +251,33 @@ void to_json(json& j, const IdTokenInfo& k) { {"status", conversions::authorization_status_enum_to_string(k.status)}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.cacheExpiryDateTime) { j["cacheExpiryDateTime"] = k.cacheExpiryDateTime.value().to_rfc3339(); } if (k.chargingPriority) { j["chargingPriority"] = k.chargingPriority.value(); } + if (k.groupIdToken) { + j["groupIdToken"] = k.groupIdToken.value(); + } if (k.language1) { j["language1"] = k.language1.value(); } + if (k.language2) { + j["language2"] = k.language2.value(); + } if (k.evseId) { j["evseId"] = json::array(); for (auto val : k.evseId.value()) { j["evseId"].push_back(val); } } - if (k.groupIdToken) { - j["groupIdToken"] = k.groupIdToken.value(); - } - if (k.language2) { - j["language2"] = k.language2.value(); - } if (k.personalMessage) { j["personalMessage"] = k.personalMessage.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } /// \brief Conversion from a given json object \p j to a given IdTokenInfo \p k @@ -211,18 +286,21 @@ void from_json(const json& j, IdTokenInfo& k) { k.status = conversions::string_to_authorization_status_enum(j.at("status")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("cacheExpiryDateTime")) { k.cacheExpiryDateTime.emplace(j.at("cacheExpiryDateTime").get()); } if (j.contains("chargingPriority")) { k.chargingPriority.emplace(j.at("chargingPriority")); } + if (j.contains("groupIdToken")) { + k.groupIdToken.emplace(j.at("groupIdToken")); + } if (j.contains("language1")) { k.language1.emplace(j.at("language1")); } + if (j.contains("language2")) { + k.language2.emplace(j.at("language2")); + } if (j.contains("evseId")) { json arr = j.at("evseId"); std::vector vec; @@ -231,15 +309,12 @@ void from_json(const json& j, IdTokenInfo& k) { } k.evseId.emplace(vec); } - if (j.contains("groupIdToken")) { - k.groupIdToken.emplace(j.at("groupIdToken")); - } - if (j.contains("language2")) { - k.language2.emplace(j.at("language2")); - } if (j.contains("personalMessage")) { k.personalMessage.emplace(j.at("personalMessage")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } // \brief Writes the string representation of the given IdTokenInfo \p k to the given output stream \p os @@ -249,888 +324,1024 @@ std::ostream& operator<<(std::ostream& os, const IdTokenInfo& k) { return os; } -/// \brief Conversion from a given Modem \p k to a given json object \p j -void to_json(json& j, const Modem& k) { +/// \brief Conversion from a given TariffConditions \p k to a given json object \p j +void to_json(json& j, const TariffConditions& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.startTimeOfDay) { + j["startTimeOfDay"] = k.startTimeOfDay.value(); } - if (k.iccid) { - j["iccid"] = k.iccid.value(); + if (k.endTimeOfDay) { + j["endTimeOfDay"] = k.endTimeOfDay.value(); } - if (k.imsi) { - j["imsi"] = k.imsi.value(); + if (k.dayOfWeek) { + if (j.size() == 0) { + j = json{{"dayOfWeek", json::array()}}; + } else { + j["dayOfWeek"] = json::array(); + } + for (auto val : k.dayOfWeek.value()) { + j["dayOfWeek"].push_back(conversions::day_of_week_enum_to_string(val)); + } + } + if (k.validFromDate) { + j["validFromDate"] = k.validFromDate.value(); + } + if (k.validToDate) { + j["validToDate"] = k.validToDate.value(); + } + if (k.evseKind) { + j["evseKind"] = conversions::evse_kind_enum_to_string(k.evseKind.value()); + } + if (k.minEnergy) { + j["minEnergy"] = k.minEnergy.value(); + } + if (k.maxEnergy) { + j["maxEnergy"] = k.maxEnergy.value(); + } + if (k.minCurrent) { + j["minCurrent"] = k.minCurrent.value(); + } + if (k.maxCurrent) { + j["maxCurrent"] = k.maxCurrent.value(); + } + if (k.minPower) { + j["minPower"] = k.minPower.value(); + } + if (k.maxPower) { + j["maxPower"] = k.maxPower.value(); + } + if (k.minTime) { + j["minTime"] = k.minTime.value(); + } + if (k.maxTime) { + j["maxTime"] = k.maxTime.value(); + } + if (k.minChargingTime) { + j["minChargingTime"] = k.minChargingTime.value(); + } + if (k.maxChargingTime) { + j["maxChargingTime"] = k.maxChargingTime.value(); + } + if (k.minIdleTime) { + j["minIdleTime"] = k.minIdleTime.value(); + } + if (k.maxIdleTime) { + j["maxIdleTime"] = k.maxIdleTime.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given Modem \p k -void from_json(const json& j, Modem& k) { +/// \brief Conversion from a given json object \p j to a given TariffConditions \p k +void from_json(const json& j, TariffConditions& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("startTimeOfDay")) { + k.startTimeOfDay.emplace(j.at("startTimeOfDay")); } - if (j.contains("iccid")) { - k.iccid.emplace(j.at("iccid")); + if (j.contains("endTimeOfDay")) { + k.endTimeOfDay.emplace(j.at("endTimeOfDay")); } - if (j.contains("imsi")) { - k.imsi.emplace(j.at("imsi")); + if (j.contains("dayOfWeek")) { + json arr = j.at("dayOfWeek"); + std::vector vec; + for (auto val : arr) { + vec.push_back(conversions::string_to_day_of_week_enum(val)); + } + k.dayOfWeek.emplace(vec); + } + if (j.contains("validFromDate")) { + k.validFromDate.emplace(j.at("validFromDate")); + } + if (j.contains("validToDate")) { + k.validToDate.emplace(j.at("validToDate")); + } + if (j.contains("evseKind")) { + k.evseKind.emplace(conversions::string_to_evse_kind_enum(j.at("evseKind"))); + } + if (j.contains("minEnergy")) { + k.minEnergy.emplace(j.at("minEnergy")); + } + if (j.contains("maxEnergy")) { + k.maxEnergy.emplace(j.at("maxEnergy")); + } + if (j.contains("minCurrent")) { + k.minCurrent.emplace(j.at("minCurrent")); + } + if (j.contains("maxCurrent")) { + k.maxCurrent.emplace(j.at("maxCurrent")); + } + if (j.contains("minPower")) { + k.minPower.emplace(j.at("minPower")); + } + if (j.contains("maxPower")) { + k.maxPower.emplace(j.at("maxPower")); + } + if (j.contains("minTime")) { + k.minTime.emplace(j.at("minTime")); + } + if (j.contains("maxTime")) { + k.maxTime.emplace(j.at("maxTime")); + } + if (j.contains("minChargingTime")) { + k.minChargingTime.emplace(j.at("minChargingTime")); + } + if (j.contains("maxChargingTime")) { + k.maxChargingTime.emplace(j.at("maxChargingTime")); + } + if (j.contains("minIdleTime")) { + k.minIdleTime.emplace(j.at("minIdleTime")); + } + if (j.contains("maxIdleTime")) { + k.maxIdleTime.emplace(j.at("maxIdleTime")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given Modem \p k to the given output stream \p os -/// \returns an output stream with the Modem written to -std::ostream& operator<<(std::ostream& os, const Modem& k) { +// \brief Writes the string representation of the given TariffConditions \p k to the given output stream \p os +/// \returns an output stream with the TariffConditions written to +std::ostream& operator<<(std::ostream& os, const TariffConditions& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingStation \p k to a given json object \p j -void to_json(json& j, const ChargingStation& k) { +/// \brief Conversion from a given TariffEnergyPrice \p k to a given json object \p j +void to_json(json& j, const TariffEnergyPrice& k) { // the required parts of the message j = json{ - {"model", k.model}, - {"vendorName", k.vendorName}, + {"priceKwh", k.priceKwh}, }; // the optional parts of the message + if (k.conditions) { + j["conditions"] = k.conditions.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.serialNumber) { - j["serialNumber"] = k.serialNumber.value(); - } - if (k.modem) { - j["modem"] = k.modem.value(); - } - if (k.firmwareVersion) { - j["firmwareVersion"] = k.firmwareVersion.value(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingStation \p k -void from_json(const json& j, ChargingStation& k) { +/// \brief Conversion from a given json object \p j to a given TariffEnergyPrice \p k +void from_json(const json& j, TariffEnergyPrice& k) { // the required parts of the message - k.model = j.at("model"); - k.vendorName = j.at("vendorName"); + k.priceKwh = j.at("priceKwh"); // the optional parts of the message + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("serialNumber")) { - k.serialNumber.emplace(j.at("serialNumber")); - } - if (j.contains("modem")) { - k.modem.emplace(j.at("modem")); - } - if (j.contains("firmwareVersion")) { - k.firmwareVersion.emplace(j.at("firmwareVersion")); - } } -// \brief Writes the string representation of the given ChargingStation \p k to the given output stream \p os -/// \returns an output stream with the ChargingStation written to -std::ostream& operator<<(std::ostream& os, const ChargingStation& k) { +// \brief Writes the string representation of the given TariffEnergyPrice \p k to the given output stream \p os +/// \returns an output stream with the TariffEnergyPrice written to +std::ostream& operator<<(std::ostream& os, const TariffEnergyPrice& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given StatusInfo \p k to a given json object \p j -void to_json(json& j, const StatusInfo& k) { +/// \brief Conversion from a given TaxRate \p k to a given json object \p j +void to_json(json& j, const TaxRate& k) { // the required parts of the message j = json{ - {"reasonCode", k.reasonCode}, + {"type", k.type}, + {"tax", k.tax}, }; // the optional parts of the message + if (k.stack) { + j["stack"] = k.stack.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.additionalInfo) { - j["additionalInfo"] = k.additionalInfo.value(); - } } -/// \brief Conversion from a given json object \p j to a given StatusInfo \p k -void from_json(const json& j, StatusInfo& k) { +/// \brief Conversion from a given json object \p j to a given TaxRate \p k +void from_json(const json& j, TaxRate& k) { // the required parts of the message - k.reasonCode = j.at("reasonCode"); + k.type = j.at("type"); + k.tax = j.at("tax"); // the optional parts of the message + if (j.contains("stack")) { + k.stack.emplace(j.at("stack")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("additionalInfo")) { - k.additionalInfo.emplace(j.at("additionalInfo")); - } } -// \brief Writes the string representation of the given StatusInfo \p k to the given output stream \p os -/// \returns an output stream with the StatusInfo written to -std::ostream& operator<<(std::ostream& os, const StatusInfo& k) { +// \brief Writes the string representation of the given TaxRate \p k to the given output stream \p os +/// \returns an output stream with the TaxRate written to +std::ostream& operator<<(std::ostream& os, const TaxRate& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given EVSE \p k to a given json object \p j -void to_json(json& j, const EVSE& k) { +/// \brief Conversion from a given TariffEnergy \p k to a given json object \p j +void to_json(json& j, const TariffEnergy& k) { // the required parts of the message j = json{ - {"id", k.id}, + {"prices", k.prices}, }; // the optional parts of the message + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.connectorId) { - j["connectorId"] = k.connectorId.value(); - } } -/// \brief Conversion from a given json object \p j to a given EVSE \p k -void from_json(const json& j, EVSE& k) { +/// \brief Conversion from a given json object \p j to a given TariffEnergy \p k +void from_json(const json& j, TariffEnergy& k) { // the required parts of the message - k.id = j.at("id"); + for (auto val : j.at("prices")) { + k.prices.push_back(val); + } // the optional parts of the message + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRates.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("connectorId")) { - k.connectorId.emplace(j.at("connectorId")); - } } -// \brief Writes the string representation of the given EVSE \p k to the given output stream \p os -/// \returns an output stream with the EVSE written to -std::ostream& operator<<(std::ostream& os, const EVSE& k) { +// \brief Writes the string representation of the given TariffEnergy \p k to the given output stream \p os +/// \returns an output stream with the TariffEnergy written to +std::ostream& operator<<(std::ostream& os, const TariffEnergy& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ClearChargingProfile \p k to a given json object \p j -void to_json(json& j, const ClearChargingProfile& k) { - // the required parts of the message - j = json({}, true); - // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } - if (k.evseId) { - j["evseId"] = k.evseId.value(); - } - if (k.chargingProfilePurpose) { - j["chargingProfilePurpose"] = - conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose.value()); - } - if (k.stackLevel) { - j["stackLevel"] = k.stackLevel.value(); - } -} - -/// \brief Conversion from a given json object \p j to a given ClearChargingProfile \p k -void from_json(const json& j, ClearChargingProfile& k) { - // the required parts of the message - - // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } - if (j.contains("evseId")) { - k.evseId.emplace(j.at("evseId")); - } - if (j.contains("chargingProfilePurpose")) { - k.chargingProfilePurpose.emplace( - conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose"))); - } - if (j.contains("stackLevel")) { - k.stackLevel.emplace(j.at("stackLevel")); - } -} - -// \brief Writes the string representation of the given ClearChargingProfile \p k to the given output stream \p os -/// \returns an output stream with the ClearChargingProfile written to -std::ostream& operator<<(std::ostream& os, const ClearChargingProfile& k) { - os << json(k).dump(4); - return os; -} - -/// \brief Conversion from a given ClearMonitoringResult \p k to a given json object \p j -void to_json(json& j, const ClearMonitoringResult& k) { +/// \brief Conversion from a given TariffTimePrice \p k to a given json object \p j +void to_json(json& j, const TariffTimePrice& k) { // the required parts of the message j = json{ - {"status", conversions::clear_monitoring_status_enum_to_string(k.status)}, - {"id", k.id}, + {"priceMinute", k.priceMinute}, }; // the optional parts of the message + if (k.conditions) { + j["conditions"] = k.conditions.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.statusInfo) { - j["statusInfo"] = k.statusInfo.value(); - } } -/// \brief Conversion from a given json object \p j to a given ClearMonitoringResult \p k -void from_json(const json& j, ClearMonitoringResult& k) { +/// \brief Conversion from a given json object \p j to a given TariffTimePrice \p k +void from_json(const json& j, TariffTimePrice& k) { // the required parts of the message - k.status = conversions::string_to_clear_monitoring_status_enum(j.at("status")); - k.id = j.at("id"); + k.priceMinute = j.at("priceMinute"); // the optional parts of the message + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("statusInfo")) { - k.statusInfo.emplace(j.at("statusInfo")); - } } -// \brief Writes the string representation of the given ClearMonitoringResult \p k to the given output stream \p os -/// \returns an output stream with the ClearMonitoringResult written to -std::ostream& operator<<(std::ostream& os, const ClearMonitoringResult& k) { +// \brief Writes the string representation of the given TariffTimePrice \p k to the given output stream \p os +/// \returns an output stream with the TariffTimePrice written to +std::ostream& operator<<(std::ostream& os, const TariffTimePrice& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given CertificateHashDataType \p k to a given json object \p j -void to_json(json& j, const CertificateHashDataType& k) { +/// \brief Conversion from a given TariffTime \p k to a given json object \p j +void to_json(json& j, const TariffTime& k) { // the required parts of the message j = json{ - {"hashAlgorithm", conversions::hash_algorithm_enum_to_string(k.hashAlgorithm)}, - {"issuerNameHash", k.issuerNameHash}, - {"issuerKeyHash", k.issuerKeyHash}, - {"serialNumber", k.serialNumber}, + {"prices", k.prices}, }; // the optional parts of the message + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given CertificateHashDataType \p k -void from_json(const json& j, CertificateHashDataType& k) { +/// \brief Conversion from a given json object \p j to a given TariffTime \p k +void from_json(const json& j, TariffTime& k) { // the required parts of the message - k.hashAlgorithm = conversions::string_to_hash_algorithm_enum(j.at("hashAlgorithm")); - k.issuerNameHash = j.at("issuerNameHash"); - k.issuerKeyHash = j.at("issuerKeyHash"); - k.serialNumber = j.at("serialNumber"); + for (auto val : j.at("prices")) { + k.prices.push_back(val); + } // the optional parts of the message + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRates.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given CertificateHashDataType \p k to the given output stream \p os -/// \returns an output stream with the CertificateHashDataType written to -std::ostream& operator<<(std::ostream& os, const CertificateHashDataType& k) { +// \brief Writes the string representation of the given TariffTime \p k to the given output stream \p os +/// \returns an output stream with the TariffTime written to +std::ostream& operator<<(std::ostream& os, const TariffTime& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingProfileCriterion \p k to a given json object \p j -void to_json(json& j, const ChargingProfileCriterion& k) { +/// \brief Conversion from a given TariffConditionsFixed \p k to a given json object \p j +void to_json(json& j, const TariffConditionsFixed& k) { // the required parts of the message j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } - if (k.chargingProfilePurpose) { - j["chargingProfilePurpose"] = - conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose.value()); + if (k.startTimeOfDay) { + j["startTimeOfDay"] = k.startTimeOfDay.value(); } - if (k.stackLevel) { - j["stackLevel"] = k.stackLevel.value(); + if (k.endTimeOfDay) { + j["endTimeOfDay"] = k.endTimeOfDay.value(); } - if (k.chargingProfileId) { + if (k.dayOfWeek) { if (j.size() == 0) { - j = json{{"chargingProfileId", json::array()}}; + j = json{{"dayOfWeek", json::array()}}; } else { - j["chargingProfileId"] = json::array(); + j["dayOfWeek"] = json::array(); } - for (auto val : k.chargingProfileId.value()) { - j["chargingProfileId"].push_back(val); + for (auto val : k.dayOfWeek.value()) { + j["dayOfWeek"].push_back(conversions::day_of_week_enum_to_string(val)); } } - if (k.chargingLimitSource) { - if (j.size() == 0) { - j = json{{"chargingLimitSource", json::array()}}; - } else { - j["chargingLimitSource"] = json::array(); - } - for (auto val : k.chargingLimitSource.value()) { - j["chargingLimitSource"].push_back(conversions::charging_limit_source_enum_to_string(val)); - } + if (k.validFromDate) { + j["validFromDate"] = k.validFromDate.value(); + } + if (k.validToDate) { + j["validToDate"] = k.validToDate.value(); + } + if (k.evseKind) { + j["evseKind"] = conversions::evse_kind_enum_to_string(k.evseKind.value()); + } + if (k.paymentBrand) { + j["paymentBrand"] = k.paymentBrand.value(); + } + if (k.paymentRecognition) { + j["paymentRecognition"] = k.paymentRecognition.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given ChargingProfileCriterion \p k -void from_json(const json& j, ChargingProfileCriterion& k) { +/// \brief Conversion from a given json object \p j to a given TariffConditionsFixed \p k +void from_json(const json& j, TariffConditionsFixed& k) { // the required parts of the message // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } - if (j.contains("chargingProfilePurpose")) { - k.chargingProfilePurpose.emplace( - conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose"))); + if (j.contains("startTimeOfDay")) { + k.startTimeOfDay.emplace(j.at("startTimeOfDay")); } - if (j.contains("stackLevel")) { - k.stackLevel.emplace(j.at("stackLevel")); + if (j.contains("endTimeOfDay")) { + k.endTimeOfDay.emplace(j.at("endTimeOfDay")); } - if (j.contains("chargingProfileId")) { - json arr = j.at("chargingProfileId"); - std::vector vec; + if (j.contains("dayOfWeek")) { + json arr = j.at("dayOfWeek"); + std::vector vec; for (auto val : arr) { - vec.push_back(val); + vec.push_back(conversions::string_to_day_of_week_enum(val)); } - k.chargingProfileId.emplace(vec); + k.dayOfWeek.emplace(vec); } - if (j.contains("chargingLimitSource")) { - json arr = j.at("chargingLimitSource"); - std::vector vec; - for (auto val : arr) { - vec.push_back(conversions::string_to_charging_limit_source_enum(val)); - } - k.chargingLimitSource.emplace(vec); + if (j.contains("validFromDate")) { + k.validFromDate.emplace(j.at("validFromDate")); + } + if (j.contains("validToDate")) { + k.validToDate.emplace(j.at("validToDate")); + } + if (j.contains("evseKind")) { + k.evseKind.emplace(conversions::string_to_evse_kind_enum(j.at("evseKind"))); + } + if (j.contains("paymentBrand")) { + k.paymentBrand.emplace(j.at("paymentBrand")); + } + if (j.contains("paymentRecognition")) { + k.paymentRecognition.emplace(j.at("paymentRecognition")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given ChargingProfileCriterion \p k to the given output stream \p os -/// \returns an output stream with the ChargingProfileCriterion written to -std::ostream& operator<<(std::ostream& os, const ChargingProfileCriterion& k) { +// \brief Writes the string representation of the given TariffConditionsFixed \p k to the given output stream \p os +/// \returns an output stream with the TariffConditionsFixed written to +std::ostream& operator<<(std::ostream& os, const TariffConditionsFixed& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingSchedulePeriod \p k to a given json object \p j -void to_json(json& j, const ChargingSchedulePeriod& k) { +/// \brief Conversion from a given TariffFixedPrice \p k to a given json object \p j +void to_json(json& j, const TariffFixedPrice& k) { // the required parts of the message j = json{ - {"startPeriod", k.startPeriod}, - {"limit", k.limit}, + {"priceFixed", k.priceFixed}, }; // the optional parts of the message + if (k.conditions) { + j["conditions"] = k.conditions.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.numberPhases) { - j["numberPhases"] = k.numberPhases.value(); - } - if (k.phaseToUse) { - j["phaseToUse"] = k.phaseToUse.value(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingSchedulePeriod \p k -void from_json(const json& j, ChargingSchedulePeriod& k) { +/// \brief Conversion from a given json object \p j to a given TariffFixedPrice \p k +void from_json(const json& j, TariffFixedPrice& k) { // the required parts of the message - k.startPeriod = j.at("startPeriod"); - k.limit = j.at("limit"); + k.priceFixed = j.at("priceFixed"); // the optional parts of the message + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("numberPhases")) { - k.numberPhases.emplace(j.at("numberPhases")); - } - if (j.contains("phaseToUse")) { - k.phaseToUse.emplace(j.at("phaseToUse")); - } } -// \brief Writes the string representation of the given ChargingSchedulePeriod \p k to the given output stream \p os -/// \returns an output stream with the ChargingSchedulePeriod written to -std::ostream& operator<<(std::ostream& os, const ChargingSchedulePeriod& k) { +// \brief Writes the string representation of the given TariffFixedPrice \p k to the given output stream \p os +/// \returns an output stream with the TariffFixedPrice written to +std::ostream& operator<<(std::ostream& os, const TariffFixedPrice& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given CompositeSchedule \p k to a given json object \p j -void to_json(json& j, const CompositeSchedule& k) { +/// \brief Conversion from a given TariffFixed \p k to a given json object \p j +void to_json(json& j, const TariffFixed& k) { // the required parts of the message j = json{ - {"chargingSchedulePeriod", k.chargingSchedulePeriod}, - {"evseId", k.evseId}, - {"duration", k.duration}, - {"scheduleStart", k.scheduleStart.to_rfc3339()}, - {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, + {"prices", k.prices}, }; // the optional parts of the message + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given CompositeSchedule \p k -void from_json(const json& j, CompositeSchedule& k) { +/// \brief Conversion from a given json object \p j to a given TariffFixed \p k +void from_json(const json& j, TariffFixed& k) { // the required parts of the message - for (auto val : j.at("chargingSchedulePeriod")) { - k.chargingSchedulePeriod.push_back(val); + for (auto val : j.at("prices")) { + k.prices.push_back(val); } - k.evseId = j.at("evseId"); - k.duration = j.at("duration"); - k.scheduleStart = ocpp::DateTime(std::string(j.at("scheduleStart"))); - k.chargingRateUnit = conversions::string_to_charging_rate_unit_enum(j.at("chargingRateUnit")); // the optional parts of the message + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRates.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given CompositeSchedule \p k to the given output stream \p os -/// \returns an output stream with the CompositeSchedule written to -std::ostream& operator<<(std::ostream& os, const CompositeSchedule& k) { +// \brief Writes the string representation of the given TariffFixed \p k to the given output stream \p os +/// \returns an output stream with the TariffFixed written to +std::ostream& operator<<(std::ostream& os, const TariffFixed& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given CertificateHashDataChain \p k to a given json object \p j -void to_json(json& j, const CertificateHashDataChain& k) { +/// \brief Conversion from a given Price \p k to a given json object \p j +void to_json(json& j, const Price& k) { // the required parts of the message - j = json{ - {"certificateHashData", k.certificateHashData}, - {"certificateType", conversions::get_certificate_id_use_enum_to_string(k.certificateType)}, - }; + j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.exclTax) { + j["exclTax"] = k.exclTax.value(); } - if (k.childCertificateHashData) { - j["childCertificateHashData"] = json::array(); - for (auto val : k.childCertificateHashData.value()) { - j["childCertificateHashData"].push_back(val); + if (k.inclTax) { + j["inclTax"] = k.inclTax.value(); + } + if (k.taxRates) { + if (j.size() == 0) { + j = json{{"taxRates", json::array()}}; + } else { + j["taxRates"] = json::array(); } + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given CertificateHashDataChain \p k -void from_json(const json& j, CertificateHashDataChain& k) { +/// \brief Conversion from a given json object \p j to a given Price \p k +void from_json(const json& j, Price& k) { // the required parts of the message - k.certificateHashData = j.at("certificateHashData"); - k.certificateType = conversions::string_to_get_certificate_id_use_enum(j.at("certificateType")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("exclTax")) { + k.exclTax.emplace(j.at("exclTax")); } - if (j.contains("childCertificateHashData")) { - json arr = j.at("childCertificateHashData"); - std::vector vec; + if (j.contains("inclTax")) { + k.inclTax.emplace(j.at("inclTax")); + } + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; for (auto val : arr) { vec.push_back(val); } - k.childCertificateHashData.emplace(vec); + k.taxRates.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given CertificateHashDataChain \p k to the given output stream \p os -/// \returns an output stream with the CertificateHashDataChain written to -std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k) { +// \brief Writes the string representation of the given Price \p k to the given output stream \p os +/// \returns an output stream with the Price written to +std::ostream& operator<<(std::ostream& os, const Price& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given LogParameters \p k to a given json object \p j -void to_json(json& j, const LogParameters& k) { +/// \brief Conversion from a given Tariff \p k to a given json object \p j +void to_json(json& j, const Tariff& k) { // the required parts of the message j = json{ - {"remoteLocation", k.remoteLocation}, + {"tariffId", k.tariffId}, + {"currency", k.currency}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.description) { + j["description"] = json::array(); + for (auto val : k.description.value()) { + j["description"].push_back(val); + } } - if (k.oldestTimestamp) { - j["oldestTimestamp"] = k.oldestTimestamp.value().to_rfc3339(); + if (k.energy) { + j["energy"] = k.energy.value(); } - if (k.latestTimestamp) { - j["latestTimestamp"] = k.latestTimestamp.value().to_rfc3339(); + if (k.validFrom) { + j["validFrom"] = k.validFrom.value().to_rfc3339(); + } + if (k.chargingTime) { + j["chargingTime"] = k.chargingTime.value(); + } + if (k.idleTime) { + j["idleTime"] = k.idleTime.value(); + } + if (k.fixedFee) { + j["fixedFee"] = k.fixedFee.value(); + } + if (k.reservationTime) { + j["reservationTime"] = k.reservationTime.value(); + } + if (k.reservationFixed) { + j["reservationFixed"] = k.reservationFixed.value(); + } + if (k.minCost) { + j["minCost"] = k.minCost.value(); + } + if (k.maxCost) { + j["maxCost"] = k.maxCost.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given LogParameters \p k -void from_json(const json& j, LogParameters& k) { +/// \brief Conversion from a given json object \p j to a given Tariff \p k +void from_json(const json& j, Tariff& k) { // the required parts of the message - k.remoteLocation = j.at("remoteLocation"); + k.tariffId = j.at("tariffId"); + k.currency = j.at("currency"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("description")) { + json arr = j.at("description"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.description.emplace(vec); } - if (j.contains("oldestTimestamp")) { - k.oldestTimestamp.emplace(j.at("oldestTimestamp").get()); + if (j.contains("energy")) { + k.energy.emplace(j.at("energy")); } - if (j.contains("latestTimestamp")) { - k.latestTimestamp.emplace(j.at("latestTimestamp").get()); + if (j.contains("validFrom")) { + k.validFrom.emplace(j.at("validFrom").get()); + } + if (j.contains("chargingTime")) { + k.chargingTime.emplace(j.at("chargingTime")); + } + if (j.contains("idleTime")) { + k.idleTime.emplace(j.at("idleTime")); + } + if (j.contains("fixedFee")) { + k.fixedFee.emplace(j.at("fixedFee")); + } + if (j.contains("reservationTime")) { + k.reservationTime.emplace(j.at("reservationTime")); + } + if (j.contains("reservationFixed")) { + k.reservationFixed.emplace(j.at("reservationFixed")); + } + if (j.contains("minCost")) { + k.minCost.emplace(j.at("minCost")); + } + if (j.contains("maxCost")) { + k.maxCost.emplace(j.at("maxCost")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given LogParameters \p k to the given output stream \p os -/// \returns an output stream with the LogParameters written to -std::ostream& operator<<(std::ostream& os, const LogParameters& k) { +// \brief Writes the string representation of the given Tariff \p k to the given output stream \p os +/// \returns an output stream with the Tariff written to +std::ostream& operator<<(std::ostream& os, const Tariff& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given Component \p k to a given json object \p j -void to_json(json& j, const Component& k) { +/// \brief Conversion from a given BatteryData \p k to a given json object \p j +void to_json(json& j, const BatteryData& k) { // the required parts of the message j = json{ - {"name", k.name}, + {"evseId", k.evseId}, + {"serialNumber", k.serialNumber}, + {"soC", k.soC}, + {"soH", k.soH}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.productionDate) { + j["productionDate"] = k.productionDate.value().to_rfc3339(); } - if (k.evse) { - j["evse"] = k.evse.value(); + if (k.vendorInfo) { + j["vendorInfo"] = k.vendorInfo.value(); } - if (k.instance) { - j["instance"] = k.instance.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given Component \p k -void from_json(const json& j, Component& k) { +/// \brief Conversion from a given json object \p j to a given BatteryData \p k +void from_json(const json& j, BatteryData& k) { // the required parts of the message - k.name = j.at("name"); + k.evseId = j.at("evseId"); + k.serialNumber = j.at("serialNumber"); + k.soC = j.at("soC"); + k.soH = j.at("soH"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("productionDate")) { + k.productionDate.emplace(j.at("productionDate").get()); } - if (j.contains("evse")) { - k.evse.emplace(j.at("evse")); + if (j.contains("vendorInfo")) { + k.vendorInfo.emplace(j.at("vendorInfo")); } - if (j.contains("instance")) { - k.instance.emplace(j.at("instance")); + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given Component \p k to the given output stream \p os -/// \returns an output stream with the Component written to -std::ostream& operator<<(std::ostream& os, const Component& k) { +// \brief Writes the string representation of the given BatteryData \p k to the given output stream \p os +/// \returns an output stream with the BatteryData written to +std::ostream& operator<<(std::ostream& os, const BatteryData& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given Variable \p k to a given json object \p j -void to_json(json& j, const Variable& k) { +/// \brief Conversion from a given Modem \p k to a given json object \p j +void to_json(json& j, const Modem& k) { // the required parts of the message - j = json{ - {"name", k.name}, - }; + j = json({}, true); // the optional parts of the message + if (k.iccid) { + j["iccid"] = k.iccid.value(); + } + if (k.imsi) { + j["imsi"] = k.imsi.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.instance) { - j["instance"] = k.instance.value(); - } } -/// \brief Conversion from a given json object \p j to a given Variable \p k -void from_json(const json& j, Variable& k) { +/// \brief Conversion from a given json object \p j to a given Modem \p k +void from_json(const json& j, Modem& k) { // the required parts of the message - k.name = j.at("name"); // the optional parts of the message + if (j.contains("iccid")) { + k.iccid.emplace(j.at("iccid")); + } + if (j.contains("imsi")) { + k.imsi.emplace(j.at("imsi")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("instance")) { - k.instance.emplace(j.at("instance")); - } } -// \brief Writes the string representation of the given Variable \p k to the given output stream \p os -/// \returns an output stream with the Variable written to -std::ostream& operator<<(std::ostream& os, const Variable& k) { +// \brief Writes the string representation of the given Modem \p k to the given output stream \p os +/// \returns an output stream with the Modem written to +std::ostream& operator<<(std::ostream& os, const Modem& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ComponentVariable \p k to a given json object \p j -void to_json(json& j, const ComponentVariable& k) { +/// \brief Conversion from a given ChargingStation \p k to a given json object \p j +void to_json(json& j, const ChargingStation& k) { // the required parts of the message j = json{ - {"component", k.component}, + {"model", k.model}, + {"vendorName", k.vendorName}, }; // the optional parts of the message + if (k.serialNumber) { + j["serialNumber"] = k.serialNumber.value(); + } + if (k.modem) { + j["modem"] = k.modem.value(); + } + if (k.firmwareVersion) { + j["firmwareVersion"] = k.firmwareVersion.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.variable) { - j["variable"] = k.variable.value(); - } } -/// \brief Conversion from a given json object \p j to a given ComponentVariable \p k -void from_json(const json& j, ComponentVariable& k) { +/// \brief Conversion from a given json object \p j to a given ChargingStation \p k +void from_json(const json& j, ChargingStation& k) { // the required parts of the message - k.component = j.at("component"); + k.model = j.at("model"); + k.vendorName = j.at("vendorName"); // the optional parts of the message + if (j.contains("serialNumber")) { + k.serialNumber.emplace(j.at("serialNumber")); + } + if (j.contains("modem")) { + k.modem.emplace(j.at("modem")); + } + if (j.contains("firmwareVersion")) { + k.firmwareVersion.emplace(j.at("firmwareVersion")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("variable")) { - k.variable.emplace(j.at("variable")); - } } -// \brief Writes the string representation of the given ComponentVariable \p k to the given output stream \p os -/// \returns an output stream with the ComponentVariable written to -std::ostream& operator<<(std::ostream& os, const ComponentVariable& k) { +// \brief Writes the string representation of the given ChargingStation \p k to the given output stream \p os +/// \returns an output stream with the ChargingStation written to +std::ostream& operator<<(std::ostream& os, const ChargingStation& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given GetVariableData \p k to a given json object \p j -void to_json(json& j, const GetVariableData& k) { +/// \brief Conversion from a given EVSE \p k to a given json object \p j +void to_json(json& j, const EVSE& k) { // the required parts of the message j = json{ - {"component", k.component}, - {"variable", k.variable}, + {"id", k.id}, }; // the optional parts of the message + if (k.connectorId) { + j["connectorId"] = k.connectorId.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); - } } -/// \brief Conversion from a given json object \p j to a given GetVariableData \p k -void from_json(const json& j, GetVariableData& k) { +/// \brief Conversion from a given json object \p j to a given EVSE \p k +void from_json(const json& j, EVSE& k) { // the required parts of the message - k.component = j.at("component"); - k.variable = j.at("variable"); + k.id = j.at("id"); // the optional parts of the message + if (j.contains("connectorId")) { + k.connectorId.emplace(j.at("connectorId")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("attributeType")) { - k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); - } } -// \brief Writes the string representation of the given GetVariableData \p k to the given output stream \p os -/// \returns an output stream with the GetVariableData written to -std::ostream& operator<<(std::ostream& os, const GetVariableData& k) { +// \brief Writes the string representation of the given EVSE \p k to the given output stream \p os +/// \returns an output stream with the EVSE written to +std::ostream& operator<<(std::ostream& os, const EVSE& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given GetVariableResult \p k to a given json object \p j -void to_json(json& j, const GetVariableResult& k) { +/// \brief Conversion from a given ClearChargingProfile \p k to a given json object \p j +void to_json(json& j, const ClearChargingProfile& k) { // the required parts of the message - j = json{ - {"attributeStatus", conversions::get_variable_status_enum_to_string(k.attributeStatus)}, - {"component", k.component}, - {"variable", k.variable}, - }; + j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.evseId) { + j["evseId"] = k.evseId.value(); } - if (k.attributeStatusInfo) { - j["attributeStatusInfo"] = k.attributeStatusInfo.value(); + if (k.chargingProfilePurpose) { + j["chargingProfilePurpose"] = + conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose.value()); } - if (k.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + if (k.stackLevel) { + j["stackLevel"] = k.stackLevel.value(); } - if (k.attributeValue) { - j["attributeValue"] = k.attributeValue.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given GetVariableResult \p k -void from_json(const json& j, GetVariableResult& k) { +/// \brief Conversion from a given json object \p j to a given ClearChargingProfile \p k +void from_json(const json& j, ClearChargingProfile& k) { // the required parts of the message - k.attributeStatus = conversions::string_to_get_variable_status_enum(j.at("attributeStatus")); - k.component = j.at("component"); - k.variable = j.at("variable"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("evseId")) { + k.evseId.emplace(j.at("evseId")); } - if (j.contains("attributeStatusInfo")) { - k.attributeStatusInfo.emplace(j.at("attributeStatusInfo")); + if (j.contains("chargingProfilePurpose")) { + k.chargingProfilePurpose.emplace( + conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose"))); } - if (j.contains("attributeType")) { - k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + if (j.contains("stackLevel")) { + k.stackLevel.emplace(j.at("stackLevel")); } - if (j.contains("attributeValue")) { - k.attributeValue.emplace(j.at("attributeValue")); + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given GetVariableResult \p k to the given output stream \p os -/// \returns an output stream with the GetVariableResult written to -std::ostream& operator<<(std::ostream& os, const GetVariableResult& k) { +// \brief Writes the string representation of the given ClearChargingProfile \p k to the given output stream \p os +/// \returns an output stream with the ClearChargingProfile written to +std::ostream& operator<<(std::ostream& os, const ClearChargingProfile& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SignedMeterValue \p k to a given json object \p j -void to_json(json& j, const SignedMeterValue& k) { +/// \brief Conversion from a given ClearTariffsResult \p k to a given json object \p j +void to_json(json& j, const ClearTariffsResult& k) { // the required parts of the message j = json{ - {"signedMeterData", k.signedMeterData}, - {"signingMethod", k.signingMethod}, - {"encodingMethod", k.encodingMethod}, - {"publicKey", k.publicKey}, + {"status", conversions::tariff_clear_status_enum_to_string(k.status)}, }; // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.tariffId) { + j["tariffId"] = k.tariffId.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given SignedMeterValue \p k -void from_json(const json& j, SignedMeterValue& k) { +/// \brief Conversion from a given json object \p j to a given ClearTariffsResult \p k +void from_json(const json& j, ClearTariffsResult& k) { // the required parts of the message - k.signedMeterData = j.at("signedMeterData"); - k.signingMethod = j.at("signingMethod"); - k.encodingMethod = j.at("encodingMethod"); - k.publicKey = j.at("publicKey"); + k.status = conversions::string_to_tariff_clear_status_enum(j.at("status")); // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("tariffId")) { + k.tariffId.emplace(j.at("tariffId")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given SignedMeterValue \p k to the given output stream \p os -/// \returns an output stream with the SignedMeterValue written to -std::ostream& operator<<(std::ostream& os, const SignedMeterValue& k) { +// \brief Writes the string representation of the given ClearTariffsResult \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsResult written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsResult& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given UnitOfMeasure \p k to a given json object \p j -void to_json(json& j, const UnitOfMeasure& k) { +/// \brief Conversion from a given ClearMonitoringResult \p k to a given json object \p j +void to_json(json& j, const ClearMonitoringResult& k) { // the required parts of the message - j = json({}, true); + j = json{ + {"status", conversions::clear_monitoring_status_enum_to_string(k.status)}, + {"id", k.id}, + }; // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.unit) { - j["unit"] = k.unit.value(); - } - if (k.multiplier) { - j["multiplier"] = k.multiplier.value(); - } } -/// \brief Conversion from a given json object \p j to a given UnitOfMeasure \p k -void from_json(const json& j, UnitOfMeasure& k) { +/// \brief Conversion from a given json object \p j to a given ClearMonitoringResult \p k +void from_json(const json& j, ClearMonitoringResult& k) { // the required parts of the message + k.status = conversions::string_to_clear_monitoring_status_enum(j.at("status")); + k.id = j.at("id"); // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("unit")) { - k.unit.emplace(j.at("unit")); - } - if (j.contains("multiplier")) { - k.multiplier.emplace(j.at("multiplier")); - } } -// \brief Writes the string representation of the given UnitOfMeasure \p k to the given output stream \p os -/// \returns an output stream with the UnitOfMeasure written to -std::ostream& operator<<(std::ostream& os, const UnitOfMeasure& k) { +// \brief Writes the string representation of the given ClearMonitoringResult \p k to the given output stream \p os +/// \returns an output stream with the ClearMonitoringResult written to +std::ostream& operator<<(std::ostream& os, const ClearMonitoringResult& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SampledValue \p k to a given json object \p j -void to_json(json& j, const SampledValue& k) { +/// \brief Conversion from a given CertificateHashDataType \p k to a given json object \p j +void to_json(json& j, const CertificateHashDataType& k) { // the required parts of the message j = json{ - {"value", k.value}, + {"hashAlgorithm", conversions::hash_algorithm_enum_to_string(k.hashAlgorithm)}, + {"issuerNameHash", k.issuerNameHash}, + {"issuerKeyHash", k.issuerKeyHash}, + {"serialNumber", k.serialNumber}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.context) { - j["context"] = conversions::reading_context_enum_to_string(k.context.value()); - } - if (k.measurand) { - j["measurand"] = conversions::measurand_enum_to_string(k.measurand.value()); - } - if (k.phase) { - j["phase"] = conversions::phase_enum_to_string(k.phase.value()); - } - if (k.location) { - j["location"] = conversions::location_enum_to_string(k.location.value()); - } - if (k.signedMeterValue) { - j["signedMeterValue"] = k.signedMeterValue.value(); - } - if (k.unitOfMeasure) { - j["unitOfMeasure"] = k.unitOfMeasure.value(); - } } -/// \brief Conversion from a given json object \p j to a given SampledValue \p k -void from_json(const json& j, SampledValue& k) { +/// \brief Conversion from a given json object \p j to a given CertificateHashDataType \p k +void from_json(const json& j, CertificateHashDataType& k) { // the required parts of the message - k.value = j.at("value"); + k.hashAlgorithm = conversions::string_to_hash_algorithm_enum(j.at("hashAlgorithm")); + k.issuerNameHash = j.at("issuerNameHash"); + k.issuerKeyHash = j.at("issuerKeyHash"); + k.serialNumber = j.at("serialNumber"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("context")) { - k.context.emplace(conversions::string_to_reading_context_enum(j.at("context"))); - } - if (j.contains("measurand")) { - k.measurand.emplace(conversions::string_to_measurand_enum(j.at("measurand"))); - } - if (j.contains("phase")) { - k.phase.emplace(conversions::string_to_phase_enum(j.at("phase"))); - } - if (j.contains("location")) { - k.location.emplace(conversions::string_to_location_enum(j.at("location"))); - } - if (j.contains("signedMeterValue")) { - k.signedMeterValue.emplace(j.at("signedMeterValue")); - } - if (j.contains("unitOfMeasure")) { - k.unitOfMeasure.emplace(j.at("unitOfMeasure")); - } } -// \brief Writes the string representation of the given SampledValue \p k to the given output stream \p os -/// \returns an output stream with the SampledValue written to -std::ostream& operator<<(std::ostream& os, const SampledValue& k) { +// \brief Writes the string representation of the given CertificateHashDataType \p k to the given output stream \p os +/// \returns an output stream with the CertificateHashDataType written to +std::ostream& operator<<(std::ostream& os, const CertificateHashDataType& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given MeterValue \p k to a given json object \p j -void to_json(json& j, const MeterValue& k) { +/// \brief Conversion from a given CertificateStatusRequestInfo \p k to a given json object \p j +void to_json(json& j, const CertificateStatusRequestInfo& k) { // the required parts of the message j = json{ - {"sampledValue", k.sampledValue}, - {"timestamp", k.timestamp.to_rfc3339()}, + {"certificateHashData", k.certificateHashData}, + {"source", conversions::certificate_status_source_enum_to_string(k.source)}, + {"urls", k.urls}, }; // the optional parts of the message if (k.customData) { @@ -1138,13 +1349,14 @@ void to_json(json& j, const MeterValue& k) { } } -/// \brief Conversion from a given json object \p j to a given MeterValue \p k -void from_json(const json& j, MeterValue& k) { +/// \brief Conversion from a given json object \p j to a given CertificateStatusRequestInfo \p k +void from_json(const json& j, CertificateStatusRequestInfo& k) { // the required parts of the message - for (auto val : j.at("sampledValue")) { - k.sampledValue.push_back(val); + k.certificateHashData = j.at("certificateHashData"); + k.source = conversions::string_to_certificate_status_source_enum(j.at("source")); + for (auto val : j.at("urls")) { + k.urls.push_back(val); } - k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); // the optional parts of the message if (j.contains("customData")) { @@ -1152,93 +1364,133 @@ void from_json(const json& j, MeterValue& k) { } } -// \brief Writes the string representation of the given MeterValue \p k to the given output stream \p os -/// \returns an output stream with the MeterValue written to -std::ostream& operator<<(std::ostream& os, const MeterValue& k) { +// \brief Writes the string representation of the given CertificateStatusRequestInfo \p k to the given output stream \p +// os +/// \returns an output stream with the CertificateStatusRequestInfo written to +std::ostream& operator<<(std::ostream& os, const CertificateStatusRequestInfo& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given RelativeTimeInterval \p k to a given json object \p j -void to_json(json& j, const RelativeTimeInterval& k) { +/// \brief Conversion from a given CertificateStatus \p k to a given json object \p j +void to_json(json& j, const CertificateStatus& k) { // the required parts of the message j = json{ - {"start", k.start}, + {"certificateHashData", k.certificateHashData}, + {"source", conversions::certificate_status_source_enum_to_string(k.source)}, + {"status", conversions::certificate_status_enum_to_string(k.status)}, + {"nextUpdate", k.nextUpdate.to_rfc3339()}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.duration) { - j["duration"] = k.duration.value(); - } } -/// \brief Conversion from a given json object \p j to a given RelativeTimeInterval \p k -void from_json(const json& j, RelativeTimeInterval& k) { +/// \brief Conversion from a given json object \p j to a given CertificateStatus \p k +void from_json(const json& j, CertificateStatus& k) { // the required parts of the message - k.start = j.at("start"); + k.certificateHashData = j.at("certificateHashData"); + k.source = conversions::string_to_certificate_status_source_enum(j.at("source")); + k.status = conversions::string_to_certificate_status_enum(j.at("status")); + k.nextUpdate = ocpp::DateTime(std::string(j.at("nextUpdate"))); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("duration")) { - k.duration.emplace(j.at("duration")); - } } -// \brief Writes the string representation of the given RelativeTimeInterval \p k to the given output stream \p os -/// \returns an output stream with the RelativeTimeInterval written to -std::ostream& operator<<(std::ostream& os, const RelativeTimeInterval& k) { +// \brief Writes the string representation of the given CertificateStatus \p k to the given output stream \p os +/// \returns an output stream with the CertificateStatus written to +std::ostream& operator<<(std::ostream& os, const CertificateStatus& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given Cost \p k to a given json object \p j -void to_json(json& j, const Cost& k) { +/// \brief Conversion from a given ChargingProfileCriterion \p k to a given json object \p j +void to_json(json& j, const ChargingProfileCriterion& k) { // the required parts of the message - j = json{ - {"costKind", conversions::cost_kind_enum_to_string(k.costKind)}, - {"amount", k.amount}, - }; + j = json({}, true); // the optional parts of the message + if (k.chargingProfilePurpose) { + j["chargingProfilePurpose"] = + conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose.value()); + } + if (k.stackLevel) { + j["stackLevel"] = k.stackLevel.value(); + } + if (k.chargingProfileId) { + if (j.size() == 0) { + j = json{{"chargingProfileId", json::array()}}; + } else { + j["chargingProfileId"] = json::array(); + } + for (auto val : k.chargingProfileId.value()) { + j["chargingProfileId"].push_back(val); + } + } + if (k.chargingLimitSource) { + if (j.size() == 0) { + j = json{{"chargingLimitSource", json::array()}}; + } else { + j["chargingLimitSource"] = json::array(); + } + for (auto val : k.chargingLimitSource.value()) { + j["chargingLimitSource"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.amountMultiplier) { - j["amountMultiplier"] = k.amountMultiplier.value(); - } } -/// \brief Conversion from a given json object \p j to a given Cost \p k -void from_json(const json& j, Cost& k) { +/// \brief Conversion from a given json object \p j to a given ChargingProfileCriterion \p k +void from_json(const json& j, ChargingProfileCriterion& k) { // the required parts of the message - k.costKind = conversions::string_to_cost_kind_enum(j.at("costKind")); - k.amount = j.at("amount"); // the optional parts of the message + if (j.contains("chargingProfilePurpose")) { + k.chargingProfilePurpose.emplace( + conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose"))); + } + if (j.contains("stackLevel")) { + k.stackLevel.emplace(j.at("stackLevel")); + } + if (j.contains("chargingProfileId")) { + json arr = j.at("chargingProfileId"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.chargingProfileId.emplace(vec); + } + if (j.contains("chargingLimitSource")) { + json arr = j.at("chargingLimitSource"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.chargingLimitSource.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("amountMultiplier")) { - k.amountMultiplier.emplace(j.at("amountMultiplier")); - } } -// \brief Writes the string representation of the given Cost \p k to the given output stream \p os -/// \returns an output stream with the Cost written to -std::ostream& operator<<(std::ostream& os, const Cost& k) { +// \brief Writes the string representation of the given ChargingProfileCriterion \p k to the given output stream \p os +/// \returns an output stream with the ChargingProfileCriterion written to +std::ostream& operator<<(std::ostream& os, const ChargingProfileCriterion& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ConsumptionCost \p k to a given json object \p j -void to_json(json& j, const ConsumptionCost& k) { +/// \brief Conversion from a given V2XFreqWattPoint \p k to a given json object \p j +void to_json(json& j, const V2XFreqWattPoint& k) { // the required parts of the message j = json{ - {"startValue", k.startValue}, - {"cost", k.cost}, + {"frequency", k.frequency}, + {"power", k.power}, }; // the optional parts of the message if (k.customData) { @@ -1246,13 +1498,11 @@ void to_json(json& j, const ConsumptionCost& k) { } } -/// \brief Conversion from a given json object \p j to a given ConsumptionCost \p k -void from_json(const json& j, ConsumptionCost& k) { +/// \brief Conversion from a given json object \p j to a given V2XFreqWattPoint \p k +void from_json(const json& j, V2XFreqWattPoint& k) { // the required parts of the message - k.startValue = j.at("startValue"); - for (auto val : j.at("cost")) { - k.cost.push_back(val); - } + k.frequency = j.at("frequency"); + k.power = j.at("power"); // the optional parts of the message if (j.contains("customData")) { @@ -1260,114 +1510,218 @@ void from_json(const json& j, ConsumptionCost& k) { } } -// \brief Writes the string representation of the given ConsumptionCost \p k to the given output stream \p os -/// \returns an output stream with the ConsumptionCost written to -std::ostream& operator<<(std::ostream& os, const ConsumptionCost& k) { +// \brief Writes the string representation of the given V2XFreqWattPoint \p k to the given output stream \p os +/// \returns an output stream with the V2XFreqWattPoint written to +std::ostream& operator<<(std::ostream& os, const V2XFreqWattPoint& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SalesTariffEntry \p k to a given json object \p j -void to_json(json& j, const SalesTariffEntry& k) { +/// \brief Conversion from a given V2XSignalWattPoint \p k to a given json object \p j +void to_json(json& j, const V2XSignalWattPoint& k) { // the required parts of the message j = json{ - {"relativeTimeInterval", k.relativeTimeInterval}, + {"signal", k.signal}, + {"power", k.power}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.ePriceLevel) { - j["ePriceLevel"] = k.ePriceLevel.value(); - } - if (k.consumptionCost) { - j["consumptionCost"] = json::array(); - for (auto val : k.consumptionCost.value()) { - j["consumptionCost"].push_back(val); - } - } } -/// \brief Conversion from a given json object \p j to a given SalesTariffEntry \p k -void from_json(const json& j, SalesTariffEntry& k) { +/// \brief Conversion from a given json object \p j to a given V2XSignalWattPoint \p k +void from_json(const json& j, V2XSignalWattPoint& k) { // the required parts of the message - k.relativeTimeInterval = j.at("relativeTimeInterval"); + k.signal = j.at("signal"); + k.power = j.at("power"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("ePriceLevel")) { - k.ePriceLevel.emplace(j.at("ePriceLevel")); - } - if (j.contains("consumptionCost")) { - json arr = j.at("consumptionCost"); - std::vector vec; - for (auto val : arr) { - vec.push_back(val); - } - k.consumptionCost.emplace(vec); - } } -// \brief Writes the string representation of the given SalesTariffEntry \p k to the given output stream \p os -/// \returns an output stream with the SalesTariffEntry written to -std::ostream& operator<<(std::ostream& os, const SalesTariffEntry& k) { +// \brief Writes the string representation of the given V2XSignalWattPoint \p k to the given output stream \p os +/// \returns an output stream with the V2XSignalWattPoint written to +std::ostream& operator<<(std::ostream& os, const V2XSignalWattPoint& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SalesTariff \p k to a given json object \p j -void to_json(json& j, const SalesTariff& k) { +/// \brief Conversion from a given ChargingSchedulePeriod \p k to a given json object \p j +void to_json(json& j, const ChargingSchedulePeriod& k) { // the required parts of the message j = json{ - {"id", k.id}, - {"salesTariffEntry", k.salesTariffEntry}, + {"startPeriod", k.startPeriod}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.limit) { + j["limit"] = k.limit.value(); } - if (k.salesTariffDescription) { - j["salesTariffDescription"] = k.salesTariffDescription.value(); + if (k.limit_L2) { + j["limit_L2"] = k.limit_L2.value(); } - if (k.numEPriceLevels) { - j["numEPriceLevels"] = k.numEPriceLevels.value(); + if (k.limit_L3) { + j["limit_L3"] = k.limit_L3.value(); } -} - -/// \brief Conversion from a given json object \p j to a given SalesTariff \p k -void from_json(const json& j, SalesTariff& k) { - // the required parts of the message - k.id = j.at("id"); - for (auto val : j.at("salesTariffEntry")) { - k.salesTariffEntry.push_back(val); + if (k.numberPhases) { + j["numberPhases"] = k.numberPhases.value(); + } + if (k.phaseToUse) { + j["phaseToUse"] = k.phaseToUse.value(); + } + if (k.dischargeLimit) { + j["dischargeLimit"] = k.dischargeLimit.value(); + } + if (k.dischargeLimit_L2) { + j["dischargeLimit_L2"] = k.dischargeLimit_L2.value(); + } + if (k.dischargeLimit_L3) { + j["dischargeLimit_L3"] = k.dischargeLimit_L3.value(); + } + if (k.setpoint) { + j["setpoint"] = k.setpoint.value(); + } + if (k.setpoint_L2) { + j["setpoint_L2"] = k.setpoint_L2.value(); + } + if (k.setpoint_L3) { + j["setpoint_L3"] = k.setpoint_L3.value(); + } + if (k.setpointReactive) { + j["setpointReactive"] = k.setpointReactive.value(); + } + if (k.setpointReactive_L2) { + j["setpointReactive_L2"] = k.setpointReactive_L2.value(); + } + if (k.setpointReactive_L3) { + j["setpointReactive_L3"] = k.setpointReactive_L3.value(); + } + if (k.preconditioningRequest) { + j["preconditioningRequest"] = k.preconditioningRequest.value(); + } + if (k.evseSleep) { + j["evseSleep"] = k.evseSleep.value(); } + if (k.v2xBaseline) { + j["v2xBaseline"] = k.v2xBaseline.value(); + } + if (k.operationMode) { + j["operationMode"] = conversions::operation_mode_enum_to_string(k.operationMode.value()); + } + if (k.v2xFreqWattCurve) { + j["v2xFreqWattCurve"] = json::array(); + for (auto val : k.v2xFreqWattCurve.value()) { + j["v2xFreqWattCurve"].push_back(val); + } + } + if (k.v2xSignalWattCurve) { + j["v2xSignalWattCurve"] = json::array(); + for (auto val : k.v2xSignalWattCurve.value()) { + j["v2xSignalWattCurve"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingSchedulePeriod \p k +void from_json(const json& j, ChargingSchedulePeriod& k) { + // the required parts of the message + k.startPeriod = j.at("startPeriod"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("limit")) { + k.limit.emplace(j.at("limit")); } - if (j.contains("salesTariffDescription")) { - k.salesTariffDescription.emplace(j.at("salesTariffDescription")); + if (j.contains("limit_L2")) { + k.limit_L2.emplace(j.at("limit_L2")); } - if (j.contains("numEPriceLevels")) { - k.numEPriceLevels.emplace(j.at("numEPriceLevels")); + if (j.contains("limit_L3")) { + k.limit_L3.emplace(j.at("limit_L3")); + } + if (j.contains("numberPhases")) { + k.numberPhases.emplace(j.at("numberPhases")); + } + if (j.contains("phaseToUse")) { + k.phaseToUse.emplace(j.at("phaseToUse")); + } + if (j.contains("dischargeLimit")) { + k.dischargeLimit.emplace(j.at("dischargeLimit")); + } + if (j.contains("dischargeLimit_L2")) { + k.dischargeLimit_L2.emplace(j.at("dischargeLimit_L2")); + } + if (j.contains("dischargeLimit_L3")) { + k.dischargeLimit_L3.emplace(j.at("dischargeLimit_L3")); + } + if (j.contains("setpoint")) { + k.setpoint.emplace(j.at("setpoint")); + } + if (j.contains("setpoint_L2")) { + k.setpoint_L2.emplace(j.at("setpoint_L2")); + } + if (j.contains("setpoint_L3")) { + k.setpoint_L3.emplace(j.at("setpoint_L3")); + } + if (j.contains("setpointReactive")) { + k.setpointReactive.emplace(j.at("setpointReactive")); + } + if (j.contains("setpointReactive_L2")) { + k.setpointReactive_L2.emplace(j.at("setpointReactive_L2")); + } + if (j.contains("setpointReactive_L3")) { + k.setpointReactive_L3.emplace(j.at("setpointReactive_L3")); + } + if (j.contains("preconditioningRequest")) { + k.preconditioningRequest.emplace(j.at("preconditioningRequest")); + } + if (j.contains("evseSleep")) { + k.evseSleep.emplace(j.at("evseSleep")); + } + if (j.contains("v2xBaseline")) { + k.v2xBaseline.emplace(j.at("v2xBaseline")); + } + if (j.contains("operationMode")) { + k.operationMode.emplace(conversions::string_to_operation_mode_enum(j.at("operationMode"))); + } + if (j.contains("v2xFreqWattCurve")) { + json arr = j.at("v2xFreqWattCurve"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.v2xFreqWattCurve.emplace(vec); + } + if (j.contains("v2xSignalWattCurve")) { + json arr = j.at("v2xSignalWattCurve"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.v2xSignalWattCurve.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given SalesTariff \p k to the given output stream \p os -/// \returns an output stream with the SalesTariff written to -std::ostream& operator<<(std::ostream& os, const SalesTariff& k) { +// \brief Writes the string representation of the given ChargingSchedulePeriod \p k to the given output stream \p os +/// \returns an output stream with the ChargingSchedulePeriod written to +std::ostream& operator<<(std::ostream& os, const ChargingSchedulePeriod& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingSchedule \p k to a given json object \p j -void to_json(json& j, const ChargingSchedule& k) { +/// \brief Conversion from a given CompositeSchedule \p k to a given json object \p j +void to_json(json& j, const CompositeSchedule& k) { // the required parts of the message j = json{ - {"id", k.id}, + {"evseId", k.evseId}, + {"duration", k.duration}, + {"scheduleStart", k.scheduleStart.to_rfc3339()}, {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, {"chargingSchedulePeriod", k.chargingSchedulePeriod}, }; @@ -1375,24 +1729,14 @@ void to_json(json& j, const ChargingSchedule& k) { if (k.customData) { j["customData"] = k.customData.value(); } - if (k.startSchedule) { - j["startSchedule"] = k.startSchedule.value().to_rfc3339(); - } - if (k.duration) { - j["duration"] = k.duration.value(); - } - if (k.minChargingRate) { - j["minChargingRate"] = k.minChargingRate.value(); - } - if (k.salesTariff) { - j["salesTariff"] = k.salesTariff.value(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingSchedule \p k -void from_json(const json& j, ChargingSchedule& k) { +/// \brief Conversion from a given json object \p j to a given CompositeSchedule \p k +void from_json(const json& j, CompositeSchedule& k) { // the required parts of the message - k.id = j.at("id"); + k.evseId = j.at("evseId"); + k.duration = j.at("duration"); + k.scheduleStart = ocpp::DateTime(std::string(j.at("scheduleStart"))); k.chargingRateUnit = conversions::string_to_charging_rate_unit_enum(j.at("chargingRateUnit")); for (auto val : j.at("chargingSchedulePeriod")) { k.chargingSchedulePeriod.push_back(val); @@ -1402,1040 +1746,4542 @@ void from_json(const json& j, ChargingSchedule& k) { if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("startSchedule")) { - k.startSchedule.emplace(j.at("startSchedule").get()); - } - if (j.contains("duration")) { - k.duration.emplace(j.at("duration")); - } - if (j.contains("minChargingRate")) { - k.minChargingRate.emplace(j.at("minChargingRate")); - } - if (j.contains("salesTariff")) { - k.salesTariff.emplace(j.at("salesTariff")); - } } -// \brief Writes the string representation of the given ChargingSchedule \p k to the given output stream \p os -/// \returns an output stream with the ChargingSchedule written to -std::ostream& operator<<(std::ostream& os, const ChargingSchedule& k) { +// \brief Writes the string representation of the given CompositeSchedule \p k to the given output stream \p os +/// \returns an output stream with the CompositeSchedule written to +std::ostream& operator<<(std::ostream& os, const CompositeSchedule& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingLimit \p k to a given json object \p j -void to_json(json& j, const ChargingLimit& k) { +/// \brief Conversion from a given CertificateHashDataChain \p k to a given json object \p j +void to_json(json& j, const CertificateHashDataChain& k) { // the required parts of the message j = json{ - {"chargingLimitSource", conversions::charging_limit_source_enum_to_string(k.chargingLimitSource)}, + {"certificateHashData", k.certificateHashData}, + {"certificateType", conversions::get_certificate_id_use_enum_to_string(k.certificateType)}, }; // the optional parts of the message + if (k.childCertificateHashData) { + j["childCertificateHashData"] = json::array(); + for (auto val : k.childCertificateHashData.value()) { + j["childCertificateHashData"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.isGridCritical) { - j["isGridCritical"] = k.isGridCritical.value(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingLimit \p k -void from_json(const json& j, ChargingLimit& k) { +/// \brief Conversion from a given json object \p j to a given CertificateHashDataChain \p k +void from_json(const json& j, CertificateHashDataChain& k) { // the required parts of the message - k.chargingLimitSource = conversions::string_to_charging_limit_source_enum(j.at("chargingLimitSource")); + k.certificateHashData = j.at("certificateHashData"); + k.certificateType = conversions::string_to_get_certificate_id_use_enum(j.at("certificateType")); // the optional parts of the message + if (j.contains("childCertificateHashData")) { + json arr = j.at("childCertificateHashData"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.childCertificateHashData.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("isGridCritical")) { - k.isGridCritical.emplace(j.at("isGridCritical")); - } } -// \brief Writes the string representation of the given ChargingLimit \p k to the given output stream \p os -/// \returns an output stream with the ChargingLimit written to -std::ostream& operator<<(std::ostream& os, const ChargingLimit& k) { +// \brief Writes the string representation of the given CertificateHashDataChain \p k to the given output stream \p os +/// \returns an output stream with the CertificateHashDataChain written to +std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given MessageInfo \p k to a given json object \p j -void to_json(json& j, const MessageInfo& k) { +/// \brief Conversion from a given LogParameters \p k to a given json object \p j +void to_json(json& j, const LogParameters& k) { // the required parts of the message j = json{ - {"id", k.id}, - {"priority", conversions::message_priority_enum_to_string(k.priority)}, - {"message", k.message}, + {"remoteLocation", k.remoteLocation}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } - if (k.display) { - j["display"] = k.display.value(); - } - if (k.state) { - j["state"] = conversions::message_state_enum_to_string(k.state.value()); - } - if (k.startDateTime) { - j["startDateTime"] = k.startDateTime.value().to_rfc3339(); + if (k.oldestTimestamp) { + j["oldestTimestamp"] = k.oldestTimestamp.value().to_rfc3339(); } - if (k.endDateTime) { - j["endDateTime"] = k.endDateTime.value().to_rfc3339(); + if (k.latestTimestamp) { + j["latestTimestamp"] = k.latestTimestamp.value().to_rfc3339(); } - if (k.transactionId) { - j["transactionId"] = k.transactionId.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given MessageInfo \p k -void from_json(const json& j, MessageInfo& k) { +/// \brief Conversion from a given json object \p j to a given LogParameters \p k +void from_json(const json& j, LogParameters& k) { // the required parts of the message - k.id = j.at("id"); - k.priority = conversions::string_to_message_priority_enum(j.at("priority")); - k.message = j.at("message"); + k.remoteLocation = j.at("remoteLocation"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } - if (j.contains("display")) { - k.display.emplace(j.at("display")); - } - if (j.contains("state")) { - k.state.emplace(conversions::string_to_message_state_enum(j.at("state"))); - } - if (j.contains("startDateTime")) { - k.startDateTime.emplace(j.at("startDateTime").get()); + if (j.contains("oldestTimestamp")) { + k.oldestTimestamp.emplace(j.at("oldestTimestamp").get()); } - if (j.contains("endDateTime")) { - k.endDateTime.emplace(j.at("endDateTime").get()); + if (j.contains("latestTimestamp")) { + k.latestTimestamp.emplace(j.at("latestTimestamp").get()); } - if (j.contains("transactionId")) { - k.transactionId.emplace(j.at("transactionId")); + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given MessageInfo \p k to the given output stream \p os -/// \returns an output stream with the MessageInfo written to -std::ostream& operator<<(std::ostream& os, const MessageInfo& k) { +// \brief Writes the string representation of the given LogParameters \p k to the given output stream \p os +/// \returns an output stream with the LogParameters written to +std::ostream& operator<<(std::ostream& os, const LogParameters& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ACChargingParameters \p k to a given json object \p j -void to_json(json& j, const ACChargingParameters& k) { +/// \brief Conversion from a given Component \p k to a given json object \p j +void to_json(json& j, const Component& k) { // the required parts of the message j = json{ - {"energyAmount", k.energyAmount}, - {"evMinCurrent", k.evMinCurrent}, - {"evMaxCurrent", k.evMaxCurrent}, - {"evMaxVoltage", k.evMaxVoltage}, + {"name", k.name}, }; // the optional parts of the message + if (k.evse) { + j["evse"] = k.evse.value(); + } + if (k.instance) { + j["instance"] = k.instance.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given ACChargingParameters \p k -void from_json(const json& j, ACChargingParameters& k) { +/// \brief Conversion from a given json object \p j to a given Component \p k +void from_json(const json& j, Component& k) { // the required parts of the message - k.energyAmount = j.at("energyAmount"); - k.evMinCurrent = j.at("evMinCurrent"); - k.evMaxCurrent = j.at("evMaxCurrent"); - k.evMaxVoltage = j.at("evMaxVoltage"); + k.name = j.at("name"); // the optional parts of the message + if (j.contains("evse")) { + k.evse.emplace(j.at("evse")); + } + if (j.contains("instance")) { + k.instance.emplace(j.at("instance")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given ACChargingParameters \p k to the given output stream \p os -/// \returns an output stream with the ACChargingParameters written to -std::ostream& operator<<(std::ostream& os, const ACChargingParameters& k) { - os << json(k).dump(4); - return os; +// \brief Writes the string representation of the given Component \p k to the given output stream \p os +/// \returns an output stream with the Component written to +std::ostream& operator<<(std::ostream& os, const Component& k) { + os << json(k).dump(4); + return os; } -/// \brief Conversion from a given DCChargingParameters \p k to a given json object \p j -void to_json(json& j, const DCChargingParameters& k) { +/// \brief Conversion from a given Variable \p k to a given json object \p j +void to_json(json& j, const Variable& k) { // the required parts of the message j = json{ - {"evMaxCurrent", k.evMaxCurrent}, - {"evMaxVoltage", k.evMaxVoltage}, + {"name", k.name}, }; // the optional parts of the message + if (k.instance) { + j["instance"] = k.instance.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.energyAmount) { - j["energyAmount"] = k.energyAmount.value(); - } - if (k.evMaxPower) { - j["evMaxPower"] = k.evMaxPower.value(); - } - if (k.stateOfCharge) { - j["stateOfCharge"] = k.stateOfCharge.value(); - } - if (k.evEnergyCapacity) { - j["evEnergyCapacity"] = k.evEnergyCapacity.value(); - } - if (k.fullSoC) { - j["fullSoC"] = k.fullSoC.value(); - } - if (k.bulkSoC) { - j["bulkSoC"] = k.bulkSoC.value(); - } } -/// \brief Conversion from a given json object \p j to a given DCChargingParameters \p k -void from_json(const json& j, DCChargingParameters& k) { +/// \brief Conversion from a given json object \p j to a given Variable \p k +void from_json(const json& j, Variable& k) { // the required parts of the message - k.evMaxCurrent = j.at("evMaxCurrent"); - k.evMaxVoltage = j.at("evMaxVoltage"); + k.name = j.at("name"); // the optional parts of the message + if (j.contains("instance")) { + k.instance.emplace(j.at("instance")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("energyAmount")) { - k.energyAmount.emplace(j.at("energyAmount")); - } - if (j.contains("evMaxPower")) { - k.evMaxPower.emplace(j.at("evMaxPower")); - } - if (j.contains("stateOfCharge")) { - k.stateOfCharge.emplace(j.at("stateOfCharge")); - } - if (j.contains("evEnergyCapacity")) { - k.evEnergyCapacity.emplace(j.at("evEnergyCapacity")); - } - if (j.contains("fullSoC")) { - k.fullSoC.emplace(j.at("fullSoC")); - } - if (j.contains("bulkSoC")) { - k.bulkSoC.emplace(j.at("bulkSoC")); - } } -// \brief Writes the string representation of the given DCChargingParameters \p k to the given output stream \p os -/// \returns an output stream with the DCChargingParameters written to -std::ostream& operator<<(std::ostream& os, const DCChargingParameters& k) { +// \brief Writes the string representation of the given Variable \p k to the given output stream \p os +/// \returns an output stream with the Variable written to +std::ostream& operator<<(std::ostream& os, const Variable& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingNeeds \p k to a given json object \p j -void to_json(json& j, const ChargingNeeds& k) { +/// \brief Conversion from a given ComponentVariable \p k to a given json object \p j +void to_json(json& j, const ComponentVariable& k) { // the required parts of the message j = json{ - {"requestedEnergyTransfer", conversions::energy_transfer_mode_enum_to_string(k.requestedEnergyTransfer)}, + {"component", k.component}, }; // the optional parts of the message + if (k.variable) { + j["variable"] = k.variable.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.acChargingParameters) { - j["acChargingParameters"] = k.acChargingParameters.value(); - } - if (k.dcChargingParameters) { - j["dcChargingParameters"] = k.dcChargingParameters.value(); - } - if (k.departureTime) { - j["departureTime"] = k.departureTime.value().to_rfc3339(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingNeeds \p k -void from_json(const json& j, ChargingNeeds& k) { +/// \brief Conversion from a given json object \p j to a given ComponentVariable \p k +void from_json(const json& j, ComponentVariable& k) { // the required parts of the message - k.requestedEnergyTransfer = conversions::string_to_energy_transfer_mode_enum(j.at("requestedEnergyTransfer")); + k.component = j.at("component"); // the optional parts of the message + if (j.contains("variable")) { + k.variable.emplace(j.at("variable")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("acChargingParameters")) { - k.acChargingParameters.emplace(j.at("acChargingParameters")); - } - if (j.contains("dcChargingParameters")) { - k.dcChargingParameters.emplace(j.at("dcChargingParameters")); - } - if (j.contains("departureTime")) { - k.departureTime.emplace(j.at("departureTime").get()); - } } -// \brief Writes the string representation of the given ChargingNeeds \p k to the given output stream \p os -/// \returns an output stream with the ChargingNeeds written to -std::ostream& operator<<(std::ostream& os, const ChargingNeeds& k) { +// \brief Writes the string representation of the given ComponentVariable \p k to the given output stream \p os +/// \returns an output stream with the ComponentVariable written to +std::ostream& operator<<(std::ostream& os, const ComponentVariable& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given EventData \p k to a given json object \p j -void to_json(json& j, const EventData& k) { +/// \brief Conversion from a given ConstantStreamData \p k to a given json object \p j +void to_json(json& j, const ConstantStreamData& k) { // the required parts of the message j = json{ - {"eventId", k.eventId}, - {"timestamp", k.timestamp.to_rfc3339()}, - {"trigger", conversions::event_trigger_enum_to_string(k.trigger)}, - {"actualValue", k.actualValue}, - {"component", k.component}, - {"eventNotificationType", conversions::event_notification_enum_to_string(k.eventNotificationType)}, - {"variable", k.variable}, + {"id", k.id}, + {"params", k.params}, + {"variableMonitoringId", k.variableMonitoringId}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.cause) { - j["cause"] = k.cause.value(); - } - if (k.techCode) { - j["techCode"] = k.techCode.value(); - } - if (k.techInfo) { - j["techInfo"] = k.techInfo.value(); - } - if (k.cleared) { - j["cleared"] = k.cleared.value(); - } - if (k.transactionId) { - j["transactionId"] = k.transactionId.value(); - } - if (k.variableMonitoringId) { - j["variableMonitoringId"] = k.variableMonitoringId.value(); - } } -/// \brief Conversion from a given json object \p j to a given EventData \p k -void from_json(const json& j, EventData& k) { +/// \brief Conversion from a given json object \p j to a given ConstantStreamData \p k +void from_json(const json& j, ConstantStreamData& k) { // the required parts of the message - k.eventId = j.at("eventId"); - k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); - k.trigger = conversions::string_to_event_trigger_enum(j.at("trigger")); - k.actualValue = j.at("actualValue"); - k.component = j.at("component"); - k.eventNotificationType = conversions::string_to_event_notification_enum(j.at("eventNotificationType")); - k.variable = j.at("variable"); + k.id = j.at("id"); + k.params = j.at("params"); + k.variableMonitoringId = j.at("variableMonitoringId"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("cause")) { - k.cause.emplace(j.at("cause")); - } - if (j.contains("techCode")) { - k.techCode.emplace(j.at("techCode")); - } - if (j.contains("techInfo")) { - k.techInfo.emplace(j.at("techInfo")); - } - if (j.contains("cleared")) { - k.cleared.emplace(j.at("cleared")); - } - if (j.contains("transactionId")) { - k.transactionId.emplace(j.at("transactionId")); - } - if (j.contains("variableMonitoringId")) { - k.variableMonitoringId.emplace(j.at("variableMonitoringId")); - } } -// \brief Writes the string representation of the given EventData \p k to the given output stream \p os -/// \returns an output stream with the EventData written to -std::ostream& operator<<(std::ostream& os, const EventData& k) { +// \brief Writes the string representation of the given ConstantStreamData \p k to the given output stream \p os +/// \returns an output stream with the ConstantStreamData written to +std::ostream& operator<<(std::ostream& os, const ConstantStreamData& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given VariableMonitoring \p k to a given json object \p j -void to_json(json& j, const VariableMonitoring& k) { +/// \brief Conversion from a given TariffAssignment \p k to a given json object \p j +void to_json(json& j, const TariffAssignment& k) { // the required parts of the message j = json{ - {"id", k.id}, - {"transaction", k.transaction}, - {"value", k.value}, - {"type", conversions::monitor_enum_to_string(k.type)}, - {"severity", k.severity}, + {"tariffId", k.tariffId}, + {"tariffKind", conversions::tariff_kind_enum_to_string(k.tariffKind)}, }; // the optional parts of the message + if (k.validFrom) { + j["validFrom"] = k.validFrom.value().to_rfc3339(); + } + if (k.evseIds) { + j["evseIds"] = json::array(); + for (auto val : k.evseIds.value()) { + j["evseIds"].push_back(val); + } + } + if (k.idTokens) { + j["idTokens"] = json::array(); + for (auto val : k.idTokens.value()) { + j["idTokens"].push_back(val); + } + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given VariableMonitoring \p k -void from_json(const json& j, VariableMonitoring& k) { +/// \brief Conversion from a given json object \p j to a given TariffAssignment \p k +void from_json(const json& j, TariffAssignment& k) { // the required parts of the message - k.id = j.at("id"); - k.transaction = j.at("transaction"); - k.value = j.at("value"); - k.type = conversions::string_to_monitor_enum(j.at("type")); - k.severity = j.at("severity"); + k.tariffId = j.at("tariffId"); + k.tariffKind = conversions::string_to_tariff_kind_enum(j.at("tariffKind")); // the optional parts of the message + if (j.contains("validFrom")) { + k.validFrom.emplace(j.at("validFrom").get()); + } + if (j.contains("evseIds")) { + json arr = j.at("evseIds"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.evseIds.emplace(vec); + } + if (j.contains("idTokens")) { + json arr = j.at("idTokens"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.idTokens.emplace(vec); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given VariableMonitoring \p k to the given output stream \p os -/// \returns an output stream with the VariableMonitoring written to -std::ostream& operator<<(std::ostream& os, const VariableMonitoring& k) { +// \brief Writes the string representation of the given TariffAssignment \p k to the given output stream \p os +/// \returns an output stream with the TariffAssignment written to +std::ostream& operator<<(std::ostream& os, const TariffAssignment& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given MonitoringData \p k to a given json object \p j -void to_json(json& j, const MonitoringData& k) { +/// \brief Conversion from a given GetVariableData \p k to a given json object \p j +void to_json(json& j, const GetVariableData& k) { // the required parts of the message j = json{ {"component", k.component}, {"variable", k.variable}, - {"variableMonitoring", k.variableMonitoring}, }; // the optional parts of the message + if (k.attributeType) { + j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + } if (k.customData) { j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given MonitoringData \p k -void from_json(const json& j, MonitoringData& k) { +/// \brief Conversion from a given json object \p j to a given GetVariableData \p k +void from_json(const json& j, GetVariableData& k) { // the required parts of the message k.component = j.at("component"); k.variable = j.at("variable"); - for (auto val : j.at("variableMonitoring")) { - k.variableMonitoring.push_back(val); - } // the optional parts of the message + if (j.contains("attributeType")) { + k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given MonitoringData \p k to the given output stream \p os -/// \returns an output stream with the MonitoringData written to -std::ostream& operator<<(std::ostream& os, const MonitoringData& k) { +// \brief Writes the string representation of the given GetVariableData \p k to the given output stream \p os +/// \returns an output stream with the GetVariableData written to +std::ostream& operator<<(std::ostream& os, const GetVariableData& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given VariableAttribute \p k to a given json object \p j -void to_json(json& j, const VariableAttribute& k) { +/// \brief Conversion from a given GetVariableResult \p k to a given json object \p j +void to_json(json& j, const GetVariableResult& k) { // the required parts of the message - j = json({}, true); + j = json{ + {"attributeStatus", conversions::get_variable_status_enum_to_string(k.attributeStatus)}, + {"component", k.component}, + {"variable", k.variable}, + }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.attributeStatusInfo) { + j["attributeStatusInfo"] = k.attributeStatusInfo.value(); } - if (k.type) { - j["type"] = conversions::attribute_enum_to_string(k.type.value()); + if (k.attributeType) { + j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); } - if (k.value) { - j["value"] = k.value.value(); + if (k.attributeValue) { + j["attributeValue"] = k.attributeValue.value(); } - if (k.mutability) { - j["mutability"] = conversions::mutability_enum_to_string(k.mutability.value()); + if (k.customData) { + j["customData"] = k.customData.value(); } - if (k.persistent) { - j["persistent"] = k.persistent.value(); +} + +/// \brief Conversion from a given json object \p j to a given GetVariableResult \p k +void from_json(const json& j, GetVariableResult& k) { + // the required parts of the message + k.attributeStatus = conversions::string_to_get_variable_status_enum(j.at("attributeStatus")); + k.component = j.at("component"); + k.variable = j.at("variable"); + + // the optional parts of the message + if (j.contains("attributeStatusInfo")) { + k.attributeStatusInfo.emplace(j.at("attributeStatusInfo")); + } + if (j.contains("attributeType")) { + k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + } + if (j.contains("attributeValue")) { + k.attributeValue.emplace(j.at("attributeValue")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given GetVariableResult \p k to the given output stream \p os +/// \returns an output stream with the GetVariableResult written to +std::ostream& operator<<(std::ostream& os, const GetVariableResult& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given SignedMeterValue \p k to a given json object \p j +void to_json(json& j, const SignedMeterValue& k) { + // the required parts of the message + j = json{ + {"signedMeterData", k.signedMeterData}, + {"encodingMethod", k.encodingMethod}, + }; + // the optional parts of the message + if (k.signingMethod) { + j["signingMethod"] = k.signingMethod.value(); + } + if (k.publicKey) { + j["publicKey"] = k.publicKey.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given SignedMeterValue \p k +void from_json(const json& j, SignedMeterValue& k) { + // the required parts of the message + k.signedMeterData = j.at("signedMeterData"); + k.encodingMethod = j.at("encodingMethod"); + + // the optional parts of the message + if (j.contains("signingMethod")) { + k.signingMethod.emplace(j.at("signingMethod")); + } + if (j.contains("publicKey")) { + k.publicKey.emplace(j.at("publicKey")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given SignedMeterValue \p k to the given output stream \p os +/// \returns an output stream with the SignedMeterValue written to +std::ostream& operator<<(std::ostream& os, const SignedMeterValue& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given UnitOfMeasure \p k to a given json object \p j +void to_json(json& j, const UnitOfMeasure& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.unit) { + j["unit"] = k.unit.value(); + } + if (k.multiplier) { + j["multiplier"] = k.multiplier.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given UnitOfMeasure \p k +void from_json(const json& j, UnitOfMeasure& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("unit")) { + k.unit.emplace(j.at("unit")); + } + if (j.contains("multiplier")) { + k.multiplier.emplace(j.at("multiplier")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given UnitOfMeasure \p k to the given output stream \p os +/// \returns an output stream with the UnitOfMeasure written to +std::ostream& operator<<(std::ostream& os, const UnitOfMeasure& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given SampledValue \p k to a given json object \p j +void to_json(json& j, const SampledValue& k) { + // the required parts of the message + j = json{ + {"value", k.value}, + }; + // the optional parts of the message + if (k.measurand) { + j["measurand"] = conversions::measurand_enum_to_string(k.measurand.value()); + } + if (k.context) { + j["context"] = conversions::reading_context_enum_to_string(k.context.value()); + } + if (k.phase) { + j["phase"] = conversions::phase_enum_to_string(k.phase.value()); + } + if (k.location) { + j["location"] = conversions::location_enum_to_string(k.location.value()); + } + if (k.signedMeterValue) { + j["signedMeterValue"] = k.signedMeterValue.value(); + } + if (k.unitOfMeasure) { + j["unitOfMeasure"] = k.unitOfMeasure.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given SampledValue \p k +void from_json(const json& j, SampledValue& k) { + // the required parts of the message + k.value = j.at("value"); + + // the optional parts of the message + if (j.contains("measurand")) { + k.measurand.emplace(conversions::string_to_measurand_enum(j.at("measurand"))); + } + if (j.contains("context")) { + k.context.emplace(conversions::string_to_reading_context_enum(j.at("context"))); + } + if (j.contains("phase")) { + k.phase.emplace(conversions::string_to_phase_enum(j.at("phase"))); + } + if (j.contains("location")) { + k.location.emplace(conversions::string_to_location_enum(j.at("location"))); + } + if (j.contains("signedMeterValue")) { + k.signedMeterValue.emplace(j.at("signedMeterValue")); + } + if (j.contains("unitOfMeasure")) { + k.unitOfMeasure.emplace(j.at("unitOfMeasure")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given SampledValue \p k to the given output stream \p os +/// \returns an output stream with the SampledValue written to +std::ostream& operator<<(std::ostream& os, const SampledValue& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given MeterValue \p k to a given json object \p j +void to_json(json& j, const MeterValue& k) { + // the required parts of the message + j = json{ + {"sampledValue", k.sampledValue}, + {"timestamp", k.timestamp.to_rfc3339()}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given MeterValue \p k +void from_json(const json& j, MeterValue& k) { + // the required parts of the message + for (auto val : j.at("sampledValue")) { + k.sampledValue.push_back(val); + } + k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given MeterValue \p k to the given output stream \p os +/// \returns an output stream with the MeterValue written to +std::ostream& operator<<(std::ostream& os, const MeterValue& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given LimitAtSoC \p k to a given json object \p j +void to_json(json& j, const LimitAtSoC& k) { + // the required parts of the message + j = json{ + {"soc", k.soc}, + {"limit", k.limit}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given LimitAtSoC \p k +void from_json(const json& j, LimitAtSoC& k) { + // the required parts of the message + k.soc = j.at("soc"); + k.limit = j.at("limit"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given LimitAtSoC \p k to the given output stream \p os +/// \returns an output stream with the LimitAtSoC written to +std::ostream& operator<<(std::ostream& os, const LimitAtSoC& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given RelativeTimeInterval \p k to a given json object \p j +void to_json(json& j, const RelativeTimeInterval& k) { + // the required parts of the message + j = json{ + {"start", k.start}, + }; + // the optional parts of the message + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given RelativeTimeInterval \p k +void from_json(const json& j, RelativeTimeInterval& k) { + // the required parts of the message + k.start = j.at("start"); + + // the optional parts of the message + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given RelativeTimeInterval \p k to the given output stream \p os +/// \returns an output stream with the RelativeTimeInterval written to +std::ostream& operator<<(std::ostream& os, const RelativeTimeInterval& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given Cost \p k to a given json object \p j +void to_json(json& j, const Cost& k) { + // the required parts of the message + j = json{ + {"costKind", conversions::cost_kind_enum_to_string(k.costKind)}, + {"amount", k.amount}, + }; + // the optional parts of the message + if (k.amountMultiplier) { + j["amountMultiplier"] = k.amountMultiplier.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given Cost \p k +void from_json(const json& j, Cost& k) { + // the required parts of the message + k.costKind = conversions::string_to_cost_kind_enum(j.at("costKind")); + k.amount = j.at("amount"); + + // the optional parts of the message + if (j.contains("amountMultiplier")) { + k.amountMultiplier.emplace(j.at("amountMultiplier")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given Cost \p k to the given output stream \p os +/// \returns an output stream with the Cost written to +std::ostream& operator<<(std::ostream& os, const Cost& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ConsumptionCost \p k to a given json object \p j +void to_json(json& j, const ConsumptionCost& k) { + // the required parts of the message + j = json{ + {"startValue", k.startValue}, + {"cost", k.cost}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ConsumptionCost \p k +void from_json(const json& j, ConsumptionCost& k) { + // the required parts of the message + k.startValue = j.at("startValue"); + for (auto val : j.at("cost")) { + k.cost.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ConsumptionCost \p k to the given output stream \p os +/// \returns an output stream with the ConsumptionCost written to +std::ostream& operator<<(std::ostream& os, const ConsumptionCost& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given SalesTariffEntry \p k to a given json object \p j +void to_json(json& j, const SalesTariffEntry& k) { + // the required parts of the message + j = json{ + {"relativeTimeInterval", k.relativeTimeInterval}, + }; + // the optional parts of the message + if (k.ePriceLevel) { + j["ePriceLevel"] = k.ePriceLevel.value(); + } + if (k.consumptionCost) { + j["consumptionCost"] = json::array(); + for (auto val : k.consumptionCost.value()) { + j["consumptionCost"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given SalesTariffEntry \p k +void from_json(const json& j, SalesTariffEntry& k) { + // the required parts of the message + k.relativeTimeInterval = j.at("relativeTimeInterval"); + + // the optional parts of the message + if (j.contains("ePriceLevel")) { + k.ePriceLevel.emplace(j.at("ePriceLevel")); + } + if (j.contains("consumptionCost")) { + json arr = j.at("consumptionCost"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.consumptionCost.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given SalesTariffEntry \p k to the given output stream \p os +/// \returns an output stream with the SalesTariffEntry written to +std::ostream& operator<<(std::ostream& os, const SalesTariffEntry& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given SalesTariff \p k to a given json object \p j +void to_json(json& j, const SalesTariff& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"salesTariffEntry", k.salesTariffEntry}, + }; + // the optional parts of the message + if (k.salesTariffDescription) { + j["salesTariffDescription"] = k.salesTariffDescription.value(); + } + if (k.numEPriceLevels) { + j["numEPriceLevels"] = k.numEPriceLevels.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given SalesTariff \p k +void from_json(const json& j, SalesTariff& k) { + // the required parts of the message + k.id = j.at("id"); + for (auto val : j.at("salesTariffEntry")) { + k.salesTariffEntry.push_back(val); + } + + // the optional parts of the message + if (j.contains("salesTariffDescription")) { + k.salesTariffDescription.emplace(j.at("salesTariffDescription")); + } + if (j.contains("numEPriceLevels")) { + k.numEPriceLevels.emplace(j.at("numEPriceLevels")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given SalesTariff \p k to the given output stream \p os +/// \returns an output stream with the SalesTariff written to +std::ostream& operator<<(std::ostream& os, const SalesTariff& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given RationalNumber \p k to a given json object \p j +void to_json(json& j, const RationalNumber& k) { + // the required parts of the message + j = json{ + {"exponent", k.exponent}, + {"value", k.value}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given RationalNumber \p k +void from_json(const json& j, RationalNumber& k) { + // the required parts of the message + k.exponent = j.at("exponent"); + k.value = j.at("value"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given RationalNumber \p k to the given output stream \p os +/// \returns an output stream with the RationalNumber written to +std::ostream& operator<<(std::ostream& os, const RationalNumber& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given PriceRule \p k to a given json object \p j +void to_json(json& j, const PriceRule& k) { + // the required parts of the message + j = json{ + {"energyFee", k.energyFee}, + {"powerRangeStart", k.powerRangeStart}, + }; + // the optional parts of the message + if (k.parkingFeePeriod) { + j["parkingFeePeriod"] = k.parkingFeePeriod.value(); + } + if (k.carbonDioxideEmission) { + j["carbonDioxideEmission"] = k.carbonDioxideEmission.value(); + } + if (k.renewableGenerationPercentage) { + j["renewableGenerationPercentage"] = k.renewableGenerationPercentage.value(); + } + if (k.parkingFee) { + j["parkingFee"] = k.parkingFee.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given PriceRule \p k +void from_json(const json& j, PriceRule& k) { + // the required parts of the message + k.energyFee = j.at("energyFee"); + k.powerRangeStart = j.at("powerRangeStart"); + + // the optional parts of the message + if (j.contains("parkingFeePeriod")) { + k.parkingFeePeriod.emplace(j.at("parkingFeePeriod")); + } + if (j.contains("carbonDioxideEmission")) { + k.carbonDioxideEmission.emplace(j.at("carbonDioxideEmission")); + } + if (j.contains("renewableGenerationPercentage")) { + k.renewableGenerationPercentage.emplace(j.at("renewableGenerationPercentage")); + } + if (j.contains("parkingFee")) { + k.parkingFee.emplace(j.at("parkingFee")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given PriceRule \p k to the given output stream \p os +/// \returns an output stream with the PriceRule written to +std::ostream& operator<<(std::ostream& os, const PriceRule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given PriceRuleStack \p k to a given json object \p j +void to_json(json& j, const PriceRuleStack& k) { + // the required parts of the message + j = json{ + {"duration", k.duration}, + {"priceRule", k.priceRule}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given PriceRuleStack \p k +void from_json(const json& j, PriceRuleStack& k) { + // the required parts of the message + k.duration = j.at("duration"); + for (auto val : j.at("priceRule")) { + k.priceRule.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given PriceRuleStack \p k to the given output stream \p os +/// \returns an output stream with the PriceRuleStack written to +std::ostream& operator<<(std::ostream& os, const PriceRuleStack& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given TaxRule \p k to a given json object \p j +void to_json(json& j, const TaxRule& k) { + // the required parts of the message + j = json{ + {"taxRuleID", k.taxRuleID}, + {"appliesToEnergyFee", k.appliesToEnergyFee}, + {"appliesToParkingFee", k.appliesToParkingFee}, + {"appliesToOverstayFee", k.appliesToOverstayFee}, + {"appliesToMinimumMaximumCost", k.appliesToMinimumMaximumCost}, + {"taxRate", k.taxRate}, + }; + // the optional parts of the message + if (k.taxRuleName) { + j["taxRuleName"] = k.taxRuleName.value(); + } + if (k.taxIncludedInPrice) { + j["taxIncludedInPrice"] = k.taxIncludedInPrice.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given TaxRule \p k +void from_json(const json& j, TaxRule& k) { + // the required parts of the message + k.taxRuleID = j.at("taxRuleID"); + k.appliesToEnergyFee = j.at("appliesToEnergyFee"); + k.appliesToParkingFee = j.at("appliesToParkingFee"); + k.appliesToOverstayFee = j.at("appliesToOverstayFee"); + k.appliesToMinimumMaximumCost = j.at("appliesToMinimumMaximumCost"); + k.taxRate = j.at("taxRate"); + + // the optional parts of the message + if (j.contains("taxRuleName")) { + k.taxRuleName.emplace(j.at("taxRuleName")); + } + if (j.contains("taxIncludedInPrice")) { + k.taxIncludedInPrice.emplace(j.at("taxIncludedInPrice")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given TaxRule \p k to the given output stream \p os +/// \returns an output stream with the TaxRule written to +std::ostream& operator<<(std::ostream& os, const TaxRule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given OverstayRule \p k to a given json object \p j +void to_json(json& j, const OverstayRule& k) { + // the required parts of the message + j = json{ + {"overstayFee", k.overstayFee}, + {"startTime", k.startTime}, + {"overstayFeePeriod", k.overstayFeePeriod}, + }; + // the optional parts of the message + if (k.overstayRuleDescription) { + j["overstayRuleDescription"] = k.overstayRuleDescription.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given OverstayRule \p k +void from_json(const json& j, OverstayRule& k) { + // the required parts of the message + k.overstayFee = j.at("overstayFee"); + k.startTime = j.at("startTime"); + k.overstayFeePeriod = j.at("overstayFeePeriod"); + + // the optional parts of the message + if (j.contains("overstayRuleDescription")) { + k.overstayRuleDescription.emplace(j.at("overstayRuleDescription")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given OverstayRule \p k to the given output stream \p os +/// \returns an output stream with the OverstayRule written to +std::ostream& operator<<(std::ostream& os, const OverstayRule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given OverstayRuleList \p k to a given json object \p j +void to_json(json& j, const OverstayRuleList& k) { + // the required parts of the message + j = json{ + {"overstayRule", k.overstayRule}, + }; + // the optional parts of the message + if (k.overstayPowerThreshold) { + j["overstayPowerThreshold"] = k.overstayPowerThreshold.value(); + } + if (k.overstayTimeThreshold) { + j["overstayTimeThreshold"] = k.overstayTimeThreshold.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given OverstayRuleList \p k +void from_json(const json& j, OverstayRuleList& k) { + // the required parts of the message + for (auto val : j.at("overstayRule")) { + k.overstayRule.push_back(val); + } + + // the optional parts of the message + if (j.contains("overstayPowerThreshold")) { + k.overstayPowerThreshold.emplace(j.at("overstayPowerThreshold")); + } + if (j.contains("overstayTimeThreshold")) { + k.overstayTimeThreshold.emplace(j.at("overstayTimeThreshold")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given OverstayRuleList \p k to the given output stream \p os +/// \returns an output stream with the OverstayRuleList written to +std::ostream& operator<<(std::ostream& os, const OverstayRuleList& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given AdditionalSelectedServices \p k to a given json object \p j +void to_json(json& j, const AdditionalSelectedServices& k) { + // the required parts of the message + j = json{ + {"serviceFee", k.serviceFee}, + {"serviceName", k.serviceName}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given AdditionalSelectedServices \p k +void from_json(const json& j, AdditionalSelectedServices& k) { + // the required parts of the message + k.serviceFee = j.at("serviceFee"); + k.serviceName = j.at("serviceName"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given AdditionalSelectedServices \p k to the given output stream \p os +/// \returns an output stream with the AdditionalSelectedServices written to +std::ostream& operator<<(std::ostream& os, const AdditionalSelectedServices& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given AbsolutePriceSchedule \p k to a given json object \p j +void to_json(json& j, const AbsolutePriceSchedule& k) { + // the required parts of the message + j = json{ + {"timeAnchor", k.timeAnchor.to_rfc3339()}, + {"priceScheduleID", k.priceScheduleID}, + {"currency", k.currency}, + {"language", k.language}, + {"priceAlgorithm", k.priceAlgorithm}, + {"priceRuleStacks", k.priceRuleStacks}, + }; + // the optional parts of the message + if (k.priceScheduleDescription) { + j["priceScheduleDescription"] = k.priceScheduleDescription.value(); + } + if (k.minimumCost) { + j["minimumCost"] = k.minimumCost.value(); + } + if (k.maximumCost) { + j["maximumCost"] = k.maximumCost.value(); + } + if (k.taxRules) { + j["taxRules"] = json::array(); + for (auto val : k.taxRules.value()) { + j["taxRules"].push_back(val); + } + } + if (k.overstayRuleList) { + j["overstayRuleList"] = k.overstayRuleList.value(); + } + if (k.additionalSelectedServices) { + j["additionalSelectedServices"] = json::array(); + for (auto val : k.additionalSelectedServices.value()) { + j["additionalSelectedServices"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given AbsolutePriceSchedule \p k +void from_json(const json& j, AbsolutePriceSchedule& k) { + // the required parts of the message + k.timeAnchor = ocpp::DateTime(std::string(j.at("timeAnchor"))); + k.priceScheduleID = j.at("priceScheduleID"); + k.currency = j.at("currency"); + k.language = j.at("language"); + k.priceAlgorithm = j.at("priceAlgorithm"); + for (auto val : j.at("priceRuleStacks")) { + k.priceRuleStacks.push_back(val); + } + + // the optional parts of the message + if (j.contains("priceScheduleDescription")) { + k.priceScheduleDescription.emplace(j.at("priceScheduleDescription")); + } + if (j.contains("minimumCost")) { + k.minimumCost.emplace(j.at("minimumCost")); + } + if (j.contains("maximumCost")) { + k.maximumCost.emplace(j.at("maximumCost")); + } + if (j.contains("taxRules")) { + json arr = j.at("taxRules"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRules.emplace(vec); + } + if (j.contains("overstayRuleList")) { + k.overstayRuleList.emplace(j.at("overstayRuleList")); + } + if (j.contains("additionalSelectedServices")) { + json arr = j.at("additionalSelectedServices"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.additionalSelectedServices.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given AbsolutePriceSchedule \p k to the given output stream \p os +/// \returns an output stream with the AbsolutePriceSchedule written to +std::ostream& operator<<(std::ostream& os, const AbsolutePriceSchedule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given PriceLevelScheduleEntry \p k to a given json object \p j +void to_json(json& j, const PriceLevelScheduleEntry& k) { + // the required parts of the message + j = json{ + {"duration", k.duration}, + {"priceLevel", k.priceLevel}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given PriceLevelScheduleEntry \p k +void from_json(const json& j, PriceLevelScheduleEntry& k) { + // the required parts of the message + k.duration = j.at("duration"); + k.priceLevel = j.at("priceLevel"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given PriceLevelScheduleEntry \p k to the given output stream \p os +/// \returns an output stream with the PriceLevelScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const PriceLevelScheduleEntry& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given PriceLevelSchedule \p k to a given json object \p j +void to_json(json& j, const PriceLevelSchedule& k) { + // the required parts of the message + j = json{ + {"priceLevelScheduleEntries", k.priceLevelScheduleEntries}, + {"timeAnchor", k.timeAnchor.to_rfc3339()}, + {"priceScheduleId", k.priceScheduleId}, + {"numberOfPriceLevels", k.numberOfPriceLevels}, + }; + // the optional parts of the message + if (k.priceScheduleDescription) { + j["priceScheduleDescription"] = k.priceScheduleDescription.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given PriceLevelSchedule \p k +void from_json(const json& j, PriceLevelSchedule& k) { + // the required parts of the message + for (auto val : j.at("priceLevelScheduleEntries")) { + k.priceLevelScheduleEntries.push_back(val); + } + k.timeAnchor = ocpp::DateTime(std::string(j.at("timeAnchor"))); + k.priceScheduleId = j.at("priceScheduleId"); + k.numberOfPriceLevels = j.at("numberOfPriceLevels"); + + // the optional parts of the message + if (j.contains("priceScheduleDescription")) { + k.priceScheduleDescription.emplace(j.at("priceScheduleDescription")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given PriceLevelSchedule \p k to the given output stream \p os +/// \returns an output stream with the PriceLevelSchedule written to +std::ostream& operator<<(std::ostream& os, const PriceLevelSchedule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ChargingSchedule \p k to a given json object \p j +void to_json(json& j, const ChargingSchedule& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, + {"chargingSchedulePeriod", k.chargingSchedulePeriod}, + }; + // the optional parts of the message + if (k.limitAtSoC) { + j["limitAtSoC"] = k.limitAtSoC.value(); + } + if (k.startSchedule) { + j["startSchedule"] = k.startSchedule.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.minChargingRate) { + j["minChargingRate"] = k.minChargingRate.value(); + } + if (k.powerTolerance) { + j["powerTolerance"] = k.powerTolerance.value(); + } + if (k.signatureId) { + j["signatureId"] = k.signatureId.value(); + } + if (k.digestValue) { + j["digestValue"] = k.digestValue.value(); + } + if (k.useLocalTime) { + j["useLocalTime"] = k.useLocalTime.value(); + } + if (k.randomizedDelay) { + j["randomizedDelay"] = k.randomizedDelay.value(); + } + if (k.salesTariff) { + j["salesTariff"] = k.salesTariff.value(); + } + if (k.absolutePriceSchedule) { + j["absolutePriceSchedule"] = k.absolutePriceSchedule.value(); + } + if (k.priceLevelSchedule) { + j["priceLevelSchedule"] = k.priceLevelSchedule.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingSchedule \p k +void from_json(const json& j, ChargingSchedule& k) { + // the required parts of the message + k.id = j.at("id"); + k.chargingRateUnit = conversions::string_to_charging_rate_unit_enum(j.at("chargingRateUnit")); + for (auto val : j.at("chargingSchedulePeriod")) { + k.chargingSchedulePeriod.push_back(val); + } + + // the optional parts of the message + if (j.contains("limitAtSoC")) { + k.limitAtSoC.emplace(j.at("limitAtSoC")); + } + if (j.contains("startSchedule")) { + k.startSchedule.emplace(j.at("startSchedule").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("minChargingRate")) { + k.minChargingRate.emplace(j.at("minChargingRate")); + } + if (j.contains("powerTolerance")) { + k.powerTolerance.emplace(j.at("powerTolerance")); + } + if (j.contains("signatureId")) { + k.signatureId.emplace(j.at("signatureId")); + } + if (j.contains("digestValue")) { + k.digestValue.emplace(j.at("digestValue")); + } + if (j.contains("useLocalTime")) { + k.useLocalTime.emplace(j.at("useLocalTime")); + } + if (j.contains("randomizedDelay")) { + k.randomizedDelay.emplace(j.at("randomizedDelay")); + } + if (j.contains("salesTariff")) { + k.salesTariff.emplace(j.at("salesTariff")); + } + if (j.contains("absolutePriceSchedule")) { + k.absolutePriceSchedule.emplace(j.at("absolutePriceSchedule")); + } + if (j.contains("priceLevelSchedule")) { + k.priceLevelSchedule.emplace(j.at("priceLevelSchedule")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ChargingSchedule \p k to the given output stream \p os +/// \returns an output stream with the ChargingSchedule written to +std::ostream& operator<<(std::ostream& os, const ChargingSchedule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ChargingLimit \p k to a given json object \p j +void to_json(json& j, const ChargingLimit& k) { + // the required parts of the message + j = json{ + {"chargingLimitSource", k.chargingLimitSource}, + }; + // the optional parts of the message + if (k.isLocalGeneration) { + j["isLocalGeneration"] = k.isLocalGeneration.value(); + } + if (k.isGridCritical) { + j["isGridCritical"] = k.isGridCritical.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingLimit \p k +void from_json(const json& j, ChargingLimit& k) { + // the required parts of the message + k.chargingLimitSource = j.at("chargingLimitSource"); + + // the optional parts of the message + if (j.contains("isLocalGeneration")) { + k.isLocalGeneration.emplace(j.at("isLocalGeneration")); + } + if (j.contains("isGridCritical")) { + k.isGridCritical.emplace(j.at("isGridCritical")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ChargingLimit \p k to the given output stream \p os +/// \returns an output stream with the ChargingLimit written to +std::ostream& operator<<(std::ostream& os, const ChargingLimit& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given MessageInfo \p k to a given json object \p j +void to_json(json& j, const MessageInfo& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"priority", conversions::message_priority_enum_to_string(k.priority)}, + {"message", k.message}, + }; + // the optional parts of the message + if (k.display) { + j["display"] = k.display.value(); + } + if (k.state) { + j["state"] = conversions::message_state_enum_to_string(k.state.value()); + } + if (k.startDateTime) { + j["startDateTime"] = k.startDateTime.value().to_rfc3339(); + } + if (k.endDateTime) { + j["endDateTime"] = k.endDateTime.value().to_rfc3339(); + } + if (k.transactionId) { + j["transactionId"] = k.transactionId.value(); + } + if (k.messageExtra) { + j["messageExtra"] = json::array(); + for (auto val : k.messageExtra.value()) { + j["messageExtra"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given MessageInfo \p k +void from_json(const json& j, MessageInfo& k) { + // the required parts of the message + k.id = j.at("id"); + k.priority = conversions::string_to_message_priority_enum(j.at("priority")); + k.message = j.at("message"); + + // the optional parts of the message + if (j.contains("display")) { + k.display.emplace(j.at("display")); + } + if (j.contains("state")) { + k.state.emplace(conversions::string_to_message_state_enum(j.at("state"))); + } + if (j.contains("startDateTime")) { + k.startDateTime.emplace(j.at("startDateTime").get()); + } + if (j.contains("endDateTime")) { + k.endDateTime.emplace(j.at("endDateTime").get()); + } + if (j.contains("transactionId")) { + k.transactionId.emplace(j.at("transactionId")); + } + if (j.contains("messageExtra")) { + json arr = j.at("messageExtra"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.messageExtra.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given MessageInfo \p k to the given output stream \p os +/// \returns an output stream with the MessageInfo written to +std::ostream& operator<<(std::ostream& os, const MessageInfo& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ACChargingParameters \p k to a given json object \p j +void to_json(json& j, const ACChargingParameters& k) { + // the required parts of the message + j = json{ + {"energyAmount", k.energyAmount}, + {"evMinCurrent", k.evMinCurrent}, + {"evMaxCurrent", k.evMaxCurrent}, + {"evMaxVoltage", k.evMaxVoltage}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ACChargingParameters \p k +void from_json(const json& j, ACChargingParameters& k) { + // the required parts of the message + k.energyAmount = j.at("energyAmount"); + k.evMinCurrent = j.at("evMinCurrent"); + k.evMaxCurrent = j.at("evMaxCurrent"); + k.evMaxVoltage = j.at("evMaxVoltage"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ACChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the ACChargingParameters written to +std::ostream& operator<<(std::ostream& os, const ACChargingParameters& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given DERChargingParameters \p k to a given json object \p j +void to_json(json& j, const DERChargingParameters& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.evSupportedDERControl) { + if (j.size() == 0) { + j = json{{"evSupportedDERControl", json::array()}}; + } else { + j["evSupportedDERControl"] = json::array(); + } + for (auto val : k.evSupportedDERControl.value()) { + j["evSupportedDERControl"].push_back(conversions::dercontrol_enum_to_string(val)); + } + } + if (k.evOverExcitedMaxDischargePower) { + j["evOverExcitedMaxDischargePower"] = k.evOverExcitedMaxDischargePower.value(); + } + if (k.evOverExcitedPowerFactor) { + j["evOverExcitedPowerFactor"] = k.evOverExcitedPowerFactor.value(); + } + if (k.evUnderExcitedMaxDischargePower) { + j["evUnderExcitedMaxDischargePower"] = k.evUnderExcitedMaxDischargePower.value(); + } + if (k.evUnderExcitedPowerFactor) { + j["evUnderExcitedPowerFactor"] = k.evUnderExcitedPowerFactor.value(); + } + if (k.maxApparentPower) { + j["maxApparentPower"] = k.maxApparentPower.value(); + } + if (k.maxChargeApparentPower) { + j["maxChargeApparentPower"] = k.maxChargeApparentPower.value(); + } + if (k.maxChargeApparentPower_L2) { + j["maxChargeApparentPower_L2"] = k.maxChargeApparentPower_L2.value(); + } + if (k.maxChargeApparentPower_L3) { + j["maxChargeApparentPower_L3"] = k.maxChargeApparentPower_L3.value(); + } + if (k.maxDischargeApparentPower) { + j["maxDischargeApparentPower"] = k.maxDischargeApparentPower.value(); + } + if (k.maxDischargeApparentPower_L2) { + j["maxDischargeApparentPower_L2"] = k.maxDischargeApparentPower_L2.value(); + } + if (k.maxDischargeApparentPower_L3) { + j["maxDischargeApparentPower_L3"] = k.maxDischargeApparentPower_L3.value(); + } + if (k.maxChargeReactivePower) { + j["maxChargeReactivePower"] = k.maxChargeReactivePower.value(); + } + if (k.maxChargeReactivePower_L2) { + j["maxChargeReactivePower_L2"] = k.maxChargeReactivePower_L2.value(); + } + if (k.maxChargeReactivePower_L3) { + j["maxChargeReactivePower_L3"] = k.maxChargeReactivePower_L3.value(); + } + if (k.minChargeReactivePower) { + j["minChargeReactivePower"] = k.minChargeReactivePower.value(); + } + if (k.minChargeReactivePower_L2) { + j["minChargeReactivePower_L2"] = k.minChargeReactivePower_L2.value(); + } + if (k.minChargeReactivePower_L3) { + j["minChargeReactivePower_L3"] = k.minChargeReactivePower_L3.value(); + } + if (k.maxDischargeReactivePower) { + j["maxDischargeReactivePower"] = k.maxDischargeReactivePower.value(); + } + if (k.maxDischargeReactivePower_L2) { + j["maxDischargeReactivePower_L2"] = k.maxDischargeReactivePower_L2.value(); + } + if (k.maxDischargeReactivePower_L3) { + j["maxDischargeReactivePower_L3"] = k.maxDischargeReactivePower_L3.value(); + } + if (k.minDischargeReactivePower) { + j["minDischargeReactivePower"] = k.minDischargeReactivePower.value(); + } + if (k.minDischargeReactivePower_L2) { + j["minDischargeReactivePower_L2"] = k.minDischargeReactivePower_L2.value(); + } + if (k.minDischargeReactivePower_L3) { + j["minDischargeReactivePower_L3"] = k.minDischargeReactivePower_L3.value(); + } + if (k.nominalVoltage) { + j["nominalVoltage"] = k.nominalVoltage.value(); + } + if (k.nominalVoltageOffset) { + j["nominalVoltageOffset"] = k.nominalVoltageOffset.value(); + } + if (k.maxNominalVoltage) { + j["maxNominalVoltage"] = k.maxNominalVoltage.value(); + } + if (k.minNominalVoltage) { + j["minNominalVoltage"] = k.minNominalVoltage.value(); + } + if (k.evInverterManufacturer) { + j["evInverterManufacturer"] = k.evInverterManufacturer.value(); + } + if (k.evInverterModel) { + j["evInverterModel"] = k.evInverterModel.value(); + } + if (k.evInverterSerialNumber) { + j["evInverterSerialNumber"] = k.evInverterSerialNumber.value(); + } + if (k.evInverterSwVersion) { + j["evInverterSwVersion"] = k.evInverterSwVersion.value(); + } + if (k.evInverterHwVersion) { + j["evInverterHwVersion"] = k.evInverterHwVersion.value(); + } + if (k.evIslandingDetectionMethod) { + if (j.size() == 0) { + j = json{{"evIslandingDetectionMethod", json::array()}}; + } else { + j["evIslandingDetectionMethod"] = json::array(); + } + for (auto val : k.evIslandingDetectionMethod.value()) { + j["evIslandingDetectionMethod"].push_back(conversions::islanding_detection_enum_to_string(val)); + } + } + if (k.evIslandingTripTime) { + j["evIslandingTripTime"] = k.evIslandingTripTime.value(); + } + if (k.evMaximumLevel1DCInjection) { + j["evMaximumLevel1DCInjection"] = k.evMaximumLevel1DCInjection.value(); + } + if (k.evDurationLevel1DCInjection) { + j["evDurationLevel1DCInjection"] = k.evDurationLevel1DCInjection.value(); + } + if (k.evMaximumLevel2DCInjection) { + j["evMaximumLevel2DCInjection"] = k.evMaximumLevel2DCInjection.value(); + } + if (k.evDurationLevel2DCInjection) { + j["evDurationLevel2DCInjection"] = k.evDurationLevel2DCInjection.value(); + } + if (k.evReactiveSusceptance) { + j["evReactiveSusceptance"] = k.evReactiveSusceptance.value(); + } + if (k.evSessionTotalDischargeEnergyAvailable) { + j["evSessionTotalDischargeEnergyAvailable"] = k.evSessionTotalDischargeEnergyAvailable.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given DERChargingParameters \p k +void from_json(const json& j, DERChargingParameters& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("evSupportedDERControl")) { + json arr = j.at("evSupportedDERControl"); + std::vector vec; + for (auto val : arr) { + vec.push_back(conversions::string_to_dercontrol_enum(val)); + } + k.evSupportedDERControl.emplace(vec); + } + if (j.contains("evOverExcitedMaxDischargePower")) { + k.evOverExcitedMaxDischargePower.emplace(j.at("evOverExcitedMaxDischargePower")); + } + if (j.contains("evOverExcitedPowerFactor")) { + k.evOverExcitedPowerFactor.emplace(j.at("evOverExcitedPowerFactor")); + } + if (j.contains("evUnderExcitedMaxDischargePower")) { + k.evUnderExcitedMaxDischargePower.emplace(j.at("evUnderExcitedMaxDischargePower")); + } + if (j.contains("evUnderExcitedPowerFactor")) { + k.evUnderExcitedPowerFactor.emplace(j.at("evUnderExcitedPowerFactor")); + } + if (j.contains("maxApparentPower")) { + k.maxApparentPower.emplace(j.at("maxApparentPower")); + } + if (j.contains("maxChargeApparentPower")) { + k.maxChargeApparentPower.emplace(j.at("maxChargeApparentPower")); + } + if (j.contains("maxChargeApparentPower_L2")) { + k.maxChargeApparentPower_L2.emplace(j.at("maxChargeApparentPower_L2")); + } + if (j.contains("maxChargeApparentPower_L3")) { + k.maxChargeApparentPower_L3.emplace(j.at("maxChargeApparentPower_L3")); + } + if (j.contains("maxDischargeApparentPower")) { + k.maxDischargeApparentPower.emplace(j.at("maxDischargeApparentPower")); + } + if (j.contains("maxDischargeApparentPower_L2")) { + k.maxDischargeApparentPower_L2.emplace(j.at("maxDischargeApparentPower_L2")); + } + if (j.contains("maxDischargeApparentPower_L3")) { + k.maxDischargeApparentPower_L3.emplace(j.at("maxDischargeApparentPower_L3")); + } + if (j.contains("maxChargeReactivePower")) { + k.maxChargeReactivePower.emplace(j.at("maxChargeReactivePower")); + } + if (j.contains("maxChargeReactivePower_L2")) { + k.maxChargeReactivePower_L2.emplace(j.at("maxChargeReactivePower_L2")); + } + if (j.contains("maxChargeReactivePower_L3")) { + k.maxChargeReactivePower_L3.emplace(j.at("maxChargeReactivePower_L3")); + } + if (j.contains("minChargeReactivePower")) { + k.minChargeReactivePower.emplace(j.at("minChargeReactivePower")); + } + if (j.contains("minChargeReactivePower_L2")) { + k.minChargeReactivePower_L2.emplace(j.at("minChargeReactivePower_L2")); + } + if (j.contains("minChargeReactivePower_L3")) { + k.minChargeReactivePower_L3.emplace(j.at("minChargeReactivePower_L3")); + } + if (j.contains("maxDischargeReactivePower")) { + k.maxDischargeReactivePower.emplace(j.at("maxDischargeReactivePower")); + } + if (j.contains("maxDischargeReactivePower_L2")) { + k.maxDischargeReactivePower_L2.emplace(j.at("maxDischargeReactivePower_L2")); + } + if (j.contains("maxDischargeReactivePower_L3")) { + k.maxDischargeReactivePower_L3.emplace(j.at("maxDischargeReactivePower_L3")); + } + if (j.contains("minDischargeReactivePower")) { + k.minDischargeReactivePower.emplace(j.at("minDischargeReactivePower")); + } + if (j.contains("minDischargeReactivePower_L2")) { + k.minDischargeReactivePower_L2.emplace(j.at("minDischargeReactivePower_L2")); + } + if (j.contains("minDischargeReactivePower_L3")) { + k.minDischargeReactivePower_L3.emplace(j.at("minDischargeReactivePower_L3")); + } + if (j.contains("nominalVoltage")) { + k.nominalVoltage.emplace(j.at("nominalVoltage")); + } + if (j.contains("nominalVoltageOffset")) { + k.nominalVoltageOffset.emplace(j.at("nominalVoltageOffset")); + } + if (j.contains("maxNominalVoltage")) { + k.maxNominalVoltage.emplace(j.at("maxNominalVoltage")); + } + if (j.contains("minNominalVoltage")) { + k.minNominalVoltage.emplace(j.at("minNominalVoltage")); + } + if (j.contains("evInverterManufacturer")) { + k.evInverterManufacturer.emplace(j.at("evInverterManufacturer")); + } + if (j.contains("evInverterModel")) { + k.evInverterModel.emplace(j.at("evInverterModel")); + } + if (j.contains("evInverterSerialNumber")) { + k.evInverterSerialNumber.emplace(j.at("evInverterSerialNumber")); + } + if (j.contains("evInverterSwVersion")) { + k.evInverterSwVersion.emplace(j.at("evInverterSwVersion")); + } + if (j.contains("evInverterHwVersion")) { + k.evInverterHwVersion.emplace(j.at("evInverterHwVersion")); + } + if (j.contains("evIslandingDetectionMethod")) { + json arr = j.at("evIslandingDetectionMethod"); + std::vector vec; + for (auto val : arr) { + vec.push_back(conversions::string_to_islanding_detection_enum(val)); + } + k.evIslandingDetectionMethod.emplace(vec); + } + if (j.contains("evIslandingTripTime")) { + k.evIslandingTripTime.emplace(j.at("evIslandingTripTime")); + } + if (j.contains("evMaximumLevel1DCInjection")) { + k.evMaximumLevel1DCInjection.emplace(j.at("evMaximumLevel1DCInjection")); + } + if (j.contains("evDurationLevel1DCInjection")) { + k.evDurationLevel1DCInjection.emplace(j.at("evDurationLevel1DCInjection")); + } + if (j.contains("evMaximumLevel2DCInjection")) { + k.evMaximumLevel2DCInjection.emplace(j.at("evMaximumLevel2DCInjection")); + } + if (j.contains("evDurationLevel2DCInjection")) { + k.evDurationLevel2DCInjection.emplace(j.at("evDurationLevel2DCInjection")); + } + if (j.contains("evReactiveSusceptance")) { + k.evReactiveSusceptance.emplace(j.at("evReactiveSusceptance")); + } + if (j.contains("evSessionTotalDischargeEnergyAvailable")) { + k.evSessionTotalDischargeEnergyAvailable.emplace(j.at("evSessionTotalDischargeEnergyAvailable")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given DERChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the DERChargingParameters written to +std::ostream& operator<<(std::ostream& os, const DERChargingParameters& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVPriceRule \p k to a given json object \p j +void to_json(json& j, const EVPriceRule& k) { + // the required parts of the message + j = json{ + {"energyFee", k.energyFee}, + {"powerRangeStart", k.powerRangeStart}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVPriceRule \p k +void from_json(const json& j, EVPriceRule& k) { + // the required parts of the message + k.energyFee = j.at("energyFee"); + k.powerRangeStart = j.at("powerRangeStart"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVPriceRule \p k to the given output stream \p os +/// \returns an output stream with the EVPriceRule written to +std::ostream& operator<<(std::ostream& os, const EVPriceRule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVAbsolutePriceScheduleEntry \p k to a given json object \p j +void to_json(json& j, const EVAbsolutePriceScheduleEntry& k) { + // the required parts of the message + j = json{ + {"duration", k.duration}, + {"evPriceRule", k.evPriceRule}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVAbsolutePriceScheduleEntry \p k +void from_json(const json& j, EVAbsolutePriceScheduleEntry& k) { + // the required parts of the message + k.duration = j.at("duration"); + for (auto val : j.at("evPriceRule")) { + k.evPriceRule.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVAbsolutePriceScheduleEntry \p k to the given output stream \p +// os +/// \returns an output stream with the EVAbsolutePriceScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const EVAbsolutePriceScheduleEntry& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVAbsolutePriceSchedule \p k to a given json object \p j +void to_json(json& j, const EVAbsolutePriceSchedule& k) { + // the required parts of the message + j = json{ + {"timeAnchor", k.timeAnchor.to_rfc3339()}, + {"currency", k.currency}, + {"evAbsolutePriceScheduleEntries", k.evAbsolutePriceScheduleEntries}, + {"priceAlgorithm", k.priceAlgorithm}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVAbsolutePriceSchedule \p k +void from_json(const json& j, EVAbsolutePriceSchedule& k) { + // the required parts of the message + k.timeAnchor = ocpp::DateTime(std::string(j.at("timeAnchor"))); + k.currency = j.at("currency"); + for (auto val : j.at("evAbsolutePriceScheduleEntries")) { + k.evAbsolutePriceScheduleEntries.push_back(val); + } + k.priceAlgorithm = j.at("priceAlgorithm"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVAbsolutePriceSchedule \p k to the given output stream \p os +/// \returns an output stream with the EVAbsolutePriceSchedule written to +std::ostream& operator<<(std::ostream& os, const EVAbsolutePriceSchedule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVPowerScheduleEntry \p k to a given json object \p j +void to_json(json& j, const EVPowerScheduleEntry& k) { + // the required parts of the message + j = json{ + {"duration", k.duration}, + {"power", k.power}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVPowerScheduleEntry \p k +void from_json(const json& j, EVPowerScheduleEntry& k) { + // the required parts of the message + k.duration = j.at("duration"); + k.power = j.at("power"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVPowerScheduleEntry \p k to the given output stream \p os +/// \returns an output stream with the EVPowerScheduleEntry written to +std::ostream& operator<<(std::ostream& os, const EVPowerScheduleEntry& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVPowerSchedule \p k to a given json object \p j +void to_json(json& j, const EVPowerSchedule& k) { + // the required parts of the message + j = json{ + {"evPowerScheduleEntries", k.evPowerScheduleEntries}, + {"timeAnchor", k.timeAnchor.to_rfc3339()}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVPowerSchedule \p k +void from_json(const json& j, EVPowerSchedule& k) { + // the required parts of the message + for (auto val : j.at("evPowerScheduleEntries")) { + k.evPowerScheduleEntries.push_back(val); + } + k.timeAnchor = ocpp::DateTime(std::string(j.at("timeAnchor"))); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVPowerSchedule \p k to the given output stream \p os +/// \returns an output stream with the EVPowerSchedule written to +std::ostream& operator<<(std::ostream& os, const EVPowerSchedule& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EVEnergyOffer \p k to a given json object \p j +void to_json(json& j, const EVEnergyOffer& k) { + // the required parts of the message + j = json{ + {"evPowerSchedule", k.evPowerSchedule}, + }; + // the optional parts of the message + if (k.evAbsolutePriceSchedule) { + j["evAbsolutePriceSchedule"] = k.evAbsolutePriceSchedule.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EVEnergyOffer \p k +void from_json(const json& j, EVEnergyOffer& k) { + // the required parts of the message + k.evPowerSchedule = j.at("evPowerSchedule"); + + // the optional parts of the message + if (j.contains("evAbsolutePriceSchedule")) { + k.evAbsolutePriceSchedule.emplace(j.at("evAbsolutePriceSchedule")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EVEnergyOffer \p k to the given output stream \p os +/// \returns an output stream with the EVEnergyOffer written to +std::ostream& operator<<(std::ostream& os, const EVEnergyOffer& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given DCChargingParameters \p k to a given json object \p j +void to_json(json& j, const DCChargingParameters& k) { + // the required parts of the message + j = json{ + {"evMaxCurrent", k.evMaxCurrent}, + {"evMaxVoltage", k.evMaxVoltage}, + }; + // the optional parts of the message + if (k.evMaxPower) { + j["evMaxPower"] = k.evMaxPower.value(); + } + if (k.evEnergyCapacity) { + j["evEnergyCapacity"] = k.evEnergyCapacity.value(); + } + if (k.energyAmount) { + j["energyAmount"] = k.energyAmount.value(); + } + if (k.stateOfCharge) { + j["stateOfCharge"] = k.stateOfCharge.value(); + } + if (k.fullSoC) { + j["fullSoC"] = k.fullSoC.value(); + } + if (k.bulkSoC) { + j["bulkSoC"] = k.bulkSoC.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given DCChargingParameters \p k +void from_json(const json& j, DCChargingParameters& k) { + // the required parts of the message + k.evMaxCurrent = j.at("evMaxCurrent"); + k.evMaxVoltage = j.at("evMaxVoltage"); + + // the optional parts of the message + if (j.contains("evMaxPower")) { + k.evMaxPower.emplace(j.at("evMaxPower")); + } + if (j.contains("evEnergyCapacity")) { + k.evEnergyCapacity.emplace(j.at("evEnergyCapacity")); + } + if (j.contains("energyAmount")) { + k.energyAmount.emplace(j.at("energyAmount")); + } + if (j.contains("stateOfCharge")) { + k.stateOfCharge.emplace(j.at("stateOfCharge")); + } + if (j.contains("fullSoC")) { + k.fullSoC.emplace(j.at("fullSoC")); + } + if (j.contains("bulkSoC")) { + k.bulkSoC.emplace(j.at("bulkSoC")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given DCChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the DCChargingParameters written to +std::ostream& operator<<(std::ostream& os, const DCChargingParameters& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given V2XChargingParameters \p k to a given json object \p j +void to_json(json& j, const V2XChargingParameters& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.minChargePower) { + j["minChargePower"] = k.minChargePower.value(); + } + if (k.minChargePower_L2) { + j["minChargePower_L2"] = k.minChargePower_L2.value(); + } + if (k.minChargePower_L3) { + j["minChargePower_L3"] = k.minChargePower_L3.value(); + } + if (k.maxChargePower) { + j["maxChargePower"] = k.maxChargePower.value(); + } + if (k.maxChargePower_L2) { + j["maxChargePower_L2"] = k.maxChargePower_L2.value(); + } + if (k.maxChargePower_L3) { + j["maxChargePower_L3"] = k.maxChargePower_L3.value(); + } + if (k.minDischargePower) { + j["minDischargePower"] = k.minDischargePower.value(); + } + if (k.minDischargePower_L2) { + j["minDischargePower_L2"] = k.minDischargePower_L2.value(); + } + if (k.minDischargePower_L3) { + j["minDischargePower_L3"] = k.minDischargePower_L3.value(); + } + if (k.maxDischargePower) { + j["maxDischargePower"] = k.maxDischargePower.value(); + } + if (k.maxDischargePower_L2) { + j["maxDischargePower_L2"] = k.maxDischargePower_L2.value(); + } + if (k.maxDischargePower_L3) { + j["maxDischargePower_L3"] = k.maxDischargePower_L3.value(); + } + if (k.minChargeCurrent) { + j["minChargeCurrent"] = k.minChargeCurrent.value(); + } + if (k.maxChargeCurrent) { + j["maxChargeCurrent"] = k.maxChargeCurrent.value(); + } + if (k.minDischargeCurrent) { + j["minDischargeCurrent"] = k.minDischargeCurrent.value(); + } + if (k.maxDischargeCurrent) { + j["maxDischargeCurrent"] = k.maxDischargeCurrent.value(); + } + if (k.minVoltage) { + j["minVoltage"] = k.minVoltage.value(); + } + if (k.maxVoltage) { + j["maxVoltage"] = k.maxVoltage.value(); + } + if (k.evTargetEnergyRequest) { + j["evTargetEnergyRequest"] = k.evTargetEnergyRequest.value(); + } + if (k.evMinEnergyRequest) { + j["evMinEnergyRequest"] = k.evMinEnergyRequest.value(); + } + if (k.evMaxEnergyRequest) { + j["evMaxEnergyRequest"] = k.evMaxEnergyRequest.value(); + } + if (k.evMinV2XEnergyRequest) { + j["evMinV2XEnergyRequest"] = k.evMinV2XEnergyRequest.value(); + } + if (k.evMaxV2XEnergyRequest) { + j["evMaxV2XEnergyRequest"] = k.evMaxV2XEnergyRequest.value(); + } + if (k.targetSoC) { + j["targetSoC"] = k.targetSoC.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given V2XChargingParameters \p k +void from_json(const json& j, V2XChargingParameters& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("minChargePower")) { + k.minChargePower.emplace(j.at("minChargePower")); + } + if (j.contains("minChargePower_L2")) { + k.minChargePower_L2.emplace(j.at("minChargePower_L2")); + } + if (j.contains("minChargePower_L3")) { + k.minChargePower_L3.emplace(j.at("minChargePower_L3")); + } + if (j.contains("maxChargePower")) { + k.maxChargePower.emplace(j.at("maxChargePower")); + } + if (j.contains("maxChargePower_L2")) { + k.maxChargePower_L2.emplace(j.at("maxChargePower_L2")); + } + if (j.contains("maxChargePower_L3")) { + k.maxChargePower_L3.emplace(j.at("maxChargePower_L3")); + } + if (j.contains("minDischargePower")) { + k.minDischargePower.emplace(j.at("minDischargePower")); + } + if (j.contains("minDischargePower_L2")) { + k.minDischargePower_L2.emplace(j.at("minDischargePower_L2")); + } + if (j.contains("minDischargePower_L3")) { + k.minDischargePower_L3.emplace(j.at("minDischargePower_L3")); + } + if (j.contains("maxDischargePower")) { + k.maxDischargePower.emplace(j.at("maxDischargePower")); + } + if (j.contains("maxDischargePower_L2")) { + k.maxDischargePower_L2.emplace(j.at("maxDischargePower_L2")); + } + if (j.contains("maxDischargePower_L3")) { + k.maxDischargePower_L3.emplace(j.at("maxDischargePower_L3")); + } + if (j.contains("minChargeCurrent")) { + k.minChargeCurrent.emplace(j.at("minChargeCurrent")); + } + if (j.contains("maxChargeCurrent")) { + k.maxChargeCurrent.emplace(j.at("maxChargeCurrent")); + } + if (j.contains("minDischargeCurrent")) { + k.minDischargeCurrent.emplace(j.at("minDischargeCurrent")); + } + if (j.contains("maxDischargeCurrent")) { + k.maxDischargeCurrent.emplace(j.at("maxDischargeCurrent")); + } + if (j.contains("minVoltage")) { + k.minVoltage.emplace(j.at("minVoltage")); + } + if (j.contains("maxVoltage")) { + k.maxVoltage.emplace(j.at("maxVoltage")); + } + if (j.contains("evTargetEnergyRequest")) { + k.evTargetEnergyRequest.emplace(j.at("evTargetEnergyRequest")); + } + if (j.contains("evMinEnergyRequest")) { + k.evMinEnergyRequest.emplace(j.at("evMinEnergyRequest")); + } + if (j.contains("evMaxEnergyRequest")) { + k.evMaxEnergyRequest.emplace(j.at("evMaxEnergyRequest")); + } + if (j.contains("evMinV2XEnergyRequest")) { + k.evMinV2XEnergyRequest.emplace(j.at("evMinV2XEnergyRequest")); + } + if (j.contains("evMaxV2XEnergyRequest")) { + k.evMaxV2XEnergyRequest.emplace(j.at("evMaxV2XEnergyRequest")); + } + if (j.contains("targetSoC")) { + k.targetSoC.emplace(j.at("targetSoC")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given V2XChargingParameters \p k to the given output stream \p os +/// \returns an output stream with the V2XChargingParameters written to +std::ostream& operator<<(std::ostream& os, const V2XChargingParameters& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ChargingNeeds \p k to a given json object \p j +void to_json(json& j, const ChargingNeeds& k) { + // the required parts of the message + j = json{ + {"requestedEnergyTransfer", conversions::energy_transfer_mode_enum_to_string(k.requestedEnergyTransfer)}, + }; + // the optional parts of the message + if (k.acChargingParameters) { + j["acChargingParameters"] = k.acChargingParameters.value(); + } + if (k.derChargingParameters) { + j["derChargingParameters"] = k.derChargingParameters.value(); + } + if (k.evEnergyOffer) { + j["evEnergyOffer"] = k.evEnergyOffer.value(); + } + if (k.dcChargingParameters) { + j["dcChargingParameters"] = k.dcChargingParameters.value(); + } + if (k.v2xChargingParameters) { + j["v2xChargingParameters"] = k.v2xChargingParameters.value(); + } + if (k.availableEnergyTransfer) { + j["availableEnergyTransfer"] = json::array(); + for (auto val : k.availableEnergyTransfer.value()) { + j["availableEnergyTransfer"].push_back(conversions::energy_transfer_mode_enum_to_string(val)); + } + } + if (k.controlMode) { + j["controlMode"] = conversions::control_mode_enum_to_string(k.controlMode.value()); + } + if (k.mobilityNeedsMode) { + j["mobilityNeedsMode"] = conversions::mobility_needs_mode_enum_to_string(k.mobilityNeedsMode.value()); + } + if (k.departureTime) { + j["departureTime"] = k.departureTime.value().to_rfc3339(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingNeeds \p k +void from_json(const json& j, ChargingNeeds& k) { + // the required parts of the message + k.requestedEnergyTransfer = conversions::string_to_energy_transfer_mode_enum(j.at("requestedEnergyTransfer")); + + // the optional parts of the message + if (j.contains("acChargingParameters")) { + k.acChargingParameters.emplace(j.at("acChargingParameters")); + } + if (j.contains("derChargingParameters")) { + k.derChargingParameters.emplace(j.at("derChargingParameters")); + } + if (j.contains("evEnergyOffer")) { + k.evEnergyOffer.emplace(j.at("evEnergyOffer")); + } + if (j.contains("dcChargingParameters")) { + k.dcChargingParameters.emplace(j.at("dcChargingParameters")); + } + if (j.contains("v2xChargingParameters")) { + k.v2xChargingParameters.emplace(j.at("v2xChargingParameters")); + } + if (j.contains("availableEnergyTransfer")) { + json arr = j.at("availableEnergyTransfer"); + std::vector vec; + for (auto val : arr) { + vec.push_back(conversions::string_to_energy_transfer_mode_enum(val)); + } + k.availableEnergyTransfer.emplace(vec); + } + if (j.contains("controlMode")) { + k.controlMode.emplace(conversions::string_to_control_mode_enum(j.at("controlMode"))); + } + if (j.contains("mobilityNeedsMode")) { + k.mobilityNeedsMode.emplace(conversions::string_to_mobility_needs_mode_enum(j.at("mobilityNeedsMode"))); + } + if (j.contains("departureTime")) { + k.departureTime.emplace(j.at("departureTime").get()); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ChargingNeeds \p k to the given output stream \p os +/// \returns an output stream with the ChargingNeeds written to +std::ostream& operator<<(std::ostream& os, const ChargingNeeds& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EventData \p k to a given json object \p j +void to_json(json& j, const EventData& k) { + // the required parts of the message + j = json{ + {"eventId", k.eventId}, + {"timestamp", k.timestamp.to_rfc3339()}, + {"trigger", conversions::event_trigger_enum_to_string(k.trigger)}, + {"actualValue", k.actualValue}, + {"component", k.component}, + {"eventNotificationType", conversions::event_notification_enum_to_string(k.eventNotificationType)}, + {"variable", k.variable}, + }; + // the optional parts of the message + if (k.cause) { + j["cause"] = k.cause.value(); + } + if (k.techCode) { + j["techCode"] = k.techCode.value(); + } + if (k.techInfo) { + j["techInfo"] = k.techInfo.value(); + } + if (k.cleared) { + j["cleared"] = k.cleared.value(); + } + if (k.transactionId) { + j["transactionId"] = k.transactionId.value(); + } + if (k.variableMonitoringId) { + j["variableMonitoringId"] = k.variableMonitoringId.value(); + } + if (k.severity) { + j["severity"] = k.severity.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EventData \p k +void from_json(const json& j, EventData& k) { + // the required parts of the message + k.eventId = j.at("eventId"); + k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); + k.trigger = conversions::string_to_event_trigger_enum(j.at("trigger")); + k.actualValue = j.at("actualValue"); + k.component = j.at("component"); + k.eventNotificationType = conversions::string_to_event_notification_enum(j.at("eventNotificationType")); + k.variable = j.at("variable"); + + // the optional parts of the message + if (j.contains("cause")) { + k.cause.emplace(j.at("cause")); + } + if (j.contains("techCode")) { + k.techCode.emplace(j.at("techCode")); + } + if (j.contains("techInfo")) { + k.techInfo.emplace(j.at("techInfo")); + } + if (j.contains("cleared")) { + k.cleared.emplace(j.at("cleared")); + } + if (j.contains("transactionId")) { + k.transactionId.emplace(j.at("transactionId")); + } + if (j.contains("variableMonitoringId")) { + k.variableMonitoringId.emplace(j.at("variableMonitoringId")); + } + if (j.contains("severity")) { + k.severity.emplace(j.at("severity")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EventData \p k to the given output stream \p os +/// \returns an output stream with the EventData written to +std::ostream& operator<<(std::ostream& os, const EventData& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given VariableMonitoring \p k to a given json object \p j +void to_json(json& j, const VariableMonitoring& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"transaction", k.transaction}, + {"value", k.value}, + {"type", conversions::monitor_enum_to_string(k.type)}, + {"severity", k.severity}, + {"eventNotificationType", conversions::event_notification_enum_to_string(k.eventNotificationType)}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given VariableMonitoring \p k +void from_json(const json& j, VariableMonitoring& k) { + // the required parts of the message + k.id = j.at("id"); + k.transaction = j.at("transaction"); + k.value = j.at("value"); + k.type = conversions::string_to_monitor_enum(j.at("type")); + k.severity = j.at("severity"); + k.eventNotificationType = conversions::string_to_event_notification_enum(j.at("eventNotificationType")); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given VariableMonitoring \p k to the given output stream \p os +/// \returns an output stream with the VariableMonitoring written to +std::ostream& operator<<(std::ostream& os, const VariableMonitoring& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given MonitoringData \p k to a given json object \p j +void to_json(json& j, const MonitoringData& k) { + // the required parts of the message + j = json{ + {"component", k.component}, + {"variable", k.variable}, + {"variableMonitoring", k.variableMonitoring}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given MonitoringData \p k +void from_json(const json& j, MonitoringData& k) { + // the required parts of the message + k.component = j.at("component"); + k.variable = j.at("variable"); + for (auto val : j.at("variableMonitoring")) { + k.variableMonitoring.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given MonitoringData \p k to the given output stream \p os +/// \returns an output stream with the MonitoringData written to +std::ostream& operator<<(std::ostream& os, const MonitoringData& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given StreamDataElement \p k to a given json object \p j +void to_json(json& j, const StreamDataElement& k) { + // the required parts of the message + j = json{ + {"t", k.t}, + {"v", k.v}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given StreamDataElement \p k +void from_json(const json& j, StreamDataElement& k) { + // the required parts of the message + k.t = j.at("t"); + k.v = j.at("v"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given StreamDataElement \p k to the given output stream \p os +/// \returns an output stream with the StreamDataElement written to +std::ostream& operator<<(std::ostream& os, const StreamDataElement& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given NotifyPeriodicEventStream \p k to a given json object \p j +void to_json(json& j, const NotifyPeriodicEventStream& k) { + // the required parts of the message + j = json{ + {"data", k.data}, + {"id", k.id}, + {"pending", k.pending}, + {"basetime", k.basetime.to_rfc3339()}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given NotifyPeriodicEventStream \p k +void from_json(const json& j, NotifyPeriodicEventStream& k) { + // the required parts of the message + for (auto val : j.at("data")) { + k.data.push_back(val); + } + k.id = j.at("id"); + k.pending = j.at("pending"); + k.basetime = ocpp::DateTime(std::string(j.at("basetime"))); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given NotifyPeriodicEventStream \p k to the given output stream \p os +/// \returns an output stream with the NotifyPeriodicEventStream written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStream& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given VariableAttribute \p k to a given json object \p j +void to_json(json& j, const VariableAttribute& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.type) { + j["type"] = conversions::attribute_enum_to_string(k.type.value()); + } + if (k.value) { + j["value"] = k.value.value(); + } + if (k.mutability) { + j["mutability"] = conversions::mutability_enum_to_string(k.mutability.value()); + } + if (k.persistent) { + j["persistent"] = k.persistent.value(); + } + if (k.constant) { + j["constant"] = k.constant.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given VariableAttribute \p k +void from_json(const json& j, VariableAttribute& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("type")) { + k.type.emplace(conversions::string_to_attribute_enum(j.at("type"))); + } + if (j.contains("value")) { + const json& value = j.at("value"); + if (value.is_string()) { + k.value = value; + } else if (value.is_boolean()) { + if (value.get()) { + // Convert to lower case if that is not the case currently. + k.value = "true"; + } else { + // Convert to lower case if that is not the case currently. + k.value = "false"; + } + } else if (value.is_array() || value.is_object()) { + // Maybe this is correct and is just a string (json value string), so just return the string. + k.value = value.dump(); + } else { + k.value = value.dump(); + } + } + if (j.contains("mutability")) { + k.mutability.emplace(conversions::string_to_mutability_enum(j.at("mutability"))); + } + if (j.contains("persistent")) { + k.persistent.emplace(j.at("persistent")); + } + if (j.contains("constant")) { + k.constant.emplace(j.at("constant")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given VariableAttribute \p k to the given output stream \p os +/// \returns an output stream with the VariableAttribute written to +std::ostream& operator<<(std::ostream& os, const VariableAttribute& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given VariableCharacteristics \p k to a given json object \p j +void to_json(json& j, const VariableCharacteristics& k) { + // the required parts of the message + j = json{ + {"dataType", conversions::data_enum_to_string(k.dataType)}, + {"supportsMonitoring", k.supportsMonitoring}, + }; + // the optional parts of the message + if (k.unit) { + j["unit"] = k.unit.value(); + } + if (k.minLimit) { + j["minLimit"] = k.minLimit.value(); + } + if (k.maxLimit) { + j["maxLimit"] = k.maxLimit.value(); + } + if (k.maxElements) { + j["maxElements"] = k.maxElements.value(); + } + if (k.valuesList) { + j["valuesList"] = k.valuesList.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given VariableCharacteristics \p k +void from_json(const json& j, VariableCharacteristics& k) { + // the required parts of the message + k.dataType = conversions::string_to_data_enum(j.at("dataType")); + k.supportsMonitoring = j.at("supportsMonitoring"); + + // the optional parts of the message + if (j.contains("unit")) { + k.unit.emplace(j.at("unit")); + } + if (j.contains("minLimit")) { + k.minLimit.emplace(j.at("minLimit")); + } + if (j.contains("maxLimit")) { + k.maxLimit.emplace(j.at("maxLimit")); + } + if (j.contains("maxElements")) { + k.maxElements.emplace(j.at("maxElements")); + } + if (j.contains("valuesList")) { + k.valuesList.emplace(j.at("valuesList")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given VariableCharacteristics \p k to the given output stream \p os +/// \returns an output stream with the VariableCharacteristics written to +std::ostream& operator<<(std::ostream& os, const VariableCharacteristics& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ReportData \p k to a given json object \p j +void to_json(json& j, const ReportData& k) { + // the required parts of the message + j = json{ + {"component", k.component}, + {"variable", k.variable}, + {"variableAttribute", k.variableAttribute}, + }; + // the optional parts of the message + if (k.variableCharacteristics) { + j["variableCharacteristics"] = k.variableCharacteristics.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ReportData \p k +void from_json(const json& j, ReportData& k) { + // the required parts of the message + k.component = j.at("component"); + k.variable = j.at("variable"); + for (auto val : j.at("variableAttribute")) { + k.variableAttribute.push_back(val); + } + + // the optional parts of the message + if (j.contains("variableCharacteristics")) { + k.variableCharacteristics.emplace(j.at("variableCharacteristics")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ReportData \p k to the given output stream \p os +/// \returns an output stream with the ReportData written to +std::ostream& operator<<(std::ostream& os, const ReportData& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given Address \p k to a given json object \p j +void to_json(json& j, const Address& k) { + // the required parts of the message + j = json{ + {"name", k.name}, + {"address1", k.address1}, + {"city", k.city}, + {"country", k.country}, + }; + // the optional parts of the message + if (k.address2) { + j["address2"] = k.address2.value(); + } + if (k.postalCode) { + j["postalCode"] = k.postalCode.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given Address \p k +void from_json(const json& j, Address& k) { + // the required parts of the message + k.name = j.at("name"); + k.address1 = j.at("address1"); + k.city = j.at("city"); + k.country = j.at("country"); + + // the optional parts of the message + if (j.contains("address2")) { + k.address2.emplace(j.at("address2")); + } + if (j.contains("postalCode")) { + k.postalCode.emplace(j.at("postalCode")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given Address \p k to the given output stream \p os +/// \returns an output stream with the Address written to +std::ostream& operator<<(std::ostream& os, const Address& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ChargingScheduleUpdate \p k to a given json object \p j +void to_json(json& j, const ChargingScheduleUpdate& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.limit) { + j["limit"] = k.limit.value(); + } + if (k.limit_L2) { + j["limit_L2"] = k.limit_L2.value(); + } + if (k.limit_L3) { + j["limit_L3"] = k.limit_L3.value(); + } + if (k.dischargeLimit) { + j["dischargeLimit"] = k.dischargeLimit.value(); + } + if (k.dischargeLimit_L2) { + j["dischargeLimit_L2"] = k.dischargeLimit_L2.value(); + } + if (k.dischargeLimit_L3) { + j["dischargeLimit_L3"] = k.dischargeLimit_L3.value(); + } + if (k.setpoint) { + j["setpoint"] = k.setpoint.value(); + } + if (k.setpoint_L2) { + j["setpoint_L2"] = k.setpoint_L2.value(); + } + if (k.setpoint_L3) { + j["setpoint_L3"] = k.setpoint_L3.value(); + } + if (k.setpointReactive) { + j["setpointReactive"] = k.setpointReactive.value(); + } + if (k.setpointReactive_L2) { + j["setpointReactive_L2"] = k.setpointReactive_L2.value(); + } + if (k.setpointReactive_L3) { + j["setpointReactive_L3"] = k.setpointReactive_L3.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingScheduleUpdate \p k +void from_json(const json& j, ChargingScheduleUpdate& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("limit")) { + k.limit.emplace(j.at("limit")); + } + if (j.contains("limit_L2")) { + k.limit_L2.emplace(j.at("limit_L2")); + } + if (j.contains("limit_L3")) { + k.limit_L3.emplace(j.at("limit_L3")); + } + if (j.contains("dischargeLimit")) { + k.dischargeLimit.emplace(j.at("dischargeLimit")); + } + if (j.contains("dischargeLimit_L2")) { + k.dischargeLimit_L2.emplace(j.at("dischargeLimit_L2")); + } + if (j.contains("dischargeLimit_L3")) { + k.dischargeLimit_L3.emplace(j.at("dischargeLimit_L3")); + } + if (j.contains("setpoint")) { + k.setpoint.emplace(j.at("setpoint")); + } + if (j.contains("setpoint_L2")) { + k.setpoint_L2.emplace(j.at("setpoint_L2")); + } + if (j.contains("setpoint_L3")) { + k.setpoint_L3.emplace(j.at("setpoint_L3")); + } + if (j.contains("setpointReactive")) { + k.setpointReactive.emplace(j.at("setpointReactive")); + } + if (j.contains("setpointReactive_L2")) { + k.setpointReactive_L2.emplace(j.at("setpointReactive_L2")); + } + if (j.contains("setpointReactive_L3")) { + k.setpointReactive_L3.emplace(j.at("setpointReactive_L3")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ChargingScheduleUpdate \p k to the given output stream \p os +/// \returns an output stream with the ChargingScheduleUpdate written to +std::ostream& operator<<(std::ostream& os, const ChargingScheduleUpdate& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ChargingProfile \p k to a given json object \p j +void to_json(json& j, const ChargingProfile& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"stackLevel", k.stackLevel}, + {"chargingProfilePurpose", conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose)}, + {"chargingProfileKind", conversions::charging_profile_kind_enum_to_string(k.chargingProfileKind)}, + {"chargingSchedule", k.chargingSchedule}, + }; + // the optional parts of the message + if (k.recurrencyKind) { + j["recurrencyKind"] = conversions::recurrency_kind_enum_to_string(k.recurrencyKind.value()); + } + if (k.validFrom) { + j["validFrom"] = k.validFrom.value().to_rfc3339(); + } + if (k.validTo) { + j["validTo"] = k.validTo.value().to_rfc3339(); + } + if (k.transactionId) { + j["transactionId"] = k.transactionId.value(); + } + if (k.maxOfflineDuration) { + j["maxOfflineDuration"] = k.maxOfflineDuration.value(); + } + if (k.invalidAfterOfflineDuration) { + j["invalidAfterOfflineDuration"] = k.invalidAfterOfflineDuration.value(); + } + if (k.dynUpdateInterval) { + j["dynUpdateInterval"] = k.dynUpdateInterval.value(); + } + if (k.dynUpdateTime) { + j["dynUpdateTime"] = k.dynUpdateTime.value().to_rfc3339(); + } + if (k.priceScheduleSignature) { + j["priceScheduleSignature"] = k.priceScheduleSignature.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ChargingProfile \p k +void from_json(const json& j, ChargingProfile& k) { + // the required parts of the message + k.id = j.at("id"); + k.stackLevel = j.at("stackLevel"); + k.chargingProfilePurpose = conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose")); + k.chargingProfileKind = conversions::string_to_charging_profile_kind_enum(j.at("chargingProfileKind")); + for (auto val : j.at("chargingSchedule")) { + k.chargingSchedule.push_back(val); + } + + // the optional parts of the message + if (j.contains("recurrencyKind")) { + k.recurrencyKind.emplace(conversions::string_to_recurrency_kind_enum(j.at("recurrencyKind"))); + } + if (j.contains("validFrom")) { + k.validFrom.emplace(j.at("validFrom").get()); + } + if (j.contains("validTo")) { + k.validTo.emplace(j.at("validTo").get()); + } + if (j.contains("transactionId")) { + k.transactionId.emplace(j.at("transactionId")); + } + if (j.contains("maxOfflineDuration")) { + k.maxOfflineDuration.emplace(j.at("maxOfflineDuration")); + } + if (j.contains("invalidAfterOfflineDuration")) { + k.invalidAfterOfflineDuration.emplace(j.at("invalidAfterOfflineDuration")); + } + if (j.contains("dynUpdateInterval")) { + k.dynUpdateInterval.emplace(j.at("dynUpdateInterval")); + } + if (j.contains("dynUpdateTime")) { + k.dynUpdateTime.emplace(j.at("dynUpdateTime").get()); + } + if (j.contains("priceScheduleSignature")) { + k.priceScheduleSignature.emplace(j.at("priceScheduleSignature")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ChargingProfile \p k to the given output stream \p os +/// \returns an output stream with the ChargingProfile written to +std::ostream& operator<<(std::ostream& os, const ChargingProfile& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given DERCurvePoints \p k to a given json object \p j +void to_json(json& j, const DERCurvePoints& k) { + // the required parts of the message + j = json{ + {"x", k.x}, + {"y", k.y}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given DERCurvePoints \p k +void from_json(const json& j, DERCurvePoints& k) { + // the required parts of the message + k.x = j.at("x"); + k.y = j.at("y"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given DERCurvePoints \p k to the given output stream \p os +/// \returns an output stream with the DERCurvePoints written to +std::ostream& operator<<(std::ostream& os, const DERCurvePoints& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given Hysteresis \p k to a given json object \p j +void to_json(json& j, const Hysteresis& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.hysteresisHigh) { + j["hysteresisHigh"] = k.hysteresisHigh.value(); + } + if (k.hysteresisLow) { + j["hysteresisLow"] = k.hysteresisLow.value(); + } + if (k.hysteresisDelay) { + j["hysteresisDelay"] = k.hysteresisDelay.value(); + } + if (k.hysteresisGradient) { + j["hysteresisGradient"] = k.hysteresisGradient.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given Hysteresis \p k +void from_json(const json& j, Hysteresis& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("hysteresisHigh")) { + k.hysteresisHigh.emplace(j.at("hysteresisHigh")); + } + if (j.contains("hysteresisLow")) { + k.hysteresisLow.emplace(j.at("hysteresisLow")); + } + if (j.contains("hysteresisDelay")) { + k.hysteresisDelay.emplace(j.at("hysteresisDelay")); + } + if (j.contains("hysteresisGradient")) { + k.hysteresisGradient.emplace(j.at("hysteresisGradient")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given Hysteresis \p k to the given output stream \p os +/// \returns an output stream with the Hysteresis written to +std::ostream& operator<<(std::ostream& os, const Hysteresis& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given ReactivePowerParams \p k to a given json object \p j +void to_json(json& j, const ReactivePowerParams& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.vRef) { + j["vRef"] = k.vRef.value(); + } + if (k.autonomousVRefEnable) { + j["autonomousVRefEnable"] = k.autonomousVRefEnable.value(); + } + if (k.autonomousVRefTimeConstant) { + j["autonomousVRefTimeConstant"] = k.autonomousVRefTimeConstant.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given ReactivePowerParams \p k +void from_json(const json& j, ReactivePowerParams& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("vRef")) { + k.vRef.emplace(j.at("vRef")); + } + if (j.contains("autonomousVRefEnable")) { + k.autonomousVRefEnable.emplace(j.at("autonomousVRefEnable")); + } + if (j.contains("autonomousVRefTimeConstant")) { + k.autonomousVRefTimeConstant.emplace(j.at("autonomousVRefTimeConstant")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given ReactivePowerParams \p k to the given output stream \p os +/// \returns an output stream with the ReactivePowerParams written to +std::ostream& operator<<(std::ostream& os, const ReactivePowerParams& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given VoltageParams \p k to a given json object \p j +void to_json(json& j, const VoltageParams& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.hv10MinMeanValue) { + j["hv10MinMeanValue"] = k.hv10MinMeanValue.value(); + } + if (k.hv10MinMeanTripDelay) { + j["hv10MinMeanTripDelay"] = k.hv10MinMeanTripDelay.value(); + } + if (k.powerDuringCessation) { + j["powerDuringCessation"] = conversions::power_during_cessation_enum_to_string(k.powerDuringCessation.value()); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given VoltageParams \p k +void from_json(const json& j, VoltageParams& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("hv10MinMeanValue")) { + k.hv10MinMeanValue.emplace(j.at("hv10MinMeanValue")); + } + if (j.contains("hv10MinMeanTripDelay")) { + k.hv10MinMeanTripDelay.emplace(j.at("hv10MinMeanTripDelay")); + } + if (j.contains("powerDuringCessation")) { + k.powerDuringCessation.emplace( + conversions::string_to_power_during_cessation_enum(j.at("powerDuringCessation"))); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given VoltageParams \p k to the given output stream \p os +/// \returns an output stream with the VoltageParams written to +std::ostream& operator<<(std::ostream& os, const VoltageParams& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given DERCurve \p k to a given json object \p j +void to_json(json& j, const DERCurve& k) { + // the required parts of the message + j = json{ + {"curveData", k.curveData}, + {"priority", k.priority}, + {"yUnit", conversions::derunit_enum_to_string(k.yUnit)}, + }; + // the optional parts of the message + if (k.hysteresis) { + j["hysteresis"] = k.hysteresis.value(); + } + if (k.reactivePowerParams) { + j["reactivePowerParams"] = k.reactivePowerParams.value(); + } + if (k.voltageParams) { + j["voltageParams"] = k.voltageParams.value(); + } + if (k.responseTime) { + j["responseTime"] = k.responseTime.value(); + } + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given DERCurve \p k +void from_json(const json& j, DERCurve& k) { + // the required parts of the message + for (auto val : j.at("curveData")) { + k.curveData.push_back(val); + } + k.priority = j.at("priority"); + k.yUnit = conversions::string_to_derunit_enum(j.at("yUnit")); + + // the optional parts of the message + if (j.contains("hysteresis")) { + k.hysteresis.emplace(j.at("hysteresis")); + } + if (j.contains("reactivePowerParams")) { + k.reactivePowerParams.emplace(j.at("reactivePowerParams")); + } + if (j.contains("voltageParams")) { + k.voltageParams.emplace(j.at("voltageParams")); + } + if (j.contains("responseTime")) { + k.responseTime.emplace(j.at("responseTime")); + } + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given DERCurve \p k to the given output stream \p os +/// \returns an output stream with the DERCurve written to +std::ostream& operator<<(std::ostream& os, const DERCurve& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given DERCurveGet \p k to a given json object \p j +void to_json(json& j, const DERCurveGet& k) { + // the required parts of the message + j = json{ + {"curve", k.curve}, + {"id", k.id}, + {"curveType", conversions::dercontrol_enum_to_string(k.curveType)}, + {"isDefault", k.isDefault}, + {"isSuperseded", k.isSuperseded}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given DERCurveGet \p k +void from_json(const json& j, DERCurveGet& k) { + // the required parts of the message + k.curve = j.at("curve"); + k.id = j.at("id"); + k.curveType = conversions::string_to_dercontrol_enum(j.at("curveType")); + k.isDefault = j.at("isDefault"); + k.isSuperseded = j.at("isSuperseded"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given DERCurveGet \p k to the given output stream \p os +/// \returns an output stream with the DERCurveGet written to +std::ostream& operator<<(std::ostream& os, const DERCurveGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EnterService \p k to a given json object \p j +void to_json(json& j, const EnterService& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, {"highVoltage", k.highVoltage}, {"lowVoltage", k.lowVoltage}, + {"highFreq", k.highFreq}, {"lowFreq", k.lowFreq}, + }; + // the optional parts of the message + if (k.delay) { + j["delay"] = k.delay.value(); + } + if (k.randomDelay) { + j["randomDelay"] = k.randomDelay.value(); + } + if (k.rampRate) { + j["rampRate"] = k.rampRate.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EnterService \p k +void from_json(const json& j, EnterService& k) { + // the required parts of the message + k.priority = j.at("priority"); + k.highVoltage = j.at("highVoltage"); + k.lowVoltage = j.at("lowVoltage"); + k.highFreq = j.at("highFreq"); + k.lowFreq = j.at("lowFreq"); + + // the optional parts of the message + if (j.contains("delay")) { + k.delay.emplace(j.at("delay")); + } + if (j.contains("randomDelay")) { + k.randomDelay.emplace(j.at("randomDelay")); + } + if (j.contains("rampRate")) { + k.rampRate.emplace(j.at("rampRate")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EnterService \p k to the given output stream \p os +/// \returns an output stream with the EnterService written to +std::ostream& operator<<(std::ostream& os, const EnterService& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given EnterServiceGet \p k to a given json object \p j +void to_json(json& j, const EnterServiceGet& k) { + // the required parts of the message + j = json{ + {"enterService", k.enterService}, + {"id", k.id}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given EnterServiceGet \p k +void from_json(const json& j, EnterServiceGet& k) { + // the required parts of the message + k.enterService = j.at("enterService"); + k.id = j.at("id"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given EnterServiceGet \p k to the given output stream \p os +/// \returns an output stream with the EnterServiceGet written to +std::ostream& operator<<(std::ostream& os, const EnterServiceGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FixedPF \p k to a given json object \p j +void to_json(json& j, const FixedPF& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, + {"displacement", k.displacement}, + {"excitation", k.excitation}, + }; + // the optional parts of the message + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FixedPF \p k +void from_json(const json& j, FixedPF& k) { + // the required parts of the message + k.priority = j.at("priority"); + k.displacement = j.at("displacement"); + k.excitation = j.at("excitation"); + + // the optional parts of the message + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FixedPF \p k to the given output stream \p os +/// \returns an output stream with the FixedPF written to +std::ostream& operator<<(std::ostream& os, const FixedPF& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FixedPFGet \p k to a given json object \p j +void to_json(json& j, const FixedPFGet& k) { + // the required parts of the message + j = json{ + {"fixedPF", k.fixedPF}, + {"id", k.id}, + {"isDefault", k.isDefault}, + {"isSuperseded", k.isSuperseded}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FixedPFGet \p k +void from_json(const json& j, FixedPFGet& k) { + // the required parts of the message + k.fixedPF = j.at("fixedPF"); + k.id = j.at("id"); + k.isDefault = j.at("isDefault"); + k.isSuperseded = j.at("isSuperseded"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FixedPFGet \p k to the given output stream \p os +/// \returns an output stream with the FixedPFGet written to +std::ostream& operator<<(std::ostream& os, const FixedPFGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FixedVar \p k to a given json object \p j +void to_json(json& j, const FixedVar& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, + {"setpoint", k.setpoint}, + {"unit", conversions::derunit_enum_to_string(k.unit)}, + }; + // the optional parts of the message + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FixedVar \p k +void from_json(const json& j, FixedVar& k) { + // the required parts of the message + k.priority = j.at("priority"); + k.setpoint = j.at("setpoint"); + k.unit = conversions::string_to_derunit_enum(j.at("unit")); + + // the optional parts of the message + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FixedVar \p k to the given output stream \p os +/// \returns an output stream with the FixedVar written to +std::ostream& operator<<(std::ostream& os, const FixedVar& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FixedVarGet \p k to a given json object \p j +void to_json(json& j, const FixedVarGet& k) { + // the required parts of the message + j = json{ + {"fixedVar", k.fixedVar}, + {"id", k.id}, + {"isDefault", k.isDefault}, + {"isSuperseded", k.isSuperseded}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FixedVarGet \p k +void from_json(const json& j, FixedVarGet& k) { + // the required parts of the message + k.fixedVar = j.at("fixedVar"); + k.id = j.at("id"); + k.isDefault = j.at("isDefault"); + k.isSuperseded = j.at("isSuperseded"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FixedVarGet \p k to the given output stream \p os +/// \returns an output stream with the FixedVarGet written to +std::ostream& operator<<(std::ostream& os, const FixedVarGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FreqDroop \p k to a given json object \p j +void to_json(json& j, const FreqDroop& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, {"overFreq", k.overFreq}, {"underFreq", k.underFreq}, + {"overDroop", k.overDroop}, {"underDroop", k.underDroop}, {"responseTime", k.responseTime}, + }; + // the optional parts of the message + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FreqDroop \p k +void from_json(const json& j, FreqDroop& k) { + // the required parts of the message + k.priority = j.at("priority"); + k.overFreq = j.at("overFreq"); + k.underFreq = j.at("underFreq"); + k.overDroop = j.at("overDroop"); + k.underDroop = j.at("underDroop"); + k.responseTime = j.at("responseTime"); + + // the optional parts of the message + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FreqDroop \p k to the given output stream \p os +/// \returns an output stream with the FreqDroop written to +std::ostream& operator<<(std::ostream& os, const FreqDroop& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given FreqDroopGet \p k to a given json object \p j +void to_json(json& j, const FreqDroopGet& k) { + // the required parts of the message + j = json{ + {"freqDroop", k.freqDroop}, + {"id", k.id}, + {"isDefault", k.isDefault}, + {"isSuperseded", k.isSuperseded}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given FreqDroopGet \p k +void from_json(const json& j, FreqDroopGet& k) { + // the required parts of the message + k.freqDroop = j.at("freqDroop"); + k.id = j.at("id"); + k.isDefault = j.at("isDefault"); + k.isSuperseded = j.at("isSuperseded"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given FreqDroopGet \p k to the given output stream \p os +/// \returns an output stream with the FreqDroopGet written to +std::ostream& operator<<(std::ostream& os, const FreqDroopGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given Gradient \p k to a given json object \p j +void to_json(json& j, const Gradient& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, + {"gradient", k.gradient}, + {"softGradient", k.softGradient}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given Gradient \p k +void from_json(const json& j, Gradient& k) { + // the required parts of the message + k.priority = j.at("priority"); + k.gradient = j.at("gradient"); + k.softGradient = j.at("softGradient"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given Gradient \p k to the given output stream \p os +/// \returns an output stream with the Gradient written to +std::ostream& operator<<(std::ostream& os, const Gradient& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given GradientGet \p k to a given json object \p j +void to_json(json& j, const GradientGet& k) { + // the required parts of the message + j = json{ + {"gradient", k.gradient}, + {"id", k.id}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); } - if (k.constant) { - j["constant"] = k.constant.value(); +} + +/// \brief Conversion from a given json object \p j to a given GradientGet \p k +void from_json(const json& j, GradientGet& k) { + // the required parts of the message + k.gradient = j.at("gradient"); + k.id = j.at("id"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -/// \brief Conversion from a given json object \p j to a given VariableAttribute \p k -void from_json(const json& j, VariableAttribute& k) { +// \brief Writes the string representation of the given GradientGet \p k to the given output stream \p os +/// \returns an output stream with the GradientGet written to +std::ostream& operator<<(std::ostream& os, const GradientGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given LimitMaxDischarge \p k to a given json object \p j +void to_json(json& j, const LimitMaxDischarge& k) { + // the required parts of the message + j = json{ + {"priority", k.priority}, + }; + // the optional parts of the message + if (k.pctMaxDischargePower) { + j["pctMaxDischargePower"] = k.pctMaxDischargePower.value(); + } + if (k.powerMonitoringMustTrip) { + j["powerMonitoringMustTrip"] = k.powerMonitoringMustTrip.value(); + } + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given LimitMaxDischarge \p k +void from_json(const json& j, LimitMaxDischarge& k) { // the required parts of the message + k.priority = j.at("priority"); // the optional parts of the message + if (j.contains("pctMaxDischargePower")) { + k.pctMaxDischargePower.emplace(j.at("pctMaxDischargePower")); + } + if (j.contains("powerMonitoringMustTrip")) { + k.powerMonitoringMustTrip.emplace(j.at("powerMonitoringMustTrip")); + } + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("type")) { - k.type.emplace(conversions::string_to_attribute_enum(j.at("type"))); +} + +// \brief Writes the string representation of the given LimitMaxDischarge \p k to the given output stream \p os +/// \returns an output stream with the LimitMaxDischarge written to +std::ostream& operator<<(std::ostream& os, const LimitMaxDischarge& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given LimitMaxDischargeGet \p k to a given json object \p j +void to_json(json& j, const LimitMaxDischargeGet& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"isDefault", k.isDefault}, + {"isSuperseded", k.isSuperseded}, + {"limitMaxDischarge", k.limitMaxDischarge}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); } - if (j.contains("value")) { - const json& value = j.at("value"); - if (value.is_string()) { - k.value = value; - } else if (value.is_boolean()) { - if (value.get()) { - // Convert to lower case if that is not the case currently. - k.value = "true"; - } else { - // Convert to lower case if that is not the case currently. - k.value = "false"; - } - } else if (value.is_array() || value.is_object()) { - // Maybe this is correct and is just a string (json value string), so just return the string. - k.value = value.dump(); - } else { - k.value = value.dump(); - } +} + +/// \brief Conversion from a given json object \p j to a given LimitMaxDischargeGet \p k +void from_json(const json& j, LimitMaxDischargeGet& k) { + // the required parts of the message + k.id = j.at("id"); + k.isDefault = j.at("isDefault"); + k.isSuperseded = j.at("isSuperseded"); + k.limitMaxDischarge = j.at("limitMaxDischarge"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given LimitMaxDischargeGet \p k to the given output stream \p os +/// \returns an output stream with the LimitMaxDischargeGet written to +std::ostream& operator<<(std::ostream& os, const LimitMaxDischargeGet& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given AuthorizationData \p k to a given json object \p j +void to_json(json& j, const AuthorizationData& k) { + // the required parts of the message + j = json{ + {"idToken", k.idToken}, + }; + // the optional parts of the message + if (k.idTokenInfo) { + j["idTokenInfo"] = k.idTokenInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given AuthorizationData \p k +void from_json(const json& j, AuthorizationData& k) { + // the required parts of the message + k.idToken = j.at("idToken"); + + // the optional parts of the message + if (j.contains("idTokenInfo")) { + k.idTokenInfo.emplace(j.at("idTokenInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given AuthorizationData \p k to the given output stream \p os +/// \returns an output stream with the AuthorizationData written to +std::ostream& operator<<(std::ostream& os, const AuthorizationData& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given APN \p k to a given json object \p j +void to_json(json& j, const APN& k) { + // the required parts of the message + j = json{ + {"apn", k.apn}, + {"apnAuthentication", conversions::apnauthentication_enum_to_string(k.apnAuthentication)}, + }; + // the optional parts of the message + if (k.apnUserName) { + j["apnUserName"] = k.apnUserName.value(); + } + if (k.apnPassword) { + j["apnPassword"] = k.apnPassword.value(); + } + if (k.simPin) { + j["simPin"] = k.simPin.value(); + } + if (k.preferredNetwork) { + j["preferredNetwork"] = k.preferredNetwork.value(); + } + if (k.useOnlyPreferredNetwork) { + j["useOnlyPreferredNetwork"] = k.useOnlyPreferredNetwork.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given APN \p k +void from_json(const json& j, APN& k) { + // the required parts of the message + k.apn = j.at("apn"); + k.apnAuthentication = conversions::string_to_apnauthentication_enum(j.at("apnAuthentication")); + + // the optional parts of the message + if (j.contains("apnUserName")) { + k.apnUserName.emplace(j.at("apnUserName")); + } + if (j.contains("apnPassword")) { + k.apnPassword.emplace(j.at("apnPassword")); + } + if (j.contains("simPin")) { + k.simPin.emplace(j.at("simPin")); + } + if (j.contains("preferredNetwork")) { + k.preferredNetwork.emplace(j.at("preferredNetwork")); + } + if (j.contains("useOnlyPreferredNetwork")) { + k.useOnlyPreferredNetwork.emplace(j.at("useOnlyPreferredNetwork")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given APN \p k to the given output stream \p os +/// \returns an output stream with the APN written to +std::ostream& operator<<(std::ostream& os, const APN& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given VPN \p k to a given json object \p j +void to_json(json& j, const VPN& k) { + // the required parts of the message + j = json{ + {"server", k.server}, + {"user", k.user}, + {"password", k.password}, + {"key", k.key}, + {"type", conversions::vpnenum_to_string(k.type)}, + }; + // the optional parts of the message + if (k.group) { + j["group"] = k.group.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given VPN \p k +void from_json(const json& j, VPN& k) { + // the required parts of the message + k.server = j.at("server"); + k.user = j.at("user"); + k.password = j.at("password"); + k.key = j.at("key"); + k.type = conversions::string_to_vpnenum(j.at("type")); + + // the optional parts of the message + if (j.contains("group")) { + k.group.emplace(j.at("group")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \brief Writes the string representation of the given VPN \p k to the given output stream \p os +/// \returns an output stream with the VPN written to +std::ostream& operator<<(std::ostream& os, const VPN& k) { + os << json(k).dump(4); + return os; +} + +/// \brief Conversion from a given NetworkConnectionProfile \p k to a given json object \p j +void to_json(json& j, const NetworkConnectionProfile& k) { + // the required parts of the message + j = json{ + {"ocppInterface", conversions::ocppinterface_enum_to_string(k.ocppInterface)}, + {"ocppTransport", conversions::ocpptransport_enum_to_string(k.ocppTransport)}, + {"messageTimeout", k.messageTimeout}, + {"ocppCsmsUrl", k.ocppCsmsUrl}, + {"securityProfile", k.securityProfile}, + }; + // the optional parts of the message + if (k.apn) { + j["apn"] = k.apn.value(); + } + if (k.ocppVersion) { + j["ocppVersion"] = conversions::ocppversion_enum_to_string(k.ocppVersion.value()); + } + if (k.identity) { + j["identity"] = k.identity.value(); + } + if (k.basicAuthPassword) { + j["basicAuthPassword"] = k.basicAuthPassword.value(); + } + if (k.vpn) { + j["vpn"] = k.vpn.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +/// \brief Conversion from a given json object \p j to a given NetworkConnectionProfile \p k +void from_json(const json& j, NetworkConnectionProfile& k) { + // the required parts of the message + k.ocppInterface = conversions::string_to_ocppinterface_enum(j.at("ocppInterface")); + k.ocppTransport = conversions::string_to_ocpptransport_enum(j.at("ocppTransport")); + k.messageTimeout = j.at("messageTimeout"); + k.ocppCsmsUrl = j.at("ocppCsmsUrl"); + k.securityProfile = j.at("securityProfile"); + + // the optional parts of the message + if (j.contains("apn")) { + k.apn.emplace(j.at("apn")); } - if (j.contains("mutability")) { - k.mutability.emplace(conversions::string_to_mutability_enum(j.at("mutability"))); + if (j.contains("ocppVersion")) { + k.ocppVersion.emplace(conversions::string_to_ocppversion_enum(j.at("ocppVersion"))); } - if (j.contains("persistent")) { - k.persistent.emplace(j.at("persistent")); + if (j.contains("identity")) { + k.identity.emplace(j.at("identity")); } - if (j.contains("constant")) { - k.constant.emplace(j.at("constant")); + if (j.contains("basicAuthPassword")) { + k.basicAuthPassword.emplace(j.at("basicAuthPassword")); + } + if (j.contains("vpn")) { + k.vpn.emplace(j.at("vpn")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given VariableAttribute \p k to the given output stream \p os -/// \returns an output stream with the VariableAttribute written to -std::ostream& operator<<(std::ostream& os, const VariableAttribute& k) { +// \brief Writes the string representation of the given NetworkConnectionProfile \p k to the given output stream \p os +/// \returns an output stream with the NetworkConnectionProfile written to +std::ostream& operator<<(std::ostream& os, const NetworkConnectionProfile& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given VariableCharacteristics \p k to a given json object \p j -void to_json(json& j, const VariableCharacteristics& k) { +/// \brief Conversion from a given SetMonitoringData \p k to a given json object \p j +void to_json(json& j, const SetMonitoringData& k) { // the required parts of the message j = json{ - {"dataType", conversions::data_enum_to_string(k.dataType)}, - {"supportsMonitoring", k.supportsMonitoring}, + {"value", k.value}, {"type", conversions::monitor_enum_to_string(k.type)}, + {"severity", k.severity}, {"component", k.component}, + {"variable", k.variable}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } - if (k.unit) { - j["unit"] = k.unit.value(); + if (k.id) { + j["id"] = k.id.value(); } - if (k.minLimit) { - j["minLimit"] = k.minLimit.value(); + if (k.periodicEventStream) { + j["periodicEventStream"] = k.periodicEventStream.value(); } - if (k.maxLimit) { - j["maxLimit"] = k.maxLimit.value(); + if (k.transaction) { + j["transaction"] = k.transaction.value(); } - if (k.valuesList) { - j["valuesList"] = k.valuesList.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given VariableCharacteristics \p k -void from_json(const json& j, VariableCharacteristics& k) { +/// \brief Conversion from a given json object \p j to a given SetMonitoringData \p k +void from_json(const json& j, SetMonitoringData& k) { // the required parts of the message - k.dataType = conversions::string_to_data_enum(j.at("dataType")); - k.supportsMonitoring = j.at("supportsMonitoring"); + k.value = j.at("value"); + k.type = conversions::string_to_monitor_enum(j.at("type")); + k.severity = j.at("severity"); + k.component = j.at("component"); + k.variable = j.at("variable"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } - if (j.contains("unit")) { - k.unit.emplace(j.at("unit")); + if (j.contains("id")) { + k.id.emplace(j.at("id")); } - if (j.contains("minLimit")) { - k.minLimit.emplace(j.at("minLimit")); + if (j.contains("periodicEventStream")) { + k.periodicEventStream.emplace(j.at("periodicEventStream")); } - if (j.contains("maxLimit")) { - k.maxLimit.emplace(j.at("maxLimit")); + if (j.contains("transaction")) { + k.transaction.emplace(j.at("transaction")); } - if (j.contains("valuesList")) { - k.valuesList.emplace(j.at("valuesList")); + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given VariableCharacteristics \p k to the given output stream \p os -/// \returns an output stream with the VariableCharacteristics written to -std::ostream& operator<<(std::ostream& os, const VariableCharacteristics& k) { +// \brief Writes the string representation of the given SetMonitoringData \p k to the given output stream \p os +/// \returns an output stream with the SetMonitoringData written to +std::ostream& operator<<(std::ostream& os, const SetMonitoringData& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ReportData \p k to a given json object \p j -void to_json(json& j, const ReportData& k) { +/// \brief Conversion from a given SetMonitoringResult \p k to a given json object \p j +void to_json(json& j, const SetMonitoringResult& k) { // the required parts of the message j = json{ + {"status", conversions::set_monitoring_status_enum_to_string(k.status)}, + {"type", conversions::monitor_enum_to_string(k.type)}, {"component", k.component}, {"variable", k.variable}, - {"variableAttribute", k.variableAttribute}, + {"severity", k.severity}, }; // the optional parts of the message + if (k.id) { + j["id"] = k.id.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.variableCharacteristics) { - j["variableCharacteristics"] = k.variableCharacteristics.value(); - } } -/// \brief Conversion from a given json object \p j to a given ReportData \p k -void from_json(const json& j, ReportData& k) { +/// \brief Conversion from a given json object \p j to a given SetMonitoringResult \p k +void from_json(const json& j, SetMonitoringResult& k) { // the required parts of the message + k.status = conversions::string_to_set_monitoring_status_enum(j.at("status")); + k.type = conversions::string_to_monitor_enum(j.at("type")); k.component = j.at("component"); k.variable = j.at("variable"); - for (auto val : j.at("variableAttribute")) { - k.variableAttribute.push_back(val); - } + k.severity = j.at("severity"); // the optional parts of the message + if (j.contains("id")) { + k.id.emplace(j.at("id")); + } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("variableCharacteristics")) { - k.variableCharacteristics.emplace(j.at("variableCharacteristics")); - } } -// \brief Writes the string representation of the given ReportData \p k to the given output stream \p os -/// \returns an output stream with the ReportData written to -std::ostream& operator<<(std::ostream& os, const ReportData& k) { +// \brief Writes the string representation of the given SetMonitoringResult \p k to the given output stream \p os +/// \returns an output stream with the SetMonitoringResult written to +std::ostream& operator<<(std::ostream& os, const SetMonitoringResult& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given ChargingProfile \p k to a given json object \p j -void to_json(json& j, const ChargingProfile& k) { +/// \brief Conversion from a given SetVariableData \p k to a given json object \p j +void to_json(json& j, const SetVariableData& k) { // the required parts of the message j = json{ - {"id", k.id}, - {"stackLevel", k.stackLevel}, - {"chargingProfilePurpose", conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose)}, - {"chargingProfileKind", conversions::charging_profile_kind_enum_to_string(k.chargingProfileKind)}, - {"chargingSchedule", k.chargingSchedule}, + {"attributeValue", k.attributeValue}, + {"component", k.component}, + {"variable", k.variable}, }; // the optional parts of the message + if (k.attributeType) { + j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.recurrencyKind) { - j["recurrencyKind"] = conversions::recurrency_kind_enum_to_string(k.recurrencyKind.value()); - } - if (k.validFrom) { - j["validFrom"] = k.validFrom.value().to_rfc3339(); - } - if (k.validTo) { - j["validTo"] = k.validTo.value().to_rfc3339(); - } - if (k.transactionId) { - j["transactionId"] = k.transactionId.value(); - } } -/// \brief Conversion from a given json object \p j to a given ChargingProfile \p k -void from_json(const json& j, ChargingProfile& k) { +/// \brief Conversion from a given json object \p j to a given SetVariableData \p k +void from_json(const json& j, SetVariableData& k) { // the required parts of the message - k.id = j.at("id"); - k.stackLevel = j.at("stackLevel"); - k.chargingProfilePurpose = conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose")); - k.chargingProfileKind = conversions::string_to_charging_profile_kind_enum(j.at("chargingProfileKind")); - for (auto val : j.at("chargingSchedule")) { - k.chargingSchedule.push_back(val); - } + k.attributeValue = j.at("attributeValue"); + k.component = j.at("component"); + k.variable = j.at("variable"); // the optional parts of the message + if (j.contains("attributeType")) { + k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("recurrencyKind")) { - k.recurrencyKind.emplace(conversions::string_to_recurrency_kind_enum(j.at("recurrencyKind"))); - } - if (j.contains("validFrom")) { - k.validFrom.emplace(j.at("validFrom").get()); - } - if (j.contains("validTo")) { - k.validTo.emplace(j.at("validTo").get()); - } - if (j.contains("transactionId")) { - k.transactionId.emplace(j.at("transactionId")); - } } -// \brief Writes the string representation of the given ChargingProfile \p k to the given output stream \p os -/// \returns an output stream with the ChargingProfile written to -std::ostream& operator<<(std::ostream& os, const ChargingProfile& k) { +// \brief Writes the string representation of the given SetVariableData \p k to the given output stream \p os +/// \returns an output stream with the SetVariableData written to +std::ostream& operator<<(std::ostream& os, const SetVariableData& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given AuthorizationData \p k to a given json object \p j -void to_json(json& j, const AuthorizationData& k) { +/// \brief Conversion from a given SetVariableResult \p k to a given json object \p j +void to_json(json& j, const SetVariableResult& k) { // the required parts of the message j = json{ - {"idToken", k.idToken}, + {"attributeStatus", conversions::set_variable_status_enum_to_string(k.attributeStatus)}, + {"component", k.component}, + {"variable", k.variable}, }; // the optional parts of the message + if (k.attributeType) { + j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + } + if (k.attributeStatusInfo) { + j["attributeStatusInfo"] = k.attributeStatusInfo.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.idTokenInfo) { - j["idTokenInfo"] = k.idTokenInfo.value(); - } } -/// \brief Conversion from a given json object \p j to a given AuthorizationData \p k -void from_json(const json& j, AuthorizationData& k) { +/// \brief Conversion from a given json object \p j to a given SetVariableResult \p k +void from_json(const json& j, SetVariableResult& k) { // the required parts of the message - k.idToken = j.at("idToken"); + k.attributeStatus = conversions::string_to_set_variable_status_enum(j.at("attributeStatus")); + k.component = j.at("component"); + k.variable = j.at("variable"); // the optional parts of the message + if (j.contains("attributeType")) { + k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + } + if (j.contains("attributeStatusInfo")) { + k.attributeStatusInfo.emplace(j.at("attributeStatusInfo")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("idTokenInfo")) { - k.idTokenInfo.emplace(j.at("idTokenInfo")); - } } -// \brief Writes the string representation of the given AuthorizationData \p k to the given output stream \p os -/// \returns an output stream with the AuthorizationData written to -std::ostream& operator<<(std::ostream& os, const AuthorizationData& k) { +// \brief Writes the string representation of the given SetVariableResult \p k to the given output stream \p os +/// \returns an output stream with the SetVariableResult written to +std::ostream& operator<<(std::ostream& os, const SetVariableResult& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given APN \p k to a given json object \p j -void to_json(json& j, const APN& k) { +/// \brief Conversion from a given CostDimension \p k to a given json object \p j +void to_json(json& j, const CostDimension& k) { // the required parts of the message j = json{ - {"apn", k.apn}, - {"apnAuthentication", conversions::apnauthentication_enum_to_string(k.apnAuthentication)}, + {"type", conversions::cost_dimension_enum_to_string(k.type)}, + {"volume", k.volume}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } - if (k.apnUserName) { - j["apnUserName"] = k.apnUserName.value(); - } - if (k.apnPassword) { - j["apnPassword"] = k.apnPassword.value(); - } - if (k.simPin) { - j["simPin"] = k.simPin.value(); - } - if (k.preferredNetwork) { - j["preferredNetwork"] = k.preferredNetwork.value(); - } - if (k.useOnlyPreferredNetwork) { - j["useOnlyPreferredNetwork"] = k.useOnlyPreferredNetwork.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given APN \p k -void from_json(const json& j, APN& k) { +/// \brief Conversion from a given json object \p j to a given CostDimension \p k +void from_json(const json& j, CostDimension& k) { // the required parts of the message - k.apn = j.at("apn"); - k.apnAuthentication = conversions::string_to_apnauthentication_enum(j.at("apnAuthentication")); + k.type = conversions::string_to_cost_dimension_enum(j.at("type")); + k.volume = j.at("volume"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("apnUserName")) { - k.apnUserName.emplace(j.at("apnUserName")); - } - if (j.contains("apnPassword")) { - k.apnPassword.emplace(j.at("apnPassword")); - } - if (j.contains("simPin")) { - k.simPin.emplace(j.at("simPin")); - } - if (j.contains("preferredNetwork")) { - k.preferredNetwork.emplace(j.at("preferredNetwork")); - } - if (j.contains("useOnlyPreferredNetwork")) { - k.useOnlyPreferredNetwork.emplace(j.at("useOnlyPreferredNetwork")); - } } -// \brief Writes the string representation of the given APN \p k to the given output stream \p os -/// \returns an output stream with the APN written to -std::ostream& operator<<(std::ostream& os, const APN& k) { +// \brief Writes the string representation of the given CostDimension \p k to the given output stream \p os +/// \returns an output stream with the CostDimension written to +std::ostream& operator<<(std::ostream& os, const CostDimension& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given VPN \p k to a given json object \p j -void to_json(json& j, const VPN& k) { +/// \brief Conversion from a given ChargingPeriod \p k to a given json object \p j +void to_json(json& j, const ChargingPeriod& k) { // the required parts of the message j = json{ - {"server", k.server}, - {"user", k.user}, - {"password", k.password}, - {"key", k.key}, - {"type", conversions::vpnenum_to_string(k.type)}, + {"startPeriod", k.startPeriod.to_rfc3339()}, }; // the optional parts of the message + if (k.dimensions) { + j["dimensions"] = json::array(); + for (auto val : k.dimensions.value()) { + j["dimensions"].push_back(val); + } + } + if (k.tariffId) { + j["tariffId"] = k.tariffId.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.group) { - j["group"] = k.group.value(); - } } -/// \brief Conversion from a given json object \p j to a given VPN \p k -void from_json(const json& j, VPN& k) { +/// \brief Conversion from a given json object \p j to a given ChargingPeriod \p k +void from_json(const json& j, ChargingPeriod& k) { // the required parts of the message - k.server = j.at("server"); - k.user = j.at("user"); - k.password = j.at("password"); - k.key = j.at("key"); - k.type = conversions::string_to_vpnenum(j.at("type")); + k.startPeriod = ocpp::DateTime(std::string(j.at("startPeriod"))); // the optional parts of the message + if (j.contains("dimensions")) { + json arr = j.at("dimensions"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.dimensions.emplace(vec); + } + if (j.contains("tariffId")) { + k.tariffId.emplace(j.at("tariffId")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("group")) { - k.group.emplace(j.at("group")); - } } -// \brief Writes the string representation of the given VPN \p k to the given output stream \p os -/// \returns an output stream with the VPN written to -std::ostream& operator<<(std::ostream& os, const VPN& k) { +// \brief Writes the string representation of the given ChargingPeriod \p k to the given output stream \p os +/// \returns an output stream with the ChargingPeriod written to +std::ostream& operator<<(std::ostream& os, const ChargingPeriod& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given NetworkConnectionProfile \p k to a given json object \p j -void to_json(json& j, const NetworkConnectionProfile& k) { +/// \brief Conversion from a given TotalPrice \p k to a given json object \p j +void to_json(json& j, const TotalPrice& k) { // the required parts of the message - j = json{ - {"ocppVersion", conversions::ocppversion_enum_to_string(k.ocppVersion)}, - {"ocppTransport", conversions::ocpptransport_enum_to_string(k.ocppTransport)}, - {"ocppCsmsUrl", k.ocppCsmsUrl}, - {"messageTimeout", k.messageTimeout}, - {"securityProfile", k.securityProfile}, - {"ocppInterface", conversions::ocppinterface_enum_to_string(k.ocppInterface)}, - }; + j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.exclTax) { + j["exclTax"] = k.exclTax.value(); } - if (k.apn) { - j["apn"] = k.apn.value(); + if (k.inclTax) { + j["inclTax"] = k.inclTax.value(); } - if (k.vpn) { - j["vpn"] = k.vpn.value(); + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given NetworkConnectionProfile \p k -void from_json(const json& j, NetworkConnectionProfile& k) { +/// \brief Conversion from a given json object \p j to a given TotalPrice \p k +void from_json(const json& j, TotalPrice& k) { // the required parts of the message - k.ocppVersion = conversions::string_to_ocppversion_enum(j.at("ocppVersion")); - k.ocppTransport = conversions::string_to_ocpptransport_enum(j.at("ocppTransport")); - k.ocppCsmsUrl = j.at("ocppCsmsUrl"); - k.messageTimeout = j.at("messageTimeout"); - k.securityProfile = j.at("securityProfile"); - k.ocppInterface = conversions::string_to_ocppinterface_enum(j.at("ocppInterface")); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("exclTax")) { + k.exclTax.emplace(j.at("exclTax")); } - if (j.contains("apn")) { - k.apn.emplace(j.at("apn")); + if (j.contains("inclTax")) { + k.inclTax.emplace(j.at("inclTax")); } - if (j.contains("vpn")) { - k.vpn.emplace(j.at("vpn")); + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given NetworkConnectionProfile \p k to the given output stream \p os -/// \returns an output stream with the NetworkConnectionProfile written to -std::ostream& operator<<(std::ostream& os, const NetworkConnectionProfile& k) { +// \brief Writes the string representation of the given TotalPrice \p k to the given output stream \p os +/// \returns an output stream with the TotalPrice written to +std::ostream& operator<<(std::ostream& os, const TotalPrice& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SetMonitoringData \p k to a given json object \p j -void to_json(json& j, const SetMonitoringData& k) { +/// \brief Conversion from a given TotalCost \p k to a given json object \p j +void to_json(json& j, const TotalCost& k) { // the required parts of the message j = json{ - {"value", k.value}, {"type", conversions::monitor_enum_to_string(k.type)}, - {"severity", k.severity}, {"component", k.component}, - {"variable", k.variable}, + {"currency", k.currency}, + {"typeOfCost", conversions::tariff_cost_enum_to_string(k.typeOfCost)}, + {"total", k.total}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.fixed) { + j["fixed"] = k.fixed.value(); } - if (k.id) { - j["id"] = k.id.value(); + if (k.energy) { + j["energy"] = k.energy.value(); } - if (k.transaction) { - j["transaction"] = k.transaction.value(); + if (k.chargingTime) { + j["chargingTime"] = k.chargingTime.value(); + } + if (k.idleTime) { + j["idleTime"] = k.idleTime.value(); + } + if (k.reservationTime) { + j["reservationTime"] = k.reservationTime.value(); + } + if (k.reservationFixed) { + j["reservationFixed"] = k.reservationFixed.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given SetMonitoringData \p k -void from_json(const json& j, SetMonitoringData& k) { +/// \brief Conversion from a given json object \p j to a given TotalCost \p k +void from_json(const json& j, TotalCost& k) { // the required parts of the message - k.value = j.at("value"); - k.type = conversions::string_to_monitor_enum(j.at("type")); - k.severity = j.at("severity"); - k.component = j.at("component"); - k.variable = j.at("variable"); + k.currency = j.at("currency"); + k.typeOfCost = conversions::string_to_tariff_cost_enum(j.at("typeOfCost")); + k.total = j.at("total"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("fixed")) { + k.fixed.emplace(j.at("fixed")); } - if (j.contains("id")) { - k.id.emplace(j.at("id")); + if (j.contains("energy")) { + k.energy.emplace(j.at("energy")); } - if (j.contains("transaction")) { - k.transaction.emplace(j.at("transaction")); + if (j.contains("chargingTime")) { + k.chargingTime.emplace(j.at("chargingTime")); + } + if (j.contains("idleTime")) { + k.idleTime.emplace(j.at("idleTime")); + } + if (j.contains("reservationTime")) { + k.reservationTime.emplace(j.at("reservationTime")); + } + if (j.contains("reservationFixed")) { + k.reservationFixed.emplace(j.at("reservationFixed")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given SetMonitoringData \p k to the given output stream \p os -/// \returns an output stream with the SetMonitoringData written to -std::ostream& operator<<(std::ostream& os, const SetMonitoringData& k) { +// \brief Writes the string representation of the given TotalCost \p k to the given output stream \p os +/// \returns an output stream with the TotalCost written to +std::ostream& operator<<(std::ostream& os, const TotalCost& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SetMonitoringResult \p k to a given json object \p j -void to_json(json& j, const SetMonitoringResult& k) { +/// \brief Conversion from a given TotalUsage \p k to a given json object \p j +void to_json(json& j, const TotalUsage& k) { // the required parts of the message j = json{ - {"status", conversions::set_monitoring_status_enum_to_string(k.status)}, - {"type", conversions::monitor_enum_to_string(k.type)}, - {"component", k.component}, - {"variable", k.variable}, - {"severity", k.severity}, + {"energy", k.energy}, + {"chargingTime", k.chargingTime}, + {"idleTime", k.idleTime}, }; // the optional parts of the message + if (k.reservationTime) { + j["reservationTime"] = k.reservationTime.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.id) { - j["id"] = k.id.value(); - } - if (k.statusInfo) { - j["statusInfo"] = k.statusInfo.value(); - } } -/// \brief Conversion from a given json object \p j to a given SetMonitoringResult \p k -void from_json(const json& j, SetMonitoringResult& k) { +/// \brief Conversion from a given json object \p j to a given TotalUsage \p k +void from_json(const json& j, TotalUsage& k) { // the required parts of the message - k.status = conversions::string_to_set_monitoring_status_enum(j.at("status")); - k.type = conversions::string_to_monitor_enum(j.at("type")); - k.component = j.at("component"); - k.variable = j.at("variable"); - k.severity = j.at("severity"); + k.energy = j.at("energy"); + k.chargingTime = j.at("chargingTime"); + k.idleTime = j.at("idleTime"); // the optional parts of the message + if (j.contains("reservationTime")) { + k.reservationTime.emplace(j.at("reservationTime")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("id")) { - k.id.emplace(j.at("id")); - } - if (j.contains("statusInfo")) { - k.statusInfo.emplace(j.at("statusInfo")); - } } -// \brief Writes the string representation of the given SetMonitoringResult \p k to the given output stream \p os -/// \returns an output stream with the SetMonitoringResult written to -std::ostream& operator<<(std::ostream& os, const SetMonitoringResult& k) { +// \brief Writes the string representation of the given TotalUsage \p k to the given output stream \p os +/// \returns an output stream with the TotalUsage written to +std::ostream& operator<<(std::ostream& os, const TotalUsage& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SetVariableData \p k to a given json object \p j -void to_json(json& j, const SetVariableData& k) { +/// \brief Conversion from a given CostDetails \p k to a given json object \p j +void to_json(json& j, const CostDetails& k) { // the required parts of the message j = json{ - {"attributeValue", k.attributeValue}, - {"component", k.component}, - {"variable", k.variable}, + {"totalCost", k.totalCost}, + {"totalUsage", k.totalUsage}, }; // the optional parts of the message + if (k.chargingPeriods) { + j["chargingPeriods"] = json::array(); + for (auto val : k.chargingPeriods.value()) { + j["chargingPeriods"].push_back(val); + } + } + if (k.failureToCalculate) { + j["failureToCalculate"] = k.failureToCalculate.value(); + } + if (k.failureReason) { + j["failureReason"] = k.failureReason.value(); + } if (k.customData) { j["customData"] = k.customData.value(); } - if (k.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); - } } -/// \brief Conversion from a given json object \p j to a given SetVariableData \p k -void from_json(const json& j, SetVariableData& k) { +/// \brief Conversion from a given json object \p j to a given CostDetails \p k +void from_json(const json& j, CostDetails& k) { // the required parts of the message - k.attributeValue = j.at("attributeValue"); - k.component = j.at("component"); - k.variable = j.at("variable"); + k.totalCost = j.at("totalCost"); + k.totalUsage = j.at("totalUsage"); // the optional parts of the message + if (j.contains("chargingPeriods")) { + json arr = j.at("chargingPeriods"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.chargingPeriods.emplace(vec); + } + if (j.contains("failureToCalculate")) { + k.failureToCalculate.emplace(j.at("failureToCalculate")); + } + if (j.contains("failureReason")) { + k.failureReason.emplace(j.at("failureReason")); + } if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("attributeType")) { - k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); - } } -// \brief Writes the string representation of the given SetVariableData \p k to the given output stream \p os -/// \returns an output stream with the SetVariableData written to -std::ostream& operator<<(std::ostream& os, const SetVariableData& k) { +// \brief Writes the string representation of the given CostDetails \p k to the given output stream \p os +/// \returns an output stream with the CostDetails written to +std::ostream& operator<<(std::ostream& os, const CostDetails& k) { os << json(k).dump(4); return os; } -/// \brief Conversion from a given SetVariableResult \p k to a given json object \p j -void to_json(json& j, const SetVariableResult& k) { +/// \brief Conversion from a given TransactionLimit \p k to a given json object \p j +void to_json(json& j, const TransactionLimit& k) { // the required parts of the message - j = json{ - {"attributeStatus", conversions::set_variable_status_enum_to_string(k.attributeStatus)}, - {"component", k.component}, - {"variable", k.variable}, - }; + j = json({}, true); // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); + if (k.maxCost) { + j["maxCost"] = k.maxCost.value(); } - if (k.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + if (k.maxEnergy) { + j["maxEnergy"] = k.maxEnergy.value(); } - if (k.attributeStatusInfo) { - j["attributeStatusInfo"] = k.attributeStatusInfo.value(); + if (k.maxTime) { + j["maxTime"] = k.maxTime.value(); + } + if (k.maxSoC) { + j["maxSoC"] = k.maxSoC.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); } } -/// \brief Conversion from a given json object \p j to a given SetVariableResult \p k -void from_json(const json& j, SetVariableResult& k) { +/// \brief Conversion from a given json object \p j to a given TransactionLimit \p k +void from_json(const json& j, TransactionLimit& k) { // the required parts of the message - k.attributeStatus = conversions::string_to_set_variable_status_enum(j.at("attributeStatus")); - k.component = j.at("component"); - k.variable = j.at("variable"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); + if (j.contains("maxCost")) { + k.maxCost.emplace(j.at("maxCost")); } - if (j.contains("attributeType")) { - k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + if (j.contains("maxEnergy")) { + k.maxEnergy.emplace(j.at("maxEnergy")); } - if (j.contains("attributeStatusInfo")) { - k.attributeStatusInfo.emplace(j.at("attributeStatusInfo")); + if (j.contains("maxTime")) { + k.maxTime.emplace(j.at("maxTime")); + } + if (j.contains("maxSoC")) { + k.maxSoC.emplace(j.at("maxSoC")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); } } -// \brief Writes the string representation of the given SetVariableResult \p k to the given output stream \p os -/// \returns an output stream with the SetVariableResult written to -std::ostream& operator<<(std::ostream& os, const SetVariableResult& k) { +// \brief Writes the string representation of the given TransactionLimit \p k to the given output stream \p os +/// \returns an output stream with the TransactionLimit written to +std::ostream& operator<<(std::ostream& os, const TransactionLimit& k) { os << json(k).dump(4); return os; } @@ -2447,9 +6293,6 @@ void to_json(json& j, const Transaction& k) { {"transactionId", k.transactionId}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.chargingState) { j["chargingState"] = conversions::charging_state_enum_to_string(k.chargingState.value()); } @@ -2462,6 +6305,18 @@ void to_json(json& j, const Transaction& k) { if (k.remoteStartId) { j["remoteStartId"] = k.remoteStartId.value(); } + if (k.operationMode) { + j["operationMode"] = conversions::operation_mode_enum_to_string(k.operationMode.value()); + } + if (k.tariffId) { + j["tariffId"] = k.tariffId.value(); + } + if (k.transactionLimit) { + j["transactionLimit"] = k.transactionLimit.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } } /// \brief Conversion from a given json object \p j to a given Transaction \p k @@ -2470,9 +6325,6 @@ void from_json(const json& j, Transaction& k) { k.transactionId = j.at("transactionId"); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("chargingState")) { k.chargingState.emplace(conversions::string_to_charging_state_enum(j.at("chargingState"))); } @@ -2485,6 +6337,18 @@ void from_json(const json& j, Transaction& k) { if (j.contains("remoteStartId")) { k.remoteStartId.emplace(j.at("remoteStartId")); } + if (j.contains("operationMode")) { + k.operationMode.emplace(conversions::string_to_operation_mode_enum(j.at("operationMode"))); + } + if (j.contains("tariffId")) { + k.tariffId.emplace(j.at("tariffId")); + } + if (j.contains("transactionLimit")) { + k.transactionLimit.emplace(j.at("transactionLimit")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } // \brief Writes the string representation of the given Transaction \p k to the given output stream \p os @@ -2502,9 +6366,6 @@ void to_json(json& j, const Firmware& k) { {"retrieveDateTime", k.retrieveDateTime.to_rfc3339()}, }; // the optional parts of the message - if (k.customData) { - j["customData"] = k.customData.value(); - } if (k.installDateTime) { j["installDateTime"] = k.installDateTime.value().to_rfc3339(); } @@ -2514,6 +6375,9 @@ void to_json(json& j, const Firmware& k) { if (k.signature) { j["signature"] = k.signature.value(); } + if (k.customData) { + j["customData"] = k.customData.value(); + } } /// \brief Conversion from a given json object \p j to a given Firmware \p k @@ -2523,9 +6387,6 @@ void from_json(const json& j, Firmware& k) { k.retrieveDateTime = ocpp::DateTime(std::string(j.at("retrieveDateTime"))); // the optional parts of the message - if (j.contains("customData")) { - k.customData.emplace(j.at("customData")); - } if (j.contains("installDateTime")) { k.installDateTime.emplace(j.at("installDateTime").get()); } @@ -2535,6 +6396,9 @@ void from_json(const json& j, Firmware& k) { if (j.contains("signature")) { k.signature.emplace(j.at("signature")); } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } } // \brief Writes the string representation of the given Firmware \p k to the given output stream \p os diff --git a/lib/ocpp/v2/profile.cpp b/lib/ocpp/v2/profile.cpp index 17652c401..e49b23fec 100644 --- a/lib/ocpp/v2/profile.cpp +++ b/lib/ocpp/v2/profile.cpp @@ -31,10 +31,14 @@ void period_entry_t::init(const DateTime& in_start, int in_duration, const Charg const auto start_tp = std::chrono::floor(in_start.to_time_point()); start = std::move(DateTime(start_tp + seconds(in_period.startPeriod))); end = std::move(DateTime(start_tp + seconds(in_duration))); - limit = in_period.limit; number_phases = in_period.numberPhases; stack_level = in_profile.stackLevel; charging_rate_unit = in_profile.chargingSchedule.front().chargingRateUnit; + if (charging_rate_unit == ChargingRateUnitEnum::A) { + limit = in_period.limit.value_or(DEFAULT_LIMIT_AMPS); + } else { + limit = in_period.limit.value_or(DEFAULT_LIMIT_WATTS); + } min_charging_rate = in_profile.chargingSchedule.front().minChargingRate; } @@ -151,6 +155,10 @@ std::vector calculate_start(const DateTime& in_now, const DateTime& in } start_times.push_back(start); break; + case ChargingProfileKindEnum::Dynamic: + // FIXME: check if other requirements for dynamic exist + start_times.push_back(floor_seconds(start)); + break; } return start_times; } @@ -564,14 +572,14 @@ convert_intermediate_into_schedule(const IntermediateProfile& profile, ChargingR period_out.limit = period.current_limit; } if (period.power_limit != NO_LIMIT_SPECIFIED) { - period_out.limit = std::min(period_out.limit, period.power_limit / transform_value); + period_out.limit = std::min(period_out.limit.value(), period.power_limit / transform_value); } } else { if (period.power_limit != NO_LIMIT_SPECIFIED) { period_out.limit = period.power_limit; } if (period.current_limit != NO_LIMIT_SPECIFIED) { - period_out.limit = std::min(period_out.limit, period.current_limit * transform_value); + period_out.limit = std::min(period_out.limit.value(), period.current_limit * transform_value); } } } diff --git a/lib/ocpp/v2/transaction.cpp b/lib/ocpp/v2/transaction.cpp index 9728b217f..8b65cd9bf 100644 --- a/lib/ocpp/v2/transaction.cpp +++ b/lib/ocpp/v2/transaction.cpp @@ -11,8 +11,12 @@ namespace ocpp { namespace v2 { Transaction EnhancedTransaction::get_transaction() { - Transaction transaction = {this->transactionId, std::nullopt, this->chargingState, - this->timeSpentCharging, this->stoppedReason, this->remoteStartId}; + Transaction transaction; + transaction.transactionId = this->transactionId; + transaction.chargingState = this->chargingState; + transaction.timeSpentCharging = this->timeSpentCharging; + transaction.stoppedReason = this->stoppedReason; + transaction.remoteStartId = this->remoteStartId; return transaction; } diff --git a/lib/ocpp/v2/types.cpp b/lib/ocpp/v2/types.cpp index 42933bd9d..3fe3b1151 100644 --- a/lib/ocpp/v2/types.cpp +++ b/lib/ocpp/v2/types.cpp @@ -268,6 +268,114 @@ std::string messagetype_to_string(MessageType m) { return "UpdateFirmware"; case MessageType::UpdateFirmwareResponse: return "UpdateFirmwareResponse"; + case MessageType::AdjustPeriodicEventStream: + return "AdjustPeriodicEventStream"; + case MessageType::AdjustPeriodicEventStreamResponse: + return "AdjustPeriodicEventStreamResponse"; + case MessageType::AFRRSignal: + return "AFRRSignal"; + case MessageType::AFRRSignalResponse: + return "AFRRSignalResponse"; + case MessageType::BatterySwap: + return "BatterySwap"; + case MessageType::BatterySwapResponse: + return "BatterySwapResponse"; + case MessageType::ChangeTransactionTariff: + return "ChangeTransactionTariff"; + case MessageType::ChangeTransactionTariffResponse: + return "ChangeTransactionTariffResponse"; + case MessageType::ClearDERControl: + return "ClearDERControl"; + case MessageType::ClearDERControlResponse: + return "ClearDERControlResponse"; + case MessageType::ClearTariffs: + return "ClearTariffs"; + case MessageType::ClearTariffsResponse: + return "ClearTariffsResponse"; + case MessageType::ClosePeriodicEventStream: + return "ClosePeriodicEventStream"; + case MessageType::ClosePeriodicEventStreamResponse: + return "ClosePeriodicEventStreamResponse"; + case MessageType::GetCRL: + return "GetCRL"; + case MessageType::GetCRLResponse: + return "GetCRLResponse"; + case MessageType::GetDERControl: + return "GetDERControl"; + case MessageType::GetDERControlResponse: + return "GetDERControlResponse"; + case MessageType::GetPeriodicEventStream: + return "GetPeriodicEventStream"; + case MessageType::GetPeriodicEventStreamResponse: + return "GetPeriodicEventStreamResponse"; + case MessageType::GetTariffs: + return "GetTariffs"; + case MessageType::GetTariffsResponse: + return "GetTariffsResponse"; + case MessageType::NotifyAllowedEnergyTransfer: + return "NotifyAllowedEnergyTransfer"; + case MessageType::NotifyAllowedEnergyTransferResponse: + return "NotifyAllowedEnergyTransferResponse"; + case MessageType::NotifyCRL: + return "NotifyCRL"; + case MessageType::NotifyCRLResponse: + return "NotifyCRLResponse"; + case MessageType::NotifyDERAlarm: + return "NotifyDERAlarm"; + case MessageType::NotifyDERAlarmResponse: + return "NotifyDERAlarmResponse"; + case MessageType::NotifyDERStartStop: + return "NotifyDERStartStop"; + case MessageType::NotifyDERStartStopResponse: + return "NotifyDERStartStopResponse"; + case MessageType::NotifyPeriodicEventStream: + return "NotifyPeriodicEventStream"; + case MessageType::NotifyPeriodicEventStreamResponse: + return "NotifyPeriodicEventStreamResponse"; + case MessageType::NotifyPriorityCharging: + return "NotifyPriorityCharging"; + case MessageType::NotifyPriorityChargingResponse: + return "NotifyPriorityChargingResponse"; + case MessageType::NotifyQRCodeScanned: + return "NotifyQRCodeScanned"; + case MessageType::NotifyQRCodeScannedResponse: + return "NotifyQRCodeScannedResponse"; + case MessageType::NotifySettlement: + return "NotifySettlement"; + case MessageType::NotifySettlementResponse: + return "NotifySettlementResponse"; + case MessageType::OpenPeriodicEventStream: + return "OpenPeriodicEventStream"; + case MessageType::OpenPeriodicEventStreamResponse: + return "OpenPeriodicEventStreamResponse"; + case MessageType::PullDynamicScheduleUpdate: + return "PullDynamicScheduleUpdate"; + case MessageType::PullDynamicScheduleUpdateResponse: + return "PullDynamicScheduleUpdateResponse"; + case MessageType::RequestBatterySwap: + return "RequestBatterySwap"; + case MessageType::RequestBatterySwapResponse: + return "RequestBatterySwapResponse"; + case MessageType::SetDefaultTariff: + return "SetDefaultTariff"; + case MessageType::SetDefaultTariffResponse: + return "SetDefaultTariffResponse"; + case MessageType::SetDERControl: + return "SetDERControl"; + case MessageType::SetDERControlResponse: + return "SetDERControlResponse"; + case MessageType::UpdateDynamicSchedule: + return "UpdateDynamicSchedule"; + case MessageType::UpdateDynamicScheduleResponse: + return "UpdateDynamicScheduleResponse"; + case MessageType::UsePriorityCharging: + return "UsePriorityCharging"; + case MessageType::UsePriorityChargingResponse: + return "UsePriorityChargingResponse"; + case MessageType::VatNumberValidation: + return "VatNumberValidation"; + case MessageType::VatNumberValidationResponse: + return "VatNumberValidationResponse"; case MessageType::InternalError: return "InternalError"; } @@ -533,6 +641,114 @@ MessageType string_to_messagetype(const std::string& s) { return MessageType::UpdateFirmwareResponse; } else if (s == "InternalError") { return MessageType::InternalError; + } else if (s == "AdjustPeriodicEventStream") { + return MessageType::AdjustPeriodicEventStream; + } else if (s == "AdjustPeriodicEventStreamResponse") { + return MessageType::AdjustPeriodicEventStreamResponse; + } else if (s == "AFRRSignal") { + return MessageType::AFRRSignal; + } else if (s == "AFRRSignalResponse") { + return MessageType::AFRRSignalResponse; + } else if (s == "BatterySwap") { + return MessageType::BatterySwap; + } else if (s == "BatterySwapResponse") { + return MessageType::BatterySwapResponse; + } else if (s == "ChangeTransactionTariff") { + return MessageType::ChangeTransactionTariff; + } else if (s == "ChangeTransactionTariffResponse") { + return MessageType::ChangeTransactionTariffResponse; + } else if (s == "ClearDERControl") { + return MessageType::ClearDERControl; + } else if (s == "ClearDERControlResponse") { + return MessageType::ClearDERControlResponse; + } else if (s == "ClearTariffs") { + return MessageType::ClearTariffs; + } else if (s == "ClearTariffsResponse") { + return MessageType::ClearTariffsResponse; + } else if (s == "ClosePeriodicEventStream") { + return MessageType::ClosePeriodicEventStream; + } else if (s == "ClosePeriodicEventStreamResponse") { + return MessageType::ClosePeriodicEventStreamResponse; + } else if (s == "GetCRL") { + return MessageType::GetCRL; + } else if (s == "GetCRLResponse") { + return MessageType::GetCRLResponse; + } else if (s == "GetDERControl") { + return MessageType::GetDERControl; + } else if (s == "GetDERControlResponse") { + return MessageType::GetDERControlResponse; + } else if (s == "GetPeriodicEventStream") { + return MessageType::GetPeriodicEventStream; + } else if (s == "GetPeriodicEventStreamResponse") { + return MessageType::GetPeriodicEventStreamResponse; + } else if (s == "GetTariffs") { + return MessageType::GetTariffs; + } else if (s == "GetTariffsResponse") { + return MessageType::GetTariffsResponse; + } else if (s == "NotifyAllowedEnergyTransfer") { + return MessageType::NotifyAllowedEnergyTransfer; + } else if (s == "NotifyAllowedEnergyTransferResponse") { + return MessageType::NotifyAllowedEnergyTransferResponse; + } else if (s == "NotifyCRL") { + return MessageType::NotifyCRL; + } else if (s == "NotifyCRLResponse") { + return MessageType::NotifyCRLResponse; + } else if (s == "NotifyDERAlarm") { + return MessageType::NotifyDERAlarm; + } else if (s == "NotifyDERAlarmResponse") { + return MessageType::NotifyDERAlarmResponse; + } else if (s == "NotifyDERStartStop") { + return MessageType::NotifyDERStartStop; + } else if (s == "NotifyDERStartStopResponse") { + return MessageType::NotifyDERStartStopResponse; + } else if (s == "NotifyPeriodicEventStream") { + return MessageType::NotifyPeriodicEventStream; + } else if (s == "NotifyPeriodicEventStreamResponse") { + return MessageType::NotifyPeriodicEventStreamResponse; + } else if (s == "NotifyPriorityCharging") { + return MessageType::NotifyPriorityCharging; + } else if (s == "NotifyPriorityChargingResponse") { + return MessageType::NotifyPriorityChargingResponse; + } else if (s == "NotifyQRCodeScanned") { + return MessageType::NotifyQRCodeScanned; + } else if (s == "NotifyQRCodeScannedResponse") { + return MessageType::NotifyQRCodeScannedResponse; + } else if (s == "NotifySettlement") { + return MessageType::NotifySettlement; + } else if (s == "NotifySettlementResponse") { + return MessageType::NotifySettlementResponse; + } else if (s == "OpenPeriodicEventStream") { + return MessageType::OpenPeriodicEventStream; + } else if (s == "OpenPeriodicEventStreamResponse") { + return MessageType::OpenPeriodicEventStreamResponse; + } else if (s == "PullDynamicScheduleUpdate") { + return MessageType::PullDynamicScheduleUpdate; + } else if (s == "PullDynamicScheduleUpdateResponse") { + return MessageType::PullDynamicScheduleUpdateResponse; + } else if (s == "RequestBatterySwap") { + return MessageType::RequestBatterySwap; + } else if (s == "RequestBatterySwapResponse") { + return MessageType::RequestBatterySwapResponse; + } else if (s == "SetDefaultTariff") { + return MessageType::SetDefaultTariff; + } else if (s == "SetDefaultTariffResponse") { + return MessageType::SetDefaultTariffResponse; + } else if (s == "SetDERControl") { + return MessageType::SetDERControl; + } else if (s == "SetDERControlResponse") { + return MessageType::SetDERControlResponse; + } else if (s == "UpdateDynamicSchedule") { + return MessageType::UpdateDynamicSchedule; + } else if (s == "UpdateDynamicScheduleResponse") { + return MessageType::UpdateDynamicScheduleResponse; + } else if (s == "UsePriorityCharging") { + return MessageType::UsePriorityCharging; + } else if (s == "UsePriorityChargingResponse") { + return MessageType::UsePriorityChargingResponse; + } else if (s == "VatNumberValidation") { + return MessageType::VatNumberValidation; + } else if (s == "VatNumberValidationResponse") { + return MessageType::VatNumberValidationResponse; } throw StringToEnumException{s, "MessageType"}; } diff --git a/lib/ocpp/v2/utils.cpp b/lib/ocpp/v2/utils.cpp index 3b57286e3..767b82540 100644 --- a/lib/ocpp/v2/utils.cpp +++ b/lib/ocpp/v2/utils.cpp @@ -123,7 +123,7 @@ std::string sha256(const std::string& str) { } std::string generate_token_hash(const IdToken& token) { - return sha256(conversions::id_token_enum_to_string(token.type) + token.idToken.get()); + return sha256(token.type.get() + token.idToken.get()); } ocpp::DateTime align_timestamp(const DateTime timestamp, std::chrono::seconds align_interval) { @@ -210,6 +210,23 @@ std::vector get_purposes_to_ignore(const std::string return purposes_to_ignore; } +std::vector get_ocpp_protocol_versions(const std::string& csl) { + if (csl.empty()) { + return {}; + } + + std::vector ocpp_versions; + const auto ocpp_versions_str = ocpp::split_string(csl, ','); + for (const auto ocpp_version_str : ocpp_versions_str) { + try { + ocpp_versions.push_back(ocpp::conversions::string_to_ocpp_protocol_version(ocpp_version_str)); + } catch (std::out_of_range& e) { + EVLOG_warning << "Error while converting ocpp protocol version: " << ocpp_version_str; + } + } + return ocpp_versions; +} + } // namespace utils } // namespace v2 } // namespace ocpp diff --git a/lib/ocpp/v21/messages/AFRRSignal.cpp b/lib/ocpp/v21/messages/AFRRSignal.cpp new file mode 100644 index 000000000..00170bebe --- /dev/null +++ b/lib/ocpp/v21/messages/AFRRSignal.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string AFRRSignalRequest::get_type() const { + return "AFRRSignal"; +} + +void to_json(json& j, const AFRRSignalRequest& k) { + // the required parts of the message + j = json{ + {"timestamp", k.timestamp.to_rfc3339()}, + {"signal", k.signal}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, AFRRSignalRequest& k) { + // the required parts of the message + k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); + k.signal = j.at("signal"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given AFRRSignalRequest \p k to the given output stream \p os +/// \returns an output stream with the AFRRSignalRequest written to +std::ostream& operator<<(std::ostream& os, const AFRRSignalRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string AFRRSignalResponse::get_type() const { + return "AFRRSignalResponse"; +} + +void to_json(json& j, const AFRRSignalResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::generic_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, AFRRSignalResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_generic_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given AFRRSignalResponse \p k to the given output stream \p os +/// \returns an output stream with the AFRRSignalResponse written to +std::ostream& operator<<(std::ostream& os, const AFRRSignalResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/AdjustPeriodicEventStream.cpp b/lib/ocpp/v21/messages/AdjustPeriodicEventStream.cpp new file mode 100644 index 000000000..abc5619f8 --- /dev/null +++ b/lib/ocpp/v21/messages/AdjustPeriodicEventStream.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string AdjustPeriodicEventStreamRequest::get_type() const { + return "AdjustPeriodicEventStream"; +} + +void to_json(json& j, const AdjustPeriodicEventStreamRequest& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + {"params", k.params}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, AdjustPeriodicEventStreamRequest& k) { + // the required parts of the message + k.id = j.at("id"); + k.params = j.at("params"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given AdjustPeriodicEventStreamRequest \p k to the given output +/// stream \p os \returns an output stream with the AdjustPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const AdjustPeriodicEventStreamRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string AdjustPeriodicEventStreamResponse::get_type() const { + return "AdjustPeriodicEventStreamResponse"; +} + +void to_json(json& j, const AdjustPeriodicEventStreamResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::generic_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, AdjustPeriodicEventStreamResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_generic_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given AdjustPeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the AdjustPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const AdjustPeriodicEventStreamResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/BatterySwap.cpp b/lib/ocpp/v21/messages/BatterySwap.cpp new file mode 100644 index 000000000..9eab8ed43 --- /dev/null +++ b/lib/ocpp/v21/messages/BatterySwap.cpp @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string BatterySwapRequest::get_type() const { + return "BatterySwap"; +} + +void to_json(json& j, const BatterySwapRequest& k) { + // the required parts of the message + j = json{ + {"batteryData", k.batteryData}, + {"eventType", ocpp::v2::conversions::battery_swap_event_enum_to_string(k.eventType)}, + {"idToken", k.idToken}, + {"requestId", k.requestId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, BatterySwapRequest& k) { + // the required parts of the message + for (auto val : j.at("batteryData")) { + k.batteryData.push_back(val); + } + k.eventType = ocpp::v2::conversions::string_to_battery_swap_event_enum(j.at("eventType")); + k.idToken = j.at("idToken"); + k.requestId = j.at("requestId"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given BatterySwapRequest \p k to the given output stream \p os +/// \returns an output stream with the BatterySwapRequest written to +std::ostream& operator<<(std::ostream& os, const BatterySwapRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string BatterySwapResponse::get_type() const { + return "BatterySwapResponse"; +} + +void to_json(json& j, const BatterySwapResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, BatterySwapResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given BatterySwapResponse \p k to the given output stream \p os +/// \returns an output stream with the BatterySwapResponse written to +std::ostream& operator<<(std::ostream& os, const BatterySwapResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/CMakeLists.txt b/lib/ocpp/v21/messages/CMakeLists.txt new file mode 100644 index 000000000..3f1b0f475 --- /dev/null +++ b/lib/ocpp/v21/messages/CMakeLists.txt @@ -0,0 +1,31 @@ + +target_sources(ocpp + PRIVATE + AFRRSignal.cpp + AdjustPeriodicEventStream.cpp + BatterySwap.cpp + ChangeTransactionTariff.cpp + ClearDERControl.cpp + ClearTariffs.cpp + ClosePeriodicEventStream.cpp + GetCertificateChainStatus.cpp + GetDERControl.cpp + GetPeriodicEventStream.cpp + GetTariffs.cpp + NotifyAllowedEnergyTransfer.cpp + NotifyDERAlarm.cpp + NotifyDERStartStop.cpp + NotifyPeriodicEventStream.cpp + NotifyPriorityCharging.cpp + NotifySettlement.cpp + NotifyWebPaymentStarted.cpp + OpenPeriodicEventStream.cpp + PullDynamicScheduleUpdate.cpp + ReportDERControl.cpp + RequestBatterySwap.cpp + SetDERControl.cpp + SetDefaultTariff.cpp + UpdateDynamicSchedule.cpp + UsePriorityCharging.cpp + VatNumberValidation.cpp + ) diff --git a/lib/ocpp/v21/messages/ChangeTransactionTariff.cpp b/lib/ocpp/v21/messages/ChangeTransactionTariff.cpp new file mode 100644 index 000000000..5513459b2 --- /dev/null +++ b/lib/ocpp/v21/messages/ChangeTransactionTariff.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string ChangeTransactionTariffRequest::get_type() const { + return "ChangeTransactionTariff"; +} + +void to_json(json& j, const ChangeTransactionTariffRequest& k) { + // the required parts of the message + j = json{ + {"tariff", k.tariff}, + {"transactionId", k.transactionId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ChangeTransactionTariffRequest& k) { + // the required parts of the message + k.tariff = j.at("tariff"); + k.transactionId = j.at("transactionId"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ChangeTransactionTariffRequest \p k to the given output stream +/// \p os \returns an output stream with the ChangeTransactionTariffRequest written to +std::ostream& operator<<(std::ostream& os, const ChangeTransactionTariffRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string ChangeTransactionTariffResponse::get_type() const { + return "ChangeTransactionTariffResponse"; +} + +void to_json(json& j, const ChangeTransactionTariffResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::tariff_change_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ChangeTransactionTariffResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_tariff_change_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ChangeTransactionTariffResponse \p k to the given output stream +/// \p os \returns an output stream with the ChangeTransactionTariffResponse written to +std::ostream& operator<<(std::ostream& os, const ChangeTransactionTariffResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/ClearDERControl.cpp b/lib/ocpp/v21/messages/ClearDERControl.cpp new file mode 100644 index 000000000..170756508 --- /dev/null +++ b/lib/ocpp/v21/messages/ClearDERControl.cpp @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string ClearDERControlRequest::get_type() const { + return "ClearDERControl"; +} + +void to_json(json& j, const ClearDERControlRequest& k) { + // the required parts of the message + j = json{ + {"isDefault", k.isDefault}, + }; + // the optional parts of the message + if (k.controlType) { + j["controlType"] = ocpp::v2::conversions::dercontrol_enum_to_string(k.controlType.value()); + } + if (k.controlId) { + j["controlId"] = k.controlId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClearDERControlRequest& k) { + // the required parts of the message + k.isDefault = j.at("isDefault"); + + // the optional parts of the message + if (j.contains("controlType")) { + k.controlType.emplace(ocpp::v2::conversions::string_to_dercontrol_enum(j.at("controlType"))); + } + if (j.contains("controlId")) { + k.controlId.emplace(j.at("controlId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClearDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the ClearDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const ClearDERControlRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string ClearDERControlResponse::get_type() const { + return "ClearDERControlResponse"; +} + +void to_json(json& j, const ClearDERControlResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::dercontrol_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClearDERControlResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_dercontrol_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClearDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the ClearDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const ClearDERControlResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/ClearTariffs.cpp b/lib/ocpp/v21/messages/ClearTariffs.cpp new file mode 100644 index 000000000..988e570ba --- /dev/null +++ b/lib/ocpp/v21/messages/ClearTariffs.cpp @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string ClearTariffsRequest::get_type() const { + return "ClearTariffs"; +} + +void to_json(json& j, const ClearTariffsRequest& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.tariffIds) { + if (j.size() == 0) { + j = json{{"tariffIds", json::array()}}; + } else { + j["tariffIds"] = json::array(); + } + for (auto val : k.tariffIds.value()) { + j["tariffIds"].push_back(val); + } + } + if (k.evseId) { + j["evseId"] = k.evseId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClearTariffsRequest& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("tariffIds")) { + json arr = j.at("tariffIds"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.tariffIds.emplace(vec); + } + if (j.contains("evseId")) { + k.evseId.emplace(j.at("evseId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClearTariffsRequest \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsRequest written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string ClearTariffsResponse::get_type() const { + return "ClearTariffsResponse"; +} + +void to_json(json& j, const ClearTariffsResponse& k) { + // the required parts of the message + j = json{ + {"clearTariffsResult", k.clearTariffsResult}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClearTariffsResponse& k) { + // the required parts of the message + for (auto val : j.at("clearTariffsResult")) { + k.clearTariffsResult.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClearTariffsResponse \p k to the given output stream \p os +/// \returns an output stream with the ClearTariffsResponse written to +std::ostream& operator<<(std::ostream& os, const ClearTariffsResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/ClosePeriodicEventStream.cpp b/lib/ocpp/v21/messages/ClosePeriodicEventStream.cpp new file mode 100644 index 000000000..79a4a5613 --- /dev/null +++ b/lib/ocpp/v21/messages/ClosePeriodicEventStream.cpp @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string ClosePeriodicEventStreamRequest::get_type() const { + return "ClosePeriodicEventStream"; +} + +void to_json(json& j, const ClosePeriodicEventStreamRequest& k) { + // the required parts of the message + j = json{ + {"id", k.id}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClosePeriodicEventStreamRequest& k) { + // the required parts of the message + k.id = j.at("id"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClosePeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the ClosePeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const ClosePeriodicEventStreamRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string ClosePeriodicEventStreamResponse::get_type() const { + return "ClosePeriodicEventStreamResponse"; +} + +void to_json(json& j, const ClosePeriodicEventStreamResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ClosePeriodicEventStreamResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ClosePeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the ClosePeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const ClosePeriodicEventStreamResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/GetCertificateChainStatus.cpp b/lib/ocpp/v21/messages/GetCertificateChainStatus.cpp new file mode 100644 index 000000000..707be8a4b --- /dev/null +++ b/lib/ocpp/v21/messages/GetCertificateChainStatus.cpp @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string GetCertificateChainStatusRequest::get_type() const { + return "GetCertificateChainStatus"; +} + +void to_json(json& j, const GetCertificateChainStatusRequest& k) { + // the required parts of the message + j = json{ + {"certificateStatusRequests", k.certificateStatusRequests}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetCertificateChainStatusRequest& k) { + // the required parts of the message + for (auto val : j.at("certificateStatusRequests")) { + k.certificateStatusRequests.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetCertificateChainStatusRequest \p k to the given output +/// stream \p os \returns an output stream with the GetCertificateChainStatusRequest written to +std::ostream& operator<<(std::ostream& os, const GetCertificateChainStatusRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string GetCertificateChainStatusResponse::get_type() const { + return "GetCertificateChainStatusResponse"; +} + +void to_json(json& j, const GetCertificateChainStatusResponse& k) { + // the required parts of the message + j = json{ + {"certificateStatus", k.certificateStatus}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetCertificateChainStatusResponse& k) { + // the required parts of the message + for (auto val : j.at("certificateStatus")) { + k.certificateStatus.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetCertificateChainStatusResponse \p k to the given output +/// stream \p os \returns an output stream with the GetCertificateChainStatusResponse written to +std::ostream& operator<<(std::ostream& os, const GetCertificateChainStatusResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/GetDERControl.cpp b/lib/ocpp/v21/messages/GetDERControl.cpp new file mode 100644 index 000000000..3160b8b9f --- /dev/null +++ b/lib/ocpp/v21/messages/GetDERControl.cpp @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string GetDERControlRequest::get_type() const { + return "GetDERControl"; +} + +void to_json(json& j, const GetDERControlRequest& k) { + // the required parts of the message + j = json{ + {"requestId", k.requestId}, + }; + // the optional parts of the message + if (k.isDefault) { + j["isDefault"] = k.isDefault.value(); + } + if (k.controlType) { + j["controlType"] = ocpp::v2::conversions::dercontrol_enum_to_string(k.controlType.value()); + } + if (k.controlId) { + j["controlId"] = k.controlId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetDERControlRequest& k) { + // the required parts of the message + k.requestId = j.at("requestId"); + + // the optional parts of the message + if (j.contains("isDefault")) { + k.isDefault.emplace(j.at("isDefault")); + } + if (j.contains("controlType")) { + k.controlType.emplace(ocpp::v2::conversions::string_to_dercontrol_enum(j.at("controlType"))); + } + if (j.contains("controlId")) { + k.controlId.emplace(j.at("controlId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the GetDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const GetDERControlRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string GetDERControlResponse::get_type() const { + return "GetDERControlResponse"; +} + +void to_json(json& j, const GetDERControlResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::dercontrol_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetDERControlResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_dercontrol_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the GetDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const GetDERControlResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/GetPeriodicEventStream.cpp b/lib/ocpp/v21/messages/GetPeriodicEventStream.cpp new file mode 100644 index 000000000..d509bf5b1 --- /dev/null +++ b/lib/ocpp/v21/messages/GetPeriodicEventStream.cpp @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string GetPeriodicEventStreamRequest::get_type() const { + return "GetPeriodicEventStream"; +} + +void to_json(json& j, const GetPeriodicEventStreamRequest& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetPeriodicEventStreamRequest& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetPeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the GetPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const GetPeriodicEventStreamRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string GetPeriodicEventStreamResponse::get_type() const { + return "GetPeriodicEventStreamResponse"; +} + +void to_json(json& j, const GetPeriodicEventStreamResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.constantStreamData) { + if (j.size() == 0) { + j = json{{"constantStreamData", json::array()}}; + } else { + j["constantStreamData"] = json::array(); + } + for (auto val : k.constantStreamData.value()) { + j["constantStreamData"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetPeriodicEventStreamResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("constantStreamData")) { + json arr = j.at("constantStreamData"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.constantStreamData.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetPeriodicEventStreamResponse \p k to the given output stream +/// \p os \returns an output stream with the GetPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const GetPeriodicEventStreamResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/GetTariffs.cpp b/lib/ocpp/v21/messages/GetTariffs.cpp new file mode 100644 index 000000000..d77596685 --- /dev/null +++ b/lib/ocpp/v21/messages/GetTariffs.cpp @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string GetTariffsRequest::get_type() const { + return "GetTariffs"; +} + +void to_json(json& j, const GetTariffsRequest& k) { + // the required parts of the message + j = json{ + {"evseId", k.evseId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetTariffsRequest& k) { + // the required parts of the message + k.evseId = j.at("evseId"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetTariffsRequest \p k to the given output stream \p os +/// \returns an output stream with the GetTariffsRequest written to +std::ostream& operator<<(std::ostream& os, const GetTariffsRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string GetTariffsResponse::get_type() const { + return "GetTariffsResponse"; +} + +void to_json(json& j, const GetTariffsResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::tariff_get_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.tariffAssignments) { + j["tariffAssignments"] = json::array(); + for (auto val : k.tariffAssignments.value()) { + j["tariffAssignments"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetTariffsResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_tariff_get_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("tariffAssignments")) { + json arr = j.at("tariffAssignments"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.tariffAssignments.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given GetTariffsResponse \p k to the given output stream \p os +/// \returns an output stream with the GetTariffsResponse written to +std::ostream& operator<<(std::ostream& os, const GetTariffsResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyAllowedEnergyTransfer.cpp b/lib/ocpp/v21/messages/NotifyAllowedEnergyTransfer.cpp new file mode 100644 index 000000000..72254799d --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyAllowedEnergyTransfer.cpp @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyAllowedEnergyTransferRequest::get_type() const { + return "NotifyAllowedEnergyTransfer"; +} + +void to_json(json& j, const NotifyAllowedEnergyTransferRequest& k) { + // the required parts of the message + j = json{ + {"transactionId", k.transactionId}, + {"allowedEnergyTransfer", k.allowedEnergyTransfer}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyAllowedEnergyTransferRequest& k) { + // the required parts of the message + k.transactionId = j.at("transactionId"); + for (auto val : j.at("allowedEnergyTransfer")) { + k.allowedEnergyTransfer.push_back(val); + } + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyAllowedEnergyTransferRequest \p k to the given output +/// stream \p os \returns an output stream with the NotifyAllowedEnergyTransferRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyAllowedEnergyTransferRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyAllowedEnergyTransferResponse::get_type() const { + return "NotifyAllowedEnergyTransferResponse"; +} + +void to_json(json& j, const NotifyAllowedEnergyTransferResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::notify_allowed_energy_transfer_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyAllowedEnergyTransferResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_notify_allowed_energy_transfer_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyAllowedEnergyTransferResponse \p k to the given output +/// stream \p os \returns an output stream with the NotifyAllowedEnergyTransferResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyAllowedEnergyTransferResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyCRL.cpp b/lib/ocpp/v21/messages/NotifyCRL.cpp new file mode 100644 index 000000000..5a88dcfae --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyCRL.cpp @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyCRLRequest::get_type() const { + return "NotifyCRL"; +} + +void to_json(json& j, const NotifyCRLRequest& k) { + // the required parts of the message + j = json{ + {"requestId", k.requestId}, + {"status", ocpp::v2::conversions::notify_crlstatus_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.location) { + j["location"] = k.location.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyCRLRequest& k) { + // the required parts of the message + k.requestId = j.at("requestId"); + k.status = ocpp::v2::conversions::string_to_notify_crlstatus_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("location")) { + k.location.emplace(j.at("location")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyCRLRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyCRLRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyCRLRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyCRLResponse::get_type() const { + return "NotifyCRLResponse"; +} + +void to_json(json& j, const NotifyCRLResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyCRLResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyCRLResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifyCRLResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyCRLResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyDERAlarm.cpp b/lib/ocpp/v21/messages/NotifyDERAlarm.cpp new file mode 100644 index 000000000..966f775c8 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyDERAlarm.cpp @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyDERAlarmRequest::get_type() const { + return "NotifyDERAlarm"; +} + +void to_json(json& j, const NotifyDERAlarmRequest& k) { + // the required parts of the message + j = json{ + {"controlType", ocpp::v2::conversions::dercontrol_enum_to_string(k.controlType)}, + {"timestamp", k.timestamp.to_rfc3339()}, + }; + // the optional parts of the message + if (k.gridEventFault) { + j["gridEventFault"] = ocpp::v2::conversions::grid_event_fault_enum_to_string(k.gridEventFault.value()); + } + if (k.alarmEnded) { + j["alarmEnded"] = k.alarmEnded.value(); + } + if (k.extraInfo) { + j["extraInfo"] = k.extraInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyDERAlarmRequest& k) { + // the required parts of the message + k.controlType = ocpp::v2::conversions::string_to_dercontrol_enum(j.at("controlType")); + k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); + + // the optional parts of the message + if (j.contains("gridEventFault")) { + k.gridEventFault.emplace(ocpp::v2::conversions::string_to_grid_event_fault_enum(j.at("gridEventFault"))); + } + if (j.contains("alarmEnded")) { + k.alarmEnded.emplace(j.at("alarmEnded")); + } + if (j.contains("extraInfo")) { + k.extraInfo.emplace(j.at("extraInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyDERAlarmRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERAlarmRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyDERAlarmRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyDERAlarmResponse::get_type() const { + return "NotifyDERAlarmResponse"; +} + +void to_json(json& j, const NotifyDERAlarmResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyDERAlarmResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyDERAlarmResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERAlarmResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyDERAlarmResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyDERStartStop.cpp b/lib/ocpp/v21/messages/NotifyDERStartStop.cpp new file mode 100644 index 000000000..875bb0600 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyDERStartStop.cpp @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyDERStartStopRequest::get_type() const { + return "NotifyDERStartStop"; +} + +void to_json(json& j, const NotifyDERStartStopRequest& k) { + // the required parts of the message + j = json{ + {"controlId", k.controlId}, + {"started", k.started}, + {"timestamp", k.timestamp.to_rfc3339()}, + }; + // the optional parts of the message + if (k.supersededIds) { + j["supersededIds"] = json::array(); + for (auto val : k.supersededIds.value()) { + j["supersededIds"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyDERStartStopRequest& k) { + // the required parts of the message + k.controlId = j.at("controlId"); + k.started = j.at("started"); + k.timestamp = ocpp::DateTime(std::string(j.at("timestamp"))); + + // the optional parts of the message + if (j.contains("supersededIds")) { + json arr = j.at("supersededIds"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.supersededIds.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyDERStartStopRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifyDERStartStopRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyDERStartStopRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyDERStartStopResponse::get_type() const { + return "NotifyDERStartStopResponse"; +} + +void to_json(json& j, const NotifyDERStartStopResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyDERStartStopResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyDERStartStopResponse \p k to the given output stream \p +/// os \returns an output stream with the NotifyDERStartStopResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyDERStartStopResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyPeriodicEventStream.cpp b/lib/ocpp/v21/messages/NotifyPeriodicEventStream.cpp new file mode 100644 index 000000000..2558f0277 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyPeriodicEventStream.cpp @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyPeriodicEventStream::get_type() const { + return "NotifyPeriodicEventStream"; +} + +void to_json(json& j, const NotifyPeriodicEventStream& k) { + // the required parts of the message + j = json{ + {"data", k.data}, + {"id", k.id}, + {"pending", k.pending}, + {"basetime", k.basetime.to_rfc3339()}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyPeriodicEventStream& k) { + // the required parts of the message + for (auto val : j.at("data")) { + k.data.push_back(val); + } + k.id = j.at("id"); + k.pending = j.at("pending"); + k.basetime = ocpp::DateTime(std::string(j.at("basetime"))); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyPeriodicEventStream \p k to the given output stream \p os +/// \returns an output stream with the NotifyPeriodicEventStream written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStream& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyPriorityCharging.cpp b/lib/ocpp/v21/messages/NotifyPriorityCharging.cpp new file mode 100644 index 000000000..2a230b2b3 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyPriorityCharging.cpp @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyPriorityChargingRequest::get_type() const { + return "NotifyPriorityCharging"; +} + +void to_json(json& j, const NotifyPriorityChargingRequest& k) { + // the required parts of the message + j = json{ + {"transactionId", k.transactionId}, + {"activated", k.activated}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyPriorityChargingRequest& k) { + // the required parts of the message + k.transactionId = j.at("transactionId"); + k.activated = j.at("activated"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyPriorityChargingRequest \p k to the given output stream +/// \p os \returns an output stream with the NotifyPriorityChargingRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyPriorityChargingRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyPriorityChargingResponse::get_type() const { + return "NotifyPriorityChargingResponse"; +} + +void to_json(json& j, const NotifyPriorityChargingResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyPriorityChargingResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyPriorityChargingResponse \p k to the given output stream +/// \p os \returns an output stream with the NotifyPriorityChargingResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyPriorityChargingResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyQRCodeScanned.cpp b/lib/ocpp/v21/messages/NotifyQRCodeScanned.cpp new file mode 100644 index 000000000..186e88a09 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyQRCodeScanned.cpp @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyQRCodeScannedRequest::get_type() const { + return "NotifyQRCodeScanned"; +} + +void to_json(json& j, const NotifyQRCodeScannedRequest& k) { + // the required parts of the message + j = json{ + {"evseId", k.evseId}, + {"timeout", k.timeout}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyQRCodeScannedRequest& k) { + // the required parts of the message + k.evseId = j.at("evseId"); + k.timeout = j.at("timeout"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyQRCodeScannedRequest \p k to the given output stream \p +/// os \returns an output stream with the NotifyQRCodeScannedRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyQRCodeScannedRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyQRCodeScannedResponse::get_type() const { + return "NotifyQRCodeScannedResponse"; +} + +void to_json(json& j, const NotifyQRCodeScannedResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyQRCodeScannedResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyQRCodeScannedResponse \p k to the given output stream \p +/// os \returns an output stream with the NotifyQRCodeScannedResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyQRCodeScannedResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifySettlement.cpp b/lib/ocpp/v21/messages/NotifySettlement.cpp new file mode 100644 index 000000000..9332ddefe --- /dev/null +++ b/lib/ocpp/v21/messages/NotifySettlement.cpp @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifySettlementRequest::get_type() const { + return "NotifySettlement"; +} + +void to_json(json& j, const NotifySettlementRequest& k) { + // the required parts of the message + j = json{ + {"pspRef", k.pspRef}, + {"status", ocpp::v2::conversions::payment_status_enum_to_string(k.status)}, + {"settlementAmount", k.settlementAmount}, + {"settlementTime", k.settlementTime.to_rfc3339()}, + }; + // the optional parts of the message + if (k.transactionId) { + j["transactionId"] = k.transactionId.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.receiptId) { + j["receiptId"] = k.receiptId.value(); + } + if (k.receiptUrl) { + j["receiptUrl"] = k.receiptUrl.value(); + } + if (k.vatCompany) { + j["vatCompany"] = k.vatCompany.value(); + } + if (k.vatNumber) { + j["vatNumber"] = k.vatNumber.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifySettlementRequest& k) { + // the required parts of the message + k.pspRef = j.at("pspRef"); + k.status = ocpp::v2::conversions::string_to_payment_status_enum(j.at("status")); + k.settlementAmount = j.at("settlementAmount"); + k.settlementTime = ocpp::DateTime(std::string(j.at("settlementTime"))); + + // the optional parts of the message + if (j.contains("transactionId")) { + k.transactionId.emplace(j.at("transactionId")); + } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("receiptId")) { + k.receiptId.emplace(j.at("receiptId")); + } + if (j.contains("receiptUrl")) { + k.receiptUrl.emplace(j.at("receiptUrl")); + } + if (j.contains("vatCompany")) { + k.vatCompany.emplace(j.at("vatCompany")); + } + if (j.contains("vatNumber")) { + k.vatNumber.emplace(j.at("vatNumber")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifySettlementRequest \p k to the given output stream \p os +/// \returns an output stream with the NotifySettlementRequest written to +std::ostream& operator<<(std::ostream& os, const NotifySettlementRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifySettlementResponse::get_type() const { + return "NotifySettlementResponse"; +} + +void to_json(json& j, const NotifySettlementResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.receiptUrl) { + j["receiptUrl"] = k.receiptUrl.value(); + } + if (k.receiptId) { + j["receiptId"] = k.receiptId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifySettlementResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("receiptUrl")) { + k.receiptUrl.emplace(j.at("receiptUrl")); + } + if (j.contains("receiptId")) { + k.receiptId.emplace(j.at("receiptId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifySettlementResponse \p k to the given output stream \p os +/// \returns an output stream with the NotifySettlementResponse written to +std::ostream& operator<<(std::ostream& os, const NotifySettlementResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/NotifyWebPaymentStarted.cpp b/lib/ocpp/v21/messages/NotifyWebPaymentStarted.cpp new file mode 100644 index 000000000..099a1de8c --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyWebPaymentStarted.cpp @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string NotifyWebPaymentStartedRequest::get_type() const { + return "NotifyWebPaymentStarted"; +} + +void to_json(json& j, const NotifyWebPaymentStartedRequest& k) { + // the required parts of the message + j = json{ + {"evseId", k.evseId}, + {"timeout", k.timeout}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyWebPaymentStartedRequest& k) { + // the required parts of the message + k.evseId = j.at("evseId"); + k.timeout = j.at("timeout"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyWebPaymentStartedRequest \p k to the given output stream +/// \p os \returns an output stream with the NotifyWebPaymentStartedRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyWebPaymentStartedRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyWebPaymentStartedResponse::get_type() const { + return "NotifyWebPaymentStartedResponse"; +} + +void to_json(json& j, const NotifyWebPaymentStartedResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyWebPaymentStartedResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyWebPaymentStartedResponse \p k to the given output stream +/// \p os \returns an output stream with the NotifyWebPaymentStartedResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyWebPaymentStartedResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/OpenPeriodicEventStream.cpp b/lib/ocpp/v21/messages/OpenPeriodicEventStream.cpp new file mode 100644 index 000000000..bb032cf0b --- /dev/null +++ b/lib/ocpp/v21/messages/OpenPeriodicEventStream.cpp @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string OpenPeriodicEventStreamRequest::get_type() const { + return "OpenPeriodicEventStream"; +} + +void to_json(json& j, const OpenPeriodicEventStreamRequest& k) { + // the required parts of the message + j = json{ + {"constantStreamData", k.constantStreamData}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, OpenPeriodicEventStreamRequest& k) { + // the required parts of the message + k.constantStreamData = j.at("constantStreamData"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given OpenPeriodicEventStreamRequest \p k to the given output stream +/// \p os \returns an output stream with the OpenPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const OpenPeriodicEventStreamRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string OpenPeriodicEventStreamResponse::get_type() const { + return "OpenPeriodicEventStreamResponse"; +} + +void to_json(json& j, const OpenPeriodicEventStreamResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::generic_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, OpenPeriodicEventStreamResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_generic_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given OpenPeriodicEventStreamResponse \p k to the given output stream +/// \p os \returns an output stream with the OpenPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const OpenPeriodicEventStreamResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/PullDynamicScheduleUpdate.cpp b/lib/ocpp/v21/messages/PullDynamicScheduleUpdate.cpp new file mode 100644 index 000000000..84a9833fd --- /dev/null +++ b/lib/ocpp/v21/messages/PullDynamicScheduleUpdate.cpp @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string PullDynamicScheduleUpdateRequest::get_type() const { + return "PullDynamicScheduleUpdate"; +} + +void to_json(json& j, const PullDynamicScheduleUpdateRequest& k) { + // the required parts of the message + j = json{ + {"chargingProfileId", k.chargingProfileId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, PullDynamicScheduleUpdateRequest& k) { + // the required parts of the message + k.chargingProfileId = j.at("chargingProfileId"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given PullDynamicScheduleUpdateRequest \p k to the given output +/// stream \p os \returns an output stream with the PullDynamicScheduleUpdateRequest written to +std::ostream& operator<<(std::ostream& os, const PullDynamicScheduleUpdateRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string PullDynamicScheduleUpdateResponse::get_type() const { + return "PullDynamicScheduleUpdateResponse"; +} + +void to_json(json& j, const PullDynamicScheduleUpdateResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::charging_profile_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.scheduleUpdate) { + j["scheduleUpdate"] = k.scheduleUpdate.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, PullDynamicScheduleUpdateResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_charging_profile_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("scheduleUpdate")) { + k.scheduleUpdate.emplace(j.at("scheduleUpdate")); + } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given PullDynamicScheduleUpdateResponse \p k to the given output +/// stream \p os \returns an output stream with the PullDynamicScheduleUpdateResponse written to +std::ostream& operator<<(std::ostream& os, const PullDynamicScheduleUpdateResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/ReportDERControl.cpp b/lib/ocpp/v21/messages/ReportDERControl.cpp new file mode 100644 index 000000000..3e04f4eff --- /dev/null +++ b/lib/ocpp/v21/messages/ReportDERControl.cpp @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string ReportDERControlRequest::get_type() const { + return "ReportDERControl"; +} + +void to_json(json& j, const ReportDERControlRequest& k) { + // the required parts of the message + j = json{ + {"requestId", k.requestId}, + }; + // the optional parts of the message + if (k.curve) { + j["curve"] = json::array(); + for (auto val : k.curve.value()) { + j["curve"].push_back(val); + } + } + if (k.enterService) { + j["enterService"] = json::array(); + for (auto val : k.enterService.value()) { + j["enterService"].push_back(val); + } + } + if (k.fixedPFAbsorb) { + j["fixedPFAbsorb"] = json::array(); + for (auto val : k.fixedPFAbsorb.value()) { + j["fixedPFAbsorb"].push_back(val); + } + } + if (k.fixedPFInject) { + j["fixedPFInject"] = json::array(); + for (auto val : k.fixedPFInject.value()) { + j["fixedPFInject"].push_back(val); + } + } + if (k.fixedVar) { + j["fixedVar"] = json::array(); + for (auto val : k.fixedVar.value()) { + j["fixedVar"].push_back(val); + } + } + if (k.freqDroop) { + j["freqDroop"] = json::array(); + for (auto val : k.freqDroop.value()) { + j["freqDroop"].push_back(val); + } + } + if (k.gradient) { + j["gradient"] = json::array(); + for (auto val : k.gradient.value()) { + j["gradient"].push_back(val); + } + } + if (k.limitMaxDischarge) { + j["limitMaxDischarge"] = json::array(); + for (auto val : k.limitMaxDischarge.value()) { + j["limitMaxDischarge"].push_back(val); + } + } + if (k.tbc) { + j["tbc"] = k.tbc.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ReportDERControlRequest& k) { + // the required parts of the message + k.requestId = j.at("requestId"); + + // the optional parts of the message + if (j.contains("curve")) { + json arr = j.at("curve"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.curve.emplace(vec); + } + if (j.contains("enterService")) { + json arr = j.at("enterService"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.enterService.emplace(vec); + } + if (j.contains("fixedPFAbsorb")) { + json arr = j.at("fixedPFAbsorb"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.fixedPFAbsorb.emplace(vec); + } + if (j.contains("fixedPFInject")) { + json arr = j.at("fixedPFInject"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.fixedPFInject.emplace(vec); + } + if (j.contains("fixedVar")) { + json arr = j.at("fixedVar"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.fixedVar.emplace(vec); + } + if (j.contains("freqDroop")) { + json arr = j.at("freqDroop"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.freqDroop.emplace(vec); + } + if (j.contains("gradient")) { + json arr = j.at("gradient"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.gradient.emplace(vec); + } + if (j.contains("limitMaxDischarge")) { + json arr = j.at("limitMaxDischarge"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.limitMaxDischarge.emplace(vec); + } + if (j.contains("tbc")) { + k.tbc.emplace(j.at("tbc")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ReportDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the ReportDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const ReportDERControlRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string ReportDERControlResponse::get_type() const { + return "ReportDERControlResponse"; +} + +void to_json(json& j, const ReportDERControlResponse& k) { + // the required parts of the message + j = json({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, ReportDERControlResponse& k) { + // the required parts of the message + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given ReportDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the ReportDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const ReportDERControlResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/RequestBatterySwap.cpp b/lib/ocpp/v21/messages/RequestBatterySwap.cpp new file mode 100644 index 000000000..20c8bd23c --- /dev/null +++ b/lib/ocpp/v21/messages/RequestBatterySwap.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string RequestBatterySwapRequest::get_type() const { + return "RequestBatterySwap"; +} + +void to_json(json& j, const RequestBatterySwapRequest& k) { + // the required parts of the message + j = json{ + {"idToken", k.idToken}, + {"requestId", k.requestId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, RequestBatterySwapRequest& k) { + // the required parts of the message + k.idToken = j.at("idToken"); + k.requestId = j.at("requestId"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given RequestBatterySwapRequest \p k to the given output stream \p os +/// \returns an output stream with the RequestBatterySwapRequest written to +std::ostream& operator<<(std::ostream& os, const RequestBatterySwapRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string RequestBatterySwapResponse::get_type() const { + return "RequestBatterySwapResponse"; +} + +void to_json(json& j, const RequestBatterySwapResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::generic_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, RequestBatterySwapResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_generic_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given RequestBatterySwapResponse \p k to the given output stream \p +/// os \returns an output stream with the RequestBatterySwapResponse written to +std::ostream& operator<<(std::ostream& os, const RequestBatterySwapResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/SetDERControl.cpp b/lib/ocpp/v21/messages/SetDERControl.cpp new file mode 100644 index 000000000..9e50f9271 --- /dev/null +++ b/lib/ocpp/v21/messages/SetDERControl.cpp @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string SetDERControlRequest::get_type() const { + return "SetDERControl"; +} + +void to_json(json& j, const SetDERControlRequest& k) { + // the required parts of the message + j = json{ + {"isDefault", k.isDefault}, + {"controlId", k.controlId}, + {"controlType", ocpp::v2::conversions::dercontrol_enum_to_string(k.controlType)}, + }; + // the optional parts of the message + if (k.curve) { + j["curve"] = k.curve.value(); + } + if (k.enterService) { + j["enterService"] = k.enterService.value(); + } + if (k.fixedPFAbsorb) { + j["fixedPFAbsorb"] = k.fixedPFAbsorb.value(); + } + if (k.fixedPFInject) { + j["fixedPFInject"] = k.fixedPFInject.value(); + } + if (k.fixedVar) { + j["fixedVar"] = k.fixedVar.value(); + } + if (k.freqDroop) { + j["freqDroop"] = k.freqDroop.value(); + } + if (k.gradient) { + j["gradient"] = k.gradient.value(); + } + if (k.limitMaxDischarge) { + j["limitMaxDischarge"] = k.limitMaxDischarge.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, SetDERControlRequest& k) { + // the required parts of the message + k.isDefault = j.at("isDefault"); + k.controlId = j.at("controlId"); + k.controlType = ocpp::v2::conversions::string_to_dercontrol_enum(j.at("controlType")); + + // the optional parts of the message + if (j.contains("curve")) { + k.curve.emplace(j.at("curve")); + } + if (j.contains("enterService")) { + k.enterService.emplace(j.at("enterService")); + } + if (j.contains("fixedPFAbsorb")) { + k.fixedPFAbsorb.emplace(j.at("fixedPFAbsorb")); + } + if (j.contains("fixedPFInject")) { + k.fixedPFInject.emplace(j.at("fixedPFInject")); + } + if (j.contains("fixedVar")) { + k.fixedVar.emplace(j.at("fixedVar")); + } + if (j.contains("freqDroop")) { + k.freqDroop.emplace(j.at("freqDroop")); + } + if (j.contains("gradient")) { + k.gradient.emplace(j.at("gradient")); + } + if (j.contains("limitMaxDischarge")) { + k.limitMaxDischarge.emplace(j.at("limitMaxDischarge")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given SetDERControlRequest \p k to the given output stream \p os +/// \returns an output stream with the SetDERControlRequest written to +std::ostream& operator<<(std::ostream& os, const SetDERControlRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string SetDERControlResponse::get_type() const { + return "SetDERControlResponse"; +} + +void to_json(json& j, const SetDERControlResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::dercontrol_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.supersededIds) { + j["supersededIds"] = json::array(); + for (auto val : k.supersededIds.value()) { + j["supersededIds"].push_back(val); + } + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, SetDERControlResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_dercontrol_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("supersededIds")) { + json arr = j.at("supersededIds"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.supersededIds.emplace(vec); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given SetDERControlResponse \p k to the given output stream \p os +/// \returns an output stream with the SetDERControlResponse written to +std::ostream& operator<<(std::ostream& os, const SetDERControlResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/SetDefaultTariff.cpp b/lib/ocpp/v21/messages/SetDefaultTariff.cpp new file mode 100644 index 000000000..9d3c0ed2b --- /dev/null +++ b/lib/ocpp/v21/messages/SetDefaultTariff.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string SetDefaultTariffRequest::get_type() const { + return "SetDefaultTariff"; +} + +void to_json(json& j, const SetDefaultTariffRequest& k) { + // the required parts of the message + j = json{ + {"evseId", k.evseId}, + {"tariff", k.tariff}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, SetDefaultTariffRequest& k) { + // the required parts of the message + k.evseId = j.at("evseId"); + k.tariff = j.at("tariff"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given SetDefaultTariffRequest \p k to the given output stream \p os +/// \returns an output stream with the SetDefaultTariffRequest written to +std::ostream& operator<<(std::ostream& os, const SetDefaultTariffRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string SetDefaultTariffResponse::get_type() const { + return "SetDefaultTariffResponse"; +} + +void to_json(json& j, const SetDefaultTariffResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::tariff_set_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, SetDefaultTariffResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_tariff_set_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given SetDefaultTariffResponse \p k to the given output stream \p os +/// \returns an output stream with the SetDefaultTariffResponse written to +std::ostream& operator<<(std::ostream& os, const SetDefaultTariffResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/UpdateDynamicSchedule.cpp b/lib/ocpp/v21/messages/UpdateDynamicSchedule.cpp new file mode 100644 index 000000000..16efee212 --- /dev/null +++ b/lib/ocpp/v21/messages/UpdateDynamicSchedule.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string UpdateDynamicScheduleRequest::get_type() const { + return "UpdateDynamicSchedule"; +} + +void to_json(json& j, const UpdateDynamicScheduleRequest& k) { + // the required parts of the message + j = json{ + {"chargingProfileId", k.chargingProfileId}, + {"scheduleUpdate", k.scheduleUpdate}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, UpdateDynamicScheduleRequest& k) { + // the required parts of the message + k.chargingProfileId = j.at("chargingProfileId"); + k.scheduleUpdate = j.at("scheduleUpdate"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given UpdateDynamicScheduleRequest \p k to the given output stream \p +/// os \returns an output stream with the UpdateDynamicScheduleRequest written to +std::ostream& operator<<(std::ostream& os, const UpdateDynamicScheduleRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string UpdateDynamicScheduleResponse::get_type() const { + return "UpdateDynamicScheduleResponse"; +} + +void to_json(json& j, const UpdateDynamicScheduleResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::charging_profile_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, UpdateDynamicScheduleResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_charging_profile_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given UpdateDynamicScheduleResponse \p k to the given output stream +/// \p os \returns an output stream with the UpdateDynamicScheduleResponse written to +std::ostream& operator<<(std::ostream& os, const UpdateDynamicScheduleResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/UsePriorityCharging.cpp b/lib/ocpp/v21/messages/UsePriorityCharging.cpp new file mode 100644 index 000000000..d13d1f2ab --- /dev/null +++ b/lib/ocpp/v21/messages/UsePriorityCharging.cpp @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string UsePriorityChargingRequest::get_type() const { + return "UsePriorityCharging"; +} + +void to_json(json& j, const UsePriorityChargingRequest& k) { + // the required parts of the message + j = json{ + {"transactionId", k.transactionId}, + {"activate", k.activate}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, UsePriorityChargingRequest& k) { + // the required parts of the message + k.transactionId = j.at("transactionId"); + k.activate = j.at("activate"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given UsePriorityChargingRequest \p k to the given output stream \p +/// os \returns an output stream with the UsePriorityChargingRequest written to +std::ostream& operator<<(std::ostream& os, const UsePriorityChargingRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string UsePriorityChargingResponse::get_type() const { + return "UsePriorityChargingResponse"; +} + +void to_json(json& j, const UsePriorityChargingResponse& k) { + // the required parts of the message + j = json{ + {"status", ocpp::v2::conversions::priority_charging_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, UsePriorityChargingResponse& k) { + // the required parts of the message + k.status = ocpp::v2::conversions::string_to_priority_charging_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given UsePriorityChargingResponse \p k to the given output stream \p +/// os \returns an output stream with the UsePriorityChargingResponse written to +std::ostream& operator<<(std::ostream& os, const UsePriorityChargingResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/lib/ocpp/v21/messages/VatNumberValidation.cpp b/lib/ocpp/v21/messages/VatNumberValidation.cpp new file mode 100644 index 000000000..211dc4bc6 --- /dev/null +++ b/lib/ocpp/v21/messages/VatNumberValidation.cpp @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +// This code is generated using the generator in 'src/code_generator/common`, please do not edit manually + +#include + +#include +#include +#include + +using json = nlohmann::json; + +namespace ocpp { +namespace v21 { + +std::string VatNumberValidationRequest::get_type() const { + return "VatNumberValidation"; +} + +void to_json(json& j, const VatNumberValidationRequest& k) { + // the required parts of the message + j = json{ + {"vatNumber", k.vatNumber}, + }; + // the optional parts of the message + if (k.evseId) { + j["evseId"] = k.evseId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, VatNumberValidationRequest& k) { + // the required parts of the message + k.vatNumber = j.at("vatNumber"); + + // the optional parts of the message + if (j.contains("evseId")) { + k.evseId.emplace(j.at("evseId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given VatNumberValidationRequest \p k to the given output stream \p +/// os \returns an output stream with the VatNumberValidationRequest written to +std::ostream& operator<<(std::ostream& os, const VatNumberValidationRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string VatNumberValidationResponse::get_type() const { + return "VatNumberValidationResponse"; +} + +void to_json(json& j, const VatNumberValidationResponse& k) { + // the required parts of the message + j = json{ + {"vatNumber", k.vatNumber}, + {"status", ocpp::v2::conversions::generic_status_enum_to_string(k.status)}, + }; + // the optional parts of the message + if (k.company) { + j["company"] = k.company.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.evseId) { + j["evseId"] = k.evseId.value(); + } + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, VatNumberValidationResponse& k) { + // the required parts of the message + k.vatNumber = j.at("vatNumber"); + k.status = ocpp::v2::conversions::string_to_generic_status_enum(j.at("status")); + + // the optional parts of the message + if (j.contains("company")) { + k.company.emplace(j.at("company")); + } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } + if (j.contains("evseId")) { + k.evseId.emplace(j.at("evseId")); + } + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given VatNumberValidationResponse \p k to the given output stream \p +/// os \returns an output stream with the VatNumberValidationResponse written to +std::ostream& operator<<(std::ostream& os, const VatNumberValidationResponse& k) { + os << json(k).dump(4); + return os; +} + +} // namespace v21 +} // namespace ocpp diff --git a/src/code_generator/README.md b/src/code_generator/README.md index 007627483..07a6a84e2 100644 --- a/src/code_generator/README.md +++ b/src/code_generator/README.md @@ -17,3 +17,21 @@ python3 generate_cpp.py --schemas ~/ocpp-schemas/v16/ --out ~/checkout/everest-w ```bash python3 generate_cpp.py --schemas ~/ocpp-schemas/v2/ --out ~/checkout/everest-workspace/libocpp --version v2 ``` + +```bash +python3 generate_cpp.py --schemas ~/ocpp-schemas/v21/ --out ~/checkout/everest-workspace/libocpp --version v21 +``` + +## YAML code generator for EVerest types + +The script [generate_everest_types.py](common/generate_cpp.py) can be used to generate EVerest YAML type definitions using OCPP2.0.1 and OCPP2.1 JSON schemas. + +```bash +python3 generate_everest_types.py --schemas --out --types +``` + +e.g. + +```bash +python3 generate_everest_types.py --schemas ~/ocpp-schemas/v21/ --out ocpp.yaml --types ChargingNeedsType,ChargingScheduleType +``` diff --git a/src/code_generator/common/generate_cpp.py b/src/code_generator/common/generate_cpp.py index adb0dc368..8eedfbc86 100644 --- a/src/code_generator/common/generate_cpp.py +++ b/src/code_generator/common/generate_cpp.py @@ -14,37 +14,7 @@ from pathlib import Path import subprocess - -def snake_case(word: str) -> str: - """Convert capital case to snake case. - Only alphanumerical characters are allowed. Only inserts camelcase - between a consecutive lower and upper alphabetical character and - lowers first letter. - """ - - out = '' - if len(word) == 0: - return out - cur_char: str = '' - for i in range(len(word)): - if i == 0: - cur_char = word[i] - if not cur_char.isalnum(): - raise Exception('Non legal character in: ' + word) - out += cur_char.lower() - continue - last_char: str = cur_char - cur_char = word[i] - if (last_char.islower() and last_char.isalpha() and - cur_char.isupper() and cur_char.isalpha): - out += '_' - if not cur_char.isalnum(): - out += '_' - else: - out += cur_char.lower() - - return out - +from utils import snake_case def remove_last(input_string: str, search: str) -> str: """Removes the last occurence of search""" @@ -192,6 +162,43 @@ def needs_types(types): enum_types['ExtendedTriggerMessageResponse']['status'] = 'TriggerMessageStatusEnumType' +# messages from OCPP 2.1 +v21_messages = ['AFRRSignal', + 'AdjustPeriodicEventStream', + 'BatterySwap', + 'ChangeTransactionTariff', + 'ClearDERControl', + 'ClearTariffs', + 'ClosePeriodicEventStream', + 'GetCertificateChainStatus', + 'GetCRL', + 'GetDERControl', + 'GetPeriodicEventStream', + 'GetTariffs', + 'NotifyAllowedEnergyTransfer', + 'NotifyCRL', + 'NotifyDERAlarm', + 'NotifyDERStartStop', + 'NotifyPeriodicEventStream', + 'NotifyPriorityCharging', + 'NotifyQRCodeScanned', + 'NotifySettlement', + 'NotifyWebPaymentStarted', + 'OpenPeriodicEventStream', + 'PullDynamicScheduleUpdate', + 'ReportDERControl', + 'RequestBatterySwap', + 'SetDERControl', + 'SetDefaultTariff', + 'UpdateDynamicSchedule', + 'UsePriorityCharging', + 'VatNumberValidation', + ] + + +send_messages = ['NotifyPeriodicEventStream'] + + def object_exists(name: str) -> bool: """Check if an object (i.e. dataclass) already exists.""" for el in parsed_types: @@ -205,7 +212,8 @@ def add_enum_type(name: str, enums: Tuple[str]): """Add special class for enum types.""" for el in parsed_enums: if el['name'] == name: - raise Exception('Warning: enum ' + name + ' already exists') + print(f'Warning: enum {name} already exists') + return print("Adding enum type: %s" % name) add = True for el in parsed_enums_unique: @@ -351,11 +359,12 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), schema_files = list(schema_dir.glob('*.json')) for schema_file in sorted(schema_files): print(f"Schema file: {schema_file}") - with open(schema_file, 'r') as schema_dump: + with open(schema_file, 'r', encoding='utf-8-sig') as schema_dump: schema = json.load(schema_dump) stripped_fn = schema_file.stem action = '' request = False + send = False if stripped_fn.endswith('Request'): request = True action = stripped_fn[0:-7] @@ -365,24 +374,49 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), request = True action = stripped_fn else: - raise Exception('Invalid schema file', schema_file) + # check if this is one of the SEND messages that do not have a Response + if stripped_fn in send_messages: + print(f'{stripped_fn} is one of the new OCPP 2.1 SEND messages') + # not a Request or Response but a SEND message + send = True + action = stripped_fn + else: + raise Exception('Invalid schema file', schema_file) - schemas.setdefault(action, {}).update( - {'req' if request else 'res': schema}) + if request: + schemas.setdefault(action, {}).update({'req': schema}) + else: + if send: + schemas.setdefault(action, {}).update({'send': schema}) + else: + schemas.setdefault(action, {}).update({'res': schema}) # check if for every action, the request and response exists for key, value in schemas.items(): if 'req' not in value or 'res' not in value: + if 'send' in value: + print('Message is a SEND message') + continue raise Exception( - 'Either response or request is missing for action: ' + key) + 'Either response or request is missing for action: ' + key, value) generated_header_dir = generated_dir / 'include' / 'ocpp' / version generated_source_dir = generated_dir / 'lib' / 'ocpp' / version + generated_header_dir_v21 = generated_header_dir + generated_source_dir_v21 = generated_source_dir + if version == 'v2': + generated_header_dir_v21 = generated_dir / 'include' / 'ocpp' / 'v21' + generated_source_dir_v21 = generated_dir / 'lib' / 'ocpp' / 'v21' + if not generated_header_dir.exists(): generated_header_dir.mkdir(parents=True) if not generated_source_dir.exists(): generated_source_dir.mkdir(parents=True) + if not generated_header_dir_v21.exists(): + generated_header_dir_v21.mkdir(parents=True) + if not generated_source_dir_v21.exists(): + generated_source_dir_v21.mkdir(parents=True) enums_hpp_fn = Path(generated_header_dir, 'ocpp_enums.hpp') enums_cpp_fn = Path(generated_source_dir, 'ocpp_enums.cpp') @@ -391,24 +425,40 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), messages_header_dir = generated_header_dir / 'messages' messages_source_dir = generated_source_dir / 'messages' messages_cmakelists_txt_fn = Path(messages_source_dir, 'CMakeLists.txt') + messages_header_dir_v21 = generated_header_dir_v21 / 'messages' + messages_source_dir_v21 = generated_source_dir_v21 / 'messages' + messages_cmakelists_txt_fn_v21 = Path(messages_source_dir_v21, 'CMakeLists.txt') + message_files = [] + message_files_v21 = [] first = True for action, type_of_action in schemas.items(): - message_files.append(action) + if action in v21_messages: + message_files_v21.append(action) + else: + message_files.append(action) if not messages_header_dir.exists(): messages_header_dir.mkdir(parents=True) if not messages_source_dir.exists(): messages_source_dir.mkdir(parents=True) + if not messages_header_dir_v21.exists(): + messages_header_dir_v21.mkdir(parents=True) + if not messages_source_dir_v21.exists(): + messages_source_dir_v21.mkdir(parents=True) writemode = dict() writemode['req'] = 'w' writemode['res'] = 'a+' + writemode['send'] = 'w' message_uses_optional = False message_needs_enums = False message_needs_types = False message_needs_constants = False - for (type_name, type_key) in (('Request', 'req'), ('Response', 'res')): + for (type_name, type_key) in (('Request', 'req'), ('Response', 'res'), ('', 'send')): + if not type_key in type_of_action: + print(f'{type_key} not available for {type_of_action}') + continue parsed_types.clear() parsed_enums.clear() @@ -432,9 +482,9 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), for class_type in parsed_types: insert_at: int = 0 for dep_class_type in class_type['depends_on']: - for i in range(len(sorted_types)): + for i, _type in enumerate(sorted_types): # the new one depends on the current - if sorted_types[i]['name'] == dep_class_type: + if _type['name'] == dep_class_type: insert_at = max(insert_at, i + 1) break @@ -449,7 +499,10 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), if action == 'Get15118EVCertificate': message_needs_constants = True - for (type_name, type_key) in (('Request', 'req'), ('Response', 'res')): + for (type_name, type_key) in (('Request', 'req'), ('Response', 'res'), ('', 'send')): + if not type_key in type_of_action: + print(f'type key {type_key} not available, skipping.') + continue parsed_types.clear() parsed_enums.clear() @@ -470,19 +523,30 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), for class_type in parsed_types: insert_at: int = 0 for dep_class_type in class_type['depends_on']: - for i in range(len(sorted_types)): + for i, _type in enumerate(sorted_types): # the new one depends on the current - if sorted_types[i]['name'] == dep_class_type: + if _type['name'] == dep_class_type: insert_at = max(insert_at, i + 1) break sorted_types.insert(insert_at, class_type) + message_version = version generated_class_hpp_fn = Path(messages_header_dir, action + '.hpp') + generated_class_cpp_fn = Path(messages_source_dir, action + '.cpp') + conversions_namespace_prefix = '' + + if action in v21_messages: + print(f'"{action}" is a OCPP 2.1 message') + message_version = 'v21' + generated_class_hpp_fn = Path(messages_header_dir_v21, action + '.hpp') + generated_class_cpp_fn = Path(messages_source_dir_v21, action + '.cpp') + conversions_namespace_prefix = 'ocpp::v2::' + with open(generated_class_hpp_fn, writemode[type_key]) as out: out.write(message_hpp_template.render({ 'types': sorted_types, - 'namespace': version_path, + 'namespace': message_version, 'enum_types': parsed_enums, 'uses_optional': message_uses_optional, 'needs_enums': message_needs_enums, @@ -492,23 +556,25 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), 'name': action, 'class_name': action_class_name, 'type_key': type_key, - 'is_request': (type_name == 'Request') + 'is_request': (type_name == 'Request'), + 'is_send': (type_key == 'send') } })) - generated_class_cpp_fn = Path(messages_source_dir, action + '.cpp') with open(generated_class_cpp_fn, writemode[type_key]) as out: out.write(message_cpp_template.render({ 'types': sorted_types, - 'namespace': version_path, + 'namespace': message_version, 'enum_types': parsed_enums, 'uses_optional': message_uses_optional, 'needs_enums': message_needs_enums, 'needs_types': message_needs_types, + 'conversions_namespace_prefix': conversions_namespace_prefix, 'action': { 'name': action, 'class_name': action_class_name, 'type_key': type_key, - 'is_request': (type_name == 'Request') + 'is_request': (type_name == 'Request'), + 'is_send': (type_key == 'send') } })) with open(enums_hpp_fn, 'w' if first else 'a+') as out: @@ -560,6 +626,11 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), })) first = False + if version == 'v2': + with open(messages_cmakelists_txt_fn_v21, 'w') as out: + out.write(messages_cmakelists_txt_template.render({ + 'messages': sorted(message_files_v21) + })) with open(messages_cmakelists_txt_fn, 'w') as out: out.write(messages_cmakelists_txt_template.render({ 'messages': sorted(message_files) @@ -590,6 +661,10 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), messages_header_dir)], cwd=messages_header_dir) subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( messages_source_dir)], cwd=messages_source_dir) + subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( + messages_header_dir_v21)], cwd=messages_header_dir_v21) + subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( + messages_source_dir_v21)], cwd=messages_source_dir_v21) subprocess.run(["clang-format", "-style=file", "-i", enums_hpp_fn, ocpp_types_hpp_fn], cwd=generated_header_dir) subprocess.run(["clang-format", "-style=file", "-i", @@ -606,14 +681,15 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), parser.add_argument("--out", metavar='OUT', help="Dir in which the generated code will be put", required=True) parser.add_argument("--version", metavar='VERSION', - help="Version of OCPP [1.6 or 2.0.1]", required=True) + help="Version of OCPP [1.6, 2.0.1, or 2.1]", required=True) args = parser.parse_args() version = args.version if version == '1.6' or version == '16' or version == 'v16': version_path = 'v16' - elif version == '2.0.1' or version == '201' or version == 'v201': + elif version == '2.0.1' or version == '2' or version == '2.1' or version == '21' or \ + version == '201' or version == 'v201' or version == 'v2' or version == 'v21': version_path = 'v2' else: raise ValueError(f"Version {version} not a valid ocpp version") diff --git a/src/code_generator/common/generate_everest_types.py b/src/code_generator/common/generate_everest_types.py new file mode 100644 index 000000000..d6fc79e01 --- /dev/null +++ b/src/code_generator/common/generate_everest_types.py @@ -0,0 +1,351 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +# + +""" +This script can be used to generate EVerest yaml type definitions based on OCPP2.0.1 or OCPP2.1 JSON schema files +""" + +import re +import html +from typing import List, Optional, Dict +from jinja2 import Environment, FileSystemLoader, select_autoescape +from pathlib import Path +from dataclasses import dataclass +import json +import argparse + +from utils import snake_case + + +@dataclass +class ArrayItem: + type: str + ref: Optional[str] + min_items: Optional[int] + max_items: Optional[int] + + +@dataclass +class Property: + name: str + description: str + type: str + ref: Optional[str] + item: Optional[ArrayItem] + required: bool + + +@dataclass +class DataType: + name: str + description: str + properties: List[Property] + + +@dataclass +class Enum: + name: str + description: str + values: List[str] + + def __eq__(self, value): + return self.name == value.name + + +def setup_jinja_template(): + """ + Sets up and returns the jinja template for everest_type.yaml.jinja + """ + relative_tmpl_path = Path(__file__).resolve().parent / "templates" + env = Environment( + loader=FileSystemLoader(relative_tmpl_path), + trim_blocks=True, + lstrip_blocks=True, + autoescape=select_autoescape(enabled_extensions=("html")), + ) + env.filters["snake_case"] = snake_case + return env.get_template("everest_type.yaml.jinja") + + +def format_yaml_description(description, indent_level=6): + """ + Format the given description to render well in yaml + """ + if description is not None: + description = description.replace("+\r\n", "\n") + + # Remove bold and underscores for formatting + description = re.sub(r"\*\*?([^*]+)\*\*?", r"\1", description) + + # Remove paragraphs starting with "NOTE:" + description = re.sub(r"(?m)^NOTE:.*(?:\r?\n)?", "", description) + + # Decode HTML entities + description = html.unescape(description) + + # Remove references like <<...,...>> + description = re.sub(r"<<[^>]+>>", "", description) + + # Clean up extra spaces and newlines + description = re.sub(r"\s*\r?\n\s*", " ", description).strip() + + # Reformat multiline descriptions with proper indentation + wrapped_lines = re.sub(r"(.{1,80})(?:\s|$)", r"\1\n", description).splitlines() + indent = " " * indent_level + formatted_description = "\n".join( + f"{indent}{line.strip()}" for line in wrapped_lines + ).strip() + return formatted_description + + return description + + +def get_data_type_dependencies(data_type: DataType) -> List[str]: + """ + Gets a list of all definitions referenced by the given data_type + """ + dependencies = [_property.ref for _property in data_type.properties if _property.ref] + for _property in data_type.properties: + if _property.ref: + dependencies.append(_property.ref) + elif _property.item and _property.item.ref: + dependencies.append(_property.item.ref) + return dependencies + + +def sort_data_types(data_types: List[DataType]) -> List[DataType]: + """ + Sorts the given data_types so that dependencies of types are listed before + they are used as part of a property of a data_type. This spares forward declaration + of types. + """ + sorted_types: List = [] + for data_type in data_types: + insert_at: int = 0 + depends_on = get_data_type_dependencies(data_type) + for dep_type in depends_on: + for i, _type in enumerate(sorted_types): + # the new one depends on the current + if _type.name == dep_type: + insert_at = max(insert_at, i + 1) + break + sorted_types.insert(insert_at, data_type) + return sorted_types + + +def parse_enum(definition_type: Dict) -> Enum: + """ + Parses Enum of given definition_type. + """ + values = [ + value.replace(".", "_").replace("-", "_") for value in definition_type["enum"] + ] + description = format_yaml_description(definition_type.get("description")) + return Enum(definition_type.get("javaType"), description, values) + + +def parse_item(_property: Dict): + """ + Parses ArrayItem of the given property + """ + property_item_type = _property.get("items").get("type", "object") + property_item_ref = None + if "$ref" in _property.get("items"): + if _property.get("items").get("$ref").endswith("EnumType"): + property_item_type = "string" + property_item_ref = ( + _property.get("items").get("$ref").split("/")[-1].replace("Type", "") + ) + min_items = _property.get("minItems") + max_items = _property.get("maxItems") + return ArrayItem(property_item_type, property_item_ref, min_items, max_items) + + +def parse_property( + _property: Dict, property_name: str, definition_type: Dict, definitions: List[Dict] +): + """ + Parses Property from the given arguments + """ + + property_type = _property.get("type", "object") + property_ref = None + if "$ref" in _property: + property_ref = _property["$ref"].split("/")[-1].replace("Type", "") + property_required = property_name in definition_type.get("required", []) + + property_description = None + if "description" in _property: + property_description = _property.get("description") + elif property_ref is not None: + property_description = definitions.get(f"{property_ref}Type").get("description") + property_item = None + if property_type == "array": + property_item = parse_item(_property) + if property_description is None and property_item.ref is not None: + property_description = definitions.get(f"{property_item.ref}Type").get( + "description" + ) + property_description = format_yaml_description( + property_description, indent_level=10 + ) + return Property( + property_name, + property_description, + property_type, + property_ref, + property_item, + property_required, + ) + + +def parse_type(definition_type: Dict, definitions) -> DataType: + """ + Parses DataType of given definition_type + """ + properties = [] + for property_name, _property in definition_type.get("properties").items(): + properties.append( + parse_property(_property, property_name, definition_type, definitions) + ) + + data_type_description = format_yaml_description(definition_type.get("description")) + return DataType(definition_type.get("javaType"), data_type_description, properties) + + +def parse_types_and_enums(schema_dir: Path, types_to_generate: List[str]): + """ + Parses Types and Enums based on the given schema_dir and types_to_generate + """ + enums = [] + types = [] + + schema_files = list(schema_dir.glob("*.json")) + for schema_file in sorted(schema_files): + with open(schema_file, "r", encoding="utf-8-sig") as schema_dump: + schema = json.load(schema_dump) + definitions = schema.get("definitions") + if definitions is None: + continue + for definition_name, definition_type in definitions.items(): + if "enum" in definition_type and definition_name in types_to_generate: + enum = parse_enum(definition_type) + if enum not in enums: + enums.append(enum) + elif ( + "enum" not in definition_type + and definition_name in types_to_generate + ): + _type = parse_type(definition_type, definitions) + if _type not in types: + types.append(_type) + + types = sort_data_types(types) + return types, enums + + +def load_schemas_from_directory(schema_dir) -> Dict: + _schema_files = {} + schema_files = list(schema_dir.glob("*.json")) + for schema_file in sorted(schema_files): + with open(schema_file, "r", encoding="utf-8-sig") as schema_dump: + schema = json.load(schema_dump) + if "definitions" in schema: + _schema_files[schema_file] = schema["definitions"] + return _schema_files + + +def resolve_references(definition, to_process, resolved_types): + if isinstance(definition, dict): + for key, value in definition.items(): + if key == "$ref": + ref_type = value.split("/")[-1] + if ref_type not in resolved_types: + to_process.add(ref_type) + else: + resolve_references(value, to_process, resolved_types) + elif isinstance(definition, list): + for item in definition: + resolve_references(item, to_process, resolved_types) + + +def get_required_types(schema_dir, target_types): + schema_files = load_schemas_from_directory(schema_dir) + resolved_types = set() + to_process = set(target_types) + + type_to_file = {} + for file_name, definitions in schema_files.items(): + for type_name in definitions.keys(): + type_to_file[type_name] = file_name + + while to_process: + current = to_process.pop() + if current in resolved_types: + continue + + resolved_types.add(current) + file_name = type_to_file.get(current) + if not file_name: + raise ValueError(f"Type {current} not found in any schema file.") + + definition = schema_files[file_name].get(current, {}) + resolve_references(definition, to_process, resolved_types) + + return resolved_types + + +def generate_everest_types( + schema_dir: Path, out_file: Path, types_to_generate: List[str] +): + + types, enums = parse_types_and_enums(schema_dir, types_to_generate) + + with open(out_file, "w") as out: + out.write( + setup_jinja_template().render( + { + "enums": enums, + "types": types, + } + ) + ) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + formatter_class=argparse.RawTextHelpFormatter, + description="Code generator for EVerest types from OCPP JSON schemas", + ) + parser.add_argument( + "--schemas", + metavar="SCHEMAS", + help="Directory in which the OCPP schemas reside", + required=True, + ) + parser.add_argument( + "--out", + metavar="OUT", + help="Dir in which the generated EVerest YAML types will be put", + required=True, + ) + parser.add_argument( + "--types", + metavar="OUT", + help="Specify comma seperated list of OCPP Types that should be generated in YAML", + required=False, + ) + + args = parser.parse_args() + + schema_dir = Path(args.schemas).resolve() + out_file = Path(args.out).resolve() + types_to_generate = [] + if args.types: + types_to_generate = args.types.split(",") + types_to_generate = get_required_types(schema_dir, types_to_generate) + + generate_everest_types(schema_dir, out_file, types_to_generate) diff --git a/src/code_generator/common/templates/everest_type.yaml.jinja b/src/code_generator/common/templates/everest_type.yaml.jinja new file mode 100644 index 000000000..cf320e2c7 --- /dev/null +++ b/src/code_generator/common/templates/everest_type.yaml.jinja @@ -0,0 +1,51 @@ +description: Autogenerated types based on OCPP JSON schemas +types: +{% for enum in enums %} + {{ enum.name }}: + description: >- + {{ enum.description }} + type: string + enum: +{% for value in enum.values %} + - "{{ value }}" +{% endfor %} +{% endfor %} +{% for type in types %} + {{ type.name }}: + description: >- + {{ type.description }} + type: object + required: +{% if type.properties|selectattr('required', 'true')|list %} +{% for property in type.properties if property.required %} + - {{ property.name | snake_case }} +{% endfor %} +{% else %} + [] +{% endif %} + properties: +{% for property in type.properties %} + {% if property.name != "customData" %} + {{ property.name | snake_case }}: + description: >- + {{ property.description }} + type: {{ property.type }} + {% if property.type == "object" or property.enum %} + $ref: /ocpp#/{{ property.ref }} + {% endif %} + {% if property.type == "array" %} + items: + type: {{ property.item.type }} + {% if property.item.ref != None %} + $ref: /ocpp#/{{ property.item.ref }} + {% endif %} + {% if property.item.min_items != None %} + minItems: {{ property.item.min_items }} + {% endif %} + {% if property.item.max_items != None %} + maxItems: {{ property.item.max_items }} + {% endif %} + {% endif %} + {% endif %} +{% endfor %} +{% endfor %} diff --git a/src/code_generator/common/templates/message.cpp.jinja b/src/code_generator/common/templates/message.cpp.jinja index 3d28d14b7..2642b6b38 100644 --- a/src/code_generator/common/templates/message.cpp.jinja +++ b/src/code_generator/common/templates/message.cpp.jinja @@ -1,4 +1,4 @@ -{% if action.is_request %} +{% if action.is_request or action.is_send %} // SPDX-License-Identifier: Apache-2.0 // Copyright 2020 - {{year}} Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually @@ -33,7 +33,7 @@ namespace {{namespace}} { {%- for property in type.properties %} {%- if property.required %}{"{{property.name}}", {%- if property.enum %} - conversions::{{- property.type | snake_case}}_to_string(k.{{property.name}}) + {{ conversions_namespace_prefix }}conversions::{{- property.type | snake_case}}_to_string(k.{{property.name}}) {%- else %} {%- if property.type == 'ocpp::DateTime' %} k.{{property.name}}.to_rfc3339() @@ -67,14 +67,14 @@ if (j.size() == 0) { {% endif %} for (auto val : k.{{property.name}}.value()) { {%- if property.type.endswith('Enum>') %} - j["{{property.name}}"].push_back(conversions::{{- property.type.replace('std::vector<','').replace('>','') | snake_case}}_to_string(val)); + j["{{property.name}}"].push_back({{ conversions_namespace_prefix }}conversions::{{- property.type.replace('std::vector<','').replace('>','') | snake_case}}_to_string(val)); {%- else%} j["{{property.name}}"].push_back(val); {%- endif%} } {% else %} {% if property.enum %} -j["{{property.name}}"] = conversions::{{- property.type | snake_case}}_to_string(k.{{property.name}}.value()); +j["{{property.name}}"] = {{ conversions_namespace_prefix }}conversions::{{- property.type | snake_case}}_to_string(k.{{property.name}}.value()); {% else %} {% if property.type == 'ocpp::DateTime' %} j["{{property.name}}"] = k.{{property.name}}.value().to_rfc3339(); @@ -102,7 +102,7 @@ j["{{property.name}}"] = k.{{property.name}}.value(); {% else %} k.{{property.name}} = {%- if property.enum %} - conversions::string_to_{{- property.type | snake_case}}(j.at("{{property.name}}")) + {{ conversions_namespace_prefix }}conversions::string_to_{{- property.type | snake_case}}(j.at("{{property.name}}")) {%- else %} {%- if property.type == 'ocpp::DateTime' %} ocpp::DateTime(std::string(j.at("{{property.name}}"))) @@ -123,7 +123,7 @@ j["{{property.name}}"] = k.{{property.name}}.value(); {{property.type}} vec; for (auto val : arr) { {%- if property.type.endswith('Enum>') %} - vec.push_back(conversions::string_to_{{- property.type.replace('std::vector<','').replace('>','') | snake_case}}(val)); + vec.push_back({{ conversions_namespace_prefix }}conversions::string_to_{{- property.type.replace('std::vector<','').replace('>','') | snake_case}}(val)); {%- else %} vec.push_back(val); {%- endif %} @@ -131,7 +131,7 @@ j["{{property.name}}"] = k.{{property.name}}.value(); k.{{property.name}}.emplace(vec); {% else %} {% if property.enum %} - k.{{property.name}}.emplace(conversions::string_to_{{- property.type | snake_case}}(j.at("{{property.name}}"))); + k.{{property.name}}.emplace({{ conversions_namespace_prefix }}conversions::string_to_{{- property.type | snake_case}}(j.at("{{property.name}}"))); {% else %} {% if property.type == 'ocpp::DateTime' %} k.{{property.name}}.emplace(ocpp::DateTime(std::string(j.at("{{property.name}}")))); @@ -162,7 +162,7 @@ std::ostream& operator<<(std::ostream& os, const {{ type.name }}& k) { {% endif %} {% endfor %} -{% if not action.is_request %} +{% if not action.is_request or action.is_send %} } // namespace {{namespace}} } // namespace ocpp diff --git a/src/code_generator/common/templates/message.hpp.jinja b/src/code_generator/common/templates/message.hpp.jinja index 98467a626..0913ebac8 100644 --- a/src/code_generator/common/templates/message.hpp.jinja +++ b/src/code_generator/common/templates/message.hpp.jinja @@ -1,4 +1,4 @@ -{% if action.is_request %} +{% if action.is_request or action.is_send %} // SPDX-License-Identifier: Apache-2.0 // Copyright 2020 - {{year}} Pionix GmbH and Contributors to EVerest // This code is generated using the generator in 'src/code_generator/common`, please do not edit manually @@ -15,9 +15,18 @@ #include {% endif %} {% if needs_enums %} +{% if namespace == 'v21' %} +#include +{% else %} #include {% endif %} +{% endif %} +{% if namespace == 'v21' %} +#include +using namespace ocpp::v2; +{% else %} #include +{% endif %} {% if needs_types %} #include {% endif %} @@ -59,7 +68,7 @@ std::ostream& operator<<(std::ostream& os, const {{ type.name }}& k); {% endif %} {% endfor %} -{% if not action.is_request %} +{% if not action.is_request or action.is_send %} } // namespace {{namespace}} } // namespace ocpp diff --git a/src/code_generator/common/templates/ocpp_types.hpp.jinja b/src/code_generator/common/templates/ocpp_types.hpp.jinja index 2993fa35f..c6d89b9d9 100644 --- a/src/code_generator/common/templates/ocpp_types.hpp.jinja +++ b/src/code_generator/common/templates/ocpp_types.hpp.jinja @@ -43,7 +43,7 @@ struct {{type.name}} { /// \brief Conversion from a given json object \p j to a given {{ type.name }} \p k void from_json(const json& j, {{ type.name }}& k); - // \brief Writes the string representation of the given {{ type.name }} \p k to the given output stream \p os + /// \brief Writes the string representation of the given {{ type.name }} \p k to the given output stream \p os /// \returns an output stream with the {{ type.name }} written to std::ostream& operator<<(std::ostream& os, const {{ type.name }}& k); @@ -52,9 +52,6 @@ struct {{type.name}} { {% endfor %} {%- endif %} {% if last %} -{% if namespace == "v2" %} - struct RequiredComponentVariable : ComponentVariable {}; -{% endif %} } // namespace {{namespace}} } // namespace ocpp diff --git a/src/code_generator/common/utils.py b/src/code_generator/common/utils.py new file mode 100644 index 000000000..cdbf6e4d9 --- /dev/null +++ b/src/code_generator/common/utils.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest +# + +def snake_case(word: str) -> str: + """Convert capital case to snake case. + Only alphanumerical characters are allowed. Only inserts camelcase + between a consecutive lower and upper alphabetical character and + lowers first letter. + """ + + # special handling for soc + word = word.replace('SoC', 'Soc') + + out = '' + if len(word) == 0: + return out + cur_char: str = '' + for i, character in enumerate(word): + if i == 0: + cur_char = character + if not cur_char.isalnum(): + raise Exception('Non legal character in: ' + word) + out += cur_char.lower() + continue + last_char: str = cur_char + cur_char = character + if (last_char.islower() and last_char.isalpha() and + cur_char.isupper() and cur_char.isalpha): + out += '_' + if not cur_char.isalnum(): + out += '_' + else: + out += cur_char.lower() + + return out diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cd18a55ab..599fcda96 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -56,8 +56,6 @@ if(LIBOCPP_ENABLE_V2) endif() add_custom_command(TARGET libocpp_unit_tests POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/unittest_device_model.db ${CMAKE_CURRENT_BINARY_DIR}/resources/unittest_device_model.db - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/unittest_device_model_missing_required.db ${CMAKE_CURRENT_BINARY_DIR}/resources/unittest_device_model_missing_required.db COMMAND ${CMAKE_COMMAND} -E copy ${CONFIG_FILE_LOCATION_V16} ${CONFIG_FILE_RESOURCES_LOCATION_V16} COMMAND ${CMAKE_COMMAND} -E copy ${USER_CONFIG_FILE_LOCATION_V16} ${USER_CONFIG_FILE_RESOURCES_LOCATION_V16} COMMAND ${CMAKE_COMMAND} -E remove_directory ${CONFIG_DIR_V16} diff --git a/tests/lib/ocpp/v2/CMakeLists.txt b/tests/lib/ocpp/v2/CMakeLists.txt index 802cf8a9f..cbd536789 100644 --- a/tests/lib/ocpp/v2/CMakeLists.txt +++ b/tests/lib/ocpp/v2/CMakeLists.txt @@ -4,6 +4,7 @@ target_include_directories(libocpp_unit_tests PUBLIC target_sources(libocpp_unit_tests PRIVATE device_model_test_helper.cpp + smart_charging_test_utils.cpp test_charge_point.cpp test_database_handler.cpp test_database_migration_files.cpp diff --git a/tests/lib/ocpp/v2/functional_blocks/CMakeLists.txt b/tests/lib/ocpp/v2/functional_blocks/CMakeLists.txt index d6c65261d..b393b8fab 100644 --- a/tests/lib/ocpp/v2/functional_blocks/CMakeLists.txt +++ b/tests/lib/ocpp/v2/functional_blocks/CMakeLists.txt @@ -47,6 +47,7 @@ target_include_directories(libocpp_test_security PUBLIC set(TEST_AUTHORIZATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../device_model_test_helper.cpp ${TEST_FUNCTIONAL_BLOCK_CONTEXT_SOURCES} ${LIBOCPP_LIB_PATH}/ocpp/v2/functional_blocks/authorization.cpp + ${LIBOCPP_LIB_PATH}/ocpp/v2/ctrlr_component_variables.cpp ${LIBOCPP_LIB_PATH}/ocpp/v2/messages/Authorize.cpp ${LIBOCPP_LIB_PATH}/ocpp/v2/messages/ClearCache.cpp ${LIBOCPP_LIB_PATH}/ocpp/v2/messages/GetLocalListVersion.cpp diff --git a/tests/lib/ocpp/v2/functional_blocks/test_authorization.cpp b/tests/lib/ocpp/v2/functional_blocks/test_authorization.cpp index 9f14f013b..a2a8273d7 100644 --- a/tests/lib/ocpp/v2/functional_blocks/test_authorization.cpp +++ b/tests/lib/ocpp/v2/functional_blocks/test_authorization.cpp @@ -206,7 +206,7 @@ class AuthorizationTest : public ::testing::Test { } IdToken get_id_token(const std::string& token = "VALID_ID_TOKEN", - const IdTokenEnum token_type = IdTokenEnum::ISO14443) { + const ocpp::CiString<20> token_type = IdTokenEnumStringType::ISO14443) { IdToken id_token; id_token.idToken = token; id_token.type = token_type; @@ -470,7 +470,7 @@ TEST_F(AuthorizationTest, validate_token_accepted_central_token) { this->set_auth_ctrlr_enabled(this->device_model, true); IdToken id_token; // For a central token, an authorize request should not be sent. - id_token.type = IdTokenEnum::Central; + id_token.type = IdTokenEnumStringType::Central; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Accepted); @@ -480,7 +480,7 @@ TEST_F(AuthorizationTest, validate_token_accepted_auth_ctrlr_disabled) { // Set AuthCtrlr::Enabled to false: no authorize request should be sent, just accept token. this->set_auth_ctrlr_enabled(this->device_model, false); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Accepted); @@ -499,7 +499,7 @@ TEST_F(AuthorizationTest, validate_token_unknown) { EXPECT_CALL(this->connectivity_manager, is_websocket_connected()).WillRepeatedly(Return(true)); // Because almost everything is disabled, authorization can not be done and status is 'unknown'. IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -520,7 +520,7 @@ TEST_F(AuthorizationTest, validate_token_local_auth_list_enabled_accepted) { .WillRepeatedly(Return(id_token_info_result)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -543,7 +543,7 @@ TEST_F(AuthorizationTest, validate_token_local_auth_list_enabled_unknown_no_remo .WillRepeatedly(Return(id_token_info_result)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -568,7 +568,7 @@ TEST_F(AuthorizationTest, validate_token_local_auth_list_enabled_unknown_websock .WillRepeatedly(Return(id_token_info_result)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -598,7 +598,7 @@ TEST_F(AuthorizationTest, validate_token_local_auth_list_enabled_connectivity_ma .WillRepeatedly(Return(id_token_info_result)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -617,7 +617,7 @@ TEST_F(AuthorizationTest, validate_token_emaid_authorize_request_accepted) { }))); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; std::vector ocsp_request_data; @@ -637,7 +637,7 @@ TEST_F(AuthorizationTest, validate_token_emaid_offline_no_certificate_contract_v .WillByDefault(Return(ocpp::CertificateValidationResult::Valid)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, @@ -658,7 +658,7 @@ TEST_F( .WillByDefault(Return(ocpp::CertificateValidationResult::Valid)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; const AuthorizeResponse response = authorization->validate_token(id_token, "", std::nullopt); @@ -687,7 +687,7 @@ TEST_F( .WillRepeatedly(Return(id_token_info_result)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, @@ -707,7 +707,7 @@ TEST_F(AuthorizationTest, .WillByDefault(Return(ocpp::CertificateValidationResult::Expired)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; const AuthorizeResponse response = authorization->validate_token(id_token, "", std::nullopt); @@ -730,7 +730,7 @@ TEST_F(AuthorizationTest, .WillByDefault(Return(ocpp::CertificateValidationResult::InvalidSignature)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; const AuthorizeResponse response = authorization->validate_token(id_token, "", std::nullopt); @@ -744,7 +744,7 @@ TEST_F(AuthorizationTest, validate_token_emaid_websocket_disconnected_certificat EXPECT_CALL(this->connectivity_manager, is_websocket_connected()).WillRepeatedly(Return(false)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -772,7 +772,7 @@ TEST_F(AuthorizationTest, validate_token_emaid_no_ocsp_websocket_connected) { }))); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Accepted); @@ -791,7 +791,7 @@ TEST_F(AuthorizationTest, EXPECT_CALL(this->evse_security, get_mo_ocsp_request_data(_)).WillOnce(Return(ocsp_request_data)); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Invalid); @@ -814,7 +814,7 @@ TEST_F(AuthorizationTest, }))); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Blocked); @@ -831,7 +831,7 @@ TEST_F(AuthorizationTest, set_allow_central_contract_validation(this->device_model, false); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Invalid); @@ -852,7 +852,7 @@ TEST_F(AuthorizationTest, }))); IdToken id_token; - id_token.type = IdTokenEnum::eMAID; + id_token.type = IdTokenEnumStringType::eMAID; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, "", std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::NoCredit); @@ -875,7 +875,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_accepted) { .WillOnce(Return(authorization_cache_entry)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -901,7 +901,7 @@ TEST_F(AuthorizationTest, validate_token_auth_local_pre_authorize_disabled) { .WillOnce(Return(authorization_cache_entry)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -927,7 +927,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_blocked_post_authorize_disab .WillOnce(Return(authorization_cache_entry)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -966,7 +966,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_invalid_post_authorize_enabl EXPECT_CALL(this->database_handler_mock, authorization_cache_insert_entry(_, _)); IdToken id_token; - id_token.type = IdTokenEnum::ISO14443; + id_token.type = IdTokenEnumStringType::ISO14443; id_token.idToken = "test_token"; EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, @@ -997,7 +997,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_cache_expired_and_status_inv EXPECT_CALL(this->database_handler_mock, authorization_cache_get_entry(_)) .WillOnce(Return(authorization_cache_entry)); - IdToken id_token = get_id_token("test_token", IdTokenEnum::ISO14443); + IdToken id_token = get_id_token("test_token", IdTokenEnumStringType::ISO14443); // Because the cache is expired, an authorize request is performed. EXPECT_CALL(mock_dispatcher, dispatch_call_async(_, _)).WillOnce(Return(std::async(std::launch::deferred, [this]() { @@ -1034,7 +1034,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_lifetime_expired) { EXPECT_CALL(this->database_handler_mock, authorization_cache_get_entry(_)) .WillOnce(Return(authorization_cache_entry)); - IdToken id_token = get_id_token("test_token", IdTokenEnum::ISO14443); + IdToken id_token = get_id_token("test_token", IdTokenEnumStringType::ISO14443); // Because the cache is expired, an authorize request is performed. EXPECT_CALL(mock_dispatcher, dispatch_call_async(_, _)).WillOnce(Return(std::async(std::launch::deferred, [this]() { @@ -1072,7 +1072,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_exception) { // Since the auth cache is enabled, after authorizing, the entry is added to the authorization cache. EXPECT_CALL(this->database_handler_mock, authorization_cache_insert_entry(_, _)); - IdToken id_token = get_id_token("test_token", IdTokenEnum::ISO14443); + IdToken id_token = get_id_token("test_token", IdTokenEnumStringType::ISO14443); EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Accepted); } @@ -1095,7 +1095,7 @@ TEST_F(AuthorizationTest, // Because of the database exception, and the websocket disabled, and offline tx for unknown id enabled, it will // just return 'Accepted'. - IdToken id_token = get_id_token("test_token", IdTokenEnum::ISO14443); + IdToken id_token = get_id_token("test_token", IdTokenEnumStringType::ISO14443); EXPECT_EQ(authorization->validate_token(id_token, std::nullopt, std::nullopt).idTokenInfo.status, AuthorizationStatusEnum::Accepted); } @@ -1122,7 +1122,7 @@ TEST_F(AuthorizationTest, validate_token_auth_cache_insert_entry_exception) { EXPECT_CALL(this->database_handler_mock, authorization_cache_get_entry(_)) .WillOnce(Return(authorization_cache_entry)); - IdToken id_token = get_id_token("test_token", IdTokenEnum::ISO14443); + IdToken id_token = get_id_token("test_token", IdTokenEnumStringType::ISO14443); // Because the cache is expired, an authorize request is performed. EXPECT_CALL(mock_dispatcher, dispatch_call_async(_, _)).WillOnce(Return(std::async(std::launch::deferred, [this]() { diff --git a/tests/lib/ocpp/v2/functional_blocks/test_reservation.cpp b/tests/lib/ocpp/v2/functional_blocks/test_reservation.cpp index 386be9113..d6b838866 100644 --- a/tests/lib/ocpp/v2/functional_blocks/test_reservation.cpp +++ b/tests/lib/ocpp/v2/functional_blocks/test_reservation.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -22,10 +23,6 @@ #include #include #include - -const static std::string MIGRATION_FILES_PATH = "./resources/v2/device_model_migration_files"; -const static std::string CONFIG_PATH = "./resources/example_config/v2/component_config"; -const static std::string DEVICE_MODEL_DB_IN_MEMORY_PATH = "file::memory:?cache=shared"; const static uint32_t NR_OF_EVSES = 2; using namespace ocpp::v2; @@ -48,7 +45,7 @@ class ReservationTest : public ::testing::Test { *functional_block_context, reserve_now_callback_mock.AsStdFunction(), cancel_reservation_callback_mock.AsStdFunction(), is_reservation_for_token_callback_mock.AsStdFunction()); default_test_token.idToken = "SOME_TOKEN"; - default_test_token.type = IdTokenEnum::ISO14443; + default_test_token.type = IdTokenEnumStringType::ISO14443; } /// @@ -139,7 +136,7 @@ class ReservationTest : public ::testing::Test { /// ocpp::EnhancedMessage create_example_reserve_now_request(const std::optional evse_id = std::nullopt, - const std::optional connector_type = std::nullopt) { + const std::optional> connector_type = std::nullopt) { ReserveNowRequest request; request.connectorType = connector_type; request.evseId = evse_id; @@ -184,8 +181,8 @@ class ReservationTest : public ::testing::Test { std::unique_ptr device_model; MockFunction reserve_now_callback_mock; MockFunction cancel_reservation_callback_mock; - MockFunction idToken, - const std::optional> groupIdToken)> + MockFunction idToken, + const std::optional> groupIdToken)> is_reservation_for_token_callback_mock; std::unique_ptr functional_block_context; // Make reservation a unique ptr so we can create it after creating the device model. @@ -307,7 +304,7 @@ TEST_F(ReservationTest, handle_reserve_now_evse_not_existing) { TEST_F(ReservationTest, handle_reserve_now_connector_not_existing) { // Try to make a reservation for a connector type that does not exist. This should reject the request. EvseMock& m1 = evse_manager.get_mock(1); - EXPECT_CALL(m1, does_connector_exist(ConnectorEnum::Pan)).WillOnce(Return(false)); + EXPECT_CALL(m1, does_connector_exist(ConnectorEnumStringType::Pan)).WillOnce(Return(false)); EXPECT_CALL(mock_dispatcher, dispatch_call_result(_)).WillOnce(Invoke([](const json& call_result) { auto response = call_result[ocpp::CALLRESULT_PAYLOAD].get(); @@ -317,7 +314,8 @@ TEST_F(ReservationTest, handle_reserve_now_connector_not_existing) { EXPECT_EQ(response.statusInfo.value().additionalInfo.value(), "Connector type does not exist"); })); - const ocpp::EnhancedMessage request = create_example_reserve_now_request(1, ConnectorEnum::Pan); + const ocpp::EnhancedMessage request = + create_example_reserve_now_request(1, ConnectorEnumStringType::Pan); this->reservation->handle_message(request); } @@ -325,10 +323,10 @@ TEST_F(ReservationTest, handle_reserve_now_connectors_not_existing) { // Try to make a non evse specific reservation for a connector type that does not exist. This should reject the // request. EvseMock& m1 = evse_manager.get_mock(1); - ON_CALL(m1, does_connector_exist(ConnectorEnum::cG105)).WillByDefault(Return(false)); + ON_CALL(m1, does_connector_exist(ConnectorEnumStringType::cG105)).WillByDefault(Return(false)); EvseMock& m2 = evse_manager.get_mock(2); - ON_CALL(m2, does_connector_exist(ConnectorEnum::cG105)).WillByDefault(Return(false)); + ON_CALL(m2, does_connector_exist(ConnectorEnumStringType::cG105)).WillByDefault(Return(false)); EXPECT_CALL(mock_dispatcher, dispatch_call_result(_)).WillOnce(Invoke([](const json& call_result) { auto response = call_result[ocpp::CALLRESULT_PAYLOAD].get(); @@ -339,7 +337,7 @@ TEST_F(ReservationTest, handle_reserve_now_connectors_not_existing) { })); const ocpp::EnhancedMessage request = - create_example_reserve_now_request(std::nullopt, ConnectorEnum::cG105); + create_example_reserve_now_request(std::nullopt, ConnectorEnumStringType::cG105); this->reservation->handle_message(request); } @@ -347,13 +345,13 @@ TEST_F(ReservationTest, handle_reserve_now_one_connector_not_existing) { // Try to make a non evse specific reservation. One connector does not have the given connector, but the other does, // so the reservation request should be accepted. const ocpp::EnhancedMessage request = - create_example_reserve_now_request(std::nullopt, ConnectorEnum::cTesla); + create_example_reserve_now_request(std::nullopt, ConnectorEnumStringType::cTesla); EvseMock& m1 = evse_manager.get_mock(1); - EXPECT_CALL(m1, does_connector_exist(ConnectorEnum::cTesla)).WillOnce(Return(false)); + EXPECT_CALL(m1, does_connector_exist(ConnectorEnumStringType::cTesla)).WillOnce(Return(false)); EvseMock& m2 = evse_manager.get_mock(2); - EXPECT_CALL(m2, does_connector_exist(ConnectorEnum::cTesla)).WillOnce(Return(true)); + EXPECT_CALL(m2, does_connector_exist(ConnectorEnumStringType::cTesla)).WillOnce(Return(true)); EXPECT_CALL(reserve_now_callback_mock, Call(_)).WillOnce(Return(ReserveNowStatusEnum::Accepted)); @@ -370,13 +368,13 @@ TEST_F(ReservationTest, handle_reserve_now_all_connectors_not_available) { // we try to do the request and it can be accepted anyway (or at least the correct reason for not accepting the // reservation can be returned, if this is a real scenario). const ocpp::EnhancedMessage request = - create_example_reserve_now_request(std::nullopt, ConnectorEnum::cTesla); + create_example_reserve_now_request(std::nullopt, ConnectorEnumStringType::cTesla); EvseMock& m1 = evse_manager.get_mock(1); - EXPECT_CALL(m1, does_connector_exist(ConnectorEnum::cTesla)).WillOnce(Return(true)); + EXPECT_CALL(m1, does_connector_exist(ConnectorEnumStringType::cTesla)).WillOnce(Return(true)); EvseMock& m2 = evse_manager.get_mock(2); - EXPECT_CALL(m2, does_connector_exist(ConnectorEnum::cTesla)).Times(0); + EXPECT_CALL(m2, does_connector_exist(ConnectorEnumStringType::cTesla)).Times(0); EXPECT_CALL(reserve_now_callback_mock, Call(_)).WillOnce(Return(ReserveNowStatusEnum::Accepted)); @@ -391,10 +389,10 @@ TEST_F(ReservationTest, handle_reserve_now_all_connectors_not_available) { TEST_F(ReservationTest, handle_reserve_now_non_specific_evse_successful) { // Try to make a non evse specific reservation which is accepted. const ocpp::EnhancedMessage request = - create_example_reserve_now_request(std::nullopt, ConnectorEnum::cTesla); + create_example_reserve_now_request(std::nullopt, ConnectorEnumStringType::cTesla); EvseMock& m1 = evse_manager.get_mock(1); - EXPECT_CALL(m1, does_connector_exist(ConnectorEnum::cTesla)).WillOnce(Return(true)); + EXPECT_CALL(m1, does_connector_exist(ConnectorEnumStringType::cTesla)).WillOnce(Return(true)); ON_CALL(reserve_now_callback_mock, Call(_)).WillByDefault(Invoke([](const ReserveNowRequest reserve_now_request) { EXPECT_FALSE(reserve_now_request.evseId.has_value()); @@ -411,12 +409,12 @@ TEST_F(ReservationTest, handle_reserve_now_non_specific_evse_successful) { TEST_F(ReservationTest, handle_reserve_now_specific_evse_successful) { // Try to make a reservation for an existing evse, which is accepted. - std::optional tesla_connector_type = ConnectorEnum::cTesla; + std::optional> tesla_connector_type = ConnectorEnumStringType::cTesla; const ocpp::EnhancedMessage request = create_example_reserve_now_request(2, tesla_connector_type); EvseMock& m2 = evse_manager.get_mock(2); - ON_CALL(m2, does_connector_exist(ConnectorEnum::cTesla)).WillByDefault(Return(true)); + ON_CALL(m2, does_connector_exist(ConnectorEnumStringType::cTesla)).WillByDefault(Return(true)); ON_CALL(reserve_now_callback_mock, Call(_)).WillByDefault(Invoke([](const ReserveNowRequest reserve_now_request) { EXPECT_TRUE(reserve_now_request.evseId.has_value()); @@ -434,12 +432,12 @@ TEST_F(ReservationTest, handle_reserve_now_specific_evse_successful) { TEST_F(ReservationTest, handle_reserve_now_specific_evse_occupied) { // Try to make a reservation for a non specific evse, but all evse's are occupied. - std::optional tesla_connector_type = ConnectorEnum::cTesla; + std::optional> tesla_connector_type = ConnectorEnumStringType::cTesla; const ocpp::EnhancedMessage request = create_example_reserve_now_request(2, tesla_connector_type); EvseMock& m2 = evse_manager.get_mock(2); - ON_CALL(m2, does_connector_exist(ConnectorEnum::cTesla)).WillByDefault(Return(true)); + ON_CALL(m2, does_connector_exist(ConnectorEnumStringType::cTesla)).WillByDefault(Return(true)); EXPECT_CALL(reserve_now_callback_mock, Call(_)).WillOnce(Return(ReserveNowStatusEnum::Occupied)); @@ -549,7 +547,7 @@ TEST_F(ReservationTest, handle_reserve_now_no_evses) { is_reservation_for_token_callback_mock.AsStdFunction()}; const ocpp::EnhancedMessage request = - create_example_reserve_now_request(std::nullopt, ConnectorEnum::cTesla); + create_example_reserve_now_request(std::nullopt, ConnectorEnumStringType::cTesla); EXPECT_CALL(mock_dispatcher, dispatch_call_result(_)).WillOnce(Invoke([](const json& call_result) { auto response = call_result[ocpp::CALLRESULT_PAYLOAD].get(); diff --git a/tests/lib/ocpp/v2/functional_blocks/test_smart_charging.cpp b/tests/lib/ocpp/v2/functional_blocks/test_smart_charging.cpp index a3e1bc33f..117f7046b 100644 --- a/tests/lib/ocpp/v2/functional_blocks/test_smart_charging.cpp +++ b/tests/lib/ocpp/v2/functional_blocks/test_smart_charging.cpp @@ -50,34 +50,6 @@ using ::testing::Return; using ::testing::ReturnRef; namespace ocpp::v2 { - -static const int NR_OF_EVSES = 2; -static const int STATION_WIDE_ID = 0; -static const int DEFAULT_EVSE_ID = 1; -static const int DEFAULT_PROFILE_ID = 1; -static const int DEFAULT_STACK_LEVEL = 1; -static const int DEFAULT_REQUEST_ID = 1; -static const std::string DEFAULT_TX_ID = "10c75ff7-74f5-44f5-9d01-f649f3ac7b78"; -const static std::string MIGRATION_FILES_PATH = "./resources/v2/device_model_migration_files"; -const static std::string CONFIG_PATH = "./resources/example_config/v2/component_config"; -const static std::string DEVICE_MODEL_DB_IN_MEMORY_PATH = "file::memory:?cache=shared"; - -class TestSmartCharging : public SmartCharging { -public: - using SmartCharging::add_profile; - using SmartCharging::clear_profiles; - using SmartCharging::get_reported_profiles; - using SmartCharging::get_valid_profiles; - using SmartCharging::validate_charging_station_max_profile; - using SmartCharging::validate_evse_exists; - using SmartCharging::validate_profile_schedules; - using SmartCharging::validate_tx_default_profile; - using SmartCharging::validate_tx_profile; - using SmartCharging::verify_no_conflicting_external_constraints_id; - - using SmartCharging::SmartCharging; -}; - class SmartChargingTest : public DatabaseTestingUtils { protected: void SetUp() override { @@ -87,158 +59,6 @@ class SmartChargingTest : public DatabaseTestingUtils { // TODO: use in-memory db so we don't need to reset the db between tests this->database_handler->clear_charging_profiles(); } - - ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit) { - int32_t id; - std::vector charging_schedule_period; - std::optional custom_data; - std::optional start_schedule; - std::optional duration; - std::optional min_charging_rate; - std::optional sales_tariff; - - return ChargingSchedule{ - id, - charging_rate_unit, - charging_schedule_period, - custom_data, - start_schedule, - duration, - min_charging_rate, - sales_tariff, - }; - } - - ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit, - std::vector charging_schedule_period, - std::optional start_schedule = std::nullopt) { - int32_t id; - std::optional custom_data; - std::optional duration; - std::optional min_charging_rate; - std::optional sales_tariff; - - return ChargingSchedule{ - id, - charging_rate_unit, - charging_schedule_period, - custom_data, - start_schedule, - duration, - min_charging_rate, - sales_tariff, - }; - } - - std::vector - create_charging_schedule_periods(int32_t start_period, std::optional number_phases = std::nullopt, - std::optional phase_to_use = std::nullopt) { - ChargingSchedulePeriod charging_schedule_period; - charging_schedule_period.startPeriod = start_period; - charging_schedule_period.numberPhases = number_phases; - charging_schedule_period.phaseToUse = phase_to_use; - - return {charging_schedule_period}; - } - - std::vector create_charging_schedule_periods(std::vector start_periods) { - auto charging_schedule_periods = std::vector(); - for (auto start_period : start_periods) { - ChargingSchedulePeriod charging_schedule_period; - charging_schedule_period.startPeriod = start_period; - - charging_schedule_periods.push_back(charging_schedule_period); - } - - return charging_schedule_periods; - } - - std::vector - create_charging_schedule_periods_with_phases(int32_t start_period, int32_t numberPhases, int32_t phaseToUse) { - ChargingSchedulePeriod charging_schedule_period; - charging_schedule_period.startPeriod = start_period; - charging_schedule_period.numberPhases = numberPhases; - charging_schedule_period.phaseToUse = phaseToUse; - - return {charging_schedule_period}; - } - - ChargingProfile - create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, - std::vector charging_schedules, - std::optional transaction_id = {}, - ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, - int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, - std::optional validTo = {}) { - auto recurrency_kind = RecurrencyKindEnum::Daily; - ChargingProfile charging_profile; - charging_profile.id = charging_profile_id; - charging_profile.stackLevel = stack_level; - charging_profile.chargingProfilePurpose = charging_profile_purpose; - charging_profile.chargingProfileKind = charging_profile_kind; - charging_profile.chargingSchedule = charging_schedules; - charging_profile.customData = {}; - charging_profile.recurrencyKind = recurrency_kind; - charging_profile.validFrom = validFrom; - charging_profile.validTo = validTo; - charging_profile.transactionId = transaction_id; - return charging_profile; - } - - ChargingProfile - create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, - ChargingSchedule charging_schedule, std::optional transaction_id = {}, - ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, - int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, - std::optional validTo = {}) { - return create_charging_profile(charging_profile_id, charging_profile_purpose, - std::vector{charging_schedule}, transaction_id, - charging_profile_kind, stack_level, validFrom, validTo); - } - - ChargingProfileCriterion create_charging_profile_criteria( - std::optional> sources = std::nullopt, - std::optional> ids = std::nullopt, - std::optional purpose = std::nullopt, - std::optional stack_level = std::nullopt) { - ChargingProfileCriterion criteria; - criteria.chargingLimitSource = sources; - criteria.chargingProfileId = ids; - criteria.chargingProfilePurpose = purpose; - criteria.stackLevel = stack_level; - return criteria; - } - - GetChargingProfilesRequest create_get_charging_profile_request(int32_t request_id, - ChargingProfileCriterion criteria, - std::optional evse_id = std::nullopt) { - GetChargingProfilesRequest req; - req.requestId = request_id; - req.chargingProfile = criteria; - req.evseId = evse_id; - return req; - } - - ClearChargingProfileRequest - create_clear_charging_profile_request(std::optional id = std::nullopt, - std::optional criteria = std::nullopt) { - ClearChargingProfileRequest req; - req.chargingProfileId = id; - req.chargingProfileCriteria = criteria; - return req; - } - - ClearChargingProfile create_clear_charging_profile(std::optional evse_id = std::nullopt, - std::optional purpose = std::nullopt, - std::optional stack_level = std::nullopt) { - ClearChargingProfile clear_charging_profile; - clear_charging_profile.customData = {}; - clear_charging_profile.evseId = evse_id; - clear_charging_profile.chargingProfilePurpose = purpose; - clear_charging_profile.stackLevel = stack_level; - return clear_charging_profile; - } - template void call_to_json(json& j, const ocpp::Call& call) { j = json::array(); j.push_back(ocpp::MessageTypeId::CALL); @@ -312,7 +132,7 @@ class SmartChargingTest : public DatabaseTestingUtils { // Default values used within the tests DeviceModelTestHelper device_model_test_helper; MockMessageDispatcher mock_dispatcher; - std::unique_ptr evse_manager = std::make_unique(NR_OF_EVSES); + std::unique_ptr evse_manager = std::make_unique(NR_OF_TWO_EVSES); sqlite3* db_handle; std::shared_ptr database_handler; @@ -638,7 +458,7 @@ TEST_F(SmartChargingTest, K01FR41_IfChargingProfileKindIsRelativeAndStartSchedul } TEST_F(SmartChargingTest, K01FR28_WhenEvseDoesNotExistThenReject) { - auto sut = smart_charging.validate_evse_exists(NR_OF_EVSES + 1); + auto sut = smart_charging.validate_evse_exists(NR_OF_TWO_EVSES + 1); EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::EvseDoesNotExist)); } @@ -972,7 +792,7 @@ TEST_F(SmartChargingTest, K01_ValidateProfile_IfEvseDoesNotExist_ThenProfileIsIn auto profile = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile, create_charge_schedule(ChargingRateUnitEnum::A), DEFAULT_TX_ID); - auto sut = smart_charging.conform_and_validate_profile(profile, NR_OF_EVSES + 1); + auto sut = smart_charging.conform_and_validate_profile(profile, NR_OF_TWO_EVSES + 1); EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::EvseDoesNotExist)); } @@ -1288,7 +1108,7 @@ TEST_F(SmartChargingTest, K04FR01_AddProfile_OnlyAddsToOneEVSE) { } TEST_F(SmartChargingTest, AddProfile_StoresChargingLimitSource) { - auto charging_limit_source = ChargingLimitSourceEnum::SO; + auto charging_limit_source = ChargingLimitSourceEnumStringType::SO; auto periods = create_charging_schedule_periods({0, 1, 2}); auto profile = create_charging_profile( @@ -1303,11 +1123,11 @@ TEST_F(SmartChargingTest, AddProfile_StoresChargingLimitSource) { auto profiles = this->database_handler->get_charging_profiles_matching_criteria(DEFAULT_EVSE_ID, criteria); const auto [e, p, sut] = profiles[0]; - EXPECT_THAT(sut, ChargingLimitSourceEnum::SO); + EXPECT_THAT(sut, ChargingLimitSourceEnumStringType::SO); } TEST_F(SmartChargingTest, ValidateAndAddProfile_StoresChargingLimitSource) { - auto charging_limit_source = ChargingLimitSourceEnum::SO; + auto charging_limit_source = ChargingLimitSourceEnumStringType::SO; auto periods = create_charging_schedule_periods({0, 1, 2}); @@ -1326,7 +1146,7 @@ TEST_F(SmartChargingTest, ValidateAndAddProfile_StoresChargingLimitSource) { auto profiles = this->database_handler->get_charging_profiles_matching_criteria(DEFAULT_EVSE_ID, criteria); ASSERT_THAT(profiles.size(), testing::Ge(1)); const auto [e, p, sut] = profiles[0]; - EXPECT_THAT(sut, ChargingLimitSourceEnum::SO); + EXPECT_THAT(sut, ChargingLimitSourceEnumStringType::SO); } TEST_F(SmartChargingTest, K01_ValidateAndAdd_RejectsInvalidProfilesWithReasonCode) { @@ -1483,8 +1303,8 @@ TEST_F(SmartChargingTest, K09_GetChargingProfiles_EvseIdAndSource) { auto profiles = database_handler->get_all_charging_profiles(); EXPECT_THAT(profiles, testing::SizeIs(1)); - std::vector requested_sources_cso{ChargingLimitSourceEnum::CSO}; - std::vector requested_sources_ems{ChargingLimitSourceEnum::EMS}; + std::vector> requested_sources_cso{ChargingLimitSourceEnumStringType::CSO}; + std::vector> requested_sources_ems{ChargingLimitSourceEnumStringType::EMS}; auto reported_profiles = smart_charging.get_reported_profiles(create_get_charging_profile_request( DEFAULT_REQUEST_ID, create_charging_profile_criteria(requested_sources_cso), DEFAULT_EVSE_ID)); @@ -1530,7 +1350,7 @@ TEST_F(SmartChargingTest, K09_GetChargingProfiles_EvseIdAndPurposeAndStackLevel) } TEST_F(SmartChargingTest, K09_GetChargingProfiles_ReportsProfileWithSource) { - auto charging_limit_source = ChargingLimitSourceEnum::SO; + auto charging_limit_source = ChargingLimitSourceEnumStringType::SO; auto periods = create_charging_schedule_periods({0, 1, 2}); @@ -1548,7 +1368,7 @@ TEST_F(SmartChargingTest, K09_GetChargingProfiles_ReportsProfileWithSource) { auto reported_profile = reported_profiles.at(0); EXPECT_THAT(profile, testing::Eq(reported_profile.profile)); - EXPECT_THAT(reported_profile.source, ChargingLimitSourceEnum::SO); + EXPECT_THAT(reported_profile.source, ChargingLimitSourceEnumStringType::SO); } TEST_F(SmartChargingTest, K10_ClearChargingProfile_ClearsId) { diff --git a/tests/lib/ocpp/v2/mocks/database_handler_mock.hpp b/tests/lib/ocpp/v2/mocks/database_handler_mock.hpp index 0b131334d..c6f275715 100644 --- a/tests/lib/ocpp/v2/mocks/database_handler_mock.hpp +++ b/tests/lib/ocpp/v2/mocks/database_handler_mock.hpp @@ -54,8 +54,7 @@ class DatabaseHandlerMock : public DatabaseHandlerInterface { (override)); MOCK_METHOD(void, transaction_delete, (const std::string& transaction_id)); MOCK_METHOD(void, insert_or_update_charging_profile, - (const int evse_id, const ChargingProfile& profile, - const ChargingLimitSourceEnum charging_limit_source), + (const int evse_id, const ChargingProfile& profile, const CiString<20> charging_limit_source), (override)); MOCK_METHOD(bool, delete_charging_profile, (const int profile_id)); MOCK_METHOD(void, delete_charging_profile_by_transaction_id, (const std::string& transaction_id)); @@ -69,7 +68,7 @@ class DatabaseHandlerMock : public DatabaseHandlerInterface { MOCK_METHOD(std::vector, get_all_charging_profiles, ()); typedef std::map> charging_profiles_grouped_by_evse; MOCK_METHOD(charging_profiles_grouped_by_evse, get_all_charging_profiles_group_by_evse, ()); - MOCK_METHOD(ChargingLimitSourceEnum, get_charging_limit_source_for_profile, (const int profile_id)); + MOCK_METHOD(CiString<20>, get_charging_limit_source_for_profile, (const int profile_id)); MOCK_METHOD(std::unique_ptr, new_statement, (const std::string& sql)); }; } // namespace ocpp::v2 diff --git a/tests/lib/ocpp/v2/mocks/evse_manager_fake.hpp b/tests/lib/ocpp/v2/mocks/evse_manager_fake.hpp index eb5783335..6677a7fa6 100644 --- a/tests/lib/ocpp/v2/mocks/evse_manager_fake.hpp +++ b/tests/lib/ocpp/v2/mocks/evse_manager_fake.hpp @@ -52,7 +52,7 @@ class EvseManagerFake : public EvseManagerInterface { return *this->evses.at(id - 1); } - virtual bool does_connector_exist(const int32_t evse_id, ConnectorEnum connector_type) const override { + virtual bool does_connector_exist(const int32_t evse_id, const CiString<20> connector_type) const override { if (evse_id > this->evses.size()) { return false; } diff --git a/tests/lib/ocpp/v2/mocks/evse_mock.hpp b/tests/lib/ocpp/v2/mocks/evse_mock.hpp index 57fcbf2f9..3e74157ef 100644 --- a/tests/lib/ocpp/v2/mocks/evse_mock.hpp +++ b/tests/lib/ocpp/v2/mocks/evse_mock.hpp @@ -12,9 +12,8 @@ class EvseMock : public EvseInterface { public: MOCK_METHOD(int32_t, get_id, (), (const)); MOCK_METHOD(uint32_t, get_number_of_connectors, (), (const)); - MOCK_METHOD(bool, does_connector_exist, (ConnectorEnum connector_type), (const)); - MOCK_METHOD(std::optional, get_connector_status, - (std::optional connector_type)); + MOCK_METHOD(bool, does_connector_exist, (CiString<20> connector_type), (const)); + MOCK_METHOD(std::optional, get_connector_status, (std::optional> connector_type)); MOCK_METHOD(void, open_transaction, (const std::string& transaction_id, const int32_t connector_id, const DateTime& timestamp, const MeterValue& meter_start, const std::optional& id_token, diff --git a/tests/lib/ocpp/v2/mocks/smart_charging_mock.hpp b/tests/lib/ocpp/v2/mocks/smart_charging_mock.hpp index c42a3686a..1333f0ada 100644 --- a/tests/lib/ocpp/v2/mocks/smart_charging_mock.hpp +++ b/tests/lib/ocpp/v2/mocks/smart_charging_mock.hpp @@ -16,7 +16,7 @@ class SmartChargingMock : public SmartChargingInterface { (const int32_t duration, const ChargingRateUnitEnum& unit)); MOCK_METHOD(void, delete_transaction_tx_profiles, (const std::string& transaction_id)); MOCK_METHOD(SetChargingProfileResponse, conform_validate_and_add_profile, - (ChargingProfile & profile, int32_t evse_id, ChargingLimitSourceEnum charging_limit_source, + (ChargingProfile & profile, int32_t evse_id, CiString<20> charging_limit_source, AddChargingProfileSource source_of_request)); MOCK_METHOD(ProfileValidationResultEnum, conform_and_validate_profile, (ChargingProfile & profile, int32_t evse_id, AddChargingProfileSource source_of_request)); diff --git a/tests/lib/ocpp/v2/smart_charging_test_utils.cpp b/tests/lib/ocpp/v2/smart_charging_test_utils.cpp new file mode 100644 index 000000000..9500166c9 --- /dev/null +++ b/tests/lib/ocpp/v2/smart_charging_test_utils.cpp @@ -0,0 +1,452 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest + +#include + +#include "ocpp/v2/ctrlr_component_variables.hpp" + +namespace ocpp::v2 { + +bool operator==(const V2XFreqWattPoint& a, const V2XFreqWattPoint& b) { + return a.frequency == b.frequency && a.power == b.power; +} + +bool operator==(const V2XSignalWattPoint& a, const V2XSignalWattPoint& b) { + return a.power == b.power and a.signal == b.signal; +} + +bool operator==(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b) { + auto diff = std::abs(a.startPeriod - b.startPeriod); + bool bRes = diff < 10; // allow for a small difference + bRes = bRes && (a.limit == b.limit); + bRes = bRes && (a.numberPhases == b.numberPhases); + bRes = bRes && (a.phaseToUse == b.phaseToUse); + bRes = bRes && (a.setpoint == b.setpoint); + bRes = bRes && (a.setpoint_L2 == b.setpoint_L2); + bRes = bRes && (a.setpoint_L3 == b.setpoint_L3); + bRes = bRes && (a.setpointReactive == b.setpointReactive); + bRes = bRes && (a.setpointReactive_L2 == b.setpointReactive_L2); + bRes = bRes && (a.setpointReactive_L3 == b.setpointReactive_L3); + bRes = bRes && (a.dischargeLimit == b.dischargeLimit); + bRes = bRes && (a.dischargeLimit_L2 == b.dischargeLimit_L2); + bRes = bRes && (a.dischargeLimit_L3 == b.dischargeLimit_L3); + bRes = bRes && (a.evseSleep == b.evseSleep); + bRes = bRes && (a.operationMode == b.operationMode); + bRes = bRes && (a.preconditioningRequest == b.preconditioningRequest); + bRes = bRes && (a.v2xBaseline == b.v2xBaseline); + bRes = bRes && (a.v2xFreqWattCurve == b.v2xFreqWattCurve); + bRes = bRes && (a.v2xSignalWattCurve == b.v2xSignalWattCurve); + + return bRes; +} + +bool operator!=(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b) { + return (!(a == b)); +} + +bool operator==(const CompositeSchedule& a, const CompositeSchedule& b) { + bool bRes = true; + + if (a.chargingSchedulePeriod.size() != b.chargingSchedulePeriod.size()) { + return false; + } + + for (std::uint32_t i = 0; bRes && i < a.chargingSchedulePeriod.size(); i++) { + bRes = a.chargingSchedulePeriod[i] == b.chargingSchedulePeriod[i]; + } + + bRes = bRes && (a.evseId == b.evseId); + bRes = bRes && (a.duration == b.duration); + bRes = bRes && (a.scheduleStart == b.scheduleStart); + bRes = bRes && (a.chargingRateUnit == b.chargingRateUnit); + + return bRes; +} + +bool operator!=(const CompositeSchedule& a, const CompositeSchedule& b) { + return (!(a == b)); +} + +bool operator==(const LimitAtSoC& a, const LimitAtSoC& b) { + return a.limit == b.limit and a.soc == b.soc; +} + +bool operator==(const ChargingSchedule& a, const ChargingSchedule& b) { + bool bRes = true; + + if (a.chargingSchedulePeriod.size() != b.chargingSchedulePeriod.size()) { + return false; + } + + for (std::uint32_t i = 0; bRes && i < a.chargingSchedulePeriod.size(); i++) { + bRes = a.chargingSchedulePeriod[i] == b.chargingSchedulePeriod[i]; + } + + bRes = bRes && (a.chargingRateUnit == b.chargingRateUnit); + bRes = bRes && (a.startSchedule == b.startSchedule); + bRes = bRes && (a.duration == b.duration); + bRes = bRes && (a.minChargingRate == b.minChargingRate); + bRes = bRes && (a.powerTolerance == b.powerTolerance); + bRes = bRes && (a.signatureId == b.signatureId); + bRes = bRes && (a.limitAtSoC == b.limitAtSoC); + bRes = bRes && (a.digestValue == b.digestValue); + bRes = bRes && (a.powerTolerance == b.powerTolerance); + bRes = bRes && (a.useLocalTime == b.useLocalTime); + bRes = bRes && (a.randomizedDelay == b.randomizedDelay); + // misses absolutePriceSchedule + // misses priceLevelSchedule + + return bRes; +} + +bool operator!=(const ChargingSchedule& a, const ChargingSchedule& b) { + return !(a == b); +} + +bool operator==(const period_entry_t& a, const period_entry_t& b) { + bool bRes = (a.start == b.start) && (a.end == b.end) && (a.limit == b.limit) && (a.stack_level == b.stack_level) && + (a.charging_rate_unit == b.charging_rate_unit); + if (a.number_phases && b.number_phases) { + bRes = bRes && a.number_phases.value() == b.number_phases.value(); + } + if (a.min_charging_rate && b.min_charging_rate) { + bRes = bRes && a.min_charging_rate.value() == b.min_charging_rate.value(); + } + return bRes; +} + +bool operator!=(const period_entry_t& a, const period_entry_t& b) { + return !(a == b); +} + +bool operator==(const std::vector& a, const std::vector& b) { + bool bRes = a.size() == b.size(); + if (bRes) { + for (std::uint8_t i = 0; i < a.size(); i++) { + bRes = a[i] == b[i]; + if (!bRes) { + break; + } + } + } + return bRes; +} + +std::string to_string(const period_entry_t& entry) { + std::string result = "Period Entry: {"; + result += "Start: " + entry.start.to_rfc3339() + ", "; + result += "End: " + entry.end.to_rfc3339() + ", "; + result += "Limit: " + std::to_string(entry.limit) + ", "; + if (entry.number_phases.has_value()) { + result += "Number of Phases: " + std::to_string(entry.number_phases.value()) + ", "; + } + result += "Stack Level: " + std::to_string(entry.stack_level) + ", "; + result += "ChargingRateUnit:" + conversions::charging_rate_unit_enum_to_string(entry.charging_rate_unit); + + if (entry.min_charging_rate.has_value()) { + result += ", Min Charging Rate: " + std::to_string(entry.min_charging_rate.value()); + } + + result += "}"; + return result; +} + +std::ostream& operator<<(std::ostream& os, const period_entry_t& entry) { + os << to_string(entry); + return os; +} + +ocpp::DateTime dt(const std::string& dt_string) { + ocpp::DateTime dt; + + if (dt_string.length() == 4) { + dt = ocpp::DateTime("2024-01-01T0" + dt_string + ":00Z"); + } else if (dt_string.length() == 5) { + dt = ocpp::DateTime("2024-01-01T" + dt_string + ":00Z"); + } else if (dt_string.length() == 7) { + dt = ocpp::DateTime("2024-01-0" + dt_string + ":00Z"); + } else if (dt_string.length() == 8) { + dt = ocpp::DateTime("2024-01-" + dt_string + ":00Z"); + } else if (dt_string.length() == 11) { + dt = ocpp::DateTime("2024-" + dt_string + ":00Z"); + } else if (dt_string.length() == 16) { + dt = ocpp::DateTime(dt_string + ":00Z"); + } + + return dt; +} + +ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit) { + ChargingSchedule charging_schedule; + charging_schedule.chargingRateUnit = charging_rate_unit; + return charging_schedule; +} + +ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit, + const std::vector& charging_schedule_period, + std::optional start_schedule) { + ChargingSchedule charging_schedule; + charging_schedule.chargingRateUnit = charging_rate_unit; + charging_schedule.chargingSchedulePeriod = charging_schedule_period; + charging_schedule.startSchedule = start_schedule; + return charging_schedule; +} + +std::vector create_charging_schedule_periods(int32_t start_period, + std::optional number_phases, + std::optional phase_to_use) { + ChargingSchedulePeriod charging_schedule_period; + charging_schedule_period.startPeriod = start_period; + charging_schedule_period.numberPhases = number_phases; + charging_schedule_period.phaseToUse = phase_to_use; + + return {charging_schedule_period}; +} + +std::vector create_charging_schedule_periods(const std::vector& start_periods) { + auto charging_schedule_periods = std::vector(); + for (auto start_period : start_periods) { + ChargingSchedulePeriod charging_schedule_period; + charging_schedule_period.startPeriod = start_period; + + charging_schedule_periods.push_back(charging_schedule_period); + } + + return charging_schedule_periods; +} + +std::vector +create_charging_schedule_periods_with_phases(int32_t start_period, int32_t numberPhases, int32_t phaseToUse) { + ChargingSchedulePeriod charging_schedule_period; + charging_schedule_period.startPeriod = start_period; + charging_schedule_period.numberPhases = numberPhases; + charging_schedule_period.phaseToUse = phaseToUse; + + return {charging_schedule_period}; +} + +ChargingProfile create_charging_profile(int32_t charging_profile_id, + ChargingProfilePurposeEnum charging_profile_purpose, + const std::vector& charging_schedules, + std::optional transaction_id, + ChargingProfileKindEnum charging_profile_kind, int stack_level, + std::optional validFrom, + std::optional validTo) { + auto recurrency_kind = RecurrencyKindEnum::Daily; + ChargingProfile charging_profile; + charging_profile.id = charging_profile_id; + charging_profile.stackLevel = stack_level; + charging_profile.chargingProfilePurpose = charging_profile_purpose; + charging_profile.chargingProfileKind = charging_profile_kind; + charging_profile.chargingSchedule = charging_schedules; + charging_profile.customData = {}; + charging_profile.recurrencyKind = recurrency_kind; + charging_profile.validFrom = validFrom; + charging_profile.validTo = validTo; + charging_profile.transactionId = transaction_id; + return charging_profile; +} + +ChargingProfile create_charging_profile(int32_t charging_profile_id, + ChargingProfilePurposeEnum charging_profile_purpose, + ChargingSchedule charging_schedule, std::optional transaction_id, + ChargingProfileKindEnum charging_profile_kind, int stack_level, + std::optional validFrom, + std::optional validTo) { + return create_charging_profile(charging_profile_id, charging_profile_purpose, + std::vector{charging_schedule}, transaction_id, + charging_profile_kind, stack_level, validFrom, validTo); +} + +ChargingProfileCriterion create_charging_profile_criteria(std::optional>> sources, + std::optional> ids, + std::optional purpose, + std::optional stack_level) { + ChargingProfileCriterion criteria; + criteria.chargingLimitSource = sources; + criteria.chargingProfileId = ids; + criteria.chargingProfilePurpose = purpose; + criteria.stackLevel = stack_level; + return criteria; +} + +GetChargingProfilesRequest create_get_charging_profile_request(int32_t request_id, ChargingProfileCriterion criteria, + std::optional evse_id) { + GetChargingProfilesRequest req; + req.requestId = request_id; + req.chargingProfile = criteria; + req.evseId = evse_id; + return req; +} + +ClearChargingProfileRequest create_clear_charging_profile_request(std::optional id, + std::optional criteria) { + ClearChargingProfileRequest req; + req.chargingProfileId = id; + req.chargingProfileCriteria = criteria; + return req; +} + +ClearChargingProfile create_clear_charging_profile(std::optional evse_id, + std::optional purpose, + std::optional stack_level) { + ClearChargingProfile clear_charging_profile; + clear_charging_profile.customData = {}; + clear_charging_profile.evseId = evse_id; + clear_charging_profile.chargingProfilePurpose = purpose; + clear_charging_profile.stackLevel = stack_level; + return clear_charging_profile; +} + +namespace SmartChargingTestUtils { +std::vector get_charging_profiles_from_directory(const std::string& path) { + EVLOG_debug << "get_charging_profiles_from_directory: " << path; + std::vector profiles; + for (const auto& entry : fs::directory_iterator(path)) { + if (!entry.is_directory()) { + fs::path path = entry.path(); + if (path.extension() == ".json") { + ChargingProfile profile = get_charging_profile_from_path(path); + std::cout << path << std::endl; + profiles.push_back(profile); + } + } + } + + // Sort profiles by id in ascending order + std::sort(profiles.begin(), profiles.end(), + [](const ChargingProfile& a, const ChargingProfile& b) { return a.id < b.id; }); + + EVLOG_debug << "get_charging_profiles_from_directory END"; + return profiles; +} + +ChargingProfile get_charging_profile_from_path(const std::string& path) { + EVLOG_debug << "get_charging_profile_from_path: " << path; + std::ifstream f(path.c_str()); + json data = json::parse(f); + + ChargingProfile cp; + from_json(data, cp); + return cp; +} + +ChargingProfile get_charging_profile_from_file(const std::string& filename) { + const std::string full_path = BASE_JSON_PATH + "/" + filename; + + return get_charging_profile_from_path(full_path); +} + +std::vector get_charging_profiles_from_file(const std::string& filename) { + std::vector profiles; + profiles.push_back(get_charging_profile_from_file(filename)); + return profiles; +} + +/// \brief Returns a vector of ChargingProfiles to be used as a baseline for testing core functionality +/// of generating an EnhancedChargingSchedule. +std::vector get_baseline_profile_vector() { + return get_charging_profiles_from_directory(BASE_JSON_PATH + "/" + "baseline/"); +} + +std::string to_string(std::vector& profiles) { + std::string s; + json cp_json; + for (auto& profile : profiles) { + if (!s.empty()) + s += ", "; + to_json(cp_json, profile); + s += cp_json.dump(4); + } + + return "[" + s + "]"; +} + +/// \brief Validates that there is no overlap in the submitted period_entry_t collection +/// \param period_entry_t collection +/// \note If there are any overlapping period_entry_t entries the function returns false +bool validate_profile_result(const std::vector& result) { + bool bRes{true}; + DateTime last{"1900-01-01T00:00:00Z"}; + for (const auto& i : result) { + // ensure no overlaps + bRes = i.start < i.end; + bRes = bRes && i.start >= last; + last = i.end; + if (!bRes) { + break; + } + } + return bRes; +} +} // namespace SmartChargingTestUtils + +void CompositeScheduleTestFixtureV2::SetUp() { +} + +void CompositeScheduleTestFixtureV2::TearDown() { +} + +void CompositeScheduleTestFixtureV2::load_charging_profiles_for_evse(const std::filesystem::path& path, + int32_t evse_id) { + std::vector profiles = std::filesystem::is_directory(path) + ? SmartChargingTestUtils::get_charging_profiles_from_directory(path) + : SmartChargingTestUtils::get_charging_profiles_from_file(path); + + ON_CALL(*database_handler, get_charging_profiles_for_evse(evse_id)).WillByDefault(testing::Return(profiles)); +} + +CompositeScheduleTestFixtureV2::CompositeScheduleTestFixtureV2() : + evse_manager(std::make_unique(NR_OF_EVSES)), + device_model_test_helper(), + mock_dispatcher(), + device_model(device_model_test_helper.get_device_model()), + connectivity_manager(), + set_charging_profiles_callback_mock(), + handler(create_smart_charging_handler()), + uuid_generator(boost::uuids::random_generator()) { + + const auto& charging_rate_unit_cv = ControllerComponentVariables::ChargingScheduleChargingRateUnit; + device_model->set_value(charging_rate_unit_cv.component, charging_rate_unit_cv.variable.value(), + AttributeEnum::Actual, "A,W", "test", true); + + const auto& ac_phase_switching_cv = ControllerComponentVariables::ACPhaseSwitchingSupported; + device_model->set_value(ac_phase_switching_cv.component, ac_phase_switching_cv.variable.value(), + AttributeEnum::Actual, "true", "test", true); + + const auto& default_limit_amps_cv = ControllerComponentVariables::CompositeScheduleDefaultLimitAmps; + device_model->set_value(default_limit_amps_cv.component, default_limit_amps_cv.variable.value(), + AttributeEnum::Actual, std::to_string(DEFAULT_LIMIT_AMPERE), "test", true); + + const auto& default_limit_watts_cv = ControllerComponentVariables::CompositeScheduleDefaultLimitWatts; + device_model->set_value(default_limit_watts_cv.component, default_limit_watts_cv.variable.value(), + AttributeEnum::Actual, std::to_string(DEFAULT_LIMIT_WATT), "test", true); + + const auto& default_limit_phases_cv = ControllerComponentVariables::CompositeScheduleDefaultNumberPhases; + device_model->set_value(default_limit_phases_cv.component, default_limit_phases_cv.variable.value(), + AttributeEnum::Actual, std::to_string(DEFAULT_NR_PHASES), "test", true); +} + +std::unique_ptr CompositeScheduleTestFixtureV2::create_smart_charging_handler() { + std::unique_ptr database_connection = + std::make_unique(fs::path("/tmp/ocpp201") / "cp.db"); + this->database_handler = + std::make_unique(std::move(database_connection), MIGRATION_FILES_LOCATION_V2); + database_handler->open_connection(); + this->functional_block_context = std::make_unique( + this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager, + *this->database_handler, this->evse_security, this->component_state_manager); + return std::make_unique(*functional_block_context, + set_charging_profiles_callback_mock.AsStdFunction()); +} + +void CompositeScheduleTestFixtureV2::reconfigure_for_nr_of_evses(int32_t nr_of_evses) { + this->evse_manager = std::make_unique(nr_of_evses); + this->functional_block_context = std::make_unique( + this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager, + *this->database_handler, this->evse_security, this->component_state_manager); + this->handler = std::make_unique(*functional_block_context, + set_charging_profiles_callback_mock.AsStdFunction()); +} + +} // namespace ocpp::v2 diff --git a/tests/lib/ocpp/v2/smart_charging_test_utils.hpp b/tests/lib/ocpp/v2/smart_charging_test_utils.hpp index 990ecad66..70185b8fc 100644 --- a/tests/lib/ocpp/v2/smart_charging_test_utils.hpp +++ b/tests/lib/ocpp/v2/smart_charging_test_utils.hpp @@ -1,10 +1,34 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest + +#pragma once #include "everest/logging.hpp" +#include "ocpp/v2/functional_blocks/smart_charging.hpp" #include "ocpp/v2/ocpp_types.hpp" #include "ocpp/v2/profile.hpp" #include "ocpp/v2/utils.hpp" +#include +#include +#include +#include +#include + +#include "connectivity_manager_mock.hpp" +#include "database_handler_mock.hpp" +#include "device_model_test_helper.hpp" +#include "lib/ocpp/common/database_testing_utils.hpp" +#include "message_dispatcher_mock.hpp" +#include "mocks/database_handler_fake.hpp" +#include +#include +#include +#include +#include +#include + +#include +#include #include #include #include @@ -15,224 +39,126 @@ #include #include +using ::testing::MockFunction; namespace ocpp::v2 { static const std::string BASE_JSON_PATH = std::string(TEST_PROFILES_LOCATION_V2) + "/json"; -inline bool operator==(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b) { - auto diff = std::abs(a.startPeriod - b.startPeriod); - bool bRes = diff < 10; // allow for a small difference - bRes = bRes && (a.limit == b.limit); - bRes = bRes && (a.numberPhases == b.numberPhases); - bRes = bRes && (a.phaseToUse == b.phaseToUse); - return bRes; -} - -inline bool operator!=(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b) { - return (!(a == b)); -} - -inline bool operator==(const CompositeSchedule& a, const CompositeSchedule& b) { - bool bRes = true; - - if (a.chargingSchedulePeriod.size() != b.chargingSchedulePeriod.size()) { - return false; - } - - for (std::uint32_t i = 0; bRes && i < a.chargingSchedulePeriod.size(); i++) { - bRes = a.chargingSchedulePeriod[i] == b.chargingSchedulePeriod[i]; - } - - bRes = bRes && (a.evseId == b.evseId); - bRes = bRes && (a.duration == b.duration); - bRes = bRes && (a.scheduleStart == b.scheduleStart); - bRes = bRes && (a.chargingRateUnit == b.chargingRateUnit); - - return bRes; -} - -inline bool operator!=(const CompositeSchedule& a, const CompositeSchedule& b) { - return (!(a == b)); -} - -inline bool operator==(const ChargingSchedule& a, const ChargingSchedule& b) { - bool bRes = true; - - if (a.chargingSchedulePeriod.size() != b.chargingSchedulePeriod.size()) { - return false; - } - - for (std::uint32_t i = 0; bRes && i < a.chargingSchedulePeriod.size(); i++) { - bRes = a.chargingSchedulePeriod[i] == b.chargingSchedulePeriod[i]; - } - - bRes = bRes && (a.chargingRateUnit == b.chargingRateUnit); - bRes = bRes && (a.startSchedule == b.startSchedule); - bRes = bRes && (a.duration == b.duration); - bRes = bRes && (a.minChargingRate == b.minChargingRate); - - return bRes; -} - -inline bool operator!=(const ChargingSchedule& a, const ChargingSchedule& b) { - return !(a == b); -} - -inline bool operator==(const period_entry_t& a, const period_entry_t& b) { - bool bRes = (a.start == b.start) && (a.end == b.end) && (a.limit == b.limit) && (a.stack_level == b.stack_level) && - (a.charging_rate_unit == b.charging_rate_unit); - if (a.number_phases && b.number_phases) { - bRes = bRes && a.number_phases.value() == b.number_phases.value(); - } - if (a.min_charging_rate && b.min_charging_rate) { - bRes = bRes && a.min_charging_rate.value() == b.min_charging_rate.value(); - } - return bRes; -} - -inline bool operator!=(const period_entry_t& a, const period_entry_t& b) { - return !(a == b); -} - -inline bool operator==(const std::vector& a, const std::vector& b) { - bool bRes = a.size() == b.size(); - if (bRes) { - for (std::uint8_t i = 0; i < a.size(); i++) { - bRes = a[i] == b[i]; - if (!bRes) { - break; - } - } - } - return bRes; -} - -inline std::string to_string(const period_entry_t& entry) { - std::string result = "Period Entry: {"; - result += "Start: " + entry.start.to_rfc3339() + ", "; - result += "End: " + entry.end.to_rfc3339() + ", "; - result += "Limit: " + std::to_string(entry.limit) + ", "; - if (entry.number_phases.has_value()) { - result += "Number of Phases: " + std::to_string(entry.number_phases.value()) + ", "; - } - result += "Stack Level: " + std::to_string(entry.stack_level) + ", "; - result += "ChargingRateUnit:" + conversions::charging_rate_unit_enum_to_string(entry.charging_rate_unit); - - if (entry.min_charging_rate.has_value()) { - result += ", Min Charging Rate: " + std::to_string(entry.min_charging_rate.value()); - } - - result += "}"; - return result; -} - -inline std::ostream& operator<<(std::ostream& os, const period_entry_t& entry) { - os << to_string(entry); - return os; -} - -static ocpp::DateTime dt(const std::string& dt_string) { - ocpp::DateTime dt; - - if (dt_string.length() == 4) { - dt = ocpp::DateTime("2024-01-01T0" + dt_string + ":00Z"); - } else if (dt_string.length() == 5) { - dt = ocpp::DateTime("2024-01-01T" + dt_string + ":00Z"); - } else if (dt_string.length() == 7) { - dt = ocpp::DateTime("2024-01-0" + dt_string + ":00Z"); - } else if (dt_string.length() == 8) { - dt = ocpp::DateTime("2024-01-" + dt_string + ":00Z"); - } else if (dt_string.length() == 11) { - dt = ocpp::DateTime("2024-" + dt_string + ":00Z"); - } else if (dt_string.length() == 16) { - dt = ocpp::DateTime(dt_string + ":00Z"); - } - - return dt; -} - -class SmartChargingTestUtils { +constexpr int NR_OF_EVSES = 1; +constexpr int NR_OF_TWO_EVSES = 2; +constexpr int STATION_WIDE_ID = 0; +constexpr int DEFAULT_EVSE_ID = 1; +constexpr int DEFAULT_PROFILE_ID = 1; +constexpr int DEFAULT_STACK_LEVEL = 1; +constexpr int DEFAULT_REQUEST_ID = 1; +constexpr int32_t DEFAULT_LIMIT_AMPERE = 57; +constexpr int32_t DEFAULT_LIMIT_WATT = 55612; +constexpr int32_t DEFAULT_NR_PHASES = 3; +static const std::string DEFAULT_TX_ID = "10c75ff7-74f5-44f5-9d01-f649f3ac7b78"; + +// Operator overloads +bool operator==(const V2XFreqWattPoint& a, const V2XFreqWattPoint& b); +bool operator==(const V2XSignalWattPoint& a, const V2XSignalWattPoint& b); +bool operator==(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b); +bool operator!=(const ChargingSchedulePeriod& a, const ChargingSchedulePeriod& b); +bool operator==(const CompositeSchedule& a, const CompositeSchedule& b); +bool operator!=(const CompositeSchedule& a, const CompositeSchedule& b); +bool operator==(const LimitAtSoC& a, const LimitAtSoC& b); +bool operator==(const ChargingSchedule& a, const ChargingSchedule& b); +bool operator!=(const ChargingSchedule& a, const ChargingSchedule& b); +bool operator==(const period_entry_t& a, const period_entry_t& b); +bool operator!=(const period_entry_t& a, const period_entry_t& b); +bool operator==(const std::vector& a, const std::vector& b); + +std::string to_string(const period_entry_t& entry); +std::ostream& operator<<(std::ostream& os, const period_entry_t& entry); +ocpp::DateTime dt(const std::string& dt_string); + +ChargingProfile +create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, + const std::vector& charging_schedules, + std::optional transaction_id = {}, + ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, + int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, + std::optional validTo = {}); +ChargingProfile +create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, + ChargingSchedule charging_schedule, std::optional transaction_id = {}, + ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, + int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, + std::optional validTo = {}); +ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit); +ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit, + const std::vector& charging_schedule_period, + std::optional start_schedule = std::nullopt); +std::vector +create_charging_schedule_periods(int32_t start_period, std::optional number_phases = std::nullopt, + std::optional phase_to_use = std::nullopt); +std::vector create_charging_schedule_periods(const std::vector& start_periods); +std::vector +create_charging_schedule_periods_with_phases(int32_t start_period, int32_t numberPhases, int32_t phaseToUse); +ChargingProfileCriterion +create_charging_profile_criteria(std::optional>> sources = std::nullopt, + std::optional> ids = std::nullopt, + std::optional purpose = std::nullopt, + std::optional stack_level = std::nullopt); +GetChargingProfilesRequest create_get_charging_profile_request(int32_t request_id, ChargingProfileCriterion criteria, + std::optional evse_id = std::nullopt); +ClearChargingProfileRequest +create_clear_charging_profile_request(std::optional id = std::nullopt, + std::optional criteria = std::nullopt); +ClearChargingProfile create_clear_charging_profile(std::optional evse_id = std::nullopt, + std::optional purpose = std::nullopt, + std::optional stack_level = std::nullopt); +namespace SmartChargingTestUtils { +std::vector get_charging_profiles_from_directory(const std::string& path); +ChargingProfile get_charging_profile_from_path(const std::string& path); +ChargingProfile get_charging_profile_from_file(const std::string& filename); +std::vector get_charging_profiles_from_file(const std::string& filename); +std::vector get_baseline_profile_vector(); +std::string to_string(std::vector& profiles); +bool validate_profile_result(const std::vector& result); +} // namespace SmartChargingTestUtils + +class TestSmartCharging : public SmartCharging { public: - static std::vector get_charging_profiles_from_directory(const std::string& path) { - EVLOG_debug << "get_charging_profiles_from_directory: " << path; - std::vector profiles; - for (const auto& entry : fs::directory_iterator(path)) { - if (!entry.is_directory()) { - fs::path path = entry.path(); - if (path.extension() == ".json") { - ChargingProfile profile = get_charging_profile_from_path(path); - std::cout << path << std::endl; - profiles.push_back(profile); - } - } - } - - // Sort profiles by id in ascending order - std::sort(profiles.begin(), profiles.end(), - [](const ChargingProfile& a, const ChargingProfile& b) { return a.id < b.id; }); - - EVLOG_debug << "get_charging_profiles_from_directory END"; - return profiles; - } - - static ChargingProfile get_charging_profile_from_path(const std::string& path) { - EVLOG_debug << "get_charging_profile_from_path: " << path; - std::ifstream f(path.c_str()); - json data = json::parse(f); - - ChargingProfile cp; - from_json(data, cp); - return cp; - } - - static ChargingProfile get_charging_profile_from_file(const std::string& filename) { - const std::string full_path = BASE_JSON_PATH + "/" + filename; - - return get_charging_profile_from_path(full_path); - } - - static std::vector get_charging_profiles_from_file(const std::string& filename) { - std::vector profiles; - profiles.push_back(get_charging_profile_from_file(filename)); - return profiles; - } - - /// \brief Returns a vector of ChargingProfiles to be used as a baseline for testing core functionality - /// of generating an EnhancedChargingSchedule. - static std::vector get_baseline_profile_vector() { - return get_charging_profiles_from_directory(BASE_JSON_PATH + "/" + "baseline/"); - } - - static std::string to_string(std::vector& profiles) { - std::string s; - json cp_json; - for (auto& profile : profiles) { - if (!s.empty()) - s += ", "; - to_json(cp_json, profile); - s += cp_json.dump(4); - } + using SmartCharging::add_profile; + using SmartCharging::calculate_composite_schedule; + using SmartCharging::clear_profiles; + using SmartCharging::get_reported_profiles; + using SmartCharging::get_valid_profiles; + using SmartCharging::SmartCharging; + using SmartCharging::validate_charging_station_max_profile; + using SmartCharging::validate_evse_exists; + using SmartCharging::validate_profile_schedules; + using SmartCharging::validate_tx_default_profile; + using SmartCharging::validate_tx_profile; + using SmartCharging::verify_no_conflicting_external_constraints_id; +}; - return "[" + s + "]"; - } +class CompositeScheduleTestFixtureV2 : public DatabaseTestingUtils { +protected: + void SetUp() override; + void TearDown() override; + void load_charging_profiles_for_evse(const std::filesystem::path& path, int32_t evse_id); + std::unique_ptr create_smart_charging_handler(); - /// \brief Validates that there is no overlap in the submitted period_entry_t collection - /// \param period_entry_t collection - /// \note If there are any overlapping period_entry_t entries the function returns false - static bool validate_profile_result(const std::vector& result) { - bool bRes{true}; - DateTime last{"1900-01-01T00:00:00Z"}; - for (const auto& i : result) { - // ensure no overlaps - bRes = i.start < i.end; - bRes = bRes && i.start >= last; - last = i.end; - if (!bRes) { - break; - } - } - return bRes; - } +public: + CompositeScheduleTestFixtureV2(); + void reconfigure_for_nr_of_evses(int32_t nr_of_evses); + + std::unique_ptr evse_manager; + DeviceModelTestHelper device_model_test_helper; + MockMessageDispatcher mock_dispatcher; + DeviceModel* device_model; + ::testing::NiceMock connectivity_manager; + ocpp::EvseSecurityMock evse_security; + ComponentStateManagerMock component_state_manager; + std::unique_ptr functional_block_context; + std::unique_ptr database_handler; + MockFunction set_charging_profiles_callback_mock; + std::unique_ptr handler; + boost::uuids::random_generator uuid_generator; }; -} // namespace ocpp::v2 \ No newline at end of file +} // namespace ocpp::v2 diff --git a/tests/lib/ocpp/v2/test_charge_point.cpp b/tests/lib/ocpp/v2/test_charge_point.cpp index bba10aadb..73c9a1b13 100644 --- a/tests/lib/ocpp/v2/test_charge_point.cpp +++ b/tests/lib/ocpp/v2/test_charge_point.cpp @@ -1,7 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest #include "comparators.hpp" +#include "device_model_test_helper.hpp" #include "everest/logging.hpp" #include "evse_security_mock.hpp" #include "lib/ocpp/common/database_testing_utils.hpp" @@ -12,27 +13,20 @@ #include "ocpp/v2/ctrlr_component_variables.hpp" #include "ocpp/v2/device_model_storage_sqlite.hpp" #include "ocpp/v2/init_device_model_db.hpp" -#include "ocpp/v2/messages/GetCompositeSchedule.hpp" -#include "ocpp/v2/messages/SetChargingProfile.hpp" #include "ocpp/v2/ocpp_enums.hpp" #include "ocpp/v2/types.hpp" -#include "gmock/gmock.h" +#include "smart_charging_test_utils.hpp" +#include "gmock/gmock.h" #include #include #include #include #include -static const int DEFAULT_EVSE_ID = 1; -static const int DEFAULT_PROFILE_ID = 1; -static const int DEFAULT_STACK_LEVEL = 1; static const ocpp::v2::AddChargingProfileSource DEFAULT_REQUEST_TO_ADD_PROFILE_SOURCE = ocpp::v2::AddChargingProfileSource::SetChargingProfile; static const std::string TEMP_OUTPUT_PATH = "/tmp/ocpp201"; -const static std::string MIGRATION_FILES_PATH = "./resources/v2/device_model_migration_files"; -const static std::string CONFIG_PATH = "./resources/example_config/v2/component_config"; -const static std::string DEVICE_MODEL_DB_IN_MEMORY_PATH = "file::memory:?cache=shared"; static const std::string DEFAULT_TX_ID = "10c75ff7-74f5-44f5-9d01-f649f3ac7b78"; namespace ocpp::v2 { @@ -73,7 +67,7 @@ class ChargePointCommonTestFixtureV2 : public DatabaseTestingUtils { return device_model; } - std::vector create_charging_schedule_periods(std::vector start_periods) { + std::vector create_charging_schedule_periods(const std::vector& start_periods) { auto charging_schedule_periods = std::vector(); for (auto start_period : start_periods) { ChargingSchedulePeriod charging_schedule_period; @@ -84,49 +78,6 @@ class ChargePointCommonTestFixtureV2 : public DatabaseTestingUtils { return charging_schedule_periods; } - ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit, - std::vector charging_schedule_period, - std::optional start_schedule = std::nullopt) { - int32_t id; - std::optional custom_data; - std::optional duration; - std::optional min_charging_rate; - std::optional sales_tariff; - - return ChargingSchedule{ - id, - charging_rate_unit, - charging_schedule_period, - custom_data, - start_schedule, - duration, - min_charging_rate, - sales_tariff, - }; - } - - ChargingProfile - create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, - ChargingSchedule charging_schedule, std::optional transaction_id = {}, - ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, - int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, - std::optional validTo = {}) { - auto recurrency_kind = RecurrencyKindEnum::Daily; - std::vector charging_schedules = {charging_schedule}; - ChargingProfile charging_profile; - charging_profile.id = charging_profile_id; - charging_profile.stackLevel = stack_level; - charging_profile.chargingProfilePurpose = charging_profile_purpose; - charging_profile.chargingProfileKind = charging_profile_kind; - charging_profile.chargingSchedule = charging_schedules; - charging_profile.customData = {}; - charging_profile.recurrencyKind = recurrency_kind; - charging_profile.validFrom = validFrom; - charging_profile.validTo = validTo; - charging_profile.transactionId = transaction_id; - return charging_profile; - } - std::shared_ptr create_database_handler() { auto database_connection = std::make_unique(fs::path("/tmp/ocpp201") / "cp.db"); return std::make_shared(std::move(database_connection), MIGRATION_FILES_LOCATION_V2); @@ -185,8 +136,8 @@ class ChargePointCommonTestFixtureV2 : public DatabaseTestingUtils { testing::MockFunction remote_start_transaction_callback_mock; - testing::MockFunction idToken, - const std::optional> groupIdToken)> + testing::MockFunction idToken, + const std::optional> groupIdToken)> is_reservation_for_token_callback_mock; testing::MockFunction update_firmware_request_callback_mock; @@ -701,7 +652,7 @@ TEST_F(ChargePointFunctionalityTestFixtureV2, RequestStartTransactionRequest req; req.evseId = DEFAULT_EVSE_ID; req.idToken.idToken = "Local"; - req.idToken.type = IdTokenEnum::Local; + req.idToken.type = IdTokenEnumStringType::Local; req.chargingProfile = profile; auto start_transaction_req = @@ -729,7 +680,7 @@ TEST_F(ChargePointFunctionalityTestFixtureV2, RequestStartTransactionRequest req; req.evseId = DEFAULT_EVSE_ID; req.idToken.idToken = "Local"; - req.idToken.type = IdTokenEnum::Local; + req.idToken.type = IdTokenEnumStringType::Local; req.chargingProfile = profile; auto start_transaction_req = diff --git a/tests/lib/ocpp/v2/test_composite_schedule.cpp b/tests/lib/ocpp/v2/test_composite_schedule.cpp index 0bad8fe5a..f042251eb 100644 --- a/tests/lib/ocpp/v2/test_composite_schedule.cpp +++ b/tests/lib/ocpp/v2/test_composite_schedule.cpp @@ -1,16 +1,8 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2024 Pionix GmbH and Contributors to EVerest - -#include "connectivity_manager_mock.hpp" -#include "database_handler_mock.hpp" -#include "date/tz.h" -#include "device_model_test_helper.hpp" -#include "everest/logging.hpp" -#include "lib/ocpp/common/database_testing_utils.hpp" -#include "message_dispatcher_mock.hpp" +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest + #include "ocpp/common/constants.hpp" #include "ocpp/common/types.hpp" -#include "ocpp/v2/ctrlr_component_variables.hpp" #include "ocpp/v2/device_model.hpp" #include "ocpp/v2/device_model_storage_sqlite.hpp" #include "ocpp/v2/functional_blocks/functional_block_context.hpp" @@ -18,29 +10,21 @@ #include "ocpp/v2/init_device_model_db.hpp" #include "ocpp/v2/ocpp_types.hpp" #include "ocpp/v2/utils.hpp" + #include -#include -#include #include #include -#include #include #include #include #include #include -#include -#include -#include -#include #include #include #include -#include "mocks/database_handler_fake.hpp" - #include "smart_charging_matchers.hpp" #include "smart_charging_test_utils.hpp" @@ -48,182 +32,7 @@ #include namespace ocpp::v2 { -static const int NR_OF_EVSES = 1; -static const int STATION_WIDE_ID = 0; -static const int DEFAULT_EVSE_ID = 1; -static const int DEFAULT_PROFILE_ID = 1; -static const int DEFAULT_STACK_LEVEL = 1; -constexpr int32_t DEFAULT_LIMIT_AMPERE = 57; -constexpr int32_t DEFAULT_LIMIT_WATT = 55612; -constexpr int32_t DEFAULT_NR_PHASES = 3; -static const std::string DEFAULT_TX_ID = "f1522902-1170-416f-8e43-9e3bce28fde7"; -static const std::string MIGRATION_FILES_PATH = "./resources/v2/device_model_migration_files"; -static const std::string CONFIG_PATH = "./resources/example_config/v2/component_config"; -static const std::string DEVICE_MODEL_DB_IN_MEMORY_PATH = "file::memory:?cache=shared"; - -using ::testing::MockFunction; - -class TestSmartCharging : public SmartCharging { -public: - using SmartCharging::calculate_composite_schedule; - using SmartCharging::validate_charging_station_max_profile; - using SmartCharging::validate_evse_exists; - using SmartCharging::validate_profile_schedules; - using SmartCharging::validate_tx_default_profile; - using SmartCharging::validate_tx_profile; - - using SmartCharging::SmartCharging; -}; - -class CompositeScheduleTestFixtureV2 : public DatabaseTestingUtils { -protected: - void SetUp() override { - } - - void TearDown() override { - } - - ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit) { - int32_t id = 0; - std::vector charging_schedule_period; - std::optional custom_data; - std::optional start_schedule; - std::optional duration; - std::optional min_charging_rate; - std::optional sales_tariff; - - return ChargingSchedule{ - id, - charging_rate_unit, - charging_schedule_period, - custom_data, - start_schedule, - duration, - min_charging_rate, - sales_tariff, - }; - } - - ChargingSchedule create_charge_schedule(ChargingRateUnitEnum charging_rate_unit, - std::vector charging_schedule_period, - std::optional start_schedule = std::nullopt) { - int32_t id; - std::optional custom_data; - std::optional duration; - std::optional min_charging_rate; - std::optional sales_tariff; - - return ChargingSchedule{ - id, - charging_rate_unit, - charging_schedule_period, - custom_data, - start_schedule, - duration, - min_charging_rate, - sales_tariff, - }; - } - - ChargingProfile - create_charging_profile(int32_t charging_profile_id, ChargingProfilePurposeEnum charging_profile_purpose, - ChargingSchedule charging_schedule, std::optional transaction_id = {}, - ChargingProfileKindEnum charging_profile_kind = ChargingProfileKindEnum::Absolute, - int stack_level = DEFAULT_STACK_LEVEL, std::optional validFrom = {}, - std::optional validTo = {}) { - auto recurrency_kind = RecurrencyKindEnum::Daily; - std::vector charging_schedules = {charging_schedule}; - ChargingProfile charging_profile; - charging_profile.id = charging_profile_id; - charging_profile.stackLevel = stack_level; - charging_profile.chargingProfilePurpose = charging_profile_purpose; - charging_profile.chargingProfileKind = charging_profile_kind; - charging_profile.chargingSchedule = charging_schedules; - charging_profile.customData = {}; - charging_profile.recurrencyKind = recurrency_kind; - charging_profile.validFrom = validFrom; - charging_profile.validTo = validTo; - charging_profile.transactionId = transaction_id; - return charging_profile; - } - - void load_charging_profiles_for_evse(const std::filesystem::path& path, int32_t evse_id) { - std::vector profiles = std::filesystem::is_directory(path) - ? SmartChargingTestUtils::get_charging_profiles_from_directory(path) - : SmartChargingTestUtils::get_charging_profiles_from_file(path); - - ON_CALL(*database_handler, get_charging_profiles_for_evse(evse_id)).WillByDefault(testing::Return(profiles)); - } - - CompositeScheduleTestFixtureV2() : - evse_manager(std::make_unique(NR_OF_EVSES)), - device_model_test_helper(), - mock_dispatcher(), - device_model(device_model_test_helper.get_device_model()), - connectivity_manager(), - set_charging_profiles_callback_mock(), - functional_block_context(nullptr), - handler(create_smart_charging_handler()), - uuid_generator(boost::uuids::random_generator()) { - - const auto& charging_rate_unit_cv = ControllerComponentVariables::ChargingScheduleChargingRateUnit; - device_model->set_value(charging_rate_unit_cv.component, charging_rate_unit_cv.variable.value(), - AttributeEnum::Actual, "A,W", "test", true); - - const auto& ac_phase_switching_cv = ControllerComponentVariables::ACPhaseSwitchingSupported; - device_model->set_value(ac_phase_switching_cv.component, ac_phase_switching_cv.variable.value(), - AttributeEnum::Actual, "true", "test", true); - - const auto& default_limit_amps_cv = ControllerComponentVariables::CompositeScheduleDefaultLimitAmps; - device_model->set_value(default_limit_amps_cv.component, default_limit_amps_cv.variable.value(), - AttributeEnum::Actual, std::to_string(DEFAULT_LIMIT_AMPERE), "test", true); - - const auto& default_limit_watts_cv = ControllerComponentVariables::CompositeScheduleDefaultLimitWatts; - device_model->set_value(default_limit_watts_cv.component, default_limit_watts_cv.variable.value(), - AttributeEnum::Actual, std::to_string(DEFAULT_LIMIT_WATT), "test", true); - - const auto& default_limit_phases_cv = ControllerComponentVariables::CompositeScheduleDefaultNumberPhases; - device_model->set_value(default_limit_phases_cv.component, default_limit_phases_cv.variable.value(), - AttributeEnum::Actual, std::to_string(DEFAULT_NR_PHASES), "test", true); - } - - std::unique_ptr create_smart_charging_handler() { - std::unique_ptr database_connection = - std::make_unique(fs::path("/tmp/ocpp201") / "cp.db"); - this->database_handler = - std::make_unique(std::move(database_connection), MIGRATION_FILES_LOCATION_V2); - database_handler->open_connection(); - this->functional_block_context = std::make_unique( - this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager, - *this->database_handler, this->evse_security, this->component_state_manager); - return std::make_unique(*functional_block_context, - set_charging_profiles_callback_mock.AsStdFunction()); - } - - void reconfigure_for_nr_of_evses(int32_t nr_of_evses) { - this->evse_manager = std::make_unique(nr_of_evses); - this->functional_block_context = std::make_unique( - this->mock_dispatcher, *this->device_model, this->connectivity_manager, *this->evse_manager, - *this->database_handler, this->evse_security, this->component_state_manager); - this->handler = std::make_unique(*functional_block_context, - set_charging_profiles_callback_mock.AsStdFunction()); - } - - // Default values used within the tests - std::unique_ptr evse_manager; - - DeviceModelTestHelper device_model_test_helper; - MockMessageDispatcher mock_dispatcher; - DeviceModel* device_model; - ::testing::NiceMock connectivity_manager; - std::unique_ptr database_handler{}; - ocpp::EvseSecurityMock evse_security; - ComponentStateManagerMock component_state_manager; - MockFunction set_charging_profiles_callback_mock; - std::unique_ptr functional_block_context; - std::unique_ptr handler; - boost::uuids::random_generator uuid_generator = boost::uuids::random_generator(); -}; +static const std::string TX_ID = "f1522902-1170-416f-8e43-9e3bce28fde7"; TEST_F(CompositeScheduleTestFixtureV2, NoSchedulesPresent) { const DateTime start_time = ocpp::DateTime("2024-01-02T00:00:00"); @@ -274,7 +83,7 @@ TEST_F(CompositeScheduleTestFixtureV2, ExtraSeconds) { TEST_F(CompositeScheduleTestFixtureV2, FoundationTest_Grid) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/grid/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T00:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-18T00:00:00"); @@ -392,7 +201,7 @@ TEST_F(CompositeScheduleTestFixtureV2, FoundationTest_Grid) { TEST_F(CompositeScheduleTestFixtureV2, LayeredTest_SameStartTime) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/layered/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); // Time Window: START = Stack #1 start time || END = Stack #1 end time { @@ -477,7 +286,7 @@ TEST_F(CompositeScheduleTestFixtureV2, LayeredTest_SameStartTime) { TEST_F(CompositeScheduleTestFixtureV2, LayeredRecurringTest_FutureStartTime) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/layered_recurring/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-02-17T18:04:00"); const DateTime end_time = ocpp::DateTime("2024-02-17T18:05:00"); @@ -502,7 +311,7 @@ TEST_F(CompositeScheduleTestFixtureV2, LayeredRecurringTest_FutureStartTime) { TEST_F(CompositeScheduleTestFixtureV2, LayeredTest_PreviousStartTime) { this->load_charging_profiles_for_evse("singles/TXProfile_Absolute_Start18-04.json", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T18:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-17T18:05:00"); @@ -529,7 +338,7 @@ TEST_F(CompositeScheduleTestFixtureV2, LayeredTest_PreviousStartTime) { TEST_F(CompositeScheduleTestFixtureV2, LayeredRecurringTest_PreviousStartTime) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/layered_recurring/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-02-19T18:00:00"); const DateTime end_time = ocpp::DateTime("2024-02-19T19:04:00"); @@ -573,7 +382,7 @@ TEST_F(CompositeScheduleTestFixtureV2, ValidateBaselineProfileVector) { ON_CALL(*database_handler, get_charging_profiles_for_evse(DEFAULT_EVSE_ID)) .WillByDefault(testing::Return(profiles)); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); ChargingSchedulePeriod period1; period1.startPeriod = 0; @@ -606,7 +415,7 @@ TEST_F(CompositeScheduleTestFixtureV2, RelativeProfile_minutia) { const DateTime start_time = ocpp::DateTime("2024-05-17T05:00:00"); const DateTime end_time = ocpp::DateTime("2024-05-17T06:00:00"); - this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + this->evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); this->evse_manager->get_evse(DEFAULT_EVSE_ID).get_transaction()->start_time = start_time; ChargingSchedulePeriod period; @@ -632,7 +441,7 @@ TEST_F(CompositeScheduleTestFixtureV2, RelativeProfile_e2e) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/relative/", DEFAULT_EVSE_ID); - this->evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + this->evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); this->evse_manager->get_evse(DEFAULT_EVSE_ID).get_transaction()->start_time = start_time; ChargingSchedulePeriod period1; @@ -659,7 +468,7 @@ TEST_F(CompositeScheduleTestFixtureV2, RelativeProfile_e2e) { TEST_F(CompositeScheduleTestFixtureV2, DemoCaseOne_17th) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/case_one/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T18:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-18T06:00:00"); @@ -692,7 +501,7 @@ TEST_F(CompositeScheduleTestFixtureV2, DemoCaseOne_17th) { TEST_F(CompositeScheduleTestFixtureV2, DemoCaseOne_19th) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/case_one/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-19T18:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-20T06:00:00"); @@ -722,7 +531,7 @@ TEST_F(CompositeScheduleTestFixtureV2, MaxOverridesHigherLimits) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/max/0/", STATION_WIDE_ID); this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/max/1/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T00:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-17T02:00:00"); @@ -751,7 +560,7 @@ TEST_F(CompositeScheduleTestFixtureV2, MaxOverridenByLowerLimits) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/max/0/", STATION_WIDE_ID); this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/max/1/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T22:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-18T00:00:00"); @@ -780,7 +589,7 @@ TEST_F(CompositeScheduleTestFixtureV2, ExternalOverridesHigherLimits) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/external/0/", STATION_WIDE_ID); this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/external/1/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T00:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-17T02:00:00"); @@ -809,7 +618,7 @@ TEST_F(CompositeScheduleTestFixtureV2, ExternalOverridenByLowerLimits) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/external/0/", STATION_WIDE_ID); this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/external/1/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-01-17T22:00:00"); const DateTime end_time = ocpp::DateTime("2024-01-18T00:00:00"); @@ -838,7 +647,7 @@ TEST_F(CompositeScheduleTestFixtureV2, OCTT_TC_K_41_CS) { this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/OCCT_TC_K_41_CS/0/", STATION_WIDE_ID); this->load_charging_profiles_for_evse(BASE_JSON_PATH + "/OCCT_TC_K_41_CS/1/", DEFAULT_EVSE_ID); - evse_manager->open_transaction(DEFAULT_EVSE_ID, DEFAULT_TX_ID); + evse_manager->open_transaction(DEFAULT_EVSE_ID, TX_ID); const DateTime start_time = ocpp::DateTime("2024-08-21T12:24:40"); const DateTime end_time = ocpp::DateTime("2024-08-21T12:31:20"); diff --git a/tests/lib/ocpp/v2/test_database_handler.cpp b/tests/lib/ocpp/v2/test_database_handler.cpp index f9e437fb7..8673b8cdb 100644 --- a/tests/lib/ocpp/v2/test_database_handler.cpp +++ b/tests/lib/ocpp/v2/test_database_handler.cpp @@ -945,13 +945,14 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingProfileS profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::EMS); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::EMS); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); ChargingProfileCriterion criteria; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::CSO}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::CSO}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(std::nullopt, criteria); @@ -983,13 +984,14 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingProfileS profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::EMS); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::EMS); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); ChargingProfileCriterion criteria; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::CSO, ChargingLimitSourceEnum::EMS}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::CSO, ChargingLimitSourceEnumStringType::EMS}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(std::nullopt, criteria); @@ -1021,7 +1023,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::CSO); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::CSO); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); @@ -1029,7 +1032,7 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe ChargingProfileCriterion criteria; criteria.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; criteria.stackLevel = 2; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::CSO}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::CSO}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(std::nullopt, criteria); @@ -1061,7 +1064,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::CSO); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::CSO); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); @@ -1069,7 +1073,7 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe ChargingProfileCriterion criteria; criteria.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; criteria.stackLevel = 2; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::EMS}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::EMS}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(std::nullopt, criteria); @@ -1101,7 +1105,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::CSO); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::CSO); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); @@ -1109,7 +1114,7 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_AllCriteriaSetRe ChargingProfileCriterion criteria; criteria.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; criteria.stackLevel = 2; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::EMS}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::EMS}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(std::nullopt, criteria); @@ -1141,7 +1146,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteriaAndEvseId0_AllCri profile3.stackLevel = stack_level + 1; profile3.chargingProfilePurpose = ChargingProfilePurposeEnum::TxProfile; profile3.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, ChargingLimitSourceEnum::CSO); + this->database_handler.insert_or_update_charging_profile(DEFAULT_EVSE_ID, profile3, + ChargingLimitSourceEnumStringType::CSO); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 3); @@ -1149,7 +1155,7 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteriaAndEvseId0_AllCri ChargingProfileCriterion criteria; criteria.chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile; criteria.stackLevel = 2; - criteria.chargingLimitSource = {{ChargingLimitSourceEnum::CSO}}; + criteria.chargingLimitSource = {{ChargingLimitSourceEnumStringType::CSO}}; std::vector sut = this->database_handler.get_charging_profiles_matching_criteria(0, criteria); @@ -1204,7 +1210,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingProfileI profile2.stackLevel = stack_level + 1; profile2.chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile; profile2.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, ChargingLimitSourceEnum::EMS); + this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, + ChargingLimitSourceEnumStringType::EMS); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 2); @@ -1216,8 +1223,10 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingProfileI this->database_handler.get_charging_profiles_matching_criteria({}, criteria); EXPECT_EQ(sut.size(), 2); - EXPECT_THAT(sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnum::CSO))); - EXPECT_THAT(sut, testing::Contains(testing::FieldsAre(profile2, STATION_WIDE_ID, ChargingLimitSourceEnum::EMS))); + EXPECT_THAT( + sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnumStringType::CSO))); + EXPECT_THAT( + sut, testing::Contains(testing::FieldsAre(profile2, STATION_WIDE_ID, ChargingLimitSourceEnumStringType::EMS))); } TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingCriteria_ReturnsEVSEAndSource) { @@ -1236,7 +1245,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingCriteria profile2.stackLevel = stack_level + 1; profile2.chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile; profile2.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, ChargingLimitSourceEnum::EMS); + this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, + ChargingLimitSourceEnumStringType::EMS); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 2); @@ -1248,8 +1258,10 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_MatchingCriteria this->database_handler.get_charging_profiles_matching_criteria({}, criteria); EXPECT_EQ(sut.size(), 2); - EXPECT_THAT(sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnum::CSO))); - EXPECT_THAT(sut, testing::Contains(testing::FieldsAre(profile2, STATION_WIDE_ID, ChargingLimitSourceEnum::EMS))); + EXPECT_THAT( + sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnumStringType::CSO))); + EXPECT_THAT( + sut, testing::Contains(testing::FieldsAre(profile2, STATION_WIDE_ID, ChargingLimitSourceEnumStringType::EMS))); } TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_OnlyEVSEIDSet_ReturnsProfileOnEVSE) { @@ -1268,7 +1280,8 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_OnlyEVSEIDSet_Re profile2.stackLevel = stack_level + 1; profile2.chargingProfilePurpose = ChargingProfilePurposeEnum::TxDefaultProfile; profile2.chargingProfileKind = ChargingProfileKindEnum::Absolute; - this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, ChargingLimitSourceEnum::EMS); + this->database_handler.insert_or_update_charging_profile(STATION_WIDE_ID, profile2, + ChargingLimitSourceEnumStringType::EMS); auto profiles = this->database_handler.get_all_charging_profiles(); EXPECT_EQ(profiles.size(), 2); @@ -1277,5 +1290,6 @@ TEST_F(DatabaseHandlerTest, GetChargingProfilesMatchingCriteria_OnlyEVSEIDSet_Re this->database_handler.get_charging_profiles_matching_criteria(DEFAULT_EVSE_ID, {}); EXPECT_EQ(sut.size(), 1); - EXPECT_THAT(sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnum::CSO))); -} \ No newline at end of file + EXPECT_THAT( + sut, testing::Contains(testing::FieldsAre(profile1, DEFAULT_EVSE_ID, ChargingLimitSourceEnumStringType::CSO))); +} diff --git a/tests/lib/ocpp/v2/test_device_model.cpp b/tests/lib/ocpp/v2/test_device_model.cpp index 27b7621eb..3e2911b5e 100644 --- a/tests/lib/ocpp/v2/test_device_model.cpp +++ b/tests/lib/ocpp/v2/test_device_model.cpp @@ -1,7 +1,10 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest +// Copyright 2020 - 2025 Pionix GmbH and Contributors to EVerest #include + +#include + #include #include #include @@ -11,29 +14,54 @@ namespace v2 { class DeviceModelTest : public ::testing::Test { protected: - const std::string DEVICE_MODEL_DATABASE = "./resources/unittest_device_model.db"; - std::unique_ptr dm; + DeviceModelTestHelper device_model_test_helper; + DeviceModel* dm; const RequiredComponentVariable cv = ControllerComponentVariables::AlignedDataInterval; + const std::map evse_connector_structure{{1, 1}, {2, 1}}; - void SetUp() override { - dm = - std::make_unique(std::move(std::make_unique(DEVICE_MODEL_DATABASE))); - } - - void TearDown() override { - // reset the value to default - dm->set_value(cv.component, cv.variable.value(), ocpp::v2::AttributeEnum::Actual, "10", "test"); + DeviceModelTest() : device_model_test_helper(), dm(device_model_test_helper.get_device_model()) { } }; +/// \brief Test if value can be changed. And test if setting a value of 0 is allowed for a value that is allowed to be +/// 0. +TEST_F(DeviceModelTest, test_set_value_and_allow_zero) { + // default value is 900 + auto r = dm->get_value(cv, ocpp::v2::AttributeEnum::Actual); + ASSERT_EQ(r, 900); + + // try to set to 2, which is allowed because there is no minLimit + auto sv_result = dm->set_value(cv.component, cv.variable.value(), ocpp::v2::AttributeEnum::Actual, "2", "test"); + ASSERT_EQ(sv_result, SetVariableStatusEnum::Accepted); + + // try to set to 0, which is allowed because 0 is an exception + sv_result = dm->set_value(cv.component, cv.variable.value(), ocpp::v2::AttributeEnum::Actual, "0", "test"); + ASSERT_EQ(sv_result, SetVariableStatusEnum::Accepted); + + r = dm->get_value(cv, ocpp::v2::AttributeEnum::Actual); + ASSERT_EQ(r, 0); +} + /// \brief Test if value of 0 is allowed for ControllerComponentVariables::AlignedDataInterval although the minLimit is /// set to 5 -TEST_F(DeviceModelTest, test_allow_zero) { - // default value is 10 +TEST_F(DeviceModelTest, test_min_limit_and_allow_zero) { + // Set a min limit to 'Interval' of 'AlignedDataCtrlr'. + VariableCharacteristics c; + c.minLimit = 10; + c.dataType = DataEnum::integer; + c.supportsMonitoring = true; + c.unit = "s"; + + device_model_test_helper.update_variable_characteristics(c, "AlignedDataCtrlr", std::nullopt, std::nullopt, + std::nullopt, "Interval", std::nullopt); + + dm = device_model_test_helper.get_device_model(); + + // default value is 900 auto r = dm->get_value(cv, ocpp::v2::AttributeEnum::Actual); - ASSERT_EQ(r, 10); + ASSERT_EQ(r, 900); - // try to set to value of 2, which is not allowed because minLimit of + // try to set to 2, which is not allowed because minLimit of 10 auto sv_result = dm->set_value(cv.component, cv.variable.value(), ocpp::v2::AttributeEnum::Actual, "2", "test"); ASSERT_EQ(sv_result, SetVariableStatusEnum::Rejected); @@ -86,24 +114,24 @@ TEST_F(DeviceModelTest, test_set_monitors) { std::vector requests; EVSE evse; - evse.id = 2; - evse.connectorId = 3; + evse.id = 1; + evse.connectorId = 1; Component component1; - component1.name = "UnitTestCtrlr"; + component1.name = "Connector"; component1.evse = evse; Component component2; component2.name = "AlignedDataCtrlr"; Variable variable_comp1; - variable_comp1.name = "UnitTestPropertyAName"; + variable_comp1.name = "SupplyPhases"; Variable variable_comp2; variable_comp2.name = "Interval"; std::vector components = { - {component1, std::nullopt, variable_comp1}, - {component2, std::nullopt, variable_comp2}, + {component1, variable_comp1}, + {component2, variable_comp2}, }; // Clear all existing monitors for a clean test state @@ -136,11 +164,23 @@ TEST_F(DeviceModelTest, test_set_monitors) { ASSERT_EQ(results.size(), requests.size()); ASSERT_EQ(results[0].status, SetMonitoringStatusEnum::Accepted); - // Interval does not support monitoring + // Interval is not a float but an integer. ASSERT_EQ(results[1].status, SetMonitoringStatusEnum::Rejected); } TEST_F(DeviceModelTest, test_get_monitors) { + // Set 'Interval' to not support monitoring. + VariableCharacteristics c; + c.minLimit = 10; + c.dataType = DataEnum::integer; + c.supportsMonitoring = false; + c.unit = "s"; + + device_model_test_helper.update_variable_characteristics(c, "AlignedDataCtrlr", std::nullopt, std::nullopt, + std::nullopt, "Interval", std::nullopt); + + dm = device_model_test_helper.get_device_model(); + std::vector criteria = { MonitoringCriterionEnum::DeltaMonitoring, MonitoringCriterionEnum::PeriodicMonitoring, @@ -148,39 +188,51 @@ TEST_F(DeviceModelTest, test_get_monitors) { }; EVSE evse; - evse.id = 2; - evse.connectorId = 3; + evse.id = 1; + evse.connectorId = 1; Component component1; - component1.name = "UnitTestCtrlr"; + component1.name = "Connector"; component1.evse = evse; Component component2; component2.name = "AlignedDataCtrlr"; Variable variable_comp1; - variable_comp1.name = "UnitTestPropertyAName"; + variable_comp1.name = "SupplyPhases"; Variable variable_comp2; variable_comp2.name = "Interval"; std::vector components = { - {component1, std::nullopt, variable_comp1}, - {component2, std::nullopt, variable_comp2}, + {component1, variable_comp1}, + {component2, variable_comp2}, }; - auto results = dm->get_monitors(criteria, components); - ASSERT_EQ(results.size(), 1); - - ASSERT_EQ(results[0].variableMonitoring.size(), 1); - auto monitor1 = results[0].variableMonitoring[0]; - - // Valued used above SetMonitoringData req_one; req_one.value = 0.0; req_one.type = MonitorEnum::PeriodicClockAligned; req_one.severity = 7; req_one.component = component1; req_one.variable = variable_comp1; + SetMonitoringData req_two; + req_two.value = 4.579; + req_two.type = MonitorEnum::UpperThreshold; + req_two.severity = 3; + req_two.component = component2; + req_two.variable = variable_comp2; + + std::vector requests; + requests.push_back(req_one); + requests.push_back(req_two); + + auto results_set = dm->set_monitors(requests); + ASSERT_EQ(results_set.size(), requests.size()); + + auto results_get = dm->get_monitors(criteria, components); + ASSERT_EQ(results_get.size(), 1); + + ASSERT_EQ(results_get[0].variableMonitoring.size(), 1); + auto monitor1 = results_get[0].variableMonitoring[0]; ASSERT_EQ(monitor1.severity, 7); ASSERT_EQ(monitor1.type, MonitorEnum::PeriodicClockAligned); @@ -194,25 +246,44 @@ TEST_F(DeviceModelTest, test_clear_monitors) { }; EVSE evse; - evse.id = 2; - evse.connectorId = 3; + evse.id = 1; + evse.connectorId = 1; Component component1; - component1.name = "UnitTestCtrlr"; + component1.name = "Connector"; component1.evse = evse; Component component2; component2.name = "AlignedDataCtrlr"; Variable variable_comp1; - variable_comp1.name = "UnitTestPropertyAName"; + variable_comp1.name = "SupplyPhases"; Variable variable_comp2; variable_comp2.name = "Interval"; std::vector components = { - {component1, std::nullopt, variable_comp1}, - {component2, std::nullopt, variable_comp2}, + {component1, variable_comp1}, + {component2, variable_comp2}, }; + SetMonitoringData req_one; + req_one.value = 0.0; + req_one.type = MonitorEnum::PeriodicClockAligned; + req_one.severity = 7; + req_one.component = component1; + req_one.variable = variable_comp1; + SetMonitoringData req_two; + req_two.value = 4.579; + req_two.type = MonitorEnum::UpperThreshold; + req_two.severity = 3; + req_two.component = component2; + req_two.variable = variable_comp2; + + std::vector requests; + requests.push_back(req_one); + requests.push_back(req_two); + + auto results_set = dm->set_monitors(requests); + // Insert some monitors that are hard-wired SetMonitoringData hardwired_one; hardwired_one.value = 0.0; @@ -227,11 +298,11 @@ TEST_F(DeviceModelTest, test_clear_monitors) { hardwired_two.component = component2; hardwired_two.variable = variable_comp2; - std::vector requests; - requests.push_back(hardwired_one); - requests.push_back(hardwired_two); + std::vector requests2; + requests2.push_back(hardwired_one); + requests2.push_back(hardwired_two); - auto set_result = dm->set_monitors(requests, VariableMonitorType::HardWiredMonitor); + auto set_result = dm->set_monitors(requests2, VariableMonitorType::HardWiredMonitor); std::vector hardwired_monitor_ids; ASSERT_EQ(set_result.size(), 2); @@ -276,5 +347,121 @@ TEST_F(DeviceModelTest, test_clear_monitors) { dm->clear_monitors(hardwired_monitor_ids, true); } +/// \brief Tests check_integrity does not raise error for valid database +TEST_F(DeviceModelTest, test_check_integrity_valid) { + EXPECT_NO_THROW(dm->check_integrity(evse_connector_structure)); +} + +/// \brief Tests check_integrity raises exception for invalid database +TEST_F(DeviceModelTest, test_check_integrity_invalid_missing_required_variable) { + // Remove a required variable from the databsae. + device_model_test_helper.remove_variable_from_db("DisplayMessageCtrlr", std::nullopt, std::nullopt, std::nullopt, + "DisplayMessages", std::nullopt); + dm = device_model_test_helper.get_device_model(); + // Set the display message ctrlr to available. + dm->set_value(ControllerComponentVariables::DisplayMessageCtrlrAvailable.component, + ControllerComponentVariables::DisplayMessageCtrlrAvailable.variable.value(), AttributeEnum::Actual, + "true", "test", true); + // This should throw an exception as the display message ctrlr is available, but there is a required variable + // missing. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + // Set display message ctrlr to unavailable. + dm->set_value(ControllerComponentVariables::DisplayMessageCtrlrAvailable.component, + ControllerComponentVariables::DisplayMessageCtrlrAvailable.variable.value(), AttributeEnum::Actual, + "false", "test", true); + + // This should now pass. + EXPECT_NO_THROW(dm->check_integrity(evse_connector_structure)); + + // If we completely remove the variable. + device_model_test_helper.remove_variable_from_db("DisplayMessageCtrlr", std::nullopt, std::nullopt, std::nullopt, + "Available", std::nullopt); + dm = device_model_test_helper.get_device_model(); + // Then it should pass as well. + EXPECT_NO_THROW(dm->check_integrity(evse_connector_structure)); +} + +TEST_F(DeviceModelTest, test_check_integrity_invalid_missing_required_variable_value) { + // Remove a required variable value from the database + device_model_test_helper.set_variable_attribute_value_null("SecurityCtrlr", std::nullopt, std::nullopt, + std::nullopt, "OrganizationName", std::nullopt, + AttributeEnum::Actual); + // This should throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + +TEST_F(DeviceModelTest, test_check_integrity_no_supported_versions_found) { + // There are no known supported ocpp versions. + dm->set_value(ControllerComponentVariables::SupportedOcppVersions.component, + ControllerComponentVariables::SupportedOcppVersions.variable.value(), AttributeEnum::Actual, "", + "test", true); + + // This should throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + +TEST_F(DeviceModelTest, test_check_integrity_wrong_connector_structure) { + std::map evse_connector_structure{{1, 3}, {2, 1}, {3, 1}}; + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + evse_connector_structure = std::map{{1, 3}, {2, 1}}; + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + evse_connector_structure = std::map{{1, 1}}; + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + +TEST_F(DeviceModelTest, test_check_integrity_missing_required_evse_variable) { + // Set required EVSE variable value to NULL. + device_model_test_helper.set_variable_attribute_value_null("EVSE", std::nullopt, 1, std::nullopt, "SupplyPhases", + std::nullopt, AttributeEnum::Actual); + dm = device_model_test_helper.get_device_model(); + // This should throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + // Now remove the complete variable. + device_model_test_helper.remove_variable_from_db("EVSE", std::nullopt, 1, std::nullopt, "SupplyPhases", + std::nullopt); + dm = device_model_test_helper.get_device_model(); + // This should also throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + +TEST_F(DeviceModelTest, test_check_integrity_missing_required_connector_variable) { + // Set required EVSE variable value to NULL. + device_model_test_helper.set_variable_attribute_value_null("Connector", std::nullopt, 1, 1, "ConnectorType", + std::nullopt, AttributeEnum::Actual); + dm = device_model_test_helper.get_device_model(); + // This should throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + // Now remove the complete variable. + device_model_test_helper.remove_variable_from_db("Connector", std::nullopt, 1, 1, "ConnectorType", std::nullopt); + dm = device_model_test_helper.get_device_model(); + // This should also throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + +TEST_F(DeviceModelTest, test_check_integrity_missing_required_evse_power) { + // Remove maxLimit of 'Power' variable of EVSE. + VariableCharacteristics c; + c.maxLimit = std::nullopt; + c.dataType = DataEnum::decimal; + c.supportsMonitoring = true; + c.unit = "W"; + device_model_test_helper.update_variable_characteristics(c, "EVSE", std::nullopt, 1, std::nullopt, "Power", + std::nullopt); + dm = device_model_test_helper.get_device_model(); + // This should throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); + + // Now remove the complete variable. + device_model_test_helper.remove_variable_from_db("EVSE", std::nullopt, 1, std::nullopt, "Power", std::nullopt); + dm = device_model_test_helper.get_device_model(); + // This should also throw an exception. + EXPECT_THROW(dm->check_integrity(evse_connector_structure), DeviceModelError); +} + } // namespace v2 } // namespace ocpp diff --git a/tests/lib/ocpp/v2/test_device_model_storage_sqlite.cpp b/tests/lib/ocpp/v2/test_device_model_storage_sqlite.cpp index ba91a3ccd..6ff30c4d5 100644 --- a/tests/lib/ocpp/v2/test_device_model_storage_sqlite.cpp +++ b/tests/lib/ocpp/v2/test_device_model_storage_sqlite.cpp @@ -3,29 +3,44 @@ #include #include + +#include + +#include #include +#include namespace ocpp { namespace v2 { class DeviceModelStorageSQLiteTest : public ::testing::Test { protected: - const std::string DEVICE_MODEL_DATABASE = "./resources/unittest_device_model.db"; - const std::string INVALID_DEVICE_MODEL_DATABASE = "./resources/unittest_device_model_missing_required.db"; + const std::string DATABASE_PATH = "file::memory:?cache=shared"; + const std::string MIGRATION_FILES_PATH = "./resources/v2/device_model_migration_files"; + const std::string CONFIGS_PATH = "./resources/config/v2/component_config"; + DeviceModelTestHelper device_model_test_helper; + +public: + DeviceModelStorageSQLiteTest() : device_model_test_helper(DATABASE_PATH, MIGRATION_FILES_PATH, CONFIGS_PATH) { + } }; /// \brief Tests check_integrity does not raise error for valid database TEST_F(DeviceModelStorageSQLiteTest, test_check_integrity_valid) { + DeviceModelStorageSqlite dm(DATABASE_PATH, "", "", false); - auto dm_storage = DeviceModelStorageSqlite(DEVICE_MODEL_DATABASE); - dm_storage.check_integrity(); + EXPECT_NO_THROW(dm.check_integrity()); } /// \brief Tests check_integrity raises exception for invalid database TEST_F(DeviceModelStorageSQLiteTest, test_check_integrity_invalid) { - auto dm_storage = DeviceModelStorageSqlite(INVALID_DEVICE_MODEL_DATABASE); - EXPECT_THROW(dm_storage.check_integrity(), DeviceModelError); + device_model_test_helper.remove_variable_from_db("DisplayMessageCtrlr", std::nullopt, std::nullopt, std::nullopt, + "NumberOfDisplayMessages", std::nullopt); + + DeviceModelStorageSqlite dm(DATABASE_PATH, "", "", false); + + EXPECT_NO_THROW(dm.check_integrity()); } } // namespace v2 diff --git a/tests/lib/ocpp/v2/test_init_device_model_db.cpp b/tests/lib/ocpp/v2/test_init_device_model_db.cpp index 7ab997745..23841b6d2 100644 --- a/tests/lib/ocpp/v2/test_init_device_model_db.cpp +++ b/tests/lib/ocpp/v2/test_init_device_model_db.cpp @@ -426,25 +426,6 @@ TEST_F(InitDeviceModelDbTest, default_device_model_config) { EXPECT_NO_THROW(db.initialize_database(CONFIG_PATH_DEFAULT, true)); } -TEST_F(InitDeviceModelDbTest, missing_required_values) { - // Test if initializing fails when there is a missing required value. - InitDeviceModelDb db(DATABASE_PATH, MIGRATION_FILES_PATH); - try { - db.initialize_database(CONFIGS_PATH_REQUIRED_NO_VALUE, true); - FAIL() << "Expected InitDeviceModelDbError, but no exception was thrown"; - } catch (const InitDeviceModelDbError& exception) { - EXPECT_EQ(std::string(exception.what()), "Check integrity failed:\n" - "- Component UnitTestCtrlr, evse 2, connector 3\n" - " - Variable UnitTestPropertyAName, errors:\n" - " - No value set for Actual attribute for required variable.\n" - " - Variable UnitTestPropertyCName, errors:\n" - " - Could not find required Actual attribute.\n"); - } catch (const std::exception& exception) { - FAIL() << "Expected InitDeviceModelDbError, but exception of type " << typeid(exception).name() - << " was thrown"; - } -} - TEST_F(InitDeviceModelDbTest, wrong_type) { // Test if initializing fails when there is a missing required value. InitDeviceModelDb db(DATABASE_PATH, MIGRATION_FILES_PATH); diff --git a/tests/lib/ocpp/v2/test_profile.cpp b/tests/lib/ocpp/v2/test_profile.cpp index a443c4d44..93f7e4bfc 100644 --- a/tests/lib/ocpp/v2/test_profile.cpp +++ b/tests/lib/ocpp/v2/test_profile.cpp @@ -26,11 +26,15 @@ using std::nullopt; using std::chrono::minutes; using std::chrono::seconds; +// it was required to introduce this default because the `limit` property became optional in the 2.1 message +auto FIXME_DEFAULT_LIMIT = 0; + period_entry_t gen_pe(ocpp::DateTime start, ocpp::DateTime end, ChargingProfile profile, int period_at) { period_entry_t period_entry; period_entry.start = start; period_entry.end = end; - period_entry.limit = profile.chargingSchedule.front().chargingSchedulePeriod[period_at].limit; + period_entry.limit = + profile.chargingSchedule.front().chargingSchedulePeriod[period_at].limit.value_or(FIXME_DEFAULT_LIMIT); period_entry.stack_level = profile.stackLevel; period_entry.charging_rate_unit = profile.chargingSchedule.front().chargingRateUnit; return period_entry; @@ -249,7 +253,8 @@ TEST_P(CalculateProfileEntryType_Param_Test, CalculateProfileEntry_Positive) { period_entry_t expected_entry; expected_entry.start = expected_start; expected_entry.end = expected_end; - expected_entry.limit = profile.chargingSchedule.front().chargingSchedulePeriod[period_index].limit; + expected_entry.limit = + profile.chargingSchedule.front().chargingSchedulePeriod[period_index].limit.value_or(FIXME_DEFAULT_LIMIT); expected_entry.stack_level = profile.stackLevel; expected_entry.charging_rate_unit = profile.chargingSchedule.front().chargingRateUnit; @@ -267,7 +272,8 @@ TEST_P(CalculateProfileEntryType_Param_Test, CalculateProfileEntry_Positive) { period_entry_t expected_second_entry; expected_second_entry.start = expected_2nd_entry_start.value(); expected_second_entry.end = expected_2nd_entry_end.value(); - expected_second_entry.limit = profile.chargingSchedule.front().chargingSchedulePeriod[period_index].limit; + expected_second_entry.limit = + profile.chargingSchedule.front().chargingSchedulePeriod[period_index].limit.value_or(FIXME_DEFAULT_LIMIT); expected_second_entry.stack_level = profile.stackLevel; expected_second_entry.charging_rate_unit = profile.chargingSchedule.front().chargingRateUnit; @@ -344,7 +350,8 @@ TEST(OCPPTypesTest, PeriodEntry_Equality) { period_entry_t actual_entry; actual_entry.start = dt("2T08:45"); actual_entry.end = dt("3T08:00"); - actual_entry.limit = absolute_profile.chargingSchedule.front().chargingSchedulePeriod[0].limit; + actual_entry.limit = + absolute_profile.chargingSchedule.front().chargingSchedulePeriod[0].limit.value_or(FIXME_DEFAULT_LIMIT); actual_entry.stack_level = absolute_profile.stackLevel; actual_entry.charging_rate_unit = absolute_profile.chargingSchedule.front().chargingRateUnit; period_entry_t same_entry = actual_entry; @@ -352,7 +359,8 @@ TEST(OCPPTypesTest, PeriodEntry_Equality) { period_entry_t different_entry; different_entry.start = dt("3T08:00"); different_entry.end = dt("3T08:00"); - different_entry.limit = absolute_profile.chargingSchedule.front().chargingSchedulePeriod[0].limit; + different_entry.limit = + absolute_profile.chargingSchedule.front().chargingSchedulePeriod[0].limit.value_or(FIXME_DEFAULT_LIMIT); different_entry.stack_level = absolute_profile.stackLevel; different_entry.charging_rate_unit = absolute_profile.chargingSchedule.front().chargingRateUnit; @@ -569,11 +577,11 @@ TEST(OCPPTypesTest, CalculateProfile_RelativeLimited) { TEST(OCPPTypesTest, ChargingSchedulePeriod_Equality) { ChargingSchedulePeriod period1; period1.startPeriod = 0; - period1.limit = NO_LIMIT_SPECIFIED; + period1.limit = std::nullopt; ChargingSchedulePeriod period2; period2.startPeriod = 0; - period2.limit = NO_LIMIT_SPECIFIED; + period2.limit = std::nullopt; ASSERT_EQ(period1, period1); ASSERT_EQ(period1, period2);