diff --git a/config/v201/component_config/standardized/InternalCtrlr.json b/config/v201/component_config/standardized/InternalCtrlr.json index 59ad5ed86..f687dfba4 100644 --- a/config/v201/component_config/standardized/InternalCtrlr.json +++ b/config/v201/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/include/ocpp/common/constants.hpp b/include/ocpp/common/constants.hpp index 7124c517b..baf2ec890 100644 --- a/include/ocpp/common/constants.hpp +++ b/include/ocpp/common/constants.hpp @@ -20,7 +20,7 @@ constexpr float DEFAULT_LIMIT_WATTS = 33120.0; constexpr std::int32_t DEFAULT_AND_MAX_NUMBER_PHASES = 3; constexpr float LOW_VOLTAGE = 230; -constexpr float NO_LIMIT_SPECIFIED = -1.0; +// constexpr float NO_LIMIT_SPECIFIED = -1.0; constexpr std::int32_t NO_START_PERIOD = -1; constexpr std::int32_t EVSEID_NOT_SET = -1; diff --git a/include/ocpp/v201/charge_point.hpp b/include/ocpp/v201/charge_point.hpp index b02e54299..1b7a76cdf 100644 --- a/include/ocpp/v201/charge_point.hpp +++ b/include/ocpp/v201/charge_point.hpp @@ -282,7 +282,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 @@ -418,6 +418,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 FirmwareStatusEnum firmware_status; // The request ID in the last firmware update status received std::optional firmware_status_id; @@ -472,7 +474,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa void scheduled_check_client_certificate_expiration(); void scheduled_check_v2g_certificate_expiration(); 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); @@ -555,7 +558,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa /// \param connector_type The connector type. /// \return True when a connector is available and the evse id exists. /// - bool is_connector_available(const uint32_t evse_id, std::optional connector_type); + bool is_connector_available(const uint32_t evse_id, std::optional> connector_type); /// /// \brief Check if the connector exists on the given evse id. @@ -563,7 +566,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa /// \param connector_type The connector type. /// \return False if evse id does not exist or evse does not have the given connector type. /// - bool does_connector_exist(const uint32_t evse_id, std::optional connector_type); + bool does_connector_exist(const uint32_t evse_id, std::optional> connector_type); /// \brief Get the value optional offline flag /// \return true if the charge point is offline. std::nullopt if it is online; @@ -652,9 +655,8 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa const bool initiated_by_trigger_message = false); // Functional Block K: Smart Charging - 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); // Functional Block N: Diagnostics @@ -871,7 +873,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/v201/charge_point_callbacks.hpp b/include/ocpp/v201/charge_point_callbacks.hpp index 0b49f276a..2c76b31a4 100644 --- a/include/ocpp/v201/charge_point_callbacks.hpp +++ b/include/ocpp/v201/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/v201/connectivity_manager.hpp b/include/ocpp/v201/connectivity_manager.hpp index 6f1c28898..f03ef235f 100644 --- a/include/ocpp/v201/connectivity_manager.hpp +++ b/include/ocpp/v201/connectivity_manager.hpp @@ -15,8 +15,15 @@ namespace v201 { 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/v201/constants.hpp b/include/ocpp/v201/constants.hpp index 1746c0b93..3d4a84cb7 100644 --- a/include/ocpp/v201/constants.hpp +++ b/include/ocpp/v201/constants.hpp @@ -10,7 +10,8 @@ namespace v201 { /// \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 vminimum alue from OCPP 2.1 +constexpr std::size_t ISO15118_GET_EV_CERTIFICATE_EXI_RESPONSE_SIZE = 17000; } // namespace v201 } // namespace ocpp diff --git a/include/ocpp/v201/ctrlr_component_variables.hpp b/include/ocpp/v201/ctrlr_component_variables.hpp index 64219fcc3..625e78059 100644 --- a/include/ocpp/v201/ctrlr_component_variables.hpp +++ b/include/ocpp/v201/ctrlr_component_variables.hpp @@ -88,6 +88,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/v201/database_handler.hpp b/include/ocpp/v201/database_handler.hpp index e5330cf7d..166da1bb7 100644 --- a/include/ocpp/v201/database_handler.hpp +++ b/include/ocpp/v201/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 v201::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 v201::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/v201/evse.hpp b/include/ocpp/v201/evse.hpp index 1b1f52819..1c4f03faa 100644 --- a/include/ocpp/v201/evse.hpp +++ b/include/ocpp/v201/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 @@ -223,7 +223,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 @@ -247,8 +247,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/v201/evse_manager.hpp b/include/ocpp/v201/evse_manager.hpp index 8506de424..174bbd44b 100644 --- a/include/ocpp/v201/evse_manager.hpp +++ b/include/ocpp/v201/evse_manager.hpp @@ -29,7 +29,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; @@ -65,7 +65,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; size_t get_number_of_evses() const override; diff --git a/include/ocpp/v201/functional_blocks/authorization.hpp b/include/ocpp/v201/functional_blocks/authorization.hpp index 8798a66ea..0a7ad9826 100644 --- a/include/ocpp/v201/functional_blocks/authorization.hpp +++ b/include/ocpp/v201/functional_blocks/authorization.hpp @@ -19,7 +19,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 @@ -36,7 +36,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; }; @@ -62,7 +62,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; @@ -76,7 +76,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/v201/functional_blocks/reservation.hpp b/include/ocpp/v201/functional_blocks/reservation.hpp index 3de86b659..83729ca78 100644 --- a/include/ocpp/v201/functional_blocks/reservation.hpp +++ b/include/ocpp/v201/functional_blocks/reservation.hpp @@ -16,8 +16,8 @@ class EvseManagerInterface; 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/v201/messages/Authorize.hpp b/include/ocpp/v201/messages/Authorize.hpp index 9e20e8569..8bed3ee96 100644 --- a/include/ocpp/v201/messages/Authorize.hpp +++ b/include/ocpp/v201/messages/Authorize.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/BootNotification.hpp b/include/ocpp/v201/messages/BootNotification.hpp index 6fd3e52be..44ab1db03 100644 --- a/include/ocpp/v201/messages/BootNotification.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/CancelReservation.hpp b/include/ocpp/v201/messages/CancelReservation.hpp index ccf8dff2e..4af57a99e 100644 --- a/include/ocpp/v201/messages/CancelReservation.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/CertificateSigned.hpp b/include/ocpp/v201/messages/CertificateSigned.hpp index 720f2afc6..46346759d 100644 --- a/include/ocpp/v201/messages/CertificateSigned.hpp +++ b/include/ocpp/v201/messages/CertificateSigned.hpp @@ -18,8 +18,9 @@ namespace v201 { /// \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/v201/messages/ChangeAvailability.hpp b/include/ocpp/v201/messages/ChangeAvailability.hpp index b11e99774..a1ff2b0ea 100644 --- a/include/ocpp/v201/messages/ChangeAvailability.hpp +++ b/include/ocpp/v201/messages/ChangeAvailability.hpp @@ -18,8 +18,8 @@ namespace v201 { /// \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/v201/messages/ClearCache.hpp b/include/ocpp/v201/messages/ClearCache.hpp index f22dbcfd5..1ffb88549 100644 --- a/include/ocpp/v201/messages/ClearCache.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/ClearChargingProfile.hpp b/include/ocpp/v201/messages/ClearChargingProfile.hpp index 8fd1f8cbf..d001ed322 100644 --- a/include/ocpp/v201/messages/ClearChargingProfile.hpp +++ b/include/ocpp/v201/messages/ClearChargingProfile.hpp @@ -17,9 +17,9 @@ namespace v201 { /// \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/v201/messages/ClearDisplayMessage.hpp b/include/ocpp/v201/messages/ClearDisplayMessage.hpp index 85f2c193b..bde450a14 100644 --- a/include/ocpp/v201/messages/ClearDisplayMessage.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/ClearedChargingLimit.hpp b/include/ocpp/v201/messages/ClearedChargingLimit.hpp index 4912aeca6..89c659051 100644 --- a/include/ocpp/v201/messages/ClearedChargingLimit.hpp +++ b/include/ocpp/v201/messages/ClearedChargingLimit.hpp @@ -9,7 +9,6 @@ #include #include -#include #include namespace ocpp { @@ -17,9 +16,9 @@ namespace v201 { /// \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/v201/messages/CustomerInformation.hpp b/include/ocpp/v201/messages/CustomerInformation.hpp index 1cd94b03b..a398361d7 100644 --- a/include/ocpp/v201/messages/CustomerInformation.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/DataTransfer.hpp b/include/ocpp/v201/messages/DataTransfer.hpp index e3a5bbadc..4e9834b12 100644 --- a/include/ocpp/v201/messages/DataTransfer.hpp +++ b/include/ocpp/v201/messages/DataTransfer.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/DeleteCertificate.hpp b/include/ocpp/v201/messages/DeleteCertificate.hpp index 397d6b4e2..ca02a3072 100644 --- a/include/ocpp/v201/messages/DeleteCertificate.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/FirmwareStatusNotification.hpp b/include/ocpp/v201/messages/FirmwareStatusNotification.hpp index 50dd623f2..52ac0ba2c 100644 --- a/include/ocpp/v201/messages/FirmwareStatusNotification.hpp +++ b/include/ocpp/v201/messages/FirmwareStatusNotification.hpp @@ -18,8 +18,9 @@ namespace v201 { /// \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/v201/messages/Get15118EVCertificate.hpp b/include/ocpp/v201/messages/Get15118EVCertificate.hpp index 73e66cb69..77ef560cd 100644 --- a/include/ocpp/v201/messages/Get15118EVCertificate.hpp +++ b/include/ocpp/v201/messages/Get15118EVCertificate.hpp @@ -20,7 +20,9 @@ namespace v201 { 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/v201/messages/GetBaseReport.hpp b/include/ocpp/v201/messages/GetBaseReport.hpp index 7df85fa0d..efe3bf2a2 100644 --- a/include/ocpp/v201/messages/GetBaseReport.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/GetCertificateChainStatus.hpp b/include/ocpp/v201/messages/GetCertificateChainStatus.hpp new file mode 100644 index 000000000..7e9012ada --- /dev/null +++ b/include/ocpp/v201/messages/GetCertificateChainStatus.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_V201_GETCERTIFICATECHAINSTATUS_HPP +#define OCPP_V201_GETCERTIFICATECHAINSTATUS_HPP + +#include +#include + +#include +#include +#include + +namespace ocpp { +namespace v201 { + +/// \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 v201 +} // namespace ocpp + +#endif // OCPP_V201_GETCERTIFICATECHAINSTATUS_HPP diff --git a/include/ocpp/v201/messages/GetCertificateStatus.hpp b/include/ocpp/v201/messages/GetCertificateStatus.hpp index 692061b73..5ab18620e 100644 --- a/include/ocpp/v201/messages/GetCertificateStatus.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/GetChargingProfiles.hpp b/include/ocpp/v201/messages/GetChargingProfiles.hpp index cc33bb397..d44f8c918 100644 --- a/include/ocpp/v201/messages/GetChargingProfiles.hpp +++ b/include/ocpp/v201/messages/GetChargingProfiles.hpp @@ -19,8 +19,8 @@ namespace v201 { 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/v201/messages/GetCompositeSchedule.hpp b/include/ocpp/v201/messages/GetCompositeSchedule.hpp index 8d8d67e1d..a7deea03b 100644 --- a/include/ocpp/v201/messages/GetCompositeSchedule.hpp +++ b/include/ocpp/v201/messages/GetCompositeSchedule.hpp @@ -19,8 +19,8 @@ namespace v201 { 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/v201/messages/GetDisplayMessages.hpp b/include/ocpp/v201/messages/GetDisplayMessages.hpp index 21236dcf0..10a2a3d5b 100644 --- a/include/ocpp/v201/messages/GetDisplayMessages.hpp +++ b/include/ocpp/v201/messages/GetDisplayMessages.hpp @@ -18,10 +18,10 @@ namespace v201 { /// \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/v201/messages/GetInstalledCertificateIds.hpp b/include/ocpp/v201/messages/GetInstalledCertificateIds.hpp index 6646cb5cd..69c88342d 100644 --- a/include/ocpp/v201/messages/GetInstalledCertificateIds.hpp +++ b/include/ocpp/v201/messages/GetInstalledCertificateIds.hpp @@ -17,8 +17,8 @@ namespace v201 { /// \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/v201/messages/GetLog.hpp b/include/ocpp/v201/messages/GetLog.hpp index fb4282e83..bb211748b 100644 --- a/include/ocpp/v201/messages/GetLog.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/GetMonitoringReport.hpp b/include/ocpp/v201/messages/GetMonitoringReport.hpp index 0bce5aaed..ea81fa06f 100644 --- a/include/ocpp/v201/messages/GetMonitoringReport.hpp +++ b/include/ocpp/v201/messages/GetMonitoringReport.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/GetReport.hpp b/include/ocpp/v201/messages/GetReport.hpp index 50ec85045..6b97051a9 100644 --- a/include/ocpp/v201/messages/GetReport.hpp +++ b/include/ocpp/v201/messages/GetReport.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/GetTransactionStatus.hpp b/include/ocpp/v201/messages/GetTransactionStatus.hpp index e7d592356..7f3aa688d 100644 --- a/include/ocpp/v201/messages/GetTransactionStatus.hpp +++ b/include/ocpp/v201/messages/GetTransactionStatus.hpp @@ -16,8 +16,8 @@ namespace v201 { /// \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/v201/messages/InstallCertificate.hpp b/include/ocpp/v201/messages/InstallCertificate.hpp index d12eab7f7..d374ed7a3 100644 --- a/include/ocpp/v201/messages/InstallCertificate.hpp +++ b/include/ocpp/v201/messages/InstallCertificate.hpp @@ -18,7 +18,7 @@ namespace v201 { /// \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/v201/messages/LogStatusNotification.hpp b/include/ocpp/v201/messages/LogStatusNotification.hpp index 58d2c7995..9b4b46bc5 100644 --- a/include/ocpp/v201/messages/LogStatusNotification.hpp +++ b/include/ocpp/v201/messages/LogStatusNotification.hpp @@ -18,8 +18,9 @@ namespace v201 { /// \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/v201/messages/NotifyChargingLimit.hpp b/include/ocpp/v201/messages/NotifyChargingLimit.hpp index e4889a704..57860d522 100644 --- a/include/ocpp/v201/messages/NotifyChargingLimit.hpp +++ b/include/ocpp/v201/messages/NotifyChargingLimit.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/NotifyCustomerInformation.hpp b/include/ocpp/v201/messages/NotifyCustomerInformation.hpp index 04bb9a188..4cb18330a 100644 --- a/include/ocpp/v201/messages/NotifyCustomerInformation.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/NotifyDisplayMessages.hpp b/include/ocpp/v201/messages/NotifyDisplayMessages.hpp index e9fc34eed..67decb7ce 100644 --- a/include/ocpp/v201/messages/NotifyDisplayMessages.hpp +++ b/include/ocpp/v201/messages/NotifyDisplayMessages.hpp @@ -18,9 +18,9 @@ namespace v201 { /// \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/v201/messages/NotifyEVChargingNeeds.hpp b/include/ocpp/v201/messages/NotifyEVChargingNeeds.hpp index fa84aed9f..01f8e9d14 100644 --- a/include/ocpp/v201/messages/NotifyEVChargingNeeds.hpp +++ b/include/ocpp/v201/messages/NotifyEVChargingNeeds.hpp @@ -17,10 +17,11 @@ namespace v201 { /// \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/v201/messages/NotifyEVChargingSchedule.hpp b/include/ocpp/v201/messages/NotifyEVChargingSchedule.hpp index a2c4f8b5c..20cda9673 100644 --- a/include/ocpp/v201/messages/NotifyEVChargingSchedule.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/NotifyEvent.hpp b/include/ocpp/v201/messages/NotifyEvent.hpp index 400dcb549..fe8303ceb 100644 --- a/include/ocpp/v201/messages/NotifyEvent.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/NotifyMonitoringReport.hpp b/include/ocpp/v201/messages/NotifyMonitoringReport.hpp index 0c98dc0b4..67b9db3b7 100644 --- a/include/ocpp/v201/messages/NotifyMonitoringReport.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/NotifyReport.hpp b/include/ocpp/v201/messages/NotifyReport.hpp index 7d91fba36..73238165f 100644 --- a/include/ocpp/v201/messages/NotifyReport.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/NotifyWebPaymentStarted.hpp b/include/ocpp/v201/messages/NotifyWebPaymentStarted.hpp new file mode 100644 index 000000000..4469dbdaf --- /dev/null +++ b/include/ocpp/v201/messages/NotifyWebPaymentStarted.hpp @@ -0,0 +1,60 @@ +// 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_V201_NOTIFYWEBPAYMENTSTARTED_HPP +#define OCPP_V201_NOTIFYWEBPAYMENTSTARTED_HPP + +#include +#include + +#include +#include + +namespace ocpp { +namespace v201 { + +/// \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 v201 +} // namespace ocpp + +#endif // OCPP_V201_NOTIFYWEBPAYMENTSTARTED_HPP diff --git a/include/ocpp/v201/messages/PublishFirmware.hpp b/include/ocpp/v201/messages/PublishFirmware.hpp index 71ef28ae8..b34ebd791 100644 --- a/include/ocpp/v201/messages/PublishFirmware.hpp +++ b/include/ocpp/v201/messages/PublishFirmware.hpp @@ -17,12 +17,12 @@ namespace v201 { /// \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/v201/messages/PublishFirmwareStatusNotification.hpp b/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp index 6ad6076fc..d059f746d 100644 --- a/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp +++ b/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp @@ -18,9 +18,10 @@ namespace v201 { /// \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/v201/messages/ReportChargingProfiles.hpp b/include/ocpp/v201/messages/ReportChargingProfiles.hpp index 3993868a3..128944d4e 100644 --- a/include/ocpp/v201/messages/ReportChargingProfiles.hpp +++ b/include/ocpp/v201/messages/ReportChargingProfiles.hpp @@ -18,11 +18,11 @@ namespace v201 { /// \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/v201/messages/ReportDERControl.hpp b/include/ocpp/v201/messages/ReportDERControl.hpp new file mode 100644 index 000000000..488f567da --- /dev/null +++ b/include/ocpp/v201/messages/ReportDERControl.hpp @@ -0,0 +1,69 @@ +// 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_V201_REPORTDERCONTROL_HPP +#define OCPP_V201_REPORTDERCONTROL_HPP + +#include +#include + +#include +#include +#include + +namespace ocpp { +namespace v201 { + +/// \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 v201 +} // namespace ocpp + +#endif // OCPP_V201_REPORTDERCONTROL_HPP diff --git a/include/ocpp/v201/messages/RequestStartTransaction.hpp b/include/ocpp/v201/messages/RequestStartTransaction.hpp index 05501ac00..f9b777066 100644 --- a/include/ocpp/v201/messages/RequestStartTransaction.hpp +++ b/include/ocpp/v201/messages/RequestStartTransaction.hpp @@ -19,10 +19,10 @@ namespace v201 { 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/v201/messages/RequestStopTransaction.hpp b/include/ocpp/v201/messages/RequestStopTransaction.hpp index 8361b2e68..f2cc0b1f0 100644 --- a/include/ocpp/v201/messages/RequestStopTransaction.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/ReserveNow.hpp b/include/ocpp/v201/messages/ReserveNow.hpp index acb262679..d4304ab73 100644 --- a/include/ocpp/v201/messages/ReserveNow.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/Reset.hpp b/include/ocpp/v201/messages/Reset.hpp index c3a58ae6f..62ea0bfc7 100644 --- a/include/ocpp/v201/messages/Reset.hpp +++ b/include/ocpp/v201/messages/Reset.hpp @@ -18,8 +18,8 @@ namespace v201 { /// \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/v201/messages/SecurityEventNotification.hpp b/include/ocpp/v201/messages/SecurityEventNotification.hpp index ce04f5645..c915a4287 100644 --- a/include/ocpp/v201/messages/SecurityEventNotification.hpp +++ b/include/ocpp/v201/messages/SecurityEventNotification.hpp @@ -18,8 +18,8 @@ namespace v201 { 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/v201/messages/SendLocalList.hpp b/include/ocpp/v201/messages/SendLocalList.hpp index da8b299d9..87b3a7c58 100644 --- a/include/ocpp/v201/messages/SendLocalList.hpp +++ b/include/ocpp/v201/messages/SendLocalList.hpp @@ -19,8 +19,8 @@ namespace v201 { 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/v201/messages/SetChargingProfile.hpp b/include/ocpp/v201/messages/SetChargingProfile.hpp index 6075b5716..7485cf4b5 100644 --- a/include/ocpp/v201/messages/SetChargingProfile.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/SetDisplayMessage.hpp b/include/ocpp/v201/messages/SetDisplayMessage.hpp index 28218e3da..aff9f2a43 100644 --- a/include/ocpp/v201/messages/SetDisplayMessage.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/SetMonitoringBase.hpp b/include/ocpp/v201/messages/SetMonitoringBase.hpp index 3dfad877c..2e6ac96a8 100644 --- a/include/ocpp/v201/messages/SetMonitoringBase.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/SetMonitoringLevel.hpp b/include/ocpp/v201/messages/SetMonitoringLevel.hpp index efab74419..a62ab5754 100644 --- a/include/ocpp/v201/messages/SetMonitoringLevel.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/SetNetworkProfile.hpp b/include/ocpp/v201/messages/SetNetworkProfile.hpp index d144af439..5ee8cadf2 100644 --- a/include/ocpp/v201/messages/SetNetworkProfile.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/SignCertificate.hpp b/include/ocpp/v201/messages/SignCertificate.hpp index 3f663ae57..a45f928d2 100644 --- a/include/ocpp/v201/messages/SignCertificate.hpp +++ b/include/ocpp/v201/messages/SignCertificate.hpp @@ -18,8 +18,10 @@ namespace v201 { /// \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/v201/messages/TransactionEvent.hpp b/include/ocpp/v201/messages/TransactionEvent.hpp index 2837f176f..0803fbca9 100644 --- a/include/ocpp/v201/messages/TransactionEvent.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/TriggerMessage.hpp b/include/ocpp/v201/messages/TriggerMessage.hpp index d50e66989..3d665bf2f 100644 --- a/include/ocpp/v201/messages/TriggerMessage.hpp +++ b/include/ocpp/v201/messages/TriggerMessage.hpp @@ -18,8 +18,9 @@ namespace v201 { /// \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/v201/messages/UnlockConnector.hpp b/include/ocpp/v201/messages/UnlockConnector.hpp index d3bc48f14..0c078ac2a 100644 --- a/include/ocpp/v201/messages/UnlockConnector.hpp +++ b/include/ocpp/v201/messages/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/v201/messages/UpdateFirmware.hpp b/include/ocpp/v201/messages/UpdateFirmware.hpp index 6e8547950..f961cb45b 100644 --- a/include/ocpp/v201/messages/UpdateFirmware.hpp +++ b/include/ocpp/v201/messages/UpdateFirmware.hpp @@ -19,9 +19,9 @@ namespace v201 { 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/v201/ocpp_enums.hpp b/include/ocpp/v201/ocpp_enums.hpp index 8f91b0a83..4caaa1545 100644 --- a/include/ocpp/v201/ocpp_enums.hpp +++ b/include/ocpp/v201/ocpp_enums.hpp @@ -11,31 +11,25 @@ namespace ocpp { namespace v201 { -// 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 v201 } // namespace ocpp diff --git a/include/ocpp/v201/ocpp_types.hpp b/include/ocpp/v201/ocpp_types.hpp index 0676cb74a..ebdfb75d8 100644 --- a/include/ocpp/v201/ocpp_types.hpp +++ b/include/ocpp/v201/ocpp_types.hpp @@ -18,8 +18,38 @@ namespace v201 { 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; }; @@ -34,10 +64,10 @@ void from_json(const json& j, AdditionalInfo& k); 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); @@ -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 @@ -69,9 +99,9 @@ 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); @@ -85,14 +115,14 @@ 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); @@ -104,10 +134,228 @@ void from_json(const json& j, IdTokenInfo& k); /// \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); @@ -122,10 +370,10 @@ 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); @@ -137,25 +385,10 @@ void from_json(const json& j, ChargingStation& k); /// \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); @@ -168,10 +401,10 @@ void from_json(const json& j, EVSE& k); 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); @@ -183,11 +416,27 @@ void from_json(const json& j, ClearChargingProfile& k); /// \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); @@ -216,12 +465,46 @@ void from_json(const json& j, CertificateHashDataType& k); /// \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); @@ -233,12 +516,59 @@ void from_json(const json& j, ChargingProfileCriterion& k); /// \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); @@ -251,11 +581,11 @@ void from_json(const json& j, ChargingSchedulePeriod& k); 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 @@ -271,8 +601,8 @@ 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); @@ -285,10 +615,10 @@ void from_json(const json& j, CertificateHashDataChain& k); 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); @@ -302,9 +632,9 @@ 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); @@ -318,8 +648,8 @@ 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); @@ -333,8 +663,8 @@ 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); @@ -346,11 +676,45 @@ void from_json(const json& j, ComponentVariable& k); /// \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); @@ -366,10 +730,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); @@ -382,10 +746,10 @@ void from_json(const json& j, GetVariableResult& k); 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 @@ -399,9 +763,9 @@ void from_json(const json& j, SignedMeterValue& k); 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); @@ -415,13 +779,13 @@ 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); @@ -448,10 +812,25 @@ void from_json(const json& j, MeterValue& k); /// \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); @@ -466,8 +845,8 @@ 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); @@ -496,9 +875,9 @@ 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); @@ -513,9 +892,9 @@ 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); @@ -527,15 +906,199 @@ void from_json(const json& j, SalesTariff& k); /// \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); @@ -548,9 +1111,10 @@ void from_json(const json& j, ChargingSchedule& k); 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); @@ -566,12 +1130,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); @@ -584,10 +1149,10 @@ void from_json(const json& j, MessageInfo& k); 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 @@ -600,16 +1165,163 @@ void from_json(const json& j, ACChargingParameters& k); /// \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); @@ -621,12 +1333,55 @@ void from_json(const json& j, DCChargingParameters& k); /// \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); @@ -646,13 +1401,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); @@ -670,6 +1426,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 @@ -698,13 +1455,45 @@ void from_json(const json& j, MonitoringData& k); /// \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); @@ -719,11 +1508,12 @@ 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); @@ -739,8 +1529,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); @@ -752,17 +1542,66 @@ void from_json(const json& j, ReportData& k); /// \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); @@ -774,10 +1613,324 @@ void from_json(const json& j, ChargingProfile& k); /// \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); @@ -790,14 +1943,14 @@ void from_json(const json& j, AuthorizationData& k); 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); @@ -810,13 +1963,13 @@ void from_json(const json& j, APN& k); 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); @@ -829,15 +1982,17 @@ void from_json(const json& j, VPN& k); 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); @@ -855,9 +2010,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); @@ -875,9 +2031,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); @@ -889,18 +2045,12 @@ void from_json(const json& j, SetMonitoringResult& k); /// \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); @@ -916,9 +2066,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); @@ -930,13 +2080,136 @@ void from_json(const json& j, SetVariableResult& k); /// \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); @@ -949,12 +2222,12 @@ void from_json(const json& j, Transaction& k); 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); diff --git a/include/ocpp/v201/smart_charging.hpp b/include/ocpp/v201/smart_charging.hpp index 23ef0efa9..867d4eedf 100644 --- a/include/ocpp/v201/smart_charging.hpp +++ b/include/ocpp/v201/smart_charging.hpp @@ -74,7 +74,7 @@ class SmartChargingHandlerInterface { 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; virtual void delete_transaction_tx_profiles(const std::string& transaction_id) = 0; @@ -85,7 +85,7 @@ class SmartChargingHandlerInterface { virtual SetChargingProfileResponse add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO) = 0; + CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO) = 0; virtual ClearChargingProfileResponse clear_profiles(const ClearChargingProfileRequest& request) = 0; @@ -122,7 +122,7 @@ class SmartChargingHandler : public SmartChargingHandlerInterface { /// 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; /// @@ -139,7 +139,7 @@ class SmartChargingHandler : public SmartChargingHandlerInterface { /// SetChargingProfileResponse add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO) override; + CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO) override; /// /// \brief Clears profiles from the system using the given \p request diff --git a/include/ocpp/v201/types.hpp b/include/ocpp/v201/types.hpp index 75d1f67a5..a343b45cb 100644 --- a/include/ocpp/v201/types.hpp +++ b/include/ocpp/v201/types.hpp @@ -145,14 +145,13 @@ enum class MessageType { }; /// \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 +171,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 v201 } // namespace ocpp diff --git a/include/ocpp/v201/utils.hpp b/include/ocpp/v201/utils.hpp index 73f07160b..ff4a74c93 100644 --- a/include/ocpp/v201/utils.hpp +++ b/include/ocpp/v201/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 v201 } // namespace ocpp diff --git a/include/ocpp/v21/messages/AFRRSignal.hpp b/include/ocpp/v21/messages/AFRRSignal.hpp new file mode 100644 index 000000000..e91b102c1 --- /dev/null +++ b/include/ocpp/v21/messages/AFRRSignal.hpp @@ -0,0 +1,64 @@ +// 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_AFRRSIGNAL_HPP +#define OCPP_V21_AFRRSIGNAL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..0dbce99f0 --- /dev/null +++ b/include/ocpp/v21/messages/AdjustPeriodicEventStream.hpp @@ -0,0 +1,64 @@ +// 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_ADJUSTPERIODICEVENTSTREAM_HPP +#define OCPP_V21_ADJUSTPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..aecff1587 --- /dev/null +++ b/include/ocpp/v21/messages/BatterySwap.hpp @@ -0,0 +1,64 @@ +// 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_BATTERYSWAP_HPP +#define OCPP_V21_BATTERYSWAP_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..ea295b54d --- /dev/null +++ b/include/ocpp/v21/messages/ChangeTransactionTariff.hpp @@ -0,0 +1,64 @@ +// 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_CHANGETRANSACTIONTARIFF_HPP +#define OCPP_V21_CHANGETRANSACTIONTARIFF_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..2ebe30ef7 --- /dev/null +++ b/include/ocpp/v21/messages/ClearDERControl.hpp @@ -0,0 +1,65 @@ +// 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_CLEARDERCONTROL_HPP +#define OCPP_V21_CLEARDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..9f089229f --- /dev/null +++ b/include/ocpp/v21/messages/ClearTariffs.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_CLEARTARIFFS_HPP +#define OCPP_V21_CLEARTARIFFS_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..396d69816 --- /dev/null +++ b/include/ocpp/v21/messages/ClosePeriodicEventStream.hpp @@ -0,0 +1,60 @@ +// 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_CLOSEPERIODICEVENTSTREAM_HPP +#define OCPP_V21_CLOSEPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v201; +#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/GetCRL.hpp b/include/ocpp/v21/messages/GetCRL.hpp new file mode 100644 index 000000000..241475772 --- /dev/null +++ b/include/ocpp/v21/messages/GetCRL.hpp @@ -0,0 +1,65 @@ +// 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_GETCRL_HPP +#define OCPP_V21_GETCRL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP GetCRL message +struct GetCRLRequest : public ocpp::Message { + CertificateHashDataType certificateHashData; + int32_t requestId; + std::optional customData; + + /// \brief Provides the type of this GetCRL 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 GetCRLRequest \p k to a given json object \p j +void to_json(json& j, const GetCRLRequest& k); + +/// \brief Conversion from a given json object \p j to a given GetCRLRequest \p k +void from_json(const json& j, GetCRLRequest& k); + +/// \brief Writes the string representation of the given GetCRLRequest \p k to the given output stream \p os +/// \returns an output stream with the GetCRLRequest written to +std::ostream& operator<<(std::ostream& os, const GetCRLRequest& k); + +/// \brief Contains a OCPP GetCRLResponse message +struct GetCRLResponse : public ocpp::Message { + int32_t requestId; + GenericStatusEnum status; + std::optional statusInfo; + std::optional customData; + + /// \brief Provides the type of this GetCRLResponse 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 GetCRLResponse \p k to a given json object \p j +void to_json(json& j, const GetCRLResponse& k); + +/// \brief Conversion from a given json object \p j to a given GetCRLResponse \p k +void from_json(const json& j, GetCRLResponse& k); + +/// \brief Writes the string representation of the given GetCRLResponse \p k to the given output stream \p os +/// \returns an output stream with the GetCRLResponse written to +std::ostream& operator<<(std::ostream& os, const GetCRLResponse& k); + +} // namespace v21 +} // namespace ocpp + +#endif // OCPP_V21_GETCRL_HPP diff --git a/include/ocpp/v21/messages/GetDERControl.hpp b/include/ocpp/v21/messages/GetDERControl.hpp new file mode 100644 index 000000000..9bf18c835 --- /dev/null +++ b/include/ocpp/v21/messages/GetDERControl.hpp @@ -0,0 +1,66 @@ +// 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_GETDERCONTROL_HPP +#define OCPP_V21_GETDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..785e268fd --- /dev/null +++ b/include/ocpp/v21/messages/GetPeriodicEventStream.hpp @@ -0,0 +1,60 @@ +// 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_GETPERIODICEVENTSTREAM_HPP +#define OCPP_V21_GETPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v201; +#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..fb00b252a --- /dev/null +++ b/include/ocpp/v21/messages/GetTariffs.hpp @@ -0,0 +1,64 @@ +// 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_GETTARIFFS_HPP +#define OCPP_V21_GETTARIFFS_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..b2428db2a --- /dev/null +++ b/include/ocpp/v21/messages/NotifyAllowedEnergyTransfer.hpp @@ -0,0 +1,64 @@ +// 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_NOTIFYALLOWEDENERGYTRANSFER_HPP +#define OCPP_V21_NOTIFYALLOWEDENERGYTRANSFER_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..fcdb7acb0 --- /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::v201; +#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..adfb4a6b6 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyDERAlarm.hpp @@ -0,0 +1,65 @@ +// 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_NOTIFYDERALARM_HPP +#define OCPP_V21_NOTIFYDERALARM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..970511617 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyDERStartStop.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_NOTIFYDERSTARTSTOP_HPP +#define OCPP_V21_NOTIFYDERSTARTSTOP_HPP + +#include +#include + +#include +using namespace ocpp::v201; +#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..ddd0070c9 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyPeriodicEventStream.hpp @@ -0,0 +1,44 @@ +// 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_NOTIFYPERIODICEVENTSTREAM_HPP +#define OCPP_V21_NOTIFYPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +using namespace ocpp::v201; +#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..6c09746c9 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyPriorityCharging.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_NOTIFYPRIORITYCHARGING_HPP +#define OCPP_V21_NOTIFYPRIORITYCHARGING_HPP + +#include +#include + +#include +using namespace ocpp::v201; +#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..e847c53a5 --- /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::v201; +#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..307c443bd --- /dev/null +++ b/include/ocpp/v21/messages/NotifySettlement.hpp @@ -0,0 +1,72 @@ +// 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_NOTIFYSETTLEMENT_HPP +#define OCPP_V21_NOTIFYSETTLEMENT_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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/OpenPeriodicEventStream.hpp b/include/ocpp/v21/messages/OpenPeriodicEventStream.hpp new file mode 100644 index 000000000..032a2c844 --- /dev/null +++ b/include/ocpp/v21/messages/OpenPeriodicEventStream.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_OPENPERIODICEVENTSTREAM_HPP +#define OCPP_V21_OPENPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..7000d982f --- /dev/null +++ b/include/ocpp/v21/messages/PullDynamicScheduleUpdate.hpp @@ -0,0 +1,64 @@ +// 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_PULLDYNAMICSCHEDULEUPDATE_HPP +#define OCPP_V21_PULLDYNAMICSCHEDULEUPDATE_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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/RequestBatterySwap.hpp b/include/ocpp/v21/messages/RequestBatterySwap.hpp new file mode 100644 index 000000000..9f8a1c7f9 --- /dev/null +++ b/include/ocpp/v21/messages/RequestBatterySwap.hpp @@ -0,0 +1,64 @@ +// 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_REQUESTBATTERYSWAP_HPP +#define OCPP_V21_REQUESTBATTERYSWAP_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..4cd547137 --- /dev/null +++ b/include/ocpp/v21/messages/SetDERControl.hpp @@ -0,0 +1,74 @@ +// 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_SETDERCONTROL_HPP +#define OCPP_V21_SETDERCONTROL_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..7402e4fcf --- /dev/null +++ b/include/ocpp/v21/messages/SetDefaultTariff.hpp @@ -0,0 +1,64 @@ +// 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_SETDEFAULTTARIFF_HPP +#define OCPP_V21_SETDEFAULTTARIFF_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..d5ccf1106 --- /dev/null +++ b/include/ocpp/v21/messages/UpdateDynamicSchedule.hpp @@ -0,0 +1,64 @@ +// 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_UPDATEDYNAMICSCHEDULE_HPP +#define OCPP_V21_UPDATEDYNAMICSCHEDULE_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..ce519b023 --- /dev/null +++ b/include/ocpp/v21/messages/UsePriorityCharging.hpp @@ -0,0 +1,64 @@ +// 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_USEPRIORITYCHARGING_HPP +#define OCPP_V21_USEPRIORITYCHARGING_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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..aefa63f2b --- /dev/null +++ b/include/ocpp/v21/messages/VatNumberValidation.hpp @@ -0,0 +1,67 @@ +// 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_VATNUMBERVALIDATION_HPP +#define OCPP_V21_VATNUMBERVALIDATION_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#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 bd8dead0f..bfb7b74b8 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -101,6 +101,7 @@ if(LIBOCPP_ENABLE_V201) ocpp/v201/functional_blocks/display_message.cpp ) add_subdirectory(ocpp/v201/messages) + add_subdirectory(ocpp/v21/messages) endif() add_subdirectory(ocpp/common/websocket) diff --git a/lib/ocpp/v16/charge_point_impl.cpp b/lib/ocpp/v16/charge_point_impl.cpp index c05f98d8b..7c3f55c52 100644 --- a/lib/ocpp/v16/charge_point_impl.cpp +++ b/lib/ocpp/v16/charge_point_impl.cpp @@ -3438,7 +3438,7 @@ ocpp::v201::AuthorizeResponse ChargePointImpl::data_transfer_pnc_authorize( ocpp::v201::AuthorizeRequest authorize_req; ocpp::v201::IdToken id_token; - id_token.type = ocpp::v201::IdTokenEnum::eMAID; + id_token.type = ocpp::v201::IdTokenEnumStringType::eMAID; id_token.idToken = emaid; authorize_req.idToken = id_token; diff --git a/lib/ocpp/v201/charge_point.cpp b/lib/ocpp/v201/charge_point.cpp index d93e6b665..3a79a8506 100644 --- a/lib/ocpp/v201/charge_point.cpp +++ b/lib/ocpp/v201/charge_point.cpp @@ -763,7 +763,7 @@ std::optional ChargePoint::get_evse_transaction_id(int32_t evse_id) return evse.get_transaction()->transactionId.get(); } -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); } @@ -876,8 +876,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) { @@ -1426,7 +1427,7 @@ static bool component_variable_change_requires_websocket_option_update_without_r void ChargePoint::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}; if (set_variable_data.attributeType.has_value() and set_variable_data.attributeType.value() != AttributeEnum::Actual) { @@ -1513,7 +1514,7 @@ void ChargePoint::handle_variables_changed(const std::map connector_type) { +bool ChargePoint::is_connector_available(const uint32_t evse_id, std::optional> connector_type) { EvseInterface* evse; try { evse = &evse_manager->get_evse(static_cast(evse_id)); @@ -1646,7 +1647,7 @@ bool ChargePoint::is_connector_available(const uint32_t evse_id, std::optional status = - evse->get_connector_status(connector_type.value_or(ConnectorEnum::Unknown)); + evse->get_connector_status(connector_type.value_or(ConnectorEnumStringType::Unknown)); if (!status.has_value()) { return false; } @@ -1654,7 +1655,7 @@ bool ChargePoint::is_connector_available(const uint32_t evse_id, std::optional connector_type) { +bool ChargePoint::does_connector_exist(const uint32_t evse_id, std::optional> connector_type) { EvseInterface* evse; try { evse = &evse_manager->get_evse(static_cast(evse_id)); @@ -1663,7 +1664,7 @@ bool ChargePoint::does_connector_exist(const uint32_t evse_id, std::optionaldoes_connector_exist(connector_type.value_or(ConnectorEnum::Unknown)); + return evse->does_connector_exist(connector_type.value_or(ConnectorEnumStringType::Unknown)); } bool ChargePoint::is_offline() { @@ -1805,8 +1806,8 @@ void ChargePoint::meter_values_req(const 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; @@ -2233,7 +2234,7 @@ void ChargePoint::handle_transaction_event_response(const EnhancedMessageis_auth_cache_ctrlr_enabled()) { + if (id_token.type != IdTokenEnumStringType::Central and authorization->is_auth_cache_ctrlr_enabled()) { try { this->authorization->authorization_cache_insert_entry(utils::generate_token_hash(id_token), msg.idTokenInfo.value()); @@ -2297,7 +2298,7 @@ void ChargePoint::handle_unlock_connector(Call call) { const UnlockConnectorRequest& msg = call.msg; UnlockConnectorResponse unlock_response; - EVSE evse = {msg.evseId, std::nullopt, msg.connectorId}; + EVSE evse = {msg.evseId, msg.connectorId}; if (this->is_valid_evse(evse)) { if (!this->evse_manager->get_evse(msg.evseId).has_active_transaction()) { @@ -2578,7 +2579,7 @@ void ChargePoint::handle_remote_start_transaction_request(Callsmart_charging_handler->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"; @@ -2884,11 +2885,11 @@ void ChargePoint::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) { @@ -3376,9 +3377,10 @@ void ChargePoint::scheduled_check_v2g_certificate_expiration() { } 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(); @@ -3409,7 +3411,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); } } @@ -3426,8 +3429,8 @@ void ChargePoint::websocket_disconnected_callback(const int configuration_slot, this->client_certificate_expiration_check_timer.stop(); this->v2g_certificate_expiration_check_timer.stop(); 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); } } diff --git a/lib/ocpp/v201/connectivity_manager.cpp b/lib/ocpp/v201/connectivity_manager.cpp index d41198d7d..442cd5535 100644 --- a/lib/ocpp/v201/connectivity_manager.cpp +++ b/lib/ocpp/v201/connectivity_manager.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace { const auto WEBSOCKET_INIT_DELAY = std::chrono::seconds(2); @@ -337,8 +338,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/v201/ctrlr_component_variables.cpp b/lib/ocpp/v201/ctrlr_component_variables.cpp index 050992cd2..029e8f132 100644 --- a/lib/ocpp/v201/ctrlr_component_variables.cpp +++ b/lib/ocpp/v201/ctrlr_component_variables.cpp @@ -39,1257 +39,1075 @@ 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", }), }; 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})}; + std::optional({"SupportedStates"})}; const ComponentVariable DisplayMessageQRCodeDisplayCapable = { ControllerComponents::DisplayMessageCtrlr, std::nullopt, - std::optional({"QRCodeDisplayCapable", std::nullopt, std::nullopt})}; + 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", }), @@ -1297,53 +1115,46 @@ const RequiredComponentVariable TotalCostFallbackMessage = { const ComponentVariable NumberOfDecimalsForCostValues = { ControllerComponents::TariffCostCtrlr, std::nullopt, - std::optional({"NumberOfDecimalsForCostValues", std::nullopt, std::nullopt})}; + 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 +1172,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 @@ -1374,9 +1188,12 @@ const Variable Type = {"Type"}; 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 diff --git a/lib/ocpp/v201/database_handler.cpp b/lib/ocpp/v201/database_handler.cpp index 6f11fb274..46e656c6b 100644 --- a/lib/ocpp/v201/database_handler.cpp +++ b/lib/ocpp/v201/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 v201::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_c 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/v201/device_model.cpp b/lib/ocpp/v201/device_model.cpp index f9c70350b..cf884a790 100644 --- a/lib/ocpp/v201/device_model.cpp +++ b/lib/ocpp/v201/device_model.cpp @@ -15,7 +15,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 +90,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; @@ -355,7 +358,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); @@ -453,8 +458,11 @@ 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"); } diff --git a/lib/ocpp/v201/evse.cpp b/lib/ocpp/v201/evse.cpp index 8139c6426..c039ded3b 100644 --- a/lib/ocpp/v201/evse.cpp +++ b/lib/ocpp/v201/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/v201/evse_manager.cpp b/lib/ocpp/v201/evse_manager.cpp index da75164b1..fda18e868 100644 --- a/lib/ocpp/v201/evse_manager.cpp +++ b/lib/ocpp/v201/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/v201/functional_blocks/authorization.cpp b/lib/ocpp/v201/functional_blocks/authorization.cpp index 6210f321d..0fc353594 100644 --- a/lib/ocpp/v201/functional_blocks/authorization.cpp +++ b/lib/ocpp/v201/functional_blocks/authorization.cpp @@ -55,7 +55,8 @@ void ocpp::v201::Authorization::handle_message(const ocpp::EnhancedMessage>& certificate, +ocpp::v201::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 +147,7 @@ void ocpp::v201::Authorization::authorization_cache_delete_entry(const std::stri } ocpp::v201::AuthorizeResponse -ocpp::v201::Authorization::validate_token(const IdToken id_token, const std::optional>& certificate, +ocpp::v201::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,14 +159,14 @@ ocpp::v201::Authorization::validate_token(const IdToken id_token, const std::opt 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->device_model.get_optional_value(ControllerComponentVariables::AuthCtrlrEnabled).value_or(true)) { response.idTokenInfo.status = AuthorizationStatusEnum::Accepted; return response; } // 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/v201/functional_blocks/reservation.cpp b/lib/ocpp/v201/functional_blocks/reservation.cpp index 3381b3ae6..98f9e64f9 100644 --- a/lib/ocpp/v201/functional_blocks/reservation.cpp +++ b/lib/ocpp/v201/functional_blocks/reservation.cpp @@ -47,8 +47,8 @@ void Reservation::on_reservation_status(const int32_t reservation_id, const Rese ocpp::ReservationCheckStatus Reservation::is_evse_reserved_for_other(const EvseInterface& evse, const IdToken& id_token, const std::optional& 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); } @@ -113,11 +113,12 @@ void Reservation::handle_reserve_now_request(Call call) { } // Check if there is a connector available for this evse id. - if (!this->evse_manager.does_connector_exist(static_cast(evse_id.value()), - request.connectorType.value_or(ConnectorEnum::Unknown))) { + if (!this->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; } @@ -132,7 +133,8 @@ void Reservation::handle_reserve_now_request(Call call) { bool connector_exists = false; for (uint64_t i = 1; i <= number_of_evses; i++) { - if (this->evse_manager.does_connector_exist(i, request.connectorType.value_or(ConnectorEnum::Unknown))) { + if (this->evse_manager.does_connector_exist( + i, request.connectorType.value_or(ConnectorEnumStringType::Unknown))) { connector_exists = true; break; } diff --git a/lib/ocpp/v201/messages/Authorize.cpp b/lib/ocpp/v201/messages/Authorize.cpp index adb557b20..6bba9b339 100644 --- a/lib/ocpp/v201/messages/Authorize.cpp +++ b/lib/ocpp/v201/messages/Authorize.cpp @@ -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/v201/messages/BootNotification.cpp b/lib/ocpp/v201/messages/BootNotification.cpp index 82810981d..813903634 100644 --- a/lib/ocpp/v201/messages/BootNotification.cpp +++ b/lib/ocpp/v201/messages/BootNotification.cpp @@ -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/v201/messages/CMakeLists.txt b/lib/ocpp/v201/messages/CMakeLists.txt index e37db62e6..6276f9ca8 100644 --- a/lib/ocpp/v201/messages/CMakeLists.txt +++ b/lib/ocpp/v201/messages/CMakeLists.txt @@ -18,6 +18,7 @@ target_sources(ocpp FirmwareStatusNotification.cpp Get15118EVCertificate.cpp GetBaseReport.cpp + GetCertificateChainStatus.cpp GetCertificateStatus.cpp GetChargingProfiles.cpp GetCompositeSchedule.cpp @@ -41,9 +42,11 @@ target_sources(ocpp NotifyEvent.cpp NotifyMonitoringReport.cpp NotifyReport.cpp + NotifyWebPaymentStarted.cpp PublishFirmware.cpp PublishFirmwareStatusNotification.cpp ReportChargingProfiles.cpp + ReportDERControl.cpp RequestStartTransaction.cpp RequestStopTransaction.cpp ReservationStatusUpdate.cpp diff --git a/lib/ocpp/v201/messages/CancelReservation.cpp b/lib/ocpp/v201/messages/CancelReservation.cpp index b4746eaf7..cdc807677 100644 --- a/lib/ocpp/v201/messages/CancelReservation.cpp +++ b/lib/ocpp/v201/messages/CancelReservation.cpp @@ -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/v201/messages/CertificateSigned.cpp b/lib/ocpp/v201/messages/CertificateSigned.cpp index e993a4996..d697e28e4 100644 --- a/lib/ocpp/v201/messages/CertificateSigned.cpp +++ b/lib/ocpp/v201/messages/CertificateSigned.cpp @@ -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/v201/messages/ChangeAvailability.cpp b/lib/ocpp/v201/messages/ChangeAvailability.cpp index 1f76b5cd0..276f96eb9 100644 --- a/lib/ocpp/v201/messages/ChangeAvailability.cpp +++ b/lib/ocpp/v201/messages/ChangeAvailability.cpp @@ -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/v201/messages/ClearCache.cpp b/lib/ocpp/v201/messages/ClearCache.cpp index f82682f53..09c39cd85 100644 --- a/lib/ocpp/v201/messages/ClearCache.cpp +++ b/lib/ocpp/v201/messages/ClearCache.cpp @@ -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/v201/messages/ClearChargingProfile.cpp b/lib/ocpp/v201/messages/ClearChargingProfile.cpp index 77833b8cd..257385cb6 100644 --- a/lib/ocpp/v201/messages/ClearChargingProfile.cpp +++ b/lib/ocpp/v201/messages/ClearChargingProfile.cpp @@ -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/v201/messages/ClearDisplayMessage.cpp b/lib/ocpp/v201/messages/ClearDisplayMessage.cpp index 48c6be9c4..00118e149 100644 --- a/lib/ocpp/v201/messages/ClearDisplayMessage.cpp +++ b/lib/ocpp/v201/messages/ClearDisplayMessage.cpp @@ -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/v201/messages/ClearedChargingLimit.cpp b/lib/ocpp/v201/messages/ClearedChargingLimit.cpp index 978659942..72594772c 100644 --- a/lib/ocpp/v201/messages/ClearedChargingLimit.cpp +++ b/lib/ocpp/v201/messages/ClearedChargingLimit.cpp @@ -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/v201/messages/CustomerInformation.cpp b/lib/ocpp/v201/messages/CustomerInformation.cpp index 00aa46607..4de942a58 100644 --- a/lib/ocpp/v201/messages/CustomerInformation.cpp +++ b/lib/ocpp/v201/messages/CustomerInformation.cpp @@ -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/v201/messages/DataTransfer.cpp b/lib/ocpp/v201/messages/DataTransfer.cpp index 4f7dd3018..9c9c2b20b 100644 --- a/lib/ocpp/v201/messages/DataTransfer.cpp +++ b/lib/ocpp/v201/messages/DataTransfer.cpp @@ -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/v201/messages/DeleteCertificate.cpp b/lib/ocpp/v201/messages/DeleteCertificate.cpp index 94a2ffa4f..7a68d1815 100644 --- a/lib/ocpp/v201/messages/DeleteCertificate.cpp +++ b/lib/ocpp/v201/messages/DeleteCertificate.cpp @@ -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/v201/messages/FirmwareStatusNotification.cpp b/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp index 4e58a9b3e..e7eb814ef 100644 --- a/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp +++ b/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp @@ -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/v201/messages/Get15118EVCertificate.cpp b/lib/ocpp/v201/messages/Get15118EVCertificate.cpp index 3016904be..53ed5c737 100644 --- a/lib/ocpp/v201/messages/Get15118EVCertificate.cpp +++ b/lib/ocpp/v201/messages/Get15118EVCertificate.cpp @@ -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/v201/messages/GetBaseReport.cpp b/lib/ocpp/v201/messages/GetBaseReport.cpp index 94b0fd917..703491a5f 100644 --- a/lib/ocpp/v201/messages/GetBaseReport.cpp +++ b/lib/ocpp/v201/messages/GetBaseReport.cpp @@ -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/v201/messages/GetCertificateChainStatus.cpp b/lib/ocpp/v201/messages/GetCertificateChainStatus.cpp new file mode 100644 index 000000000..2735a45a0 --- /dev/null +++ b/lib/ocpp/v201/messages/GetCertificateChainStatus.cpp @@ -0,0 +1,85 @@ +// 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 v201 { + +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 v201 +} // namespace ocpp diff --git a/lib/ocpp/v201/messages/GetCertificateStatus.cpp b/lib/ocpp/v201/messages/GetCertificateStatus.cpp index 53dcf2457..96950e7f1 100644 --- a/lib/ocpp/v201/messages/GetCertificateStatus.cpp +++ b/lib/ocpp/v201/messages/GetCertificateStatus.cpp @@ -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/v201/messages/GetChargingProfiles.cpp b/lib/ocpp/v201/messages/GetChargingProfiles.cpp index 59079d156..f1da7210f 100644 --- a/lib/ocpp/v201/messages/GetChargingProfiles.cpp +++ b/lib/ocpp/v201/messages/GetChargingProfiles.cpp @@ -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/v201/messages/GetCompositeSchedule.cpp b/lib/ocpp/v201/messages/GetCompositeSchedule.cpp index fff162552..de6191ecf 100644 --- a/lib/ocpp/v201/messages/GetCompositeSchedule.cpp +++ b/lib/ocpp/v201/messages/GetCompositeSchedule.cpp @@ -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/v201/messages/GetDisplayMessages.cpp b/lib/ocpp/v201/messages/GetDisplayMessages.cpp index 9be7344bc..769dd52c7 100644 --- a/lib/ocpp/v201/messages/GetDisplayMessages.cpp +++ b/lib/ocpp/v201/messages/GetDisplayMessages.cpp @@ -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/v201/messages/GetInstalledCertificateIds.cpp b/lib/ocpp/v201/messages/GetInstalledCertificateIds.cpp index 5fd921a4b..1dbe85422 100644 --- a/lib/ocpp/v201/messages/GetInstalledCertificateIds.cpp +++ b/lib/ocpp/v201/messages/GetInstalledCertificateIds.cpp @@ -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/v201/messages/GetLog.cpp b/lib/ocpp/v201/messages/GetLog.cpp index 790b8da03..ac440c38c 100644 --- a/lib/ocpp/v201/messages/GetLog.cpp +++ b/lib/ocpp/v201/messages/GetLog.cpp @@ -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/v201/messages/GetMonitoringReport.cpp b/lib/ocpp/v201/messages/GetMonitoringReport.cpp index fc4d72990..826850557 100644 --- a/lib/ocpp/v201/messages/GetMonitoringReport.cpp +++ b/lib/ocpp/v201/messages/GetMonitoringReport.cpp @@ -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/v201/messages/GetReport.cpp b/lib/ocpp/v201/messages/GetReport.cpp index 27b53c7d0..086ee8d2f 100644 --- a/lib/ocpp/v201/messages/GetReport.cpp +++ b/lib/ocpp/v201/messages/GetReport.cpp @@ -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/v201/messages/GetTransactionStatus.cpp b/lib/ocpp/v201/messages/GetTransactionStatus.cpp index 80257b150..be556de01 100644 --- a/lib/ocpp/v201/messages/GetTransactionStatus.cpp +++ b/lib/ocpp/v201/messages/GetTransactionStatus.cpp @@ -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/v201/messages/InstallCertificate.cpp b/lib/ocpp/v201/messages/InstallCertificate.cpp index cd35e8eb0..0c8d67652 100644 --- a/lib/ocpp/v201/messages/InstallCertificate.cpp +++ b/lib/ocpp/v201/messages/InstallCertificate.cpp @@ -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/v201/messages/LogStatusNotification.cpp b/lib/ocpp/v201/messages/LogStatusNotification.cpp index f1f61783c..42606de9c 100644 --- a/lib/ocpp/v201/messages/LogStatusNotification.cpp +++ b/lib/ocpp/v201/messages/LogStatusNotification.cpp @@ -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/v201/messages/NotifyChargingLimit.cpp b/lib/ocpp/v201/messages/NotifyChargingLimit.cpp index 3c6d244bb..ea8183975 100644 --- a/lib/ocpp/v201/messages/NotifyChargingLimit.cpp +++ b/lib/ocpp/v201/messages/NotifyChargingLimit.cpp @@ -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/v201/messages/NotifyCustomerInformation.cpp b/lib/ocpp/v201/messages/NotifyCustomerInformation.cpp index 5785ab4d5..ea00b9e35 100644 --- a/lib/ocpp/v201/messages/NotifyCustomerInformation.cpp +++ b/lib/ocpp/v201/messages/NotifyCustomerInformation.cpp @@ -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/v201/messages/NotifyDisplayMessages.cpp b/lib/ocpp/v201/messages/NotifyDisplayMessages.cpp index 72cd531b3..32dac736d 100644 --- a/lib/ocpp/v201/messages/NotifyDisplayMessages.cpp +++ b/lib/ocpp/v201/messages/NotifyDisplayMessages.cpp @@ -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/v201/messages/NotifyEVChargingNeeds.cpp b/lib/ocpp/v201/messages/NotifyEVChargingNeeds.cpp index d3982d576..e9be6f592 100644 --- a/lib/ocpp/v201/messages/NotifyEVChargingNeeds.cpp +++ b/lib/ocpp/v201/messages/NotifyEVChargingNeeds.cpp @@ -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/v201/messages/NotifyEVChargingSchedule.cpp b/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp index 32ed78d5a..c68132178 100644 --- a/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp +++ b/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp @@ -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/v201/messages/NotifyEvent.cpp b/lib/ocpp/v201/messages/NotifyEvent.cpp index 0bf69b82d..c4d11b840 100644 --- a/lib/ocpp/v201/messages/NotifyEvent.cpp +++ b/lib/ocpp/v201/messages/NotifyEvent.cpp @@ -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/v201/messages/NotifyMonitoringReport.cpp b/lib/ocpp/v201/messages/NotifyMonitoringReport.cpp index 1c8351a11..29dd26647 100644 --- a/lib/ocpp/v201/messages/NotifyMonitoringReport.cpp +++ b/lib/ocpp/v201/messages/NotifyMonitoringReport.cpp @@ -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/v201/messages/NotifyReport.cpp b/lib/ocpp/v201/messages/NotifyReport.cpp index 5fce1c968..244990025 100644 --- a/lib/ocpp/v201/messages/NotifyReport.cpp +++ b/lib/ocpp/v201/messages/NotifyReport.cpp @@ -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/v201/messages/NotifyWebPaymentStarted.cpp b/lib/ocpp/v201/messages/NotifyWebPaymentStarted.cpp new file mode 100644 index 000000000..a78dea2de --- /dev/null +++ b/lib/ocpp/v201/messages/NotifyWebPaymentStarted.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 v201 { + +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 v201 +} // namespace ocpp diff --git a/lib/ocpp/v201/messages/PublishFirmware.cpp b/lib/ocpp/v201/messages/PublishFirmware.cpp index b9331a39e..5b6cb00b0 100644 --- a/lib/ocpp/v201/messages/PublishFirmware.cpp +++ b/lib/ocpp/v201/messages/PublishFirmware.cpp @@ -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/v201/messages/PublishFirmwareStatusNotification.cpp b/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp index 914df0a6e..36738b2d4 100644 --- a/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp +++ b/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp @@ -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/v201/messages/ReportChargingProfiles.cpp b/lib/ocpp/v201/messages/ReportChargingProfiles.cpp index 97d84a87c..eac8ddaf6 100644 --- a/lib/ocpp/v201/messages/ReportChargingProfiles.cpp +++ b/lib/ocpp/v201/messages/ReportChargingProfiles.cpp @@ -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/v201/messages/ReportDERControl.cpp b/lib/ocpp/v201/messages/ReportDERControl.cpp new file mode 100644 index 000000000..5d8ee763c --- /dev/null +++ b/lib/ocpp/v201/messages/ReportDERControl.cpp @@ -0,0 +1,196 @@ +// 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 v201 { + +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 v201 +} // namespace ocpp diff --git a/lib/ocpp/v201/messages/RequestStartTransaction.cpp b/lib/ocpp/v201/messages/RequestStartTransaction.cpp index 1ba362016..f68a9238f 100644 --- a/lib/ocpp/v201/messages/RequestStartTransaction.cpp +++ b/lib/ocpp/v201/messages/RequestStartTransaction.cpp @@ -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/v201/messages/RequestStopTransaction.cpp b/lib/ocpp/v201/messages/RequestStopTransaction.cpp index 32119cc96..60f6b51c2 100644 --- a/lib/ocpp/v201/messages/RequestStopTransaction.cpp +++ b/lib/ocpp/v201/messages/RequestStopTransaction.cpp @@ -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/v201/messages/ReserveNow.cpp b/lib/ocpp/v201/messages/ReserveNow.cpp index 38a50eef4..55fe4642c 100644 --- a/lib/ocpp/v201/messages/ReserveNow.cpp +++ b/lib/ocpp/v201/messages/ReserveNow.cpp @@ -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/v201/messages/Reset.cpp b/lib/ocpp/v201/messages/Reset.cpp index 08efd6df8..4181eb171 100644 --- a/lib/ocpp/v201/messages/Reset.cpp +++ b/lib/ocpp/v201/messages/Reset.cpp @@ -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/v201/messages/SecurityEventNotification.cpp b/lib/ocpp/v201/messages/SecurityEventNotification.cpp index cbb95e4a2..c019f77c9 100644 --- a/lib/ocpp/v201/messages/SecurityEventNotification.cpp +++ b/lib/ocpp/v201/messages/SecurityEventNotification.cpp @@ -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/v201/messages/SendLocalList.cpp b/lib/ocpp/v201/messages/SendLocalList.cpp index 5ead4c62a..18bab2518 100644 --- a/lib/ocpp/v201/messages/SendLocalList.cpp +++ b/lib/ocpp/v201/messages/SendLocalList.cpp @@ -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/v201/messages/SetChargingProfile.cpp b/lib/ocpp/v201/messages/SetChargingProfile.cpp index 1eeb44dad..17a266d4c 100644 --- a/lib/ocpp/v201/messages/SetChargingProfile.cpp +++ b/lib/ocpp/v201/messages/SetChargingProfile.cpp @@ -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/v201/messages/SetDisplayMessage.cpp b/lib/ocpp/v201/messages/SetDisplayMessage.cpp index 6a94ade5b..65c04b0aa 100644 --- a/lib/ocpp/v201/messages/SetDisplayMessage.cpp +++ b/lib/ocpp/v201/messages/SetDisplayMessage.cpp @@ -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/v201/messages/SetMonitoringBase.cpp b/lib/ocpp/v201/messages/SetMonitoringBase.cpp index 76ba7a18c..1f925aa35 100644 --- a/lib/ocpp/v201/messages/SetMonitoringBase.cpp +++ b/lib/ocpp/v201/messages/SetMonitoringBase.cpp @@ -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/v201/messages/SetMonitoringLevel.cpp b/lib/ocpp/v201/messages/SetMonitoringLevel.cpp index 747a77d35..87b189a33 100644 --- a/lib/ocpp/v201/messages/SetMonitoringLevel.cpp +++ b/lib/ocpp/v201/messages/SetMonitoringLevel.cpp @@ -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/v201/messages/SetNetworkProfile.cpp b/lib/ocpp/v201/messages/SetNetworkProfile.cpp index b610407a3..0d101b08b 100644 --- a/lib/ocpp/v201/messages/SetNetworkProfile.cpp +++ b/lib/ocpp/v201/messages/SetNetworkProfile.cpp @@ -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/v201/messages/SignCertificate.cpp b/lib/ocpp/v201/messages/SignCertificate.cpp index c2e90a330..147671a35 100644 --- a/lib/ocpp/v201/messages/SignCertificate.cpp +++ b/lib/ocpp/v201/messages/SignCertificate.cpp @@ -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/v201/messages/TransactionEvent.cpp b/lib/ocpp/v201/messages/TransactionEvent.cpp index 8f354cdfa..75a71df78 100644 --- a/lib/ocpp/v201/messages/TransactionEvent.cpp +++ b/lib/ocpp/v201/messages/TransactionEvent.cpp @@ -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/v201/messages/TriggerMessage.cpp b/lib/ocpp/v201/messages/TriggerMessage.cpp index 5751e1b3c..829d1dbb1 100644 --- a/lib/ocpp/v201/messages/TriggerMessage.cpp +++ b/lib/ocpp/v201/messages/TriggerMessage.cpp @@ -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/v201/messages/UnlockConnector.cpp b/lib/ocpp/v201/messages/UnlockConnector.cpp index c0ee59b54..73610222c 100644 --- a/lib/ocpp/v201/messages/UnlockConnector.cpp +++ b/lib/ocpp/v201/messages/UnlockConnector.cpp @@ -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/v201/messages/UpdateFirmware.cpp b/lib/ocpp/v201/messages/UpdateFirmware.cpp index 8597c11b9..7a48ed39e 100644 --- a/lib/ocpp/v201/messages/UpdateFirmware.cpp +++ b/lib/ocpp/v201/messages/UpdateFirmware.cpp @@ -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/v201/ocpp_enums.cpp b/lib/ocpp/v201/ocpp_enums.cpp index 56b1a8891..1c76a09c8 100644 --- a/lib/ocpp/v201/ocpp_enums.cpp +++ b/lib/ocpp/v201/ocpp_enums.cpp @@ -11,63 +11,33 @@ namespace ocpp { namespace v201 { -// 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 v201 } // namespace ocpp diff --git a/lib/ocpp/v201/ocpp_types.cpp b/lib/ocpp/v201/ocpp_types.cpp index b842115e8..ea9d4b82f 100644 --- a/lib/ocpp/v201/ocpp_types.cpp +++ b/lib/ocpp/v201/ocpp_types.cpp @@ -15,6 +15,81 @@ namespace ocpp { namespace v201 { +/// \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/v201/profile.cpp b/lib/ocpp/v201/profile.cpp index 9656d0692..df63ba738 100644 --- a/lib/ocpp/v201/profile.cpp +++ b/lib/ocpp/v201/profile.cpp @@ -102,10 +102,15 @@ 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; + // FIXME: are default limits correct here or does period_entry_t need an optional limit? + if (charging_rate_unit == ChargingRateUnitEnum::A) { + limit = in_period.limit.value_or(DEFAULT_LIMIT_AMPS); // FIXME + } else { + limit = in_period.limit.value_or(DEFAULT_LIMIT_WATTS); // FIXME + } min_charging_rate = in_profile.chargingSchedule.front().minChargingRate; } @@ -399,16 +404,21 @@ CompositeSchedule calculate_composite_schedule(std::vector& in_c if (earliest > current) { // there is a gap to fill - composite.chargingSchedulePeriod.push_back( - {elapsed_seconds(current, now), NO_LIMIT_SPECIFIED, std::nullopt, std::nullopt, std::nullopt}); + ChargingSchedulePeriod charging_schedule_period; + charging_schedule_period.startPeriod = elapsed_seconds(current, now); + charging_schedule_period.limit = + std::nullopt; // FIXME: does this already do the same as NO_LIMIT_SPECIFIED ? + composite.chargingSchedulePeriod.push_back(charging_schedule_period); current = earliest; } else { // there is a schedule to use const auto [limit, number_phases] = convert_limit(chosen, selected_unit, default_number_phases, supply_voltage); - ChargingSchedulePeriod charging_schedule_period{elapsed_seconds(current, now), limit, std::nullopt, - number_phases}; + ChargingSchedulePeriod charging_schedule_period; + charging_schedule_period.startPeriod = elapsed_seconds(current, now); + charging_schedule_period.limit = limit; + charging_schedule_period.numberPhases = number_phases; // If the new ChargingSchedulePeriod.phaseToUse field is set, pass it on // Profile validation has already ensured that the values have been properly set. @@ -445,21 +455,22 @@ ChargingSchedulePeriod minimize_charging_schedule_period_by_limit( return adjusted_period; } - if (prevailing_period.limit == NO_LIMIT_SPECIFIED && candidate_period.limit != NO_LIMIT_SPECIFIED) { + if (!prevailing_period.limit.has_value() && candidate_period.limit.has_value()) { adjusted_period = candidate_period; - } else if (candidate_period.limit != NO_LIMIT_SPECIFIED) { + } else if (candidate_period.limit.has_value()) { const auto charge_point_max_phases = candidate_period.numberPhases.value_or(default_number_phases); const auto period_max_phases = prevailing_period.numberPhases.value_or(default_number_phases); adjusted_period.numberPhases = std::min(charge_point_max_phases, period_max_phases); if (current_charging_rate_unit_enum == ChargingRateUnitEnum::A) { - if (candidate_period.limit < prevailing_period.limit) { - adjusted_period.limit = candidate_period.limit; + if (candidate_period.limit.value() < prevailing_period.limit.value_or(0)) { + adjusted_period.limit = candidate_period.limit.value(); } } else { - const auto charge_point_limit_per_phase = candidate_period.limit / charge_point_max_phases; - const auto period_limit_per_phase = prevailing_period.limit / period_max_phases; + const auto charge_point_limit_per_phase = candidate_period.limit.value() / charge_point_max_phases; + const auto period_limit_per_phase = + prevailing_period.limit.value_or(DEFAULT_LIMIT_WATTS) / period_max_phases; adjusted_period.limit = std::floor(std::min(charge_point_limit_per_phase, period_limit_per_phase) * adjusted_period.numberPhases.value()); @@ -502,11 +513,10 @@ CompositeSchedule calculate_composite_schedule(const CompositeSchedule& charging int duration_tx_default{std::numeric_limits::max()}; int duration_tx{std::numeric_limits::max()}; - ChargingSchedulePeriod period_charging_station_external_constraints{NO_START_PERIOD, NO_LIMIT_SPECIFIED, - std::nullopt, std::nullopt}; - ChargingSchedulePeriod period_charging_station_max{NO_START_PERIOD, NO_LIMIT_SPECIFIED, std::nullopt, std::nullopt}; - ChargingSchedulePeriod period_tx_default{NO_START_PERIOD, NO_LIMIT_SPECIFIED, std::nullopt, std::nullopt}; - ChargingSchedulePeriod period_tx{NO_START_PERIOD, NO_LIMIT_SPECIFIED, std::nullopt, std::nullopt}; + ChargingSchedulePeriod period_charging_station_external_constraints{NO_START_PERIOD}; + ChargingSchedulePeriod period_charging_station_max{NO_START_PERIOD}; + ChargingSchedulePeriod period_tx_default{NO_START_PERIOD}; + ChargingSchedulePeriod period_tx{NO_START_PERIOD}; update_itt(0, charging_station_external_constraints_itt, charging_station_external_constraints.chargingSchedulePeriod.end(), @@ -519,7 +529,8 @@ CompositeSchedule calculate_composite_schedule(const CompositeSchedule& charging update_itt(0, tx_itt, tx.chargingSchedulePeriod.end(), period_tx, duration_tx); - ChargingSchedulePeriod last{1, NO_LIMIT_SPECIFIED, std::nullopt, default_limits.number_phases}; + ChargingSchedulePeriod last{1}; + last.numberPhases = default_limits.number_phases; while (current_period < end) { @@ -528,14 +539,15 @@ CompositeSchedule calculate_composite_schedule(const CompositeSchedule& charging std::min(std::min(duration_charging_station_max, duration_tx_default), duration_tx)); // create an unset period to override as needed. - ChargingSchedulePeriod period{NO_START_PERIOD, NO_LIMIT_SPECIFIED, std::nullopt, default_limits.number_phases}; + ChargingSchedulePeriod period{NO_START_PERIOD}; + period.numberPhases = default_limits.number_phases; if (period_tx.startPeriod != NO_START_PERIOD) { period = period_tx; } if (period_tx_default.startPeriod != NO_START_PERIOD) { - if ((period.limit == NO_LIMIT_SPECIFIED) && (period_tx_default.limit != NO_LIMIT_SPECIFIED)) { + if ((!period.limit.has_value()) && period_tx_default.limit.has_value()) { period = period_tx_default; } } @@ -560,20 +572,24 @@ CompositeSchedule calculate_composite_schedule(const CompositeSchedule& charging period.numberPhases = default_limits.number_phases; } - if (period.limit == NO_LIMIT_SPECIFIED) { + if (!period.limit.has_value()) { period.limit = default_limit; } period.startPeriod = current_period; // check this new period is a change from the previous one - if ((period.limit != last.limit) || (period.numberPhases.value() != last.numberPhases.value())) { + if ((period.limit != last.limit) || + (!last.numberPhases.has_value() || (period.numberPhases.value() != last.numberPhases.value()))) { combined.chargingSchedulePeriod.push_back(period); } current_period = duration; last = period; } else { - combined.chargingSchedulePeriod.push_back( - {current_period, default_limit, std::nullopt, default_limits.number_phases}); + ChargingSchedulePeriod no_start_period; + no_start_period.startPeriod = current_period; + no_start_period.limit = default_limit; // FIXME? + no_start_period.numberPhases = default_limits.number_phases; + combined.chargingSchedulePeriod.push_back(no_start_period); current_period = end; } } diff --git a/lib/ocpp/v201/smart_charging.cpp b/lib/ocpp/v201/smart_charging.cpp index ec3f11003..6c3e4129a 100644 --- a/lib/ocpp/v201/smart_charging.cpp +++ b/lib/ocpp/v201/smart_charging.cpp @@ -157,7 +157,7 @@ void SmartChargingHandler::delete_transaction_tx_profiles(const std::string& tra SetChargingProfileResponse SmartChargingHandler::conform_validate_and_add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source, + CiString<20> charging_limit_source, AddChargingProfileSource source_of_request) { SetChargingProfileResponse response; response.status = ChargingProfileStatusEnum::Rejected; @@ -425,7 +425,7 @@ SmartChargingHandler::validate_request_start_transaction_profile(const ChargingP } SetChargingProfileResponse SmartChargingHandler::add_profile(ChargingProfile& profile, int32_t evse_id, - ChargingLimitSourceEnum charging_limit_source) { + CiString<20> charging_limit_source) { SetChargingProfileResponse response; response.status = ChargingProfileStatusEnum::Accepted; diff --git a/lib/ocpp/v201/transaction.cpp b/lib/ocpp/v201/transaction.cpp index d60a2c9d3..a2602b73a 100644 --- a/lib/ocpp/v201/transaction.cpp +++ b/lib/ocpp/v201/transaction.cpp @@ -11,8 +11,12 @@ namespace ocpp { namespace v201 { 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/v201/utils.cpp b/lib/ocpp/v201/utils.cpp index 73fa775bb..40a224766 100644 --- a/lib/ocpp/v201/utils.cpp +++ b/lib/ocpp/v201/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 v201 } // namespace ocpp diff --git a/lib/ocpp/v21/messages/AFRRSignal.cpp b/lib/ocpp/v21/messages/AFRRSignal.cpp new file mode 100644 index 000000000..2cd791faa --- /dev/null +++ b/lib/ocpp/v21/messages/AFRRSignal.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..656aa884d --- /dev/null +++ b/lib/ocpp/v21/messages/AdjustPeriodicEventStream.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..0fcb37659 --- /dev/null +++ b/lib/ocpp/v21/messages/BatterySwap.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 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::v201::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::v201::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..b97b34670 --- /dev/null +++ b/lib/ocpp/v21/messages/CMakeLists.txt @@ -0,0 +1,28 @@ + +target_sources(ocpp + PRIVATE + AFRRSignal.cpp + AdjustPeriodicEventStream.cpp + BatterySwap.cpp + ChangeTransactionTariff.cpp + ClearDERControl.cpp + ClearTariffs.cpp + ClosePeriodicEventStream.cpp + GetDERControl.cpp + GetPeriodicEventStream.cpp + GetTariffs.cpp + NotifyAllowedEnergyTransfer.cpp + NotifyDERAlarm.cpp + NotifyDERStartStop.cpp + NotifyPeriodicEventStream.cpp + NotifyPriorityCharging.cpp + NotifySettlement.cpp + OpenPeriodicEventStream.cpp + PullDynamicScheduleUpdate.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..0713758d4 --- /dev/null +++ b/lib/ocpp/v21/messages/ChangeTransactionTariff.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..fe7a742b5 --- /dev/null +++ b/lib/ocpp/v21/messages/ClearDERControl.cpp @@ -0,0 +1,99 @@ +// 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 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::v201::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::v201::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::v201::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::v201::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..ec2830e02 --- /dev/null +++ b/lib/ocpp/v21/messages/ClearTariffs.cpp @@ -0,0 +1,104 @@ +// 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 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..c6656ba93 --- /dev/null +++ b/lib/ocpp/v21/messages/ClosePeriodicEventStream.cpp @@ -0,0 +1,78 @@ +// 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 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/GetCRL.cpp b/lib/ocpp/v21/messages/GetCRL.cpp new file mode 100644 index 000000000..0b1620225 --- /dev/null +++ b/lib/ocpp/v21/messages/GetCRL.cpp @@ -0,0 +1,91 @@ +// 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 GetCRLRequest::get_type() const { + return "GetCRL"; +} + +void to_json(json& j, const GetCRLRequest& k) { + // the required parts of the message + j = json{ + {"certificateHashData", k.certificateHashData}, + {"requestId", k.requestId}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, GetCRLRequest& k) { + // the required parts of the message + k.certificateHashData = j.at("certificateHashData"); + 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 GetCRLRequest \p k to the given output stream \p os +/// \returns an output stream with the GetCRLRequest written to +std::ostream& operator<<(std::ostream& os, const GetCRLRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string GetCRLResponse::get_type() const { + return "GetCRLResponse"; +} + +void to_json(json& j, const GetCRLResponse& k) { + // the required parts of the message + j = json{ + {"requestId", k.requestId}, + {"status", ocpp::v201::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, GetCRLResponse& k) { + // the required parts of the message + k.requestId = j.at("requestId"); + k.status = ocpp::v201::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 GetCRLResponse \p k to the given output stream \p os +/// \returns an output stream with the GetCRLResponse written to +std::ostream& operator<<(std::ostream& os, const GetCRLResponse& 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..e7354956d --- /dev/null +++ b/lib/ocpp/v21/messages/GetDERControl.cpp @@ -0,0 +1,105 @@ +// 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 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::v201::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::v201::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::v201::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::v201::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..df11cf284 --- /dev/null +++ b/lib/ocpp/v21/messages/GetPeriodicEventStream.cpp @@ -0,0 +1,93 @@ +// 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 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..e764d5f9e --- /dev/null +++ b/lib/ocpp/v21/messages/GetTariffs.cpp @@ -0,0 +1,101 @@ +// 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 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::v201::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::v201::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..7ec03f451 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyAllowedEnergyTransfer.cpp @@ -0,0 +1,91 @@ +// 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 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::v201::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::v201::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..4b87cd3c6 --- /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::v201::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::v201::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..b1ff8f7ab --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyDERAlarm.cpp @@ -0,0 +1,98 @@ +// 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 NotifyDERAlarmRequest::get_type() const { + return "NotifyDERAlarm"; +} + +void to_json(json& j, const NotifyDERAlarmRequest& k) { + // the required parts of the message + j = json{ + {"controlType", ocpp::v201::conversions::dercontrol_enum_to_string(k.controlType)}, + {"timestamp", k.timestamp.to_rfc3339()}, + }; + // the optional parts of the message + if (k.gridEventFault) { + j["gridEventFault"] = ocpp::v201::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::v201::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::v201::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..a30dc0c79 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyDERStartStop.cpp @@ -0,0 +1,96 @@ +// 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 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..9b8d382fc --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyPeriodicEventStream.cpp @@ -0,0 +1,57 @@ +// 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 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..87ab8a8f4 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyPriorityCharging.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 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..d07634e5a --- /dev/null +++ b/lib/ocpp/v21/messages/NotifySettlement.cpp @@ -0,0 +1,132 @@ +// 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 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::v201::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::v201::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/OpenPeriodicEventStream.cpp b/lib/ocpp/v21/messages/OpenPeriodicEventStream.cpp new file mode 100644 index 000000000..98f41c9a1 --- /dev/null +++ b/lib/ocpp/v21/messages/OpenPeriodicEventStream.cpp @@ -0,0 +1,87 @@ +// 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 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::v201::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::v201::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..07655efb8 --- /dev/null +++ b/lib/ocpp/v21/messages/PullDynamicScheduleUpdate.cpp @@ -0,0 +1,93 @@ +// 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 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::v201::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::v201::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/RequestBatterySwap.cpp b/lib/ocpp/v21/messages/RequestBatterySwap.cpp new file mode 100644 index 000000000..3e17c1e76 --- /dev/null +++ b/lib/ocpp/v21/messages/RequestBatterySwap.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..9dd0df4c6 --- /dev/null +++ b/lib/ocpp/v21/messages/SetDERControl.cpp @@ -0,0 +1,153 @@ +// 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 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::v201::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::v201::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::v201::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::v201::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..77bb0beca --- /dev/null +++ b/lib/ocpp/v21/messages/SetDefaultTariff.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..70cf99312 --- /dev/null +++ b/lib/ocpp/v21/messages/UpdateDynamicSchedule.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..19a36153c --- /dev/null +++ b/lib/ocpp/v21/messages/UsePriorityCharging.cpp @@ -0,0 +1,89 @@ +// 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 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::v201::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::v201::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..2d9584e20 --- /dev/null +++ b/lib/ocpp/v21/messages/VatNumberValidation.cpp @@ -0,0 +1,107 @@ +// 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 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::v201::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::v201::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/common/generate_cpp.py b/src/code_generator/common/generate_cpp.py index da2c2bd16..788986e1d 100644 --- a/src/code_generator/common/generate_cpp.py +++ b/src/code_generator/common/generate_cpp.py @@ -192,6 +192,40 @@ def needs_types(types): enum_types['ExtendedTriggerMessageResponse']['status'] = 'TriggerMessageStatusEnumType' +# messages from OCPP 2.1 +v21_messages = ['AFRRSignal', + 'AdjustPeriodicEventStream', + 'BatterySwap', + 'ChangeTransactionTariff', + 'ClearDERControl', + 'ClearTariffs', + 'ClosePeriodicEventStream', + 'GetCRL', + 'GetDERControl', + 'GetPeriodicEventStream', + 'GetTariffs', + 'NotifyAllowedEnergyTransfer', + 'NotifyCRL', + 'NotifyDERAlarm', + 'NotifyDERStartStop', + 'NotifyPeriodicEventStream', + 'NotifyPriorityCharging', + 'NotifyQRCodeScanned', + 'NotifySettlement', + 'OpenPeriodicEventStream', + 'PullDynamicScheduleUpdate', + '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 +239,9 @@ 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') + #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 +387,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 +402,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 == 'v201': + 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 +453,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() @@ -449,7 +527,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() @@ -478,11 +559,22 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), 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::v201::' + 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 +584,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 +654,11 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), })) first = False + if version == 'v201': + 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 +689,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,7 +709,7 @@ 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 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..25b4b0bae 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::v201; +{% 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/tests/lib/ocpp/v201/functional_blocks/test_authorization.cpp b/tests/lib/ocpp/v201/functional_blocks/test_authorization.cpp index cf9a6aed5..b1bb2caee 100644 --- a/tests/lib/ocpp/v201/functional_blocks/test_authorization.cpp +++ b/tests/lib/ocpp/v201/functional_blocks/test_authorization.cpp @@ -189,7 +189,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; @@ -451,7 +451,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); @@ -461,7 +461,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); @@ -480,7 +480,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, @@ -501,7 +501,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, @@ -524,7 +524,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, @@ -549,7 +549,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, @@ -579,7 +579,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, @@ -598,7 +598,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; @@ -618,7 +618,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, @@ -639,7 +639,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); @@ -668,7 +668,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, @@ -688,7 +688,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); @@ -711,7 +711,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); @@ -725,7 +725,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, @@ -753,7 +753,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); @@ -772,7 +772,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); @@ -795,7 +795,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); @@ -812,7 +812,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); @@ -833,7 +833,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); @@ -856,7 +856,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, @@ -882,7 +882,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, @@ -908,7 +908,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, @@ -947,7 +947,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, @@ -978,7 +978,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]() { @@ -1015,7 +1015,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]() { @@ -1053,7 +1053,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); } @@ -1076,7 +1076,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); } @@ -1103,7 +1103,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/v201/functional_blocks/test_reservation.cpp b/tests/lib/ocpp/v201/functional_blocks/test_reservation.cpp index 50c49d707..8c597347f 100644 --- a/tests/lib/ocpp/v201/functional_blocks/test_reservation.cpp +++ b/tests/lib/ocpp/v201/functional_blocks/test_reservation.cpp @@ -36,7 +36,7 @@ class ReservationTest : public ::testing::Test { mock_dispatcher, *this->device_model, evse_manager, 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; } /// @@ -127,7 +127,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; @@ -168,8 +168,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; // Make reservation a unique ptr so we can create it after creating the device model. std::unique_ptr reservation; @@ -294,7 +294,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(); @@ -304,7 +304,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); } @@ -312,10 +313,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(); @@ -326,7 +327,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); } @@ -334,13 +335,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)); @@ -357,13 +358,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)); @@ -378,10 +379,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()); @@ -398,12 +399,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()); @@ -421,12 +422,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)); @@ -534,7 +535,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/v201/mocks/database_handler_mock.hpp b/tests/lib/ocpp/v201/mocks/database_handler_mock.hpp index 61023e866..47ab76a39 100644 --- a/tests/lib/ocpp/v201/mocks/database_handler_mock.hpp +++ b/tests/lib/ocpp/v201/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::v201 diff --git a/tests/lib/ocpp/v201/mocks/evse_manager_fake.hpp b/tests/lib/ocpp/v201/mocks/evse_manager_fake.hpp index 45b777082..b2496347b 100644 --- a/tests/lib/ocpp/v201/mocks/evse_manager_fake.hpp +++ b/tests/lib/ocpp/v201/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/v201/mocks/evse_mock.hpp b/tests/lib/ocpp/v201/mocks/evse_mock.hpp index 2d27ac7a7..17a085fc0 100644 --- a/tests/lib/ocpp/v201/mocks/evse_mock.hpp +++ b/tests/lib/ocpp/v201/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/v201/mocks/smart_charging_handler_mock.hpp b/tests/lib/ocpp/v201/mocks/smart_charging_handler_mock.hpp index d34f9b1ae..7243b0add 100644 --- a/tests/lib/ocpp/v201/mocks/smart_charging_handler_mock.hpp +++ b/tests/lib/ocpp/v201/mocks/smart_charging_handler_mock.hpp @@ -13,13 +13,13 @@ namespace ocpp::v201 { class SmartChargingHandlerMock : public SmartChargingHandlerInterface { public: 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)); MOCK_METHOD(void, delete_transaction_tx_profiles, (const std::string& transaction_id)); MOCK_METHOD(SetChargingProfileResponse, add_profile, - (ChargingProfile & profile, int32_t evse_id, ChargingLimitSourceEnum charging_limit_source)); + (ChargingProfile & profile, int32_t evse_id, CiString<20> charging_limit_source)); MOCK_METHOD(ClearChargingProfileResponse, clear_profiles, (const ClearChargingProfileRequest& request), (override)); MOCK_METHOD(std::vector, get_reported_profiles, (const GetChargingProfilesRequest& request), (const, override)); diff --git a/tests/lib/ocpp/v201/test_charge_point.cpp b/tests/lib/ocpp/v201/test_charge_point.cpp index b8cba8fb8..a5299825a 100644 --- a/tests/lib/ocpp/v201/test_charge_point.cpp +++ b/tests/lib/ocpp/v201/test_charge_point.cpp @@ -87,22 +87,11 @@ class ChargePointCommonTestFixtureV201 : public DatabaseTestingUtils { 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, - }; + ChargingSchedule charging_schedule; + charging_schedule.chargingRateUnit = charging_rate_unit; + charging_schedule.chargingSchedulePeriod = charging_schedule_period; + charging_schedule.startSchedule = start_schedule; + return charging_schedule; } ChargingProfile @@ -185,8 +174,8 @@ class ChargePointCommonTestFixtureV201 : 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; @@ -706,7 +695,7 @@ TEST_F(ChargePointFunctionalityTestFixtureV201, K01_SetChargingProfileRequest_Va request_to_enhanced_message(req); EXPECT_CALL(*smart_charging_handler, - conform_validate_and_add_profile(profile, DEFAULT_EVSE_ID, ChargingLimitSourceEnum::CSO, + conform_validate_and_add_profile(profile, DEFAULT_EVSE_ID, ChargingLimitSourceEnumStringType::CSO, DEFAULT_REQUEST_TO_ADD_PROFILE_SOURCE)); charge_point->handle_message(set_charging_profile_req); @@ -824,7 +813,7 @@ TEST_F(ChargePointFunctionalityTestFixtureV201, 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 = @@ -944,7 +933,7 @@ TEST_F(ChargePointFunctionalityTestFixtureV201, 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/v201/test_composite_schedule.cpp b/tests/lib/ocpp/v201/test_composite_schedule.cpp index 1d733494d..d1ef2e10d 100644 --- a/tests/lib/ocpp/v201/test_composite_schedule.cpp +++ b/tests/lib/ocpp/v201/test_composite_schedule.cpp @@ -71,45 +71,19 @@ class CompositeScheduleTestFixtureV201 : public DatabaseTestingUtils { } 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 charging_schedule; + charging_schedule.chargingRateUnit = charging_rate_unit; + return charging_schedule; } 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, - }; + 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 diff --git a/tests/lib/ocpp/v201/test_database_handler.cpp b/tests/lib/ocpp/v201/test_database_handler.cpp index 5a0fd8795..199afaaf1 100644 --- a/tests/lib/ocpp/v201/test_database_handler.cpp +++ b/tests/lib/ocpp/v201/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/v201/test_device_model.cpp b/tests/lib/ocpp/v201/test_device_model.cpp index 2ce6e2823..6bf349cf2 100644 --- a/tests/lib/ocpp/v201/test_device_model.cpp +++ b/tests/lib/ocpp/v201/test_device_model.cpp @@ -102,8 +102,8 @@ TEST_F(DeviceModelTest, test_set_monitors) { 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 @@ -164,8 +164,8 @@ TEST_F(DeviceModelTest, test_get_monitors) { 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); @@ -209,8 +209,8 @@ TEST_F(DeviceModelTest, test_clear_monitors) { variable_comp2.name = "Interval"; std::vector components = { - {component1, std::nullopt, variable_comp1}, - {component2, std::nullopt, variable_comp2}, + {component1, variable_comp1}, + {component2, variable_comp2}, }; // Insert some monitors that are hard-wired diff --git a/tests/lib/ocpp/v201/test_profile.cpp b/tests/lib/ocpp/v201/test_profile.cpp index 6960a2398..a27afc18e 100644 --- a/tests/lib/ocpp/v201/test_profile.cpp +++ b/tests/lib/ocpp/v201/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); @@ -681,7 +689,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_Empty) { std::vector combined_schedules{}; ChargingSchedulePeriod period; period.startPeriod = 0; - period.limit = NO_LIMIT_SPECIFIED; + period.limit = std::nullopt; CompositeSchedule expected; expected.chargingSchedulePeriod = {period}; expected.evseId = EVSEID_NOT_SET; @@ -730,7 +738,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_ShortExact) { period1.numberPhases = 3; ChargingSchedulePeriod period2; period2.startPeriod = 599; - period2.limit = NO_LIMIT_SPECIFIED; + period2.limit = std::nullopt; CompositeSchedule expected; expected.chargingSchedulePeriod = {period1, period2}; expected.evseId = EVSEID_NOT_SET; @@ -777,14 +785,14 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_AlmostExact) { ChargingSchedulePeriod period1; period1.startPeriod = 0; - period1.limit = NO_LIMIT_SPECIFIED; + period1.limit = std::nullopt; ChargingSchedulePeriod period2; period2.startPeriod = 1; period2.limit = 24.0; period2.numberPhases = 3; ChargingSchedulePeriod period3; period3.startPeriod = 599; - period3.limit = NO_LIMIT_SPECIFIED; + period3.limit = std::nullopt; CompositeSchedule expected; expected.chargingSchedulePeriod = {period1, period2, period3}; expected.evseId = EVSEID_NOT_SET; @@ -831,7 +839,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_SingleShort) { period1.numberPhases = 3; ChargingSchedulePeriod period2; period2.startPeriod = 300; - period2.limit = NO_LIMIT_SPECIFIED; + period2.limit = std::nullopt; CompositeSchedule expected; expected.chargingSchedulePeriod = {period1, period2}; expected.evseId = EVSEID_NOT_SET; @@ -852,7 +860,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_SingleDelayedStartLong) { {dt("12:02"), dt("12:30"), 24.0, 3, std::nullopt, 1, ChargingRateUnitEnum::A, std::nullopt}}; ChargingSchedulePeriod period1; period1.startPeriod = 0; - period1.limit = NO_LIMIT_SPECIFIED; + period1.limit = std::nullopt; ChargingSchedulePeriod period2; period2.startPeriod = 120, period2.limit = 24.0, period2.numberPhases = 3; CompositeSchedule expected; @@ -1097,7 +1105,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_1SecondGap) { period1.numberPhases = 1; ChargingSchedulePeriod period2; period2.startPeriod = 299; - period2.limit = NO_LIMIT_SPECIFIED; + period2.limit = std::nullopt; ChargingSchedulePeriod period3; period3.startPeriod = 300; period3.limit = 24.0; @@ -1128,7 +1136,7 @@ TEST(OCPPTypesTest, CalculateChargingSchedule_WithPhaseToUse) { period1.phaseToUse = 3; ChargingSchedulePeriod period2; period2.startPeriod = 299; - period2.limit = NO_LIMIT_SPECIFIED; + period2.limit = std::nullopt; ChargingSchedulePeriod period3; period3.startPeriod = 300; period3.limit = 24.0; @@ -1247,13 +1255,13 @@ TEST(OCPPTypesTest, CalculateChargingScheduleCombined_CombinedOverlapTxAndTxDefa ChargingSchedulePeriod period3; period3.startPeriod = 0; - period3.limit = NO_LIMIT_SPECIFIED; + period3.limit = std::nullopt; ChargingSchedulePeriod period4; period4.startPeriod = 150; period4.limit = 32.0; ChargingSchedulePeriod period5; period5.startPeriod = 450; - period5.limit = NO_LIMIT_SPECIFIED; + period5.limit = std::nullopt; CompositeSchedule tx_schedule; tx_schedule.chargingSchedulePeriod = {period3, period4, period5}; tx_schedule.evseId = EVSEID_NOT_SET; @@ -1263,7 +1271,7 @@ TEST(OCPPTypesTest, CalculateChargingScheduleCombined_CombinedOverlapTxAndTxDefa ChargingSchedulePeriod period6; period6.startPeriod = 0; - period6.limit = NO_LIMIT_SPECIFIED; + period6.limit = std::nullopt; CompositeSchedule charging_station_max; charging_station_max.chargingSchedulePeriod = {period6}; charging_station_max.evseId = EVSEID_NOT_SET; @@ -1313,13 +1321,13 @@ TEST(OCPPTypesTest, CalculateChargingScheduleCombined_CombinedOverlapTxTxDefault ChargingSchedulePeriod period3; period3.startPeriod = 0; - period3.limit = NO_LIMIT_SPECIFIED; + period3.limit = std::nullopt; ChargingSchedulePeriod period4; period4.startPeriod = 150; period4.limit = 32.0; ChargingSchedulePeriod period5; period5.startPeriod = 450; - period5.limit = NO_LIMIT_SPECIFIED; + period5.limit = std::nullopt; CompositeSchedule tx_schedule; tx_schedule.chargingSchedulePeriod = {period3, period4, period5}; @@ -1330,13 +1338,13 @@ TEST(OCPPTypesTest, CalculateChargingScheduleCombined_CombinedOverlapTxTxDefault ChargingSchedulePeriod period6; period6.startPeriod = 0; - period6.limit = NO_LIMIT_SPECIFIED; + period6.limit = std::nullopt; ChargingSchedulePeriod period7; period7.startPeriod = 500; period7.limit = 15.0; ChargingSchedulePeriod period8; period8.startPeriod = 550; - period8.limit = NO_LIMIT_SPECIFIED; + period8.limit = std::nullopt; CompositeSchedule charging_station_max; charging_station_max.chargingSchedulePeriod = {period6, period7, period8}; charging_station_max.evseId = EVSEID_NOT_SET; diff --git a/tests/lib/ocpp/v201/test_smart_charging_handler.cpp b/tests/lib/ocpp/v201/test_smart_charging_handler.cpp index 2e2300810..ab4a1d427 100644 --- a/tests/lib/ocpp/v201/test_smart_charging_handler.cpp +++ b/tests/lib/ocpp/v201/test_smart_charging_handler.cpp @@ -70,45 +70,19 @@ class SmartChargingHandlerTestFixtureV201 : public DatabaseTestingUtils { } 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 charging_schedule; + charging_schedule.chargingRateUnit = charging_rate_unit; + return charging_schedule; } 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, - }; + 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 @@ -166,11 +140,11 @@ class SmartChargingHandlerTestFixtureV201 : public DatabaseTestingUtils { return charging_profile; } - 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 + 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; @@ -1271,7 +1245,7 @@ TEST_F(SmartChargingHandlerTestFixtureV201, K04FR01_AddProfile_OnlyAddsToOneEVSE } TEST_F(SmartChargingHandlerTestFixtureV201, 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( @@ -1286,11 +1260,11 @@ TEST_F(SmartChargingHandlerTestFixtureV201, 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(SmartChargingHandlerTestFixtureV201, ValidateAndAddProfile_StoresChargingLimitSource) { - auto charging_limit_source = ChargingLimitSourceEnum::SO; + auto charging_limit_source = ChargingLimitSourceEnumStringType::SO; auto periods = create_charging_schedule_periods({0, 1, 2}); @@ -1309,7 +1283,7 @@ TEST_F(SmartChargingHandlerTestFixtureV201, ValidateAndAddProfile_StoresCharging 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(SmartChargingHandlerTestFixtureV201, K01_ValidateAndAdd_RejectsInvalidProfilesWithReasonCode) { @@ -1466,8 +1440,8 @@ TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseIdAndSou 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 = handler.get_reported_profiles(create_get_charging_profile_request( DEFAULT_REQUEST_ID, create_charging_profile_criteria(requested_sources_cso), DEFAULT_EVSE_ID)); @@ -1513,7 +1487,7 @@ TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_EvseIdAndPur } TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_ReportsProfileWithSource) { - auto charging_limit_source = ChargingLimitSourceEnum::SO; + auto charging_limit_source = ChargingLimitSourceEnumStringType::SO; auto periods = create_charging_schedule_periods({0, 1, 2}); @@ -1531,7 +1505,7 @@ TEST_F(SmartChargingHandlerTestFixtureV201, K09_GetChargingProfiles_ReportsProfi 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(SmartChargingHandlerTestFixtureV201, K10_ClearChargingProfile_ClearsId) { diff --git a/tests/lib/ocpp/v201/utils_tests.cpp b/tests/lib/ocpp/v201/utils_tests.cpp index 99b5e7b43..26de8a9e7 100644 --- a/tests/lib/ocpp/v201/utils_tests.cpp +++ b/tests/lib/ocpp/v201/utils_tests.cpp @@ -16,7 +16,7 @@ class V201UtilsTest : public ::testing::Test { "hello there hello there hello there hello there hello there hello there hello there hello there " "hello there hello there hello there hello there hello there hello there hello there hello there " "hello there hello there hello there hello there hello there hello there hello there hello there"; - const ocpp::v201::IdToken valid_central_token = {"valid", ocpp::v201::IdTokenEnum::Central}; + const ocpp::v201::IdToken valid_central_token = {"valid", ocpp::v201::IdTokenEnumStringType::Central}; void SetUp() override { } @@ -34,8 +34,8 @@ TEST_F(V201UtilsTest, test_valid_sha256) { } TEST_F(V201UtilsTest, test_valid_generate_token_hash) { - ocpp::v201::IdToken valid_iso14443_token = {"ABAD1DEA", ocpp::v201::IdTokenEnum::ISO14443}; - ocpp::v201::IdToken valid_iso15693_token = {"ABAD1DEA", ocpp::v201::IdTokenEnum::ISO15693}; + ocpp::v201::IdToken valid_iso14443_token = {"ABAD1DEA", ocpp::v201::IdTokenEnumStringType::ISO14443}; + ocpp::v201::IdToken valid_iso15693_token = {"ABAD1DEA", ocpp::v201::IdTokenEnumStringType::ISO15693}; ASSERT_EQ("63f3202a9c2e08a033a861481c6259e7a70a2b6e243f91233ebf26f33859c113", ocpp::v201::utils::generate_token_hash(valid_central_token));