diff --git a/.ci/build-kit/install_and_test.sh b/.ci/build-kit/install_and_test.sh index 96e58b9d5..e840ab877 100755 --- a/.ci/build-kit/install_and_test.sh +++ b/.ci/build-kit/install_and_test.sh @@ -16,6 +16,6 @@ ninja -j$(nproc) -C build install trap "cp build/Testing/Temporary/LastTest.log /ext/ctest-report" EXIT -ninja -j$(nproc) -C build test +CTEST_OUTPUT_ON_FAILURE=1 ninja -j$(nproc) -C build test # cmake -B build -G Ninja -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="./dist" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ No newline at end of file diff --git a/include/ocpp/common/constants.hpp b/include/ocpp/common/constants.hpp index 93a0eca9e..6fa16910e 100644 --- a/include/ocpp/common/constants.hpp +++ b/include/ocpp/common/constants.hpp @@ -18,7 +18,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 e2804b0c6..ef3006aa0 100644 --- a/include/ocpp/v201/charge_point.hpp +++ b/include/ocpp/v201/charge_point.hpp @@ -241,7 +241,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 Event handler that can be called to trigger a NotifyEvent.req with the given \p events @@ -640,7 +640,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa void notify_report_req(const int request_id, const std::vector& report_data); // Functional Block C: Authorization - 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); // Functional Block G: Availability @@ -665,9 +665,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 @@ -898,7 +897,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 a154f6e69..521556159 100644 --- a/include/ocpp/v201/charge_point_callbacks.hpp +++ b/include/ocpp/v201/charge_point_callbacks.hpp @@ -75,8 +75,8 @@ struct Callbacks { /// \return True if evse is reserved for the given id token / group id token, false if it is reserved for another /// one. /// - 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 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/database_handler.hpp b/include/ocpp/v201/database_handler.hpp index 437e5ba14..768dde791 100644 --- a/include/ocpp/v201/database_handler.hpp +++ b/include/ocpp/v201/database_handler.hpp @@ -181,7 +181,7 @@ class DatabaseHandler : public common::DatabaseHandlerCommon { /// \brief Inserts or updates the given \p profile to CHARGING_PROFILES table void insert_or_update_charging_profile( const int evse_id, const v201::ChargingProfile& profile, - const ChargingLimitSourceEnum charging_limit_source = ChargingLimitSourceEnum::CSO); + const CiString<20> charging_limit_source = ChargingLimitSourceEnumStringType::CSO); /// \brief Deletes the profile with the given \p profile_id bool delete_charging_profile(const int profile_id); @@ -210,7 +210,7 @@ class DatabaseHandler : public common::DatabaseHandlerCommon { /// \brief Retrieves all ChargingProfiles grouped by EVSE ID virtual std::map> get_all_charging_profiles_group_by_evse(); - ChargingLimitSourceEnum get_charging_limit_source_for_profile(const int profile_id); + CiString<20> get_charging_limit_source_for_profile(const int profile_id); std::unique_ptr new_statement(const std::string& sql); }; diff --git a/include/ocpp/v201/messages/Authorize.hpp b/include/ocpp/v201/messages/Authorize.hpp index 9e20e8569..1ae20d688 100644 --- a/include/ocpp/v201/messages/Authorize.hpp +++ b/include/ocpp/v201/messages/Authorize.hpp @@ -19,7 +19,7 @@ namespace v201 { struct AuthorizeRequest : public ocpp::Message { IdToken idToken; std::optional customData; - std::optional> certificate; + std::optional> certificate; std::optional> iso15118CertificateHashData; /// \brief Provides the type of this Authorize message as a human readable string @@ -42,6 +42,9 @@ struct AuthorizeResponse : public ocpp::Message { IdTokenInfo idTokenInfo; std::optional customData; std::optional certificateStatus; + std::optional> allowedEnergyTransfer; + std::optional tariff; + std::optional transactionLimit; /// \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/ClearedChargingLimit.hpp b/include/ocpp/v201/messages/ClearedChargingLimit.hpp index 4912aeca6..20f200650 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,7 +16,7 @@ namespace v201 { /// \brief Contains a OCPP ClearedChargingLimit message struct ClearedChargingLimitRequest : public ocpp::Message { - ChargingLimitSourceEnum chargingLimitSource; + CiString<20> chargingLimitSource; std::optional customData; std::optional evseId; diff --git a/include/ocpp/v201/messages/FirmwareStatusNotification.hpp b/include/ocpp/v201/messages/FirmwareStatusNotification.hpp index 50dd623f2..0eda52bf7 100644 --- a/include/ocpp/v201/messages/FirmwareStatusNotification.hpp +++ b/include/ocpp/v201/messages/FirmwareStatusNotification.hpp @@ -20,6 +20,7 @@ struct FirmwareStatusNotificationRequest : public ocpp::Message { FirmwareStatusEnum status; std::optional customData; std::optional requestId; + std::optional statusInfo; /// \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..820f5b350 100644 --- a/include/ocpp/v201/messages/Get15118EVCertificate.hpp +++ b/include/ocpp/v201/messages/Get15118EVCertificate.hpp @@ -20,8 +20,10 @@ namespace v201 { struct Get15118EVCertificateRequest : public ocpp::Message { CiString<50> iso15118SchemaVersion; CertificateActionEnum action; - CiString<5600> exiRequest; + CiString<11000> exiRequest; std::optional customData; + std::optional maximumContractCertificateChains; + std::optional>> prioritizedEMAIDs; /// \brief Provides the type of this Get15118EVCertificate message as a human readable string /// \returns the message type as a human readable string @@ -44,6 +46,7 @@ struct Get15118EVCertificateResponse : public ocpp::Message { CiString exiResponse; std::optional customData; std::optional statusInfo; + std::optional remainingContracts; /// \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/GetCertificateStatus.hpp b/include/ocpp/v201/messages/GetCertificateStatus.hpp index 692061b73..6c3e8ec23 100644 --- a/include/ocpp/v201/messages/GetCertificateStatus.hpp +++ b/include/ocpp/v201/messages/GetCertificateStatus.hpp @@ -40,7 +40,7 @@ struct GetCertificateStatusResponse : public ocpp::Message { GetCertificateStatusEnum status; std::optional customData; std::optional statusInfo; - std::optional> ocspResult; + std::optional> ocspResult; /// \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/InstallCertificate.hpp b/include/ocpp/v201/messages/InstallCertificate.hpp index d12eab7f7..3bc55d5b9 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 diff --git a/include/ocpp/v201/messages/LogStatusNotification.hpp b/include/ocpp/v201/messages/LogStatusNotification.hpp index 58d2c7995..1482abdc3 100644 --- a/include/ocpp/v201/messages/LogStatusNotification.hpp +++ b/include/ocpp/v201/messages/LogStatusNotification.hpp @@ -20,6 +20,7 @@ struct LogStatusNotificationRequest : public ocpp::Message { UploadLogStatusEnum status; std::optional customData; std::optional requestId; + std::optional statusInfo; /// \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/NotifyEVChargingNeeds.hpp b/include/ocpp/v201/messages/NotifyEVChargingNeeds.hpp index fa84aed9f..940a29cf7 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; + ChargingNeeds chargingNeeds; std::optional customData; std::optional maxScheduleTuples; + std::optional timestamp; /// \brief Provides the type of this NotifyEVChargingNeeds 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..6dc67f85c 100644 --- a/include/ocpp/v201/messages/NotifyEVChargingSchedule.hpp +++ b/include/ocpp/v201/messages/NotifyEVChargingSchedule.hpp @@ -21,6 +21,8 @@ struct NotifyEVChargingScheduleRequest : public ocpp::Message { ChargingSchedule chargingSchedule; int32_t evseId; std::optional customData; + std::optional selectedScheduleTupleId; + std::optional powerToleranceAcceptance; /// \brief Provides the type of this NotifyEVChargingSchedule message as a human readable string /// \returns the message type as a human readable string diff --git a/include/ocpp/v201/messages/PublishFirmware.hpp b/include/ocpp/v201/messages/PublishFirmware.hpp index 71ef28ae8..f2a5a6c2e 100644 --- a/include/ocpp/v201/messages/PublishFirmware.hpp +++ b/include/ocpp/v201/messages/PublishFirmware.hpp @@ -17,7 +17,7 @@ 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; diff --git a/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp b/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp index 6ad6076fc..6442b88c3 100644 --- a/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp +++ b/include/ocpp/v201/messages/PublishFirmwareStatusNotification.hpp @@ -19,8 +19,9 @@ namespace v201 { struct PublishFirmwareStatusNotificationRequest : public ocpp::Message { PublishFirmwareStatusEnum status; std::optional customData; - std::optional>> location; + std::optional>> location; std::optional requestId; + std::optional statusInfo; /// \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..c56c18630 100644 --- a/include/ocpp/v201/messages/ReportChargingProfiles.hpp +++ b/include/ocpp/v201/messages/ReportChargingProfiles.hpp @@ -18,7 +18,7 @@ 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; diff --git a/include/ocpp/v201/messages/RequestStartTransaction.hpp b/include/ocpp/v201/messages/RequestStartTransaction.hpp index 05501ac00..7bdb2c802 100644 --- a/include/ocpp/v201/messages/RequestStartTransaction.hpp +++ b/include/ocpp/v201/messages/RequestStartTransaction.hpp @@ -23,6 +23,7 @@ struct RequestStartTransactionRequest : public ocpp::Message { std::optional evseId; std::optional groupIdToken; std::optional chargingProfile; + std::optional transactionLimit; /// \brief Provides the type of this StartTransaction 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..509027711 100644 --- a/include/ocpp/v201/messages/ReserveNow.hpp +++ b/include/ocpp/v201/messages/ReserveNow.hpp @@ -21,7 +21,7 @@ struct ReserveNowRequest : public ocpp::Message { ocpp::DateTime expiryDateTime; IdToken idToken; std::optional customData; - std::optional connectorType; + std::optional> connectorType; std::optional evseId; std::optional groupIdToken; diff --git a/include/ocpp/v201/messages/TransactionEvent.hpp b/include/ocpp/v201/messages/TransactionEvent.hpp index 2837f176f..b1e2bb15e 100644 --- a/include/ocpp/v201/messages/TransactionEvent.hpp +++ b/include/ocpp/v201/messages/TransactionEvent.hpp @@ -23,11 +23,14 @@ struct TransactionEventRequest : public ocpp::Message { 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 cableMaxCurrent; std::optional reservationId; + std::optional preconditioningStatus; + std::optional evseSleep; std::optional evse; std::optional idToken; @@ -52,7 +55,9 @@ struct TransactionEventResponse : public ocpp::Message { std::optional totalCost; std::optional chargingPriority; std::optional idTokenInfo; + std::optional transactionLimit; std::optional updatedPersonalMessage; + std::optional> updatedPersonalMessageExtra; /// \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..721159647 100644 --- a/include/ocpp/v201/messages/TriggerMessage.hpp +++ b/include/ocpp/v201/messages/TriggerMessage.hpp @@ -20,6 +20,7 @@ struct TriggerMessageRequest : public ocpp::Message { MessageTriggerEnum requestedMessage; std::optional customData; std::optional evse; + std::optional> customTrigger; /// \brief Provides the type of this TriggerMessage 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..10add897a 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,120 @@ 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: AuthorizeResponse +enum class TariffKindEnum { + DefaultTariff, + UserTariff, +}; + +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: BatterySwapRequest +enum class BatterySwapEventEnum { + BatteryIn, + BatteryOut, +}; + +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, @@ -283,6 +392,32 @@ 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 TariffStatusEnum { + Accepted, + Rejected, + TooManyElements, + ConditionNotSupported, + NoTariff, + TariffInUse, + TxNotFound, + NoCurrencyChange, +}; + +namespace conversions { +/// \brief Converts the given TariffStatusEnum \p e to human readable string +/// \returns a string representation of the TariffStatusEnum +std::string tariff_status_enum_to_string(TariffStatusEnum e); + +/// \brief Converts the given std::string \p s to TariffStatusEnum +/// \returns a TariffStatusEnum from a string representation +TariffStatusEnum string_to_tariff_status_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given TariffStatusEnum \p tariff_status_enum to the given output +/// stream \p os \returns an output stream with the TariffStatusEnum written to +std::ostream& operator<<(std::ostream& os, const TariffStatusEnum& tariff_status_enum); + // from: ClearCacheResponse enum class ClearCacheStatusEnum { Accepted, @@ -309,6 +444,8 @@ enum class ChargingProfilePurposeEnum { ChargingStationMaxProfile, TxDefaultProfile, TxProfile, + PriorityCharging, + LocalGeneration, }; namespace conversions { @@ -346,10 +483,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, + Unsupported, + 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 { @@ -387,28 +587,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, @@ -653,24 +831,74 @@ 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: GetDERControlResponse +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: GetDERControlResponse +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: GetDisplayMessagesRequest enum class MessagePriorityEnum { @@ -699,6 +927,8 @@ enum class MessageStateEnum { Faulted, Idle, Unavailable, + Suspending, + Discharging, }; namespace conversions { @@ -743,6 +973,7 @@ enum class GetCertificateIdUseEnum { CSMSRootCertificate, V2GCertificateChain, ManufacturerRootCertificate, + OEMRootCertificate, }; namespace conversions { @@ -785,6 +1016,7 @@ std::ostream& operator<<(std::ostream& os, enum class LogEnum { DiagnosticsLog, SecurityLog, + DataCollectorLog, }; namespace conversions { @@ -914,8 +1146,9 @@ std::ostream& operator<<(std::ostream& os, const GetVariableStatusEnum& get_vari enum class InstallCertificateUseEnum { V2GRootCertificate, MORootCertificate, - CSMSRootCertificate, ManufacturerRootCertificate, + CSMSRootCertificate, + OEMRootCertificate, }; namespace conversions { @@ -979,59 +1212,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 +1286,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 +1347,7 @@ enum class LocationEnum { EV, Inlet, Outlet, + Upstream, }; namespace conversions { @@ -1099,6 +1364,48 @@ 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: NotifyCRLRequest +enum class NotifyCRLStatusEnum { + Available, + Unavailable, +}; + +namespace conversions { +/// \brief Converts the given NotifyCRLStatusEnum \p e to human readable string +/// \returns a string representation of the NotifyCRLStatusEnum +std::string notify_crlstatus_enum_to_string(NotifyCRLStatusEnum e); + +/// \brief Converts the given std::string \p s to NotifyCRLStatusEnum +/// \returns a NotifyCRLStatusEnum from a string representation +NotifyCRLStatusEnum string_to_notify_crlstatus_enum(const std::string& s); +} // namespace conversions + +/// \brief Writes the string representation of the given NotifyCRLStatusEnum \p notify_crlstatus_enum to the given +/// output stream \p os \returns an output stream with the NotifyCRLStatusEnum written to +std::ostream& operator<<(std::ostream& os, const NotifyCRLStatusEnum& notify_crlstatus_enum); + // from: NotifyChargingLimitRequest enum class CostKindEnum { CarbonDioxideEmission, @@ -1120,33 +1427,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 +1602,8 @@ enum class MonitorEnum { Delta, Periodic, PeriodicClockAligned, + TargetDelta, + TargetDeltaRelative, }; namespace conversions { @@ -1277,6 +1667,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 +1717,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 { @@ -1370,6 +1803,7 @@ std::ostream& operator<<(std::ostream& os, const RequestStartStopStatusEnum& req enum class ReservationUpdateStatusEnum { Expired, Removed, + NoTransaction, }; namespace conversions { @@ -1386,46 +1820,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 +1847,7 @@ std::ostream& operator<<(std::ostream& os, const ReserveNowStatusEnum& reserve_n enum class ResetEnum { Immediate, OnIdle, + ImmediateAndResume, }; namespace conversions { @@ -1531,26 +1926,6 @@ 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 { - 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: SetDisplayMessageResponse enum class DisplayMessageStatusEnum { Accepted, @@ -1559,6 +1934,7 @@ enum class DisplayMessageStatusEnum { NotSupportedPriority, NotSupportedState, UnknownTransaction, + LanguageNotSupported, }; namespace conversions { @@ -1598,9 +1974,9 @@ std::ostream& operator<<(std::ostream& os, const MonitoringBaseEnum& monitoring_ // from: SetNetworkProfileRequest enum class APNAuthenticationEnum { + PAP, CHAP, NONE, - PAP, AUTO, }; @@ -1624,6 +2000,8 @@ enum class OCPPVersionEnum { OCPP15, OCPP16, OCPP20, + OCPP201, + OCPP21, }; namespace conversions { @@ -1640,26 +2018,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 +2028,7 @@ enum class OCPPInterfaceEnum { Wireless1, Wireless2, Wireless3, + Any, }; namespace conversions { @@ -1686,6 +2045,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 +2179,31 @@ 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 TransactionEventEnum { Ended, @@ -1823,27 +2227,34 @@ 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, + LimitChanged, MeterValueClock, MeterValuePeriodic, + OperationModeChanged, + RemoteStart, + RemoteStop, + ResetCommand, + RunningCost, + SignedDataReceived, + SoCLimitReached, + StopAuthorized, + TariffChanged, TimeLimitReached, Trigger, + TxResumed, UnlockCommand, - StopAuthorized, - EVDeparted, - EVDetected, - RemoteStop, - RemoteStart, - AbnormalCondition, - SignedDataReceived, - ResetCommand, }; namespace conversions { @@ -1860,10 +2271,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 +2324,9 @@ enum class ReasonEnum { EVDisconnected, GroundFault, ImmediateReset, + MasterPass, Local, LocalOutOfCredit, - MasterPass, Other, OvercurrentFault, PowerLoss, @@ -1904,6 +2337,7 @@ enum class ReasonEnum { StoppedByEV, TimeLimitReached, Timeout, + ReqEnergyTransferRejected, }; namespace conversions { @@ -1929,10 +2363,12 @@ enum class MessageTriggerEnum { MeterValues, SignChargingStationCertificate, SignV2GCertificate, + SignV2G20Certificate, StatusNotification, TransactionEvent, SignCombinedCertificate, PublishFirmwareStatusNotification, + CustomTrigger, }; namespace conversions { @@ -2036,6 +2472,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 5c76097e8..efbdd0007 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 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 PeriodicEventStreamParams { + std::optional customData; + std::optional interval; + std::optional values; +}; +/// \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,8 +64,8 @@ void from_json(const json& j, AdditionalInfo& k); std::ostream& operator<<(std::ostream& os, const AdditionalInfo& k); struct IdToken { - CiString<36> idToken; - IdTokenEnum type; + CiString<255> idToken; + CiString<20> type; std::optional customData; std::optional> additionalInfo; }; @@ -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,7 +99,7 @@ std::ostream& operator<<(std::ostream& os, const OCSPRequestData& k); struct MessageContent { MessageFormatEnum format; - CiString<512> content; + CiString<1024> content; std::optional customData; std::optional> language; }; @@ -88,10 +118,10 @@ struct IdTokenInfo { 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; }; /// \brief Conversion from a given IdTokenInfo \p k to a given json object \p j @@ -104,6 +134,222 @@ 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 TariffConditions { + std::optional customData; + std::optional startTimeOfDay; + std::optional endTimeOfDay; + std::optional validFrom; + std::optional validTo; + 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> dayOfWeek; + std::optional evseKind; + std::optional tariffKind; + std::optional> paymentBrand; + std::optional> paymentRecognition; + std::optional isReservation; +}; +/// \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 TariffTimePrice { + float priceMinute; + std::optional customData; + std::optional stepSize; + std::optional conditions; +}; +/// \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 TaxRate { + CiString<20> type; + float tax; + 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 TariffTime { + std::vector prices; + std::optional customData; + std::optional> taxRates; +}; +/// \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 TariffEnergyPrice { + float priceKwh; + std::optional customData; + std::optional stepSize; + std::optional conditions; +}; +/// \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 TariffEnergy { + std::vector prices; + std::optional customData; + std::optional> taxRates; +}; +/// \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 TariffFixedPrice { + float priceFixed; + std::optional customData; + std::optional conditions; +}; +/// \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 fixedFee; + std::optional customData; + std::optional> taxRates; +}; +/// \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 customData; + std::optional exclTax; + std::optional inclTax; + std::optional> taxRates; +}; +/// \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 customData; + std::optional chargingTIme; + std::optional> description; + std::optional energy; + std::optional idleTime; + std::optional fixedFee; + std::optional maxPrice; + std::optional minPrice; +}; +/// \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 TransactionLimit { + std::optional customData; + std::optional maxCost; + std::optional maxEnergy; + std::optional maxTime; + std::optional maxSoC; +}; +/// \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 BatteryData { + int32_t evseId; + CiString<50> serialNumber; + int32_t soC; + int32_t soH; + std::optional customData; + std::optional productionDate; + std::optional> vendorInfo; +}; +/// \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 customData; std::optional> iccid; @@ -137,21 +383,6 @@ 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; @@ -183,6 +414,22 @@ 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 { + TariffStatusEnum status; + std::optional customData; + std::optional statusInfo; + std::optional> tariffId; +}; +/// \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; @@ -221,7 +468,7 @@ struct ChargingProfileCriterion { std::optional chargingProfilePurpose; std::optional stackLevel; std::optional> chargingProfileId; - std::optional> chargingLimitSource; + std::optional>> chargingLimitSource; }; /// \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 +480,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 operationMode; + std::optional evseSleep; + std::optional v2xBaseline; + std::optional> v2xFreqWattCurve; + std::optional> v2xSignalWattCurve; }; /// \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 +545,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 @@ -268,6 +562,320 @@ void from_json(const json& j, CompositeSchedule& k); /// \returns an output stream with the CompositeSchedule written to std::ostream& operator<<(std::ostream& os, const CompositeSchedule& 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 customData; + std::optional hysteresisHigh; + std::optional hysteresisLow; + std::optional hysteresisDelay; + std::optional hysteresisGradient; +}; +/// \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 customData; + std::optional vRef; + std::optional autonomousVRefEnable; + std::optional autonomousVRefTimeConstant; +}; +/// \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 customData; + std::optional hvMeanValue10Min; + std::optional hv10MinMeanTripDelay; + std::optional powerDuringCessation; +}; +/// \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 customData; + std::optional hysteresis; + std::optional reactivePowerParams; + std::optional voltageParams; + std::optional responseTime; + std::optional startTime; + std::optional duration; +}; +/// \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 customData; + std::optional delay; + std::optional randomDelay; + std::optional rampRate; +}; +/// \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 customData; + std::optional startTime; + std::optional duration; +}; +/// \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 customData; + std::optional startTime; + std::optional duration; +}; +/// \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 customData; + std::optional startTime; + std::optional duration; +}; +/// \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 customData; + std::optional pctMaxDischargePower; + std::optional powerMonitoringMustTrip; + std::optional startTime; + std::optional duration; +}; +/// \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 CertificateHashDataChain { CertificateHashDataType certificateHashData; GetCertificateIdUseEnum certificateType; @@ -285,7 +893,7 @@ void from_json(const json& j, CertificateHashDataChain& k); std::ostream& operator<<(std::ostream& os, const CertificateHashDataChain& k); struct LogParameters { - CiString<512> remoteLocation; + CiString<2000> remoteLocation; std::optional customData; std::optional oldestTimestamp; std::optional latestTimestamp; @@ -346,6 +954,39 @@ 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 customData; + std::optional> evseIds; + std::optional>> idTokens; +}; +/// \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; @@ -383,10 +1024,10 @@ std::ostream& operator<<(std::ostream& os, const GetVariableResult& k); struct SignedMeterValue { CiString<2500> signedMeterData; - CiString<50> signingMethod; CiString<50> encodingMethod; - CiString<2500> publicKey; std::optional customData; + std::optional> signingMethod; + std::optional> publicKey; }; /// \brief Conversion from a given SignedMeterValue \p k to a given json object \p j void to_json(json& j, const SignedMeterValue& k); @@ -416,8 +1057,8 @@ 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; @@ -448,6 +1089,21 @@ 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 LimitBeyondSoC { + int32_t soc; + float limit; + std::optional customData; +}; +/// \brief Conversion from a given LimitBeyondSoC \p k to a given json object \p j +void to_json(json& j, const LimitBeyondSoC& k); + +/// \brief Conversion from a given json object \p j to a given LimitBeyondSoC \p k +void from_json(const json& j, LimitBeyondSoC& k); + +// \brief Writes the string representation of the given LimitBeyondSoC \p k to the given output stream \p os +/// \returns an output stream with the LimitBeyondSoC written to +std::ostream& operator<<(std::ostream& os, const LimitBeyondSoC& k); + struct RelativeTimeInterval { int32_t start; std::optional customData; @@ -527,6 +1183,182 @@ 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 customData; + std::optional parkingFeePeriod; + std::optional carbonDioxideEmission; + std::optional renewableGenerationPercentage; + std::optional parkingFee; +}; +/// \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 customData; + std::optional> taxRuleName; + std::optional taxIncludedInPrice; +}; +/// \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 customData; + std::optional> overstayRuleDescription; +}; +/// \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 customData; + std::optional overstayPowerThreshold; + std::optional overstayTimeThreshold; +}; +/// \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 customData; + std::optional> priceScheduleDescription; + std::optional minimumCost; + std::optional maximumCost; + std::optional> taxRules; + std::optional overstayRuleList; + std::optional> additionalSelectedServices; +}; +/// \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 customData; + std::optional> priceScheduleDescription; +}; +/// \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; @@ -535,7 +1367,15 @@ struct ChargingSchedule { std::optional startSchedule; std::optional duration; std::optional minChargingRate; + std::optional limitBeyondSoc; + std::optional powerTolerance; std::optional salesTariff; + std::optional signatureId; + std::optional absolutePriceSchedule; + std::optional> digestValue; + std::optional priceLevelSchedule; + std::optional useLocalTime; + std::optional randomizedDelay; }; /// \brief Conversion from a given ChargingSchedule \p k to a given json object \p j void to_json(json& j, const ChargingSchedule& k); @@ -548,8 +1388,9 @@ void from_json(const json& j, ChargingSchedule& k); std::ostream& operator<<(std::ostream& os, const ChargingSchedule& k); struct ChargingLimit { - ChargingLimitSourceEnum chargingLimitSource; + CiString<20> chargingLimitSource; std::optional customData; + std::optional isLocalGeneration; std::optional isGridCritical; }; /// \brief Conversion from a given ChargingLimit \p k to a given json object \p j @@ -572,6 +1413,7 @@ struct MessageInfo { std::optional startDateTime; std::optional endDateTime; std::optional> transactionId; + std::optional> messageExtra; }; /// \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 +1426,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,14 +1442,161 @@ 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 DERChargingParameters { + std::optional customData; + 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; +}; +/// \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; +}; +/// \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 customData; + std::optional evAbsolutePriceSchedule; +}; +/// \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 { - int32_t evMaxCurrent; - int32_t evMaxVoltage; + float evMaxCurrent; + float evMaxVoltage; std::optional customData; - std::optional energyAmount; - std::optional evMaxPower; + std::optional evMaxPower; + std::optional evEnergyCapacity; + std::optional energyAmount; std::optional stateOfCharge; - std::optional evEnergyCapacity; std::optional fullSoC; std::optional bulkSoC; }; @@ -621,11 +1610,54 @@ 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 customData; + 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; +}; +/// \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; }; /// \brief Conversion from a given ChargingNeeds \p k to a given json object \p j @@ -653,6 +1685,7 @@ struct EventData { std::optional cleared; std::optional> transactionId; std::optional variableMonitoringId; + std::optional severity; }; /// \brief Conversion from a given EventData \p k to a given json object \p j void to_json(json& j, const EventData& k); @@ -671,6 +1704,7 @@ struct VariableMonitoring { MonitorEnum type; int32_t severity; std::optional customData; + std::optional eventNotificationType; }; /// \brief Conversion from a given VariableMonitoring \p k to a given json object \p j void to_json(json& j, const VariableMonitoring& k); @@ -698,6 +1732,21 @@ 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 StreamDataElement { + ocpp::DateTime 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 VariableAttribute { std::optional customData; std::optional type; @@ -723,6 +1772,7 @@ struct VariableCharacteristics { std::optional> unit; std::optional minLimit; std::optional maxLimit; + std::optional maxElements; std::optional> valuesList; }; /// \brief Conversion from a given VariableCharacteristics \p k to a given json object \p j @@ -752,6 +1802,50 @@ 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> address2; + CiString<50> city; + CiString<20> postalCode; + CiString<50> country; + 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 customData; + 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; +}; +/// \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; @@ -763,6 +1857,11 @@ struct ChargingProfile { std::optional validFrom; std::optional validTo; std::optional> transactionId; + std::optional maxOfflineDuration; + std::optional stopAfterOffline; + std::optional updateInterval; + std::optional dynUpdateTime; + std::optional> priceScheduleSignature; }; /// \brief Conversion from a given ChargingProfile \p k to a given json object \p j void to_json(json& j, const ChargingProfile& k); @@ -790,11 +1889,11 @@ 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; @@ -810,13 +1909,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<40> password; CiString<255> key; VPNEnum type; std::optional customData; - std::optional> group; + 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,14 +1928,16 @@ 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; }; /// \brief Conversion from a given NetworkConnectionProfile \p k to a given json object \p j @@ -857,6 +1958,7 @@ struct SetMonitoringData { Variable variable; std::optional customData; std::optional id; + std::optional periodicEventStream; std::optional transaction; }; /// \brief Conversion from a given SetMonitoringData \p k to a given json object \p j @@ -897,7 +1999,7 @@ struct ConfigNetworkResult { }; struct SetVariableData { - CiString<1000> attributeValue; + CiString<2500> attributeValue; Component component; Variable variable; std::optional customData; @@ -931,6 +2033,90 @@ 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 customData; + std::optional> dimensions; + std::optional> tariffId; +}; +/// \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 TotalCost { + CiString<3> currency; + std::optional customData; + std::optional chargingTime; + std::optional energy; + std::optional fixed; + std::optional idleTime; + std::optional reservation; +}; +/// \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 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 customData; + std::optional> chargingPeriods; + std::optional failureToCalculate; + std::optional> failureReason; +}; +/// \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 Transaction { CiString<36> transactionId; std::optional customData; @@ -938,6 +2124,9 @@ struct Transaction { std::optional timeSpentCharging; std::optional stoppedReason; std::optional remoteStartId; + std::optional operationMode; + std::optional> tariffId; + std::optional transactionLimit; }; /// \brief Conversion from a given Transaction \p k to a given json object \p j void to_json(json& j, const Transaction& k); @@ -950,7 +2139,7 @@ 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; diff --git a/include/ocpp/v201/smart_charging.hpp b/include/ocpp/v201/smart_charging.hpp index 4f2105057..09934f370 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; @@ -123,7 +123,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; /// @@ -140,7 +140,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..9e079d824 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,28 @@ 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 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..599486293 --- /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 customData; + std::optional statusInfo; + + /// \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..1a4ab9dc7 --- /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 customData; + std::optional statusInfo; + + /// \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..8159b4fd8 --- /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 { + TariffStatusEnum status; + std::optional customData; + std::optional statusInfo; + + /// \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..74f3ddc36 --- /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 customData; + std::optional controlType; + std::optional> controlId; + + /// \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 customData; + std::optional statusInfo; + + /// \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..f41d2e67d --- /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 customData; + std::optional>> tariffIds; + std::optional tariffKind; + + /// \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..c0c00887c --- /dev/null +++ b/include/ocpp/v21/messages/ClosePeriodicEventStream.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_CLOSEPERIODICEVENTSTREAM_HPP +#define OCPP_V21_CLOSEPERIODICEVENTSTREAM_HPP + +#include +#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 { + GenericStatusEnum status; + std::optional customData; + std::optional statusInfo; + + /// \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..57f58fd94 --- /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 customData; + std::optional statusInfo; + + /// \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..f73a5d780 --- /dev/null +++ b/include/ocpp/v21/messages/GetDERControl.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_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 { + bool isDefault; + std::optional customData; + std::optional controlType; + std::optional> controlId; + + /// \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 customData; + std::optional> curve; + std::optional> enterService; + std::optional> fixedPFAbsorb; + std::optional> fixedPFInject; + std::optional> fixedVar; + std::optional> freqDroop; + std::optional> gradient; + std::optional> limitMaxDischarge; + + /// \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..6932e2899 --- /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 customData; + std::optional> constantStreamData; + + /// \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..ded5fc0e6 --- /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 { + std::optional customData; + std::optional evseId; + + /// \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 { + TariffStatusEnum status; + std::optional customData; + std::optional statusInfo; + std::optional> tariffAssignments; + + /// \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..fbe3f2e00 --- /dev/null +++ b/include/ocpp/v21/messages/NotifyAllowedEnergyTransfer.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_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 { + 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 customData; + std::optional statusInfo; + + /// \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..83072fc6c --- /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 customData; + std::optional> location; + + /// \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..caa0ea981 --- /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::string extraInfo; + std::optional customData; + std::optional gridEventFault; + std::optional alarmEnded; + + /// \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..80815a25d --- /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 customData; + std::optional>> supersededIds; + + /// \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..8fa0b90de --- /dev/null +++ b/include/ocpp/v21/messages/NotifyPeriodicEventStream.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_NOTIFYPERIODICEVENTSTREAM_HPP +#define OCPP_V21_NOTIFYPERIODICEVENTSTREAM_HPP + +#include +#include + +#include +#include +using namespace ocpp::v201; +#include + +namespace ocpp { +namespace v21 { + +/// \brief Contains a OCPP NotifyPeriodicEventStream message +struct NotifyPeriodicEventStreamRequest : public ocpp::Message { + std::vector data; + int32_t id; + int32_t pending; + 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 NotifyPeriodicEventStreamRequest \p k to a given json object \p j +void to_json(json& j, const NotifyPeriodicEventStreamRequest& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPeriodicEventStreamRequest \p k +void from_json(const json& j, NotifyPeriodicEventStreamRequest& k); + +/// \brief Writes the string representation of the given NotifyPeriodicEventStreamRequest \p k to the given output +/// stream \p os \returns an output stream with the NotifyPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStreamRequest& k); + +/// \brief Contains a OCPP NotifyPeriodicEventStreamResponse message +struct NotifyPeriodicEventStreamResponse : public ocpp::Message { + GenericStatusEnum status; + std::optional customData; + std::optional statusInfo; + + /// \brief Provides the type of this NotifyPeriodicEventStreamResponse 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 NotifyPeriodicEventStreamResponse \p k to a given json object \p j +void to_json(json& j, const NotifyPeriodicEventStreamResponse& k); + +/// \brief Conversion from a given json object \p j to a given NotifyPeriodicEventStreamResponse \p k +void from_json(const json& j, NotifyPeriodicEventStreamResponse& k); + +/// \brief Writes the string representation of the given NotifyPeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the NotifyPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStreamResponse& 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..ea5370928 --- /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 customData; + std::optional> transactionId; + std::optional> statusInfo; + std::optional> receiptId; + std::optional> receiptUrl; + std::optional
vatCompany; + std::optional> vatNumber; + + /// \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 customData; + std::optional> receiptURL; + std::optional> receiptId; + + /// \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..84224a1d1 --- /dev/null +++ b/include/ocpp/v21/messages/OpenPeriodicEventStream.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_OPENPERIODICEVENTSTREAM_HPP +#define OCPP_V21_OPENPERIODICEVENTSTREAM_HPP + +#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 { + 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..6adba2cf8 --- /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 customData; + std::optional scheduleUpdate; + std::optional statusInfo; + + /// \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..73adc89cd --- /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 customData; + std::optional statusInfo; + + /// \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..577640cd9 --- /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 customData; + std::optional curve; + std::optional enterService; + std::optional fixedPFAbsorb; + std::optional fixedPFInject; + std::optional fixedVar; + std::optional freqDroop; + std::optional gradient; + std::optional limitMaxDischarge; + + /// \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 customData; + std::optional statusInfo; + std::optional>> supersededIds; + + /// \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..f036057ac --- /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 { + TariffStatusEnum status; + std::optional customData; + std::optional statusInfo; + + /// \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..31f50ff09 --- /dev/null +++ b/include/ocpp/v21/messages/UpdateDynamicSchedule.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_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 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..adc27d712 --- /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 customData; + std::optional statusInfo; + + /// \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..98d8f3331 --- /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 customData; + std::optional evseId; + + /// \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 customData; + std::optional
company; + std::optional statusInfo; + std::optional evseId; + + /// \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 246a53f4f..3b4cad2c3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -82,6 +82,7 @@ if(LIBOCPP_ENABLE_V201) ocpp/v201/connectivity_manager.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 7bef0fac9..6c064ddfd 100644 --- a/lib/ocpp/v16/charge_point_impl.cpp +++ b/lib/ocpp/v16/charge_point_impl.cpp @@ -3414,7 +3414,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 8fd80edf4..171cc74fd 100644 --- a/lib/ocpp/v201/charge_point.cpp +++ b/lib/ocpp/v201/charge_point.cpp @@ -804,7 +804,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) { // TODO(piet): C01.FR.14 // TODO(piet): C01.FR.15 @@ -816,14 +816,14 @@ AuthorizeResponse ChargePoint::validate_token(const IdToken id_token, const std: 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; @@ -1941,8 +1941,8 @@ bool ChargePoint::is_evse_reserved_for_other(EvseInterface& evse, const IdToken& const ConnectorStatusEnum status = evse.get_connector(static_cast(i))->get_effective_connector_status(); if (status == ConnectorStatusEnum::Reserved) { - const std::optional> groupIdToken = - group_id_token.has_value() ? group_id_token.value().idToken : std::optional>{}; + const std::optional> groupIdToken = + group_id_token.has_value() ? group_id_token.value().idToken : std::optional>{}; if (!callbacks.is_reservation_for_token_callback(evse.get_id(), id_token.idToken, groupIdToken)) { return true; @@ -2125,7 +2125,7 @@ void ChargePoint::notify_report_req(const int request_id, const std::vector>& certificate, +AuthorizeResponse ChargePoint::authorize_req(const IdToken id_token, const std::optional>& certificate, const std::optional>& ocsp_request_data) { AuthorizeRequest req; req.idToken = id_token; @@ -2255,8 +2255,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; @@ -2815,7 +2815,7 @@ void ChargePoint::handle_transaction_event_response(const EnhancedMessagedevice_model->get_optional_value(ControllerComponentVariables::AuthCacheCtrlrEnabled) .value_or(true)) { try { @@ -3159,7 +3159,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"; @@ -3459,11 +3459,12 @@ 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 + // Prepare ReportChargingProfileRequest(s). The message defines the properties evseId and + // ChargingLimitSourceEnumStringType as required, so we can not report all profiles in a single + // ReportChargingProfilesRequest. We need to prepare a single ReportChargingProfilesRequest for each combination of + // evseId and ChargingLimitSourceEnumStringType + std::set evse_ids; // will contain all evse_ids of the profiles + std::set> sources; // will contain all sources of the profiles // fill evse_ids and sources sets for (const auto& profile : profiles_to_report) { diff --git a/lib/ocpp/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/messages/Authorize.cpp b/lib/ocpp/v201/messages/Authorize.cpp index adb557b20..cb416ec05 100644 --- a/lib/ocpp/v201/messages/Authorize.cpp +++ b/lib/ocpp/v201/messages/Authorize.cpp @@ -81,6 +81,18 @@ void to_json(json& j, const AuthorizeResponse& k) { 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.transactionLimit) { + j["transactionLimit"] = k.transactionLimit.value(); + } } void from_json(const json& j, AuthorizeResponse& k) { @@ -95,6 +107,20 @@ void from_json(const json& j, AuthorizeResponse& k) { 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("transactionLimit")) { + k.transactionLimit.emplace(j.at("transactionLimit")); + } } /// \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/ClearedChargingLimit.cpp b/lib/ocpp/v201/messages/ClearedChargingLimit.cpp index 978659942..1418a4d16 100644 --- a/lib/ocpp/v201/messages/ClearedChargingLimit.cpp +++ b/lib/ocpp/v201/messages/ClearedChargingLimit.cpp @@ -20,7 +20,7 @@ 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) { @@ -33,7 +33,7 @@ void to_json(json& j, const ClearedChargingLimitRequest& k) { 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")) { diff --git a/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp b/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp index 4e58a9b3e..d47f0d289 100644 --- a/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp +++ b/lib/ocpp/v201/messages/FirmwareStatusNotification.cpp @@ -29,6 +29,9 @@ void to_json(json& j, const FirmwareStatusNotificationRequest& k) { if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } } void from_json(const json& j, FirmwareStatusNotificationRequest& k) { @@ -42,6 +45,9 @@ void from_json(const json& j, FirmwareStatusNotificationRequest& k) { if (j.contains("requestId")) { k.requestId.emplace(j.at("requestId")); } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } } /// \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..768535dbe 100644 --- a/lib/ocpp/v201/messages/Get15118EVCertificate.cpp +++ b/lib/ocpp/v201/messages/Get15118EVCertificate.cpp @@ -28,6 +28,15 @@ void to_json(json& j, const Get15118EVCertificateRequest& k) { if (k.customData) { j["customData"] = k.customData.value(); } + 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); + } + } } void from_json(const json& j, Get15118EVCertificateRequest& k) { @@ -40,6 +49,17 @@ void from_json(const json& j, Get15118EVCertificateRequest& k) { if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } + 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); + } } /// \brief Writes the string representation of the given Get15118EVCertificateRequest \p k to the given output stream \p @@ -66,6 +86,9 @@ void to_json(json& j, const Get15118EVCertificateResponse& k) { if (k.statusInfo) { j["statusInfo"] = k.statusInfo.value(); } + if (k.remainingContracts) { + j["remainingContracts"] = k.remainingContracts.value(); + } } void from_json(const json& j, Get15118EVCertificateResponse& k) { @@ -80,6 +103,9 @@ void from_json(const json& j, Get15118EVCertificateResponse& k) { if (j.contains("statusInfo")) { k.statusInfo.emplace(j.at("statusInfo")); } + if (j.contains("remainingContracts")) { + k.remainingContracts.emplace(j.at("remainingContracts")); + } } /// \brief Writes the string representation of the given Get15118EVCertificateResponse \p k to the given output stream diff --git a/lib/ocpp/v201/messages/LogStatusNotification.cpp b/lib/ocpp/v201/messages/LogStatusNotification.cpp index f1f61783c..35d6fc10f 100644 --- a/lib/ocpp/v201/messages/LogStatusNotification.cpp +++ b/lib/ocpp/v201/messages/LogStatusNotification.cpp @@ -29,6 +29,9 @@ void to_json(json& j, const LogStatusNotificationRequest& k) { if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } } void from_json(const json& j, LogStatusNotificationRequest& k) { @@ -42,6 +45,9 @@ void from_json(const json& j, LogStatusNotificationRequest& k) { if (j.contains("requestId")) { k.requestId.emplace(j.at("requestId")); } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } } /// \brief Writes the string representation of the given LogStatusNotificationRequest \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..6624ac2a7 100644 --- a/lib/ocpp/v201/messages/NotifyEVChargingNeeds.cpp +++ b/lib/ocpp/v201/messages/NotifyEVChargingNeeds.cpp @@ -20,8 +20,8 @@ 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) { @@ -30,12 +30,15 @@ void to_json(json& j, const NotifyEVChargingNeedsRequest& k) { if (k.maxScheduleTuples) { j["maxScheduleTuples"] = k.maxScheduleTuples.value(); } + if (k.timestamp) { + j["timestamp"] = k.timestamp.value().to_rfc3339(); + } } 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")) { @@ -44,6 +47,9 @@ void from_json(const json& j, NotifyEVChargingNeedsRequest& k) { if (j.contains("maxScheduleTuples")) { k.maxScheduleTuples.emplace(j.at("maxScheduleTuples")); } + if (j.contains("timestamp")) { + k.timestamp.emplace(ocpp::DateTime(std::string(j.at("timestamp")))); + } } /// \brief Writes the string representation of the given NotifyEVChargingNeedsRequest \p k to the given output stream \p diff --git a/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp b/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp index 32ed78d5a..c43882e7d 100644 --- a/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp +++ b/lib/ocpp/v201/messages/NotifyEVChargingSchedule.cpp @@ -28,6 +28,12 @@ void to_json(json& j, const NotifyEVChargingScheduleRequest& k) { if (k.customData) { j["customData"] = k.customData.value(); } + if (k.selectedScheduleTupleId) { + j["selectedScheduleTupleId"] = k.selectedScheduleTupleId.value(); + } + if (k.powerToleranceAcceptance) { + j["powerToleranceAcceptance"] = k.powerToleranceAcceptance.value(); + } } void from_json(const json& j, NotifyEVChargingScheduleRequest& k) { @@ -40,6 +46,12 @@ void from_json(const json& j, NotifyEVChargingScheduleRequest& k) { if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } + if (j.contains("selectedScheduleTupleId")) { + k.selectedScheduleTupleId.emplace(j.at("selectedScheduleTupleId")); + } + if (j.contains("powerToleranceAcceptance")) { + k.powerToleranceAcceptance.emplace(j.at("powerToleranceAcceptance")); + } } /// \brief Writes the string representation of the given NotifyEVChargingScheduleRequest \p k to the given output stream diff --git a/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp b/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp index 914df0a6e..ee22d21bf 100644 --- a/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp +++ b/lib/ocpp/v201/messages/PublishFirmwareStatusNotification.cpp @@ -35,6 +35,9 @@ void to_json(json& j, const PublishFirmwareStatusNotificationRequest& k) { if (k.requestId) { j["requestId"] = k.requestId.value(); } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } } void from_json(const json& j, PublishFirmwareStatusNotificationRequest& k) { @@ -47,7 +50,7 @@ void from_json(const json& j, PublishFirmwareStatusNotificationRequest& k) { } 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 +59,9 @@ 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")); + } } /// \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..b152d2af3 100644 --- a/lib/ocpp/v201/messages/ReportChargingProfiles.cpp +++ b/lib/ocpp/v201/messages/ReportChargingProfiles.cpp @@ -21,7 +21,7 @@ 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}, }; @@ -37,7 +37,7 @@ void to_json(json& j, const ReportChargingProfilesRequest& k) { 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); } diff --git a/lib/ocpp/v201/messages/RequestStartTransaction.cpp b/lib/ocpp/v201/messages/RequestStartTransaction.cpp index 1ba362016..315e36006 100644 --- a/lib/ocpp/v201/messages/RequestStartTransaction.cpp +++ b/lib/ocpp/v201/messages/RequestStartTransaction.cpp @@ -36,6 +36,9 @@ void to_json(json& j, const RequestStartTransactionRequest& k) { if (k.chargingProfile) { j["chargingProfile"] = k.chargingProfile.value(); } + if (k.transactionLimit) { + j["transactionLimit"] = k.transactionLimit.value(); + } } void from_json(const json& j, RequestStartTransactionRequest& k) { @@ -56,6 +59,9 @@ void from_json(const json& j, RequestStartTransactionRequest& k) { if (j.contains("chargingProfile")) { k.chargingProfile.emplace(j.at("chargingProfile")); } + if (j.contains("transactionLimit")) { + k.transactionLimit.emplace(j.at("transactionLimit")); + } } /// \brief Writes the string representation of the given RequestStartTransactionRequest \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..f0ce58b46 100644 --- a/lib/ocpp/v201/messages/ReserveNow.cpp +++ b/lib/ocpp/v201/messages/ReserveNow.cpp @@ -29,7 +29,7 @@ void to_json(json& j, const ReserveNowRequest& k) { 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(); @@ -50,7 +50,7 @@ void from_json(const json& j, ReserveNowRequest& k) { 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")); diff --git a/lib/ocpp/v201/messages/TransactionEvent.cpp b/lib/ocpp/v201/messages/TransactionEvent.cpp index 8f354cdfa..d64f4aa07 100644 --- a/lib/ocpp/v201/messages/TransactionEvent.cpp +++ b/lib/ocpp/v201/messages/TransactionEvent.cpp @@ -30,6 +30,9 @@ void to_json(json& j, const TransactionEventRequest& k) { if (k.customData) { j["customData"] = k.customData.value(); } + if (k.costDetails) { + j["costDetails"] = k.costDetails.value(); + } if (k.meterValue) { j["meterValue"] = json::array(); for (auto val : k.meterValue.value()) { @@ -48,6 +51,13 @@ 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(); } @@ -68,6 +78,9 @@ void from_json(const json& j, TransactionEventRequest& k) { 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"); std::vector vec; @@ -88,6 +101,13 @@ 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")); } @@ -123,9 +143,22 @@ 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); + } + } } void from_json(const json& j, TransactionEventResponse& k) { @@ -144,9 +177,20 @@ 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); + } } /// \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..d6668dc29 100644 --- a/lib/ocpp/v201/messages/TriggerMessage.cpp +++ b/lib/ocpp/v201/messages/TriggerMessage.cpp @@ -29,6 +29,9 @@ void to_json(json& j, const TriggerMessageRequest& k) { if (k.evse) { j["evse"] = k.evse.value(); } + if (k.customTrigger) { + j["customTrigger"] = k.customTrigger.value(); + } } void from_json(const json& j, TriggerMessageRequest& k) { @@ -42,6 +45,9 @@ void from_json(const json& j, TriggerMessageRequest& k) { if (j.contains("evse")) { k.evse.emplace(j.at("evse")); } + if (j.contains("customTrigger")) { + k.customTrigger.emplace(j.at("customTrigger")); + } } /// \brief Writes the string representation of the given TriggerMessageRequest \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..3e9f63ee6 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,226 @@ 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: AuthorizeResponse +namespace conversions { +std::string tariff_kind_enum_to_string(TariffKindEnum e) { + switch (e) { + case TariffKindEnum::DefaultTariff: + return "DefaultTariff"; + case TariffKindEnum::UserTariff: + return "UserTariff"; + } + + throw EnumToStringException{e, "TariffKindEnum"}; +} + +TariffKindEnum string_to_tariff_kind_enum(const std::string& s) { + if (s == "DefaultTariff") { + return TariffKindEnum::DefaultTariff; + } + if (s == "UserTariff") { + return TariffKindEnum::UserTariff; + } + + 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: 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"; + } + + 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; + } + + 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) { @@ -526,6 +721,66 @@ std::ostream& operator<<(std::ostream& os, const ChangeAvailabilityStatusEnum& c return os; } +// from: ChangeTransactionTariffResponse +namespace conversions { +std::string tariff_status_enum_to_string(TariffStatusEnum e) { + switch (e) { + case TariffStatusEnum::Accepted: + return "Accepted"; + case TariffStatusEnum::Rejected: + return "Rejected"; + case TariffStatusEnum::TooManyElements: + return "TooManyElements"; + case TariffStatusEnum::ConditionNotSupported: + return "ConditionNotSupported"; + case TariffStatusEnum::NoTariff: + return "NoTariff"; + case TariffStatusEnum::TariffInUse: + return "TariffInUse"; + case TariffStatusEnum::TxNotFound: + return "TxNotFound"; + case TariffStatusEnum::NoCurrencyChange: + return "NoCurrencyChange"; + } + + throw EnumToStringException{e, "TariffStatusEnum"}; +} + +TariffStatusEnum string_to_tariff_status_enum(const std::string& s) { + if (s == "Accepted") { + return TariffStatusEnum::Accepted; + } + if (s == "Rejected") { + return TariffStatusEnum::Rejected; + } + if (s == "TooManyElements") { + return TariffStatusEnum::TooManyElements; + } + if (s == "ConditionNotSupported") { + return TariffStatusEnum::ConditionNotSupported; + } + if (s == "NoTariff") { + return TariffStatusEnum::NoTariff; + } + if (s == "TariffInUse") { + return TariffStatusEnum::TariffInUse; + } + if (s == "TxNotFound") { + return TariffStatusEnum::TxNotFound; + } + if (s == "NoCurrencyChange") { + return TariffStatusEnum::NoCurrencyChange; + } + + throw StringToEnumException{s, "TariffStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const TariffStatusEnum& tariff_status_enum) { + os << conversions::tariff_status_enum_to_string(tariff_status_enum); + return os; +} + // from: ClearCacheResponse namespace conversions { std::string clear_cache_status_enum_to_string(ClearCacheStatusEnum e) { @@ -568,6 +823,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 +845,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 +891,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::Unsupported: + return "Unsupported"; + 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 == "Unsupported") { + return DERControlStatusEnum::Unsupported; + } + 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 +1069,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 +1083,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"}; } @@ -691,46 +1131,6 @@ std::ostream& operator<<(std::ostream& os, const ClearMonitoringStatusEnum& clea return os; } -// from: ClearedChargingLimitRequest -namespace conversions { -std::string charging_limit_source_enum_to_string(ChargingLimitSourceEnum e) { - switch (e) { - case ChargingLimitSourceEnum::EMS: - return "EMS"; - case ChargingLimitSourceEnum::Other: - return "Other"; - case ChargingLimitSourceEnum::SO: - return "SO"; - case ChargingLimitSourceEnum::CSO: - return "CSO"; - } - - throw EnumToStringException{e, "ChargingLimitSourceEnum"}; -} - -ChargingLimitSourceEnum string_to_charging_limit_source_enum(const std::string& s) { - if (s == "EMS") { - return ChargingLimitSourceEnum::EMS; - } - if (s == "Other") { - return ChargingLimitSourceEnum::Other; - } - if (s == "SO") { - return ChargingLimitSourceEnum::SO; - } - if (s == "CSO") { - return ChargingLimitSourceEnum::CSO; - } - - throw StringToEnumException{s, "ChargingLimitSourceEnum"}; -} -} // 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); - return os; -} - // from: CustomerInformationResponse namespace conversions { std::string customer_information_status_enum_to_string(CustomerInformationStatusEnum e) { @@ -1158,41 +1558,151 @@ 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; } -// from: GetDisplayMessagesRequest +// from: GetDERControlResponse namespace conversions { -std::string message_priority_enum_to_string(MessagePriorityEnum e) { +std::string power_during_cessation_enum_to_string(PowerDuringCessationEnum e) { switch (e) { - case MessagePriorityEnum::AlwaysFront: - return "AlwaysFront"; - case MessagePriorityEnum::InFront: + 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: GetDERControlResponse +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: GetDisplayMessagesRequest +namespace conversions { +std::string message_priority_enum_to_string(MessagePriorityEnum e) { + switch (e) { + case MessagePriorityEnum::AlwaysFront: + return "AlwaysFront"; + case MessagePriorityEnum::InFront: return "InFront"; case MessagePriorityEnum::NormalCycle: return "NormalCycle"; @@ -1233,6 +1743,10 @@ std::string message_state_enum_to_string(MessageStateEnum e) { return "Idle"; case MessageStateEnum::Unavailable: return "Unavailable"; + case MessageStateEnum::Suspending: + return "Suspending"; + case MessageStateEnum::Discharging: + return "Discharging"; } throw EnumToStringException{e, "MessageStateEnum"}; @@ -1251,6 +1765,12 @@ MessageStateEnum string_to_message_state_enum(const std::string& s) { if (s == "Unavailable") { return MessageStateEnum::Unavailable; } + if (s == "Suspending") { + return MessageStateEnum::Suspending; + } + if (s == "Discharging") { + return MessageStateEnum::Discharging; + } throw StringToEnumException{s, "MessageStateEnum"}; } @@ -1305,6 +1825,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 +1848,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 +1900,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 +1914,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"}; } @@ -1600,10 +2130,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 +2148,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 +2262,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 +2374,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 +2387,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 +2510,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 +2546,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 +2706,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 +2729,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 +2742,67 @@ 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: NotifyCRLRequest +namespace conversions { +std::string notify_crlstatus_enum_to_string(NotifyCRLStatusEnum e) { + switch (e) { + case NotifyCRLStatusEnum::Available: + return "Available"; + case NotifyCRLStatusEnum::Unavailable: + return "Unavailable"; + } + + throw EnumToStringException{e, "NotifyCRLStatusEnum"}; +} + +NotifyCRLStatusEnum string_to_notify_crlstatus_enum(const std::string& s) { + if (s == "Available") { + return NotifyCRLStatusEnum::Available; + } + if (s == "Unavailable") { + return NotifyCRLStatusEnum::Unavailable; + } + + throw StringToEnumException{s, "NotifyCRLStatusEnum"}; +} +} // namespace conversions + +std::ostream& operator<<(std::ostream& os, const NotifyCRLStatusEnum& notify_crlstatus_enum) { + os << conversions::notify_crlstatus_enum_to_string(notify_crlstatus_enum); + return os; +} + // from: NotifyChargingLimitRequest namespace conversions { std::string cost_kind_enum_to_string(CostKindEnum e) { @@ -2082,43 +2838,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 +3078,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 +3095,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 +3197,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 +3222,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 +3333,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 +3443,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 +3483,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 +3500,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"}; } @@ -2545,6 +3581,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 +3595,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 +3608,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 +3661,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 +3675,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"}; } @@ -2854,51 +3770,21 @@ std::string send_local_list_status_enum_to_string(SendLocalListStatusEnum e) { SendLocalListStatusEnum string_to_send_local_list_status_enum(const std::string& s) { if (s == "Accepted") { - return SendLocalListStatusEnum::Accepted; - } - if (s == "Failed") { - return SendLocalListStatusEnum::Failed; - } - if (s == "VersionMismatch") { - return SendLocalListStatusEnum::VersionMismatch; - } - - throw StringToEnumException{s, "SendLocalListStatusEnum"}; -} -} // namespace conversions - -std::ostream& operator<<(std::ostream& os, const SendLocalListStatusEnum& send_local_list_status_enum) { - os << conversions::send_local_list_status_enum_to_string(send_local_list_status_enum); - return os; -} - -// from: SetChargingProfileResponse -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; + return SendLocalListStatusEnum::Accepted; } - if (s == "Rejected") { - return ChargingProfileStatusEnum::Rejected; + if (s == "Failed") { + return SendLocalListStatusEnum::Failed; + } + if (s == "VersionMismatch") { + return SendLocalListStatusEnum::VersionMismatch; } - throw StringToEnumException{s, "ChargingProfileStatusEnum"}; + throw StringToEnumException{s, "SendLocalListStatusEnum"}; } } // 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 SendLocalListStatusEnum& send_local_list_status_enum) { + os << conversions::send_local_list_status_enum_to_string(send_local_list_status_enum); return os; } @@ -2918,6 +3804,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 +3830,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 +3882,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 +3896,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 +3930,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 +3952,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 +3968,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 +3988,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 +4020,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 +4033,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 +4283,61 @@ 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 transaction_event_enum_to_string(TransactionEventEnum e) { @@ -3416,6 +4377,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 +4387,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 +4397,51 @@ 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::LimitChanged: + return "LimitChanged"; 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::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 +4454,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 +4469,59 @@ 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 == "LimitChanged") { + return TriggerReasonEnum::LimitChanged; + } if (s == "MeterValueClock") { return TriggerReasonEnum::MeterValueClock; } if (s == "MeterValuePeriodic") { return TriggerReasonEnum::MeterValuePeriodic; } - if (s == "TimeLimitReached") { - return TriggerReasonEnum::TimeLimitReached; - } - if (s == "Trigger") { - return TriggerReasonEnum::Trigger; - } - if (s == "UnlockCommand") { - return TriggerReasonEnum::UnlockCommand; - } - if (s == "StopAuthorized") { - return TriggerReasonEnum::StopAuthorized; - } - if (s == "EVDeparted") { - return TriggerReasonEnum::EVDeparted; + if (s == "OperationModeChanged") { + return TriggerReasonEnum::OperationModeChanged; } - if (s == "EVDetected") { - return TriggerReasonEnum::EVDetected; + if (s == "RemoteStart") { + return TriggerReasonEnum::RemoteStart; } if (s == "RemoteStop") { return TriggerReasonEnum::RemoteStop; } - if (s == "RemoteStart") { - return TriggerReasonEnum::RemoteStart; + if (s == "ResetCommand") { + return TriggerReasonEnum::ResetCommand; } - if (s == "AbnormalCondition") { - return TriggerReasonEnum::AbnormalCondition; + if (s == "RunningCost") { + return TriggerReasonEnum::RunningCost; } if (s == "SignedDataReceived") { return TriggerReasonEnum::SignedDataReceived; } - if (s == "ResetCommand") { - return TriggerReasonEnum::ResetCommand; + if (s == "SoCLimitReached") { + return TriggerReasonEnum::SoCLimitReached; + } + if (s == "StopAuthorized") { + return TriggerReasonEnum::StopAuthorized; + } + if (s == "TariffChanged") { + return TriggerReasonEnum::TariffChanged; + } + if (s == "TimeLimitReached") { + return TriggerReasonEnum::TimeLimitReached; + } + if (s == "Trigger") { + return TriggerReasonEnum::Trigger; + } + if (s == "TxResumed") { + return TriggerReasonEnum::TxResumed; + } + if (s == "UnlockCommand") { + return TriggerReasonEnum::UnlockCommand; } throw StringToEnumException{s, "TriggerReasonEnum"}; @@ -3537,14 +4533,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 +4593,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 +4634,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 +4660,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 +4686,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 +4725,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 +4756,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 +4766,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 +4795,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 +4810,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 +4978,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..7b90cf2c8 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.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) { + // the required parts of the message + k.reasonCode = j.at("reasonCode"); + + // the optional parts of the message + 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) { + 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.customData) { + j["customData"] = k.customData.value(); + } + if (k.interval) { + j["interval"] = k.interval.value(); + } + if (k.values) { + j["values"] = k.values.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("interval")) { + k.interval.emplace(j.at("interval")); + } + if (j.contains("values")) { + k.values.emplace(j.at("values")); + } +} + +// \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,7 +127,7 @@ 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) { @@ -70,7 +145,7 @@ void to_json(json& j, const IdToken& 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")) { @@ -185,21 +260,21 @@ void to_json(json& j, const IdTokenInfo& k) { 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(); } @@ -220,9 +295,15 @@ void from_json(const json& j, IdTokenInfo& k) { 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,12 +312,6 @@ 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")); } @@ -249,888 +324,1076 @@ 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.iccid) { - j["iccid"] = k.iccid.value(); + if (k.startTimeOfDay) { + j["startTimeOfDay"] = k.startTimeOfDay.value(); } - if (k.imsi) { - j["imsi"] = k.imsi.value(); + if (k.endTimeOfDay) { + j["endTimeOfDay"] = k.endTimeOfDay.value(); + } + if (k.validFrom) { + j["validFrom"] = k.validFrom.value(); + } + if (k.validTo) { + j["validTo"] = k.validTo.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.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.evseKind) { + j["evseKind"] = conversions::evse_kind_enum_to_string(k.evseKind.value()); + } + if (k.tariffKind) { + j["tariffKind"] = conversions::tariff_kind_enum_to_string(k.tariffKind.value()); + } + if (k.paymentBrand) { + j["paymentBrand"] = k.paymentBrand.value(); + } + if (k.paymentRecognition) { + j["paymentRecognition"] = k.paymentRecognition.value(); + } + if (k.isReservation) { + j["isReservation"] = k.isReservation.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("iccid")) { - k.iccid.emplace(j.at("iccid")); + if (j.contains("startTimeOfDay")) { + k.startTimeOfDay.emplace(j.at("startTimeOfDay")); } - if (j.contains("imsi")) { - k.imsi.emplace(j.at("imsi")); + if (j.contains("endTimeOfDay")) { + k.endTimeOfDay.emplace(j.at("endTimeOfDay")); + } + if (j.contains("validFrom")) { + k.validFrom.emplace(j.at("validFrom")); + } + if (j.contains("validTo")) { + k.validTo.emplace(j.at("validTo")); + } + 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("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("evseKind")) { + k.evseKind.emplace(conversions::string_to_evse_kind_enum(j.at("evseKind"))); + } + if (j.contains("tariffKind")) { + k.tariffKind.emplace(conversions::string_to_tariff_kind_enum(j.at("tariffKind"))); + } + if (j.contains("paymentBrand")) { + k.paymentBrand.emplace(j.at("paymentBrand")); + } + if (j.contains("paymentRecognition")) { + k.paymentRecognition.emplace(j.at("paymentRecognition")); + } + if (j.contains("isReservation")) { + k.isReservation.emplace(j.at("isReservation")); } } -// \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 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{ - {"model", k.model}, - {"vendorName", k.vendorName}, + {"priceMinute", k.priceMinute}, }; // the optional parts of the message 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.stepSize) { + j["stepSize"] = k.stepSize.value(); } - if (k.firmwareVersion) { - j["firmwareVersion"] = k.firmwareVersion.value(); + if (k.conditions) { + j["conditions"] = k.conditions.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 TariffTimePrice \p k +void from_json(const json& j, TariffTimePrice& k) { // the required parts of the message - k.model = j.at("model"); - k.vendorName = j.at("vendorName"); + k.priceMinute = j.at("priceMinute"); // the optional parts of the message 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("stepSize")) { + k.stepSize.emplace(j.at("stepSize")); } - if (j.contains("firmwareVersion")) { - k.firmwareVersion.emplace(j.at("firmwareVersion")); + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); } } -// \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 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 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.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("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 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{ - {"id", k.id}, + {"prices", k.prices}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.connectorId) { - j["connectorId"] = k.connectorId.value(); + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } } } -/// \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 TariffTime \p k +void from_json(const json& j, TariffTime& 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("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("connectorId")) { - k.connectorId.emplace(j.at("connectorId")); + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRates.emplace(vec); } } -// \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 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 ClearChargingProfile \p k to a given json object \p j -void to_json(json& j, const ClearChargingProfile& 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({}, true); + j = json{ + {"priceKwh", k.priceKwh}, + }; // 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.stepSize) { + j["stepSize"] = k.stepSize.value(); } - if (k.stackLevel) { - j["stackLevel"] = k.stackLevel.value(); + if (k.conditions) { + j["conditions"] = k.conditions.value(); } } -/// \brief Conversion from a given json object \p j to a given ClearChargingProfile \p k -void from_json(const json& j, ClearChargingProfile& 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.priceKwh = j.at("priceKwh"); // 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("stepSize")) { + k.stepSize.emplace(j.at("stepSize")); } - if (j.contains("stackLevel")) { - k.stackLevel.emplace(j.at("stackLevel")); + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); } } -// \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) { +// \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 ClearMonitoringResult \p k to a given json object \p j -void to_json(json& j, const ClearMonitoringResult& 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{ - {"status", conversions::clear_monitoring_status_enum_to_string(k.status)}, - {"id", k.id}, + {"prices", k.prices}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.statusInfo) { - j["statusInfo"] = k.statusInfo.value(); + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); + } } } -/// \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 TariffEnergy \p k +void from_json(const json& j, TariffEnergy& k) { // the required parts of the message - k.status = conversions::string_to_clear_monitoring_status_enum(j.at("status")); - 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("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("statusInfo")) { - k.statusInfo.emplace(j.at("statusInfo")); + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.taxRates.emplace(vec); } } -// \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 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 CertificateHashDataType \p k to a given json object \p j -void to_json(json& j, const CertificateHashDataType& 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{ - {"hashAlgorithm", conversions::hash_algorithm_enum_to_string(k.hashAlgorithm)}, - {"issuerNameHash", k.issuerNameHash}, - {"issuerKeyHash", k.issuerKeyHash}, - {"serialNumber", k.serialNumber}, + {"priceFixed", k.priceFixed}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } + if (k.conditions) { + j["conditions"] = k.conditions.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 TariffFixedPrice \p k +void from_json(const json& j, TariffFixedPrice& 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"); + k.priceFixed = j.at("priceFixed"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } + if (j.contains("conditions")) { + k.conditions.emplace(j.at("conditions")); + } } -// \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 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 ChargingProfileCriterion \p k to a given json object \p j -void to_json(json& j, const ChargingProfileCriterion& 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({}, true); + j = json{ + {"fixedFee", k.fixedFee}, + }; // 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.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(conversions::charging_limit_source_enum_to_string(val)); + if (k.taxRates) { + j["taxRates"] = json::array(); + for (auto val : k.taxRates.value()) { + j["taxRates"].push_back(val); } } } -/// \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 TariffFixed \p k +void from_json(const json& j, TariffFixed& k) { // the required parts of the message + for (auto val : j.at("fixedFee")) { + k.fixedFee.push_back(val); + } // 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("stackLevel")) { - k.stackLevel.emplace(j.at("stackLevel")); - } - if (j.contains("chargingProfileId")) { - json arr = j.at("chargingProfileId"); - std::vector vec; + if (j.contains("taxRates")) { + json arr = j.at("taxRates"); + 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(conversions::string_to_charging_limit_source_enum(val)); - } - k.chargingLimitSource.emplace(vec); + k.taxRates.emplace(vec); } } -// \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 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 ChargingSchedulePeriod \p k to a given json object \p j -void to_json(json& j, const ChargingSchedulePeriod& 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{ - {"startPeriod", k.startPeriod}, - {"limit", k.limit}, - }; + j = json({}, true); // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.numberPhases) { - j["numberPhases"] = k.numberPhases.value(); + if (k.exclTax) { + j["exclTax"] = k.exclTax.value(); } - if (k.phaseToUse) { - j["phaseToUse"] = k.phaseToUse.value(); + 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); + } } } -/// \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 Price \p k +void from_json(const json& j, Price& k) { // the required parts of the message - k.startPeriod = j.at("startPeriod"); - k.limit = j.at("limit"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("numberPhases")) { - k.numberPhases.emplace(j.at("numberPhases")); + if (j.contains("exclTax")) { + k.exclTax.emplace(j.at("exclTax")); } - if (j.contains("phaseToUse")) { - k.phaseToUse.emplace(j.at("phaseToUse")); + 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.taxRates.emplace(vec); } } -// \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 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 CompositeSchedule \p k to a given json object \p j -void to_json(json& j, const CompositeSchedule& 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{ - {"chargingSchedulePeriod", k.chargingSchedulePeriod}, - {"evseId", k.evseId}, - {"duration", k.duration}, - {"scheduleStart", k.scheduleStart.to_rfc3339()}, - {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, + {"tariffId", k.tariffId}, + {"currency", k.currency}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } + if (k.chargingTIme) { + j["chargingTIme"] = k.chargingTIme.value(); + } + if (k.description) { + j["description"] = json::array(); + for (auto val : k.description.value()) { + j["description"].push_back(val); + } + } + if (k.energy) { + j["energy"] = k.energy.value(); + } + if (k.idleTime) { + j["idleTime"] = k.idleTime.value(); + } + if (k.fixedFee) { + j["fixedFee"] = k.fixedFee.value(); + } + if (k.maxPrice) { + j["maxPrice"] = k.maxPrice.value(); + } + if (k.minPrice) { + j["minPrice"] = k.minPrice.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 Tariff \p k +void from_json(const json& j, Tariff& k) { // the required parts of the message - for (auto val : j.at("chargingSchedulePeriod")) { - k.chargingSchedulePeriod.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")); + 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("chargingTIme")) { + k.chargingTIme.emplace(j.at("chargingTIme")); + } + 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("energy")) { + k.energy.emplace(j.at("energy")); + } + if (j.contains("idleTime")) { + k.idleTime.emplace(j.at("idleTime")); + } + if (j.contains("fixedFee")) { + k.fixedFee.emplace(j.at("fixedFee")); + } + if (j.contains("maxPrice")) { + k.maxPrice.emplace(j.at("maxPrice")); + } + if (j.contains("minPrice")) { + k.minPrice.emplace(j.at("minPrice")); + } } -// \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 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 CertificateHashDataChain \p k to a given json object \p j -void to_json(json& j, const CertificateHashDataChain& 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{ - {"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.childCertificateHashData) { - j["childCertificateHashData"] = json::array(); - for (auto val : k.childCertificateHashData.value()) { - j["childCertificateHashData"].push_back(val); - } + if (k.maxCost) { + j["maxCost"] = k.maxCost.value(); + } + if (k.maxEnergy) { + j["maxEnergy"] = k.maxEnergy.value(); + } + if (k.maxTime) { + j["maxTime"] = k.maxTime.value(); + } + if (k.maxSoC) { + j["maxSoC"] = k.maxSoC.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 TransactionLimit \p k +void from_json(const json& j, TransactionLimit& 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("childCertificateHashData")) { - json arr = j.at("childCertificateHashData"); - std::vector vec; - for (auto val : arr) { - vec.push_back(val); - } - k.childCertificateHashData.emplace(vec); + if (j.contains("maxCost")) { + k.maxCost.emplace(j.at("maxCost")); + } + if (j.contains("maxEnergy")) { + k.maxEnergy.emplace(j.at("maxEnergy")); + } + if (j.contains("maxTime")) { + k.maxTime.emplace(j.at("maxTime")); + } + if (j.contains("maxSoC")) { + k.maxSoC.emplace(j.at("maxSoC")); } } -// \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 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; } -/// \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 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{ - {"remoteLocation", k.remoteLocation}, + {"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.oldestTimestamp) { - j["oldestTimestamp"] = k.oldestTimestamp.value().to_rfc3339(); + if (k.productionDate) { + j["productionDate"] = k.productionDate.value().to_rfc3339(); } - if (k.latestTimestamp) { - j["latestTimestamp"] = k.latestTimestamp.value().to_rfc3339(); + if (k.vendorInfo) { + j["vendorInfo"] = k.vendorInfo.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 BatteryData \p k +void from_json(const json& j, BatteryData& k) { // the required parts of the message - k.remoteLocation = j.at("remoteLocation"); + 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("oldestTimestamp")) { - k.oldestTimestamp.emplace(j.at("oldestTimestamp").get()); + if (j.contains("productionDate")) { + k.productionDate.emplace(j.at("productionDate").get()); } - if (j.contains("latestTimestamp")) { - k.latestTimestamp.emplace(j.at("latestTimestamp").get()); + if (j.contains("vendorInfo")) { + k.vendorInfo.emplace(j.at("vendorInfo")); } } -// \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 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 Component \p k to a given json object \p j -void to_json(json& j, const Component& 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.customData) { j["customData"] = k.customData.value(); } - if (k.evse) { - j["evse"] = k.evse.value(); + if (k.iccid) { + j["iccid"] = k.iccid.value(); } - if (k.instance) { - j["instance"] = k.instance.value(); + if (k.imsi) { + j["imsi"] = k.imsi.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 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("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("evse")) { - k.evse.emplace(j.at("evse")); + if (j.contains("iccid")) { + k.iccid.emplace(j.at("iccid")); } - if (j.contains("instance")) { - k.instance.emplace(j.at("instance")); + if (j.contains("imsi")) { + k.imsi.emplace(j.at("imsi")); } } -// \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 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 Variable \p k to a given json object \p j -void to_json(json& j, const Variable& 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{ - {"name", k.name}, + {"model", k.model}, + {"vendorName", k.vendorName}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.instance) { - j["instance"] = k.instance.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 Variable \p k -void from_json(const json& j, Variable& 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.name = j.at("name"); + k.model = j.at("model"); + k.vendorName = j.at("vendorName"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("instance")) { - k.instance.emplace(j.at("instance")); + if (j.contains("serialNumber")) { + k.serialNumber.emplace(j.at("serialNumber")); } -} - -// \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) { + 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) { 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 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}, + {"id", k.id}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.variable) { - j["variable"] = k.variable.value(); + if (k.connectorId) { + j["connectorId"] = k.connectorId.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 EVSE \p k +void from_json(const json& j, EVSE& k) { // the required parts of the message - k.component = j.at("component"); + k.id = j.at("id"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("variable")) { - k.variable.emplace(j.at("variable")); + if (j.contains("connectorId")) { + k.connectorId.emplace(j.at("connectorId")); } } -// \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 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 GetVariableData \p k to a given json object \p j -void to_json(json& j, const GetVariableData& 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{ - {"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.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.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 GetVariableData \p k -void from_json(const json& j, GetVariableData& 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.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("attributeType")) { - k.attributeType.emplace(conversions::string_to_attribute_enum(j.at("attributeType"))); + 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 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 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 GetVariableResult \p k to a given json object \p j -void to_json(json& j, const GetVariableResult& 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{ - {"attributeStatus", conversions::get_variable_status_enum_to_string(k.attributeStatus)}, - {"component", k.component}, - {"variable", k.variable}, + {"status", conversions::tariff_status_enum_to_string(k.status)}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.attributeStatusInfo) { - j["attributeStatusInfo"] = k.attributeStatusInfo.value(); - } - if (k.attributeType) { - j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); } - if (k.attributeValue) { - j["attributeValue"] = k.attributeValue.value(); + if (k.tariffId) { + j["tariffId"] = k.tariffId.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 ClearTariffsResult \p k +void from_json(const json& j, ClearTariffsResult& 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"); + k.status = conversions::string_to_tariff_status_enum(j.at("status")); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - 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("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); } - if (j.contains("attributeValue")) { - k.attributeValue.emplace(j.at("attributeValue")); + if (j.contains("tariffId")) { + k.tariffId.emplace(j.at("tariffId")); } } -// \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 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 SignedMeterValue \p k to a given json object \p j -void to_json(json& j, const SignedMeterValue& 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{ - {"signedMeterData", k.signedMeterData}, - {"signingMethod", k.signingMethod}, - {"encodingMethod", k.encodingMethod}, - {"publicKey", k.publicKey}, + {"status", conversions::clear_monitoring_status_enum_to_string(k.status)}, + {"id", k.id}, }; // the optional parts of the message 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 SignedMeterValue \p k -void from_json(const json& j, SignedMeterValue& 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.signedMeterData = j.at("signedMeterData"); - k.signingMethod = j.at("signingMethod"); - k.encodingMethod = j.at("encodingMethod"); - k.publicKey = j.at("publicKey"); + 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("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 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 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 UnitOfMeasure \p k to a given json object \p j -void to_json(json& j, const UnitOfMeasure& 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({}, true); + j = json{ + {"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.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 CertificateHashDataType \p k +void from_json(const json& j, CertificateHashDataType& 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"); // 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("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 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 SampledValue \p k to a given json object \p j -void to_json(json& j, const SampledValue& 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{ - {"value", k.value}, - }; + j = json({}, true); // 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.chargingProfilePurpose) { + j["chargingProfilePurpose"] = + conversions::charging_profile_purpose_enum_to_string(k.chargingProfilePurpose.value()); } - if (k.location) { - j["location"] = conversions::location_enum_to_string(k.location.value()); + if (k.stackLevel) { + j["stackLevel"] = k.stackLevel.value(); } - if (k.signedMeterValue) { - j["signedMeterValue"] = k.signedMeterValue.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.unitOfMeasure) { - j["unitOfMeasure"] = k.unitOfMeasure.value(); + 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); + } } } -/// \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 ChargingProfileCriterion \p k +void from_json(const json& j, ChargingProfileCriterion& k) { // the required parts of the message - k.value = j.at("value"); // 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("chargingProfilePurpose")) { + k.chargingProfilePurpose.emplace( + conversions::string_to_charging_profile_purpose_enum(j.at("chargingProfilePurpose"))); } - if (j.contains("measurand")) { - k.measurand.emplace(conversions::string_to_measurand_enum(j.at("measurand"))); + if (j.contains("stackLevel")) { + k.stackLevel.emplace(j.at("stackLevel")); } - if (j.contains("phase")) { - k.phase.emplace(conversions::string_to_phase_enum(j.at("phase"))); + 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("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("chargingLimitSource")) { + json arr = j.at("chargingLimitSource"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.chargingLimitSource.emplace(vec); } } -// \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 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 MeterValue \p k to a given json object \p j -void to_json(json& j, const MeterValue& 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{ - {"sampledValue", k.sampledValue}, - {"timestamp", k.timestamp.to_rfc3339()}, + {"frequency", k.frequency}, + {"power", k.power}, }; // the optional parts of the message if (k.customData) { @@ -1138,13 +1401,11 @@ 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 V2XFreqWattPoint \p k +void from_json(const json& j, V2XFreqWattPoint& 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"))); + k.frequency = j.at("frequency"); + k.power = j.at("power"); // the optional parts of the message if (j.contains("customData")) { @@ -1152,93 +1413,220 @@ 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 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 RelativeTimeInterval \p k to a given json object \p j -void to_json(json& j, const RelativeTimeInterval& 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{ - {"start", k.start}, + {"signal", k.signal}, + {"power", k.power}, }; // 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 V2XSignalWattPoint \p k +void from_json(const json& j, V2XSignalWattPoint& k) { // the required parts of the message - k.start = j.at("start"); + 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("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 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 Cost \p k to a given json object \p j -void to_json(json& j, const Cost& 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{ - {"costKind", conversions::cost_kind_enum_to_string(k.costKind)}, - {"amount", k.amount}, + {"startPeriod", k.startPeriod}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.amountMultiplier) { - j["amountMultiplier"] = k.amountMultiplier.value(); + 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.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.operationMode) { + j["operationMode"] = conversions::operation_mode_enum_to_string(k.operationMode.value()); + } + if (k.evseSleep) { + j["evseSleep"] = k.evseSleep.value(); + } + if (k.v2xBaseline) { + j["v2xBaseline"] = k.v2xBaseline.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); + } } } -/// \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 ChargingSchedulePeriod \p k +void from_json(const json& j, ChargingSchedulePeriod& k) { // the required parts of the message - k.costKind = conversions::string_to_cost_kind_enum(j.at("costKind")); - k.amount = j.at("amount"); + k.startPeriod = j.at("startPeriod"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } - if (j.contains("amountMultiplier")) { - k.amountMultiplier.emplace(j.at("amountMultiplier")); + 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("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("operationMode")) { + k.operationMode.emplace(conversions::string_to_operation_mode_enum(j.at("operationMode"))); + } + if (j.contains("evseSleep")) { + k.evseSleep.emplace(j.at("evseSleep")); + } + if (j.contains("v2xBaseline")) { + k.v2xBaseline.emplace(j.at("v2xBaseline")); + } + 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); } } -// \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 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 ConsumptionCost \p k to a given json object \p j -void to_json(json& j, const ConsumptionCost& 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{ - {"startValue", k.startValue}, - {"cost", k.cost}, + {"evseId", k.evseId}, + {"duration", k.duration}, + {"scheduleStart", k.scheduleStart.to_rfc3339()}, + {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, + {"chargingSchedulePeriod", k.chargingSchedulePeriod}, }; // the optional parts of the message if (k.customData) { @@ -1246,12 +1634,15 @@ void to_json(json& j, const ConsumptionCost& k) { } } -/// \brief Conversion from a given json object \p j to a given ConsumptionCost \p k -void from_json(const json& j, ConsumptionCost& k) { +/// \brief 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.startValue = j.at("startValue"); - for (auto val : j.at("cost")) { - k.cost.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")); + for (auto val : j.at("chargingSchedulePeriod")) { + k.chargingSchedulePeriod.push_back(val); } // the optional parts of the message @@ -1260,301 +1651,2815 @@ 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 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 SalesTariffEntry \p k to a given json object \p j -void to_json(json& j, const SalesTariffEntry& k) { +/// \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{ - {"relativeTimeInterval", k.relativeTimeInterval}, + {"x", k.x}, + {"y", k.y}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.ePriceLevel) { - j["ePriceLevel"] = k.ePriceLevel.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")); } - if (k.consumptionCost) { - j["consumptionCost"] = json::array(); - for (auto val : k.consumptionCost.value()) { - j["consumptionCost"].push_back(val); - } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + 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(); } } -/// \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 Hysteresis \p k +void from_json(const json& j, Hysteresis& k) { // the required parts of the message - k.relativeTimeInterval = j.at("relativeTimeInterval"); // 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("hysteresisHigh")) { + k.hysteresisHigh.emplace(j.at("hysteresisHigh")); } - 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("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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.vRef) { + j["vRef"] = k.vRef.value(); + } + if (k.autonomousVRefEnable) { + j["autonomousVRefEnable"] = k.autonomousVRefEnable.value(); + } + if (k.autonomousVRefTimeConstant) { + j["autonomousVRefTimeConstant"] = k.autonomousVRefTimeConstant.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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.hvMeanValue10Min) { + j["hvMeanValue10Min"] = k.hvMeanValue10Min.value(); + } + if (k.hv10MinMeanTripDelay) { + j["hv10MinMeanTripDelay"] = k.hv10MinMeanTripDelay.value(); + } + if (k.powerDuringCessation) { + j["powerDuringCessation"] = conversions::power_during_cessation_enum_to_string(k.powerDuringCessation.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("hvMeanValue10Min")) { + k.hvMeanValue10Min.emplace(j.at("hvMeanValue10Min")); + } + 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"))); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.delay) { + j["delay"] = k.delay.value(); + } + if (k.randomDelay) { + j["randomDelay"] = k.randomDelay.value(); + } + if (k.rampRate) { + j["rampRate"] = k.rampRate.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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.startTime) { + j["startTime"] = k.startTime.value().to_rfc3339(); + } + if (k.duration) { + j["duration"] = k.duration.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("startTime")) { + k.startTime.emplace(j.at("startTime").get()); + } + if (j.contains("duration")) { + k.duration.emplace(j.at("duration")); + } +} + +// \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(); + } +} + +/// \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 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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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(); + } +} + +/// \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 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{ + {"certificateHashData", k.certificateHashData}, + {"certificateType", conversions::get_certificate_id_use_enum_to_string(k.certificateType)}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + if (k.childCertificateHashData) { + j["childCertificateHashData"] = json::array(); + for (auto val : k.childCertificateHashData.value()) { + j["childCertificateHashData"].push_back(val); + } + } +} + +/// \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.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("childCertificateHashData")) { + json arr = j.at("childCertificateHashData"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.childCertificateHashData.emplace(vec); + } +} + +// \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 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{ + {"remoteLocation", k.remoteLocation}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + if (k.oldestTimestamp) { + j["oldestTimestamp"] = k.oldestTimestamp.value().to_rfc3339(); + } + if (k.latestTimestamp) { + j["latestTimestamp"] = k.latestTimestamp.value().to_rfc3339(); + } +} + +/// \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.remoteLocation = j.at("remoteLocation"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("oldestTimestamp")) { + k.oldestTimestamp.emplace(j.at("oldestTimestamp").get()); + } + if (j.contains("latestTimestamp")) { + k.latestTimestamp.emplace(j.at("latestTimestamp").get()); + } +} + +// \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 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{ + {"name", k.name}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + if (k.evse) { + j["evse"] = k.evse.value(); + } + if (k.instance) { + j["instance"] = k.instance.value(); + } +} + +/// \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.name = j.at("name"); + + // 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("instance")) { + k.instance.emplace(j.at("instance")); + } +} + +// \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 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{ + {"name", k.name}, + }; + // the optional parts of the message + 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) { + // the required parts of the message + k.name = j.at("name"); + + // the optional parts of the message + 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) { + 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) { + // the required parts of the message + j = json{ + {"component", k.component}, + }; + // the optional parts of the message + 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) { + // the required parts of the message + k.component = j.at("component"); + + // the optional parts of the message + 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) { + os << json(k).dump(4); + return os; +} + +/// \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{ + {"id", k.id}, + {"params", k.params}, + {"variableMonitoringId", k.variableMonitoringId}, + }; + // 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 ConstantStreamData \p k +void from_json(const json& j, ConstantStreamData& k) { + // the required parts of the message + 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")); + } +} + +// \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 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{ + {"tariffId", k.tariffId}, + {"tariffKind", conversions::tariff_kind_enum_to_string(k.tariffKind)}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + 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); + } + } +} + +/// \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.tariffId = j.at("tariffId"); + k.tariffKind = conversions::string_to_tariff_kind_enum(j.at("tariffKind")); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + 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); + } +} + +// \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 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}, + }; + // the optional parts of the message + 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) { + // the required parts of the message + 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("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) { + 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) { + // the required parts of the message + 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.attributeType) { + j["attributeType"] = conversions::attribute_enum_to_string(k.attributeType.value()); + } + if (k.attributeValue) { + j["attributeValue"] = k.attributeValue.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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.signingMethod) { + j["signingMethod"] = k.signingMethod.value(); + } + if (k.publicKey) { + j["publicKey"] = k.publicKey.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("signingMethod")) { + k.signingMethod.emplace(j.at("signingMethod")); + } + if (j.contains("publicKey")) { + k.publicKey.emplace(j.at("publicKey")); + } +} + +// \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.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) { + // 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("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) { + 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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 LimitBeyondSoC \p k to a given json object \p j +void to_json(json& j, const LimitBeyondSoC& 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 LimitBeyondSoC \p k +void from_json(const json& j, LimitBeyondSoC& 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 LimitBeyondSoC \p k to the given output stream \p os +/// \returns an output stream with the LimitBeyondSoC written to +std::ostream& operator<<(std::ostream& os, const LimitBeyondSoC& 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.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) { + // the required parts of the message + k.start = j.at("start"); + + // 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) { + 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.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) { + // 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("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) { + 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.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) { + // the required parts of the message + k.relativeTimeInterval = j.at("relativeTimeInterval"); + + // 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) { + 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.customData) { + j["customData"] = k.customData.value(); + } + if (k.salesTariffDescription) { + j["salesTariffDescription"] = k.salesTariffDescription.value(); + } + if (k.numEPriceLevels) { + j["numEPriceLevels"] = k.numEPriceLevels.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("salesTariffDescription")) { + k.salesTariffDescription.emplace(j.at("salesTariffDescription")); + } + if (j.contains("numEPriceLevels")) { + k.numEPriceLevels.emplace(j.at("numEPriceLevels")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.taxRuleName) { + j["taxRuleName"] = k.taxRuleName.value(); + } + if (k.taxIncludedInPrice) { + j["taxIncludedInPrice"] = k.taxIncludedInPrice.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("taxRuleName")) { + k.taxRuleName.emplace(j.at("taxRuleName")); + } + if (j.contains("taxIncludedInPrice")) { + k.taxIncludedInPrice.emplace(j.at("taxIncludedInPrice")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.overstayRuleDescription) { + j["overstayRuleDescription"] = k.overstayRuleDescription.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("overstayRuleDescription")) { + k.overstayRuleDescription.emplace(j.at("overstayRuleDescription")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.overstayPowerThreshold) { + j["overstayPowerThreshold"] = k.overstayPowerThreshold.value(); + } + if (k.overstayTimeThreshold) { + j["overstayTimeThreshold"] = k.overstayTimeThreshold.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("overstayPowerThreshold")) { + k.overstayPowerThreshold.emplace(j.at("overstayPowerThreshold")); + } + if (j.contains("overstayTimeThreshold")) { + k.overstayTimeThreshold.emplace(j.at("overstayTimeThreshold")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + 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); + } + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.priceScheduleDescription) { + j["priceScheduleDescription"] = k.priceScheduleDescription.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("priceScheduleDescription")) { + k.priceScheduleDescription.emplace(j.at("priceScheduleDescription")); + } +} + +// \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.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.limitBeyondSoc) { + j["limitBeyondSoc"] = k.limitBeyondSoc.value(); + } + if (k.powerTolerance) { + j["powerTolerance"] = k.powerTolerance.value(); + } + if (k.salesTariff) { + j["salesTariff"] = k.salesTariff.value(); + } + if (k.signatureId) { + j["signatureId"] = k.signatureId.value(); + } + if (k.absolutePriceSchedule) { + j["absolutePriceSchedule"] = k.absolutePriceSchedule.value(); + } + if (k.digestValue) { + j["digestValue"] = k.digestValue.value(); + } + if (k.priceLevelSchedule) { + j["priceLevelSchedule"] = k.priceLevelSchedule.value(); + } + if (k.useLocalTime) { + j["useLocalTime"] = k.useLocalTime.value(); + } + if (k.randomizedDelay) { + j["randomizedDelay"] = k.randomizedDelay.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("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("limitBeyondSoc")) { + k.limitBeyondSoc.emplace(j.at("limitBeyondSoc")); + } + if (j.contains("powerTolerance")) { + k.powerTolerance.emplace(j.at("powerTolerance")); + } + if (j.contains("salesTariff")) { + k.salesTariff.emplace(j.at("salesTariff")); + } + if (j.contains("signatureId")) { + k.signatureId.emplace(j.at("signatureId")); + } + if (j.contains("absolutePriceSchedule")) { + k.absolutePriceSchedule.emplace(j.at("absolutePriceSchedule")); + } + if (j.contains("digestValue")) { + k.digestValue.emplace(j.at("digestValue")); + } + if (j.contains("priceLevelSchedule")) { + k.priceLevelSchedule.emplace(j.at("priceLevelSchedule")); + } + if (j.contains("useLocalTime")) { + k.useLocalTime.emplace(j.at("useLocalTime")); + } + if (j.contains("randomizedDelay")) { + k.randomizedDelay.emplace(j.at("randomizedDelay")); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.isLocalGeneration) { + j["isLocalGeneration"] = k.isLocalGeneration.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) { + // the required parts of the message + k.chargingLimitSource = j.at("chargingLimitSource"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("isLocalGeneration")) { + k.isLocalGeneration.emplace(j.at("isLocalGeneration")); + } + 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) { + 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.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.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); + } + } +} + +/// \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("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("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); + } +} + +// \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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 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 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 SalesTariff \p k to a given json object \p j -void to_json(json& j, const SalesTariff& k) { +/// \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{ - {"id", k.id}, - {"salesTariffEntry", k.salesTariffEntry}, + {"duration", k.duration}, + {"evPriceRule", k.evPriceRule}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } - if (k.salesTariffDescription) { - j["salesTariffDescription"] = k.salesTariffDescription.value(); - } - if (k.numEPriceLevels) { - j["numEPriceLevels"] = k.numEPriceLevels.value(); - } } -/// \brief Conversion from a given json object \p j to a given SalesTariff \p k -void from_json(const json& j, SalesTariff& k) { +/// \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.id = j.at("id"); - for (auto val : j.at("salesTariffEntry")) { - k.salesTariffEntry.push_back(val); + 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")); } - if (j.contains("salesTariffDescription")) { - k.salesTariffDescription.emplace(j.at("salesTariffDescription")); - } - if (j.contains("numEPriceLevels")) { - k.numEPriceLevels.emplace(j.at("numEPriceLevels")); - } } -// \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 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 ChargingSchedule \p k to a given json object \p j -void to_json(json& j, const ChargingSchedule& k) { +/// \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{ - {"id", k.id}, - {"chargingRateUnit", conversions::charging_rate_unit_enum_to_string(k.chargingRateUnit)}, - {"chargingSchedulePeriod", k.chargingSchedulePeriod}, + {"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(); } - 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 EVAbsolutePriceSchedule \p k +void from_json(const json& j, EVAbsolutePriceSchedule& 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); + 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")); } - 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 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 ChargingLimit \p k to a given json object \p j -void to_json(json& j, const ChargingLimit& k) { +/// \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{ - {"chargingLimitSource", conversions::charging_limit_source_enum_to_string(k.chargingLimitSource)}, + {"duration", k.duration}, + {"power", k.power}, }; // the optional parts of the message 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 EVPowerScheduleEntry \p k +void from_json(const json& j, EVPowerScheduleEntry& k) { // the required parts of the message - k.chargingLimitSource = conversions::string_to_charging_limit_source_enum(j.at("chargingLimitSource")); + 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")); } - 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 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 MessageInfo \p k to a given json object \p j -void to_json(json& j, const MessageInfo& k) { +/// \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{ - {"id", k.id}, - {"priority", conversions::message_priority_enum_to_string(k.priority)}, - {"message", k.message}, + {"evPowerScheduleEntries", k.evPowerScheduleEntries}, + {"timeAnchor", k.timeAnchor.to_rfc3339()}, }; // 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.endDateTime) { - j["endDateTime"] = k.endDateTime.value().to_rfc3339(); - } - if (k.transactionId) { - j["transactionId"] = k.transactionId.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 EVPowerSchedule \p k +void from_json(const json& j, EVPowerSchedule& 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"); + 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")); } - 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")); - } } -// \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 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 ACChargingParameters \p k to a given json object \p j -void to_json(json& j, const ACChargingParameters& k) { +/// \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{ - {"energyAmount", k.energyAmount}, - {"evMinCurrent", k.evMinCurrent}, - {"evMaxCurrent", k.evMaxCurrent}, - {"evMaxVoltage", k.evMaxVoltage}, + {"evPowerSchedule", k.evPowerSchedule}, }; // the optional parts of the message if (k.customData) { j["customData"] = k.customData.value(); } + if (k.evAbsolutePriceSchedule) { + j["evAbsolutePriceSchedule"] = k.evAbsolutePriceSchedule.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 EVEnergyOffer \p k +void from_json(const json& j, EVEnergyOffer& 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.evPowerSchedule = j.at("evPowerSchedule"); // the optional parts of the message if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } + if (j.contains("evAbsolutePriceSchedule")) { + k.evAbsolutePriceSchedule.emplace(j.at("evAbsolutePriceSchedule")); + } } -// \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) { +// \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; } @@ -1570,18 +4475,18 @@ void to_json(json& j, const DCChargingParameters& k) { 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.energyAmount) { + j["energyAmount"] = k.energyAmount.value(); + } + if (k.stateOfCharge) { + j["stateOfCharge"] = k.stateOfCharge.value(); + } if (k.fullSoC) { j["fullSoC"] = k.fullSoC.value(); } @@ -1600,18 +4505,18 @@ void from_json(const json& j, DCChargingParameters& k) { 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("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")); } @@ -1627,6 +4532,177 @@ std::ostream& operator<<(std::ostream& os, const DCChargingParameters& k) { 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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 @@ -1640,9 +4716,30 @@ void to_json(json& j, const ChargingNeeds& k) { 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(); } @@ -1660,9 +4757,32 @@ void from_json(const json& j, ChargingNeeds& k) { 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()); } @@ -1709,6 +4829,9 @@ void to_json(json& j, const EventData& k) { if (k.variableMonitoringId) { j["variableMonitoringId"] = k.variableMonitoringId.value(); } + if (k.severity) { + j["severity"] = k.severity.value(); + } } /// \brief Conversion from a given json object \p j to a given EventData \p k @@ -1744,6 +4867,9 @@ void from_json(const json& j, EventData& k) { if (j.contains("variableMonitoringId")) { k.variableMonitoringId.emplace(j.at("variableMonitoringId")); } + if (j.contains("severity")) { + k.severity.emplace(j.at("severity")); + } } // \brief Writes the string representation of the given EventData \p k to the given output stream \p os @@ -1767,6 +4893,9 @@ void to_json(json& j, const VariableMonitoring& k) { if (k.customData) { j["customData"] = k.customData.value(); } + if (k.eventNotificationType) { + j["eventNotificationType"] = conversions::event_notification_enum_to_string(k.eventNotificationType.value()); + } } /// \brief Conversion from a given json object \p j to a given VariableMonitoring \p k @@ -1782,6 +4911,9 @@ void from_json(const json& j, VariableMonitoring& k) { if (j.contains("customData")) { k.customData.emplace(j.at("customData")); } + if (j.contains("eventNotificationType")) { + k.eventNotificationType.emplace(conversions::string_to_event_notification_enum(j.at("eventNotificationType"))); + } } // \brief Writes the string representation of the given VariableMonitoring \p k to the given output stream \p os @@ -1827,6 +4959,38 @@ std::ostream& operator<<(std::ostream& os, const MonitoringData& k) { 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.to_rfc3339()}, + {"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 = ocpp::DateTime(std::string(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 VariableAttribute \p k to a given json object \p j void to_json(json& j, const VariableAttribute& k) { // the required parts of the message @@ -1920,6 +5084,9 @@ void to_json(json& j, const VariableCharacteristics& k) { if (k.maxLimit) { j["maxLimit"] = k.maxLimit.value(); } + if (k.maxElements) { + j["maxElements"] = k.maxElements.value(); + } if (k.valuesList) { j["valuesList"] = k.valuesList.value(); } @@ -1944,6 +5111,9 @@ void from_json(const json& j, VariableCharacteristics& k) { 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")); } @@ -1998,6 +5168,141 @@ std::ostream& operator<<(std::ostream& os, const ReportData& k) { 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}, {"address2", k.address2}, + {"city", k.city}, {"postalCode", k.postalCode}, {"country", k.country}, + }; + // 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 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.address2 = j.at("address2"); + k.city = j.at("city"); + k.postalCode = j.at("postalCode"); + k.country = j.at("country"); + + // the optional parts of the message + 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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 @@ -2024,6 +5329,21 @@ void to_json(json& j, const ChargingProfile& k) { if (k.transactionId) { j["transactionId"] = k.transactionId.value(); } + if (k.maxOfflineDuration) { + j["maxOfflineDuration"] = k.maxOfflineDuration.value(); + } + if (k.stopAfterOffline) { + j["stopAfterOffline"] = k.stopAfterOffline.value(); + } + if (k.updateInterval) { + j["updateInterval"] = k.updateInterval.value(); + } + if (k.dynUpdateTime) { + j["dynUpdateTime"] = k.dynUpdateTime.value().to_rfc3339(); + } + if (k.priceScheduleSignature) { + j["priceScheduleSignature"] = k.priceScheduleSignature.value(); + } } /// \brief Conversion from a given json object \p j to a given ChargingProfile \p k @@ -2053,6 +5373,21 @@ void from_json(const json& j, ChargingProfile& k) { if (j.contains("transactionId")) { k.transactionId.emplace(j.at("transactionId")); } + if (j.contains("maxOfflineDuration")) { + k.maxOfflineDuration.emplace(j.at("maxOfflineDuration")); + } + if (j.contains("stopAfterOffline")) { + k.stopAfterOffline.emplace(j.at("stopAfterOffline")); + } + if (j.contains("updateInterval")) { + k.updateInterval.emplace(j.at("updateInterval")); + } + if (j.contains("dynUpdateTime")) { + k.dynUpdateTime.emplace(j.at("dynUpdateTime").get()); + } + if (j.contains("priceScheduleSignature")) { + k.priceScheduleSignature.emplace(j.at("priceScheduleSignature")); + } } // \brief Writes the string representation of the given ChargingProfile \p k to the given output stream \p os @@ -2208,12 +5543,11 @@ std::ostream& operator<<(std::ostream& os, const VPN& k) { void to_json(json& j, const NetworkConnectionProfile& k) { // the required parts of the message j = json{ - {"ocppVersion", conversions::ocppversion_enum_to_string(k.ocppVersion)}, + {"ocppInterface", conversions::ocppinterface_enum_to_string(k.ocppInterface)}, {"ocppTransport", conversions::ocpptransport_enum_to_string(k.ocppTransport)}, - {"ocppCsmsUrl", k.ocppCsmsUrl}, {"messageTimeout", k.messageTimeout}, + {"ocppCsmsUrl", k.ocppCsmsUrl}, {"securityProfile", k.securityProfile}, - {"ocppInterface", conversions::ocppinterface_enum_to_string(k.ocppInterface)}, }; // the optional parts of the message if (k.customData) { @@ -2222,6 +5556,15 @@ void to_json(json& j, const NetworkConnectionProfile& k) { 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(); } @@ -2230,12 +5573,11 @@ void to_json(json& j, const NetworkConnectionProfile& k) { /// \brief Conversion from a given json object \p j to a given NetworkConnectionProfile \p k void from_json(const json& j, NetworkConnectionProfile& k) { // the required parts of the message - k.ocppVersion = conversions::string_to_ocppversion_enum(j.at("ocppVersion")); + k.ocppInterface = conversions::string_to_ocppinterface_enum(j.at("ocppInterface")); k.ocppTransport = conversions::string_to_ocpptransport_enum(j.at("ocppTransport")); - k.ocppCsmsUrl = j.at("ocppCsmsUrl"); k.messageTimeout = j.at("messageTimeout"); + k.ocppCsmsUrl = j.at("ocppCsmsUrl"); 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")) { @@ -2244,6 +5586,15 @@ void from_json(const json& j, NetworkConnectionProfile& k) { if (j.contains("apn")) { k.apn.emplace(j.at("apn")); } + if (j.contains("ocppVersion")) { + k.ocppVersion.emplace(conversions::string_to_ocppversion_enum(j.at("ocppVersion"))); + } + if (j.contains("identity")) { + k.identity.emplace(j.at("identity")); + } + if (j.contains("basicAuthPassword")) { + k.basicAuthPassword.emplace(j.at("basicAuthPassword")); + } if (j.contains("vpn")) { k.vpn.emplace(j.at("vpn")); } @@ -2271,6 +5622,9 @@ void to_json(json& j, const SetMonitoringData& k) { if (k.id) { j["id"] = k.id.value(); } + if (k.periodicEventStream) { + j["periodicEventStream"] = k.periodicEventStream.value(); + } if (k.transaction) { j["transaction"] = k.transaction.value(); } @@ -2292,6 +5646,9 @@ void from_json(const json& j, SetMonitoringData& k) { if (j.contains("id")) { k.id.emplace(j.at("id")); } + if (j.contains("periodicEventStream")) { + k.periodicEventStream.emplace(j.at("periodicEventStream")); + } if (j.contains("transaction")) { k.transaction.emplace(j.at("transaction")); } @@ -2440,6 +5797,240 @@ std::ostream& operator<<(std::ostream& os, const SetVariableResult& k) { return os; } +/// \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{ + {"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(); + } +} + +/// \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.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")); + } +} + +// \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 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{ + {"startPeriod", k.startPeriod.to_rfc3339()}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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.startPeriod = ocpp::DateTime(std::string(j.at("startPeriod"))); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 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{ + {"currency", k.currency}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + if (k.chargingTime) { + j["chargingTime"] = k.chargingTime.value(); + } + if (k.energy) { + j["energy"] = k.energy.value(); + } + if (k.fixed) { + j["fixed"] = k.fixed.value(); + } + if (k.idleTime) { + j["idleTime"] = k.idleTime.value(); + } + if (k.reservation) { + j["reservation"] = k.reservation.value(); + } +} + +/// \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.currency = j.at("currency"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("chargingTime")) { + k.chargingTime.emplace(j.at("chargingTime")); + } + if (j.contains("energy")) { + k.energy.emplace(j.at("energy")); + } + if (j.contains("fixed")) { + k.fixed.emplace(j.at("fixed")); + } + if (j.contains("idleTime")) { + k.idleTime.emplace(j.at("idleTime")); + } + if (j.contains("reservation")) { + k.reservation.emplace(j.at("reservation")); + } +} + +// \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 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{ + {"energy", k.energy}, + {"chargingTime", k.chargingTime}, + {"idleTime", k.idleTime}, + }; + // 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 TotalUsage \p k +void from_json(const json& j, TotalUsage& k) { + // the required parts of the message + k.energy = j.at("energy"); + k.chargingTime = j.at("chargingTime"); + k.idleTime = j.at("idleTime"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +// \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 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{ + {"totalCost", k.totalCost}, + {"totalUsage", k.totalUsage}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +/// \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.totalCost = j.at("totalCost"); + k.totalUsage = j.at("totalUsage"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +// \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 Transaction \p k to a given json object \p j void to_json(json& j, const Transaction& k) { // the required parts of the message @@ -2462,6 +6053,15 @@ 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(); + } } /// \brief Conversion from a given json object \p j to a given Transaction \p k @@ -2485,6 +6085,15 @@ 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")); + } } // \brief Writes the string representation of the given Transaction \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 25d470808..206c85b71 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; @@ -424,7 +424,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/utils.cpp b/lib/ocpp/v201/utils.cpp index 914cb1b6a..43758fd01 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) { diff --git a/lib/ocpp/v21/messages/AFRRSignal.cpp b/lib/ocpp/v21/messages/AFRRSignal.cpp new file mode 100644 index 000000000..b88800194 --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..45a7401a9 --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..5ca58b66a --- /dev/null +++ b/lib/ocpp/v21/messages/CMakeLists.txt @@ -0,0 +1,31 @@ + +target_sources(ocpp + PRIVATE + AFRRSignal.cpp + AdjustPeriodicEventStream.cpp + BatterySwap.cpp + ChangeTransactionTariff.cpp + ClearDERControl.cpp + ClearTariffs.cpp + ClosePeriodicEventStream.cpp + GetCRL.cpp + GetDERControl.cpp + GetPeriodicEventStream.cpp + GetTariffs.cpp + NotifyAllowedEnergyTransfer.cpp + NotifyCRL.cpp + NotifyDERAlarm.cpp + NotifyDERStartStop.cpp + NotifyPeriodicEventStream.cpp + NotifyPriorityCharging.cpp + NotifyQRCodeScanned.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..f853714af --- /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_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(); + } +} + +void from_json(const json& j, ChangeTransactionTariffResponse& k) { + // the required parts of the message + k.status = ocpp::v201::conversions::string_to_tariff_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")); + } +} + +/// \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..76ac514f2 --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.controlType) { + j["controlType"] = ocpp::v201::conversions::dercontrol_enum_to_string(k.controlType.value()); + } + if (k.controlId) { + j["controlId"] = k.controlId.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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..46e2d7fd1 --- /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.customData) { + j["customData"] = k.customData.value(); + } + 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.tariffKind) { + j["tariffKind"] = ocpp::v201::conversions::tariff_kind_enum_to_string(k.tariffKind.value()); + } +} + +void from_json(const json& j, ClearTariffsRequest& 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("tariffIds")) { + json arr = j.at("tariffIds"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.tariffIds.emplace(vec); + } + if (j.contains("tariffKind")) { + k.tariffKind.emplace(ocpp::v201::conversions::string_to_tariff_kind_enum(j.at("tariffKind"))); + } +} + +/// \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..db8398b08 --- /dev/null +++ b/lib/ocpp/v21/messages/ClosePeriodicEventStream.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 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{ + {"status", ocpp::v201::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(); + } +} + +void from_json(const json& j, ClosePeriodicEventStreamResponse& 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("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 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..611020c12 --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..22f328d1d --- /dev/null +++ b/lib/ocpp/v21/messages/GetDERControl.cpp @@ -0,0 +1,205 @@ +// 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{ + {"isDefault", k.isDefault}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + if (k.controlType) { + j["controlType"] = ocpp::v201::conversions::dercontrol_enum_to_string(k.controlType.value()); + } + if (k.controlId) { + j["controlId"] = k.controlId.value(); + } +} + +void from_json(const json& j, GetDERControlRequest& k) { + // the required parts of the message + k.isDefault = j.at("isDefault"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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.customData) { + j["customData"] = k.customData.value(); + } + 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); + } + } +} + +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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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); + } +} + +/// \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..be7cf160e --- /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.customData) { + j["customData"] = k.customData.value(); + } + 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); + } + } +} + +void from_json(const json& j, GetPeriodicEventStreamResponse& 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("constantStreamData")) { + json arr = j.at("constantStreamData"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.constantStreamData.emplace(vec); + } +} + +/// \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..616a56c2e --- /dev/null +++ b/lib/ocpp/v21/messages/GetTariffs.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 GetTariffsRequest::get_type() const { + return "GetTariffs"; +} + +void to_json(json& j, const GetTariffsRequest& 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(); + } +} + +void from_json(const json& j, GetTariffsRequest& 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")); + } +} + +/// \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_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.tariffAssignments) { + j["tariffAssignments"] = json::array(); + for (auto val : k.tariffAssignments.value()) { + j["tariffAssignments"].push_back(val); + } + } +} + +void from_json(const json& j, GetTariffsResponse& k) { + // the required parts of the message + k.status = ocpp::v201::conversions::string_to_tariff_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("tariffAssignments")) { + json arr = j.at("tariffAssignments"); + std::vector vec; + for (auto val : arr) { + vec.push_back(val); + } + k.tariffAssignments.emplace(vec); + } +} + +/// \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..b22f3295b --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyAllowedEnergyTransfer.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 NotifyAllowedEnergyTransferRequest::get_type() const { + return "NotifyAllowedEnergyTransfer"; +} + +void to_json(json& j, const NotifyAllowedEnergyTransferRequest& k) { + // the required parts of the message + j = json{ + {"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 + 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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..50befbe0e --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.location) { + j["location"] = k.location.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("location")) { + k.location.emplace(j.at("location")); + } +} + +/// \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..3b1d4e749 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyDERAlarm.cpp @@ -0,0 +1,94 @@ +// 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()}, + {"extraInfo", k.extraInfo}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +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"))); + k.extraInfo = j.at("extraInfo"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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..ee3a0e255 --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.supersededIds) { + j["supersededIds"] = json::array(); + for (auto val : k.supersededIds.value()) { + j["supersededIds"].push_back(val); + } + } +} + +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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("supersededIds")) { + json arr = j.at("supersededIds"); + std::vector> vec; + for (auto val : arr) { + vec.push_back(val); + } + k.supersededIds.emplace(vec); + } +} + +/// \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..e23c198c9 --- /dev/null +++ b/lib/ocpp/v21/messages/NotifyPeriodicEventStream.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 NotifyPeriodicEventStreamRequest::get_type() const { + return "NotifyPeriodicEventStream"; +} + +void to_json(json& j, const NotifyPeriodicEventStreamRequest& k) { + // the required parts of the message + j = json{ + {"data", k.data}, + {"id", k.id}, + {"pending", k.pending}, + }; + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, NotifyPeriodicEventStreamRequest& 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"); + + // the optional parts of the message + if (j.contains("customData")) { + k.customData.emplace(j.at("customData")); + } +} + +/// \brief Writes the string representation of the given NotifyPeriodicEventStreamRequest \p k to the given output +/// stream \p os \returns an output stream with the NotifyPeriodicEventStreamRequest written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStreamRequest& k) { + os << json(k).dump(4); + return os; +} + +std::string NotifyPeriodicEventStreamResponse::get_type() const { + return "NotifyPeriodicEventStreamResponse"; +} + +void to_json(json& j, const NotifyPeriodicEventStreamResponse& 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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } +} + +void from_json(const json& j, NotifyPeriodicEventStreamResponse& 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("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 NotifyPeriodicEventStreamResponse \p k to the given output +/// stream \p os \returns an output stream with the NotifyPeriodicEventStreamResponse written to +std::ostream& operator<<(std::ostream& os, const NotifyPeriodicEventStreamResponse& 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..b78976db8 --- /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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.receiptURL) { + j["receiptURL"] = k.receiptURL.value(); + } + if (k.receiptId) { + j["receiptId"] = k.receiptId.value(); + } +} + +void from_json(const json& j, NotifySettlementResponse& 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("receiptURL")) { + k.receiptURL.emplace(j.at("receiptURL")); + } + if (j.contains("receiptId")) { + k.receiptId.emplace(j.at("receiptId")); + } +} + +/// \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..0ad05c242 --- /dev/null +++ b/lib/ocpp/v21/messages/OpenPeriodicEventStream.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 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({}, true); + // the optional parts of the message + if (k.customData) { + j["customData"] = k.customData.value(); + } +} + +void from_json(const json& j, OpenPeriodicEventStreamResponse& 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 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..68a8fb34c --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.scheduleUpdate) { + j["scheduleUpdate"] = k.scheduleUpdate.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("scheduleUpdate")) { + k.scheduleUpdate.emplace(j.at("scheduleUpdate")); + } + if (j.contains("statusInfo")) { + k.statusInfo.emplace(j.at("statusInfo")); + } +} + +/// \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..578d847ca --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..7719c2b1c --- /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.customData) { + j["customData"] = k.customData.value(); + } + 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(); + } +} + +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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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.customData) { + j["customData"] = k.customData.value(); + } + 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); + } + } +} + +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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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); + } +} + +/// \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..81b692351 --- /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_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(); + } +} + +void from_json(const json& j, SetDefaultTariffResponse& k) { + // the required parts of the message + k.status = ocpp::v201::conversions::string_to_tariff_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")); + } +} + +/// \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..0af8d0c1b --- /dev/null +++ b/lib/ocpp/v21/messages/UpdateDynamicSchedule.cpp @@ -0,0 +1,83 @@ +// 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.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("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..cabf9bd6b --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.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("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 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..673fabb3f --- /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.customData) { + j["customData"] = k.customData.value(); + } + if (k.evseId) { + j["evseId"] = k.evseId.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("customData")) { + k.customData.emplace(j.at("customData")); + } + if (j.contains("evseId")) { + k.evseId.emplace(j.at("evseId")); + } +} + +/// \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.customData) { + j["customData"] = k.customData.value(); + } + if (k.company) { + j["company"] = k.company.value(); + } + if (k.statusInfo) { + j["statusInfo"] = k.statusInfo.value(); + } + if (k.evseId) { + j["evseId"] = k.evseId.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("customData")) { + k.customData.emplace(j.at("customData")); + } + 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")); + } +} + +/// \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..ff343b229 100644 --- a/src/code_generator/common/generate_cpp.py +++ b/src/code_generator/common/generate_cpp.py @@ -192,6 +192,37 @@ 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', + ] + + def object_exists(name: str) -> bool: """Check if an object (i.e. dataclass) already exists.""" for el in parsed_types: @@ -205,7 +236,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: @@ -379,10 +412,20 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), 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,14 +434,26 @@ 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+' @@ -478,11 +533,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, @@ -495,15 +561,15 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), 'is_request': (type_name == 'Request') } })) - 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, @@ -560,6 +626,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 +661,10 @@ def parse_schemas(version: str, schema_dir: Path = Path('schemas/json/'), messages_header_dir)], cwd=messages_header_dir) subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( messages_source_dir)], cwd=messages_source_dir) + subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( + messages_header_dir_v21)], cwd=messages_header_dir_v21) + subprocess.run(["sh", "-c", "find {} -regex '.*\\.\\(cpp\\|hpp\\)' -exec clang-format -style=file -i {{}} \\;".format( + messages_source_dir_v21)], cwd=messages_source_dir_v21) subprocess.run(["clang-format", "-style=file", "-i", enums_hpp_fn, ocpp_types_hpp_fn], cwd=generated_header_dir) subprocess.run(["clang-format", "-style=file", "-i", @@ -606,7 +681,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..12648f87b 100644 --- a/src/code_generator/common/templates/message.cpp.jinja +++ b/src/code_generator/common/templates/message.cpp.jinja @@ -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}}")))); diff --git a/src/code_generator/common/templates/message.hpp.jinja b/src/code_generator/common/templates/message.hpp.jinja index 98467a626..4cc1b2e50 100644 --- a/src/code_generator/common/templates/message.hpp.jinja +++ b/src/code_generator/common/templates/message.hpp.jinja @@ -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 %} 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 4b9ea9846..a1b2e32cb 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 0fa45be8c..013e28756 100644 --- a/tests/lib/ocpp/v201/test_charge_point.cpp +++ b/tests/lib/ocpp/v201/test_charge_point.cpp @@ -101,6 +101,8 @@ class ChargePointCommonTestFixtureV201 : public DatabaseTestingUtils { start_schedule, duration, min_charging_rate, + std::nullopt, + std::nullopt, sales_tariff, }; } @@ -183,8 +185,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; @@ -665,7 +667,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); @@ -783,7 +785,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 = @@ -910,7 +912,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 654f3032f..877eed408 100644 --- a/tests/lib/ocpp/v201/test_composite_schedule.cpp +++ b/tests/lib/ocpp/v201/test_composite_schedule.cpp @@ -86,6 +86,8 @@ class CompositeScheduleTestFixtureV201 : public DatabaseTestingUtils { start_schedule, duration, min_charging_rate, + std::nullopt, + std::nullopt, sales_tariff, }; } @@ -107,6 +109,8 @@ class CompositeScheduleTestFixtureV201 : public DatabaseTestingUtils { start_schedule, duration, min_charging_rate, + std::nullopt, + std::nullopt, sales_tariff, }; } 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_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 ace74ce2d..07614af40 100644 --- a/tests/lib/ocpp/v201/test_smart_charging_handler.cpp +++ b/tests/lib/ocpp/v201/test_smart_charging_handler.cpp @@ -86,6 +86,8 @@ class SmartChargingHandlerTestFixtureV201 : public DatabaseTestingUtils { start_schedule, duration, min_charging_rate, + std::nullopt, + std::nullopt, sales_tariff, }; } @@ -107,6 +109,8 @@ class SmartChargingHandlerTestFixtureV201 : public DatabaseTestingUtils { start_schedule, duration, min_charging_rate, + std::nullopt, + std::nullopt, sales_tariff, }; } @@ -166,11 +170,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 +1275,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 +1290,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}); @@ -1308,7 +1312,7 @@ TEST_F(SmartChargingHandlerTestFixtureV201, ValidateAndAddProfile_StoresCharging 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, K01_ValidateAndAdd_RejectsInvalidProfilesWithReasonCode) { @@ -1465,8 +1469,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)); @@ -1512,7 +1516,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}); @@ -1530,7 +1534,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));