-
Notifications
You must be signed in to change notification settings - Fork 25
Traits v2 1 #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traits v2 1 #164
Conversation
* feat: custom serde serializer for datetime * feat: use custom serde serializer for datetime for all DateTime<Utc> fields * review: rename datetime serializer to datetime_rfc3339
* Bump version to 2.0.2 * Bump version to 3.0.0 * docs: bump version to 3.0
every trait have tests |
Thank you @AnlangA will check it out this weekend 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds builder-style functions (new, with_, and set_) to a wide range of datatypes in the v2_1 module to simplify object creation and update patterns. Key changes include additions to charging, certificate, battery, authorization, network, address, and pricing datatypes as well as an update to Cargo.toml to enable v2_1 as the default feature.
Reviewed Changes
Copilot reviewed 124 out of 124 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
datatypes/charging_schedule_update.rs | Adds new constructor and builder/setter functions for charging schedule update parameters. |
datatypes/charging_schedule_period.rs | Introduces builder functions for charging schedule period related fields. |
datatypes/charging_schedule.rs | Implements convenience methods for creating and updating schedule details. |
datatypes/charging_profile_criterion.rs | Provides new methods to set charging profile criterion properties. |
datatypes/charging_period.rs | Adds builder methods for charging period properties. |
datatypes/charging_needs.rs | Adds new functions to build and update charging needs data. |
datatypes/charging_limit.rs | Implements builder functions for charging limit parameters. |
datatypes/certificate_status_request_info.rs | Adds builder methods to manage certificate status request information. |
datatypes/certificate_status.rs | Introduces new trait functions for certificate status handling. |
datatypes/certificate_hash_data_chain.rs | Adds new helper methods for certificate hash data chain manipulation. |
datatypes/certificate_hash_data.rs | Implements convenience builder/setter functions for certificate hash data. |
datatypes/battery_data.rs | Adds methods for constructing and updating battery data objects. |
datatypes/authorization_data.rs | Introduces new constructor and builder functions for authorization data. |
datatypes/apn.rs | Adds builder functions for constructing and modifying APN configurations. |
datatypes/address.rs | Implements new trait functions to ease creation and update of address information. |
datatypes/additional_selected_services.rs | Adds builder methods for additional selected services to support pricing details. |
datatypes/additional_info.rs | Provides new convenience functions for additional identifier information. |
datatypes/ac_charging_parameters.rs | Introduces new functions to create and update AC charging parameters. |
datatypes/absolute_price_schedule.rs | Implements builder-style methods for constructing absolute price schedules. |
Cargo.toml | Updates the default feature to include v2_1. |
Can you rebase on main? |
i will do it later |
- Remove default feature for OCPP versions - Add support for OCPP v2.1 feature flag - Improve formatting of dependency configurations
- Add comprehensive BootNotificationRequest and BootNotificationResponse structs - Introduce new enumerations: BootReasonEnumType and RegistrationStatusEnumType - Implement validation for datetime and field lengths - Add support for custom data and modem information - Improve test coverage with various validation scenarios - Update Cargo.toml to include lazy_static and serde_json dependencies
- Introduce new GenericStatusEnumType enumeration - Support serialization and deserialization of status - Add Accepted and Rejected status variants - Update enumerations module to export the new type
- Introduce new HashAlgorithmEnumType enumeration - Support serialization and deserialization of hash algorithms - Include SHA256, SHA384, and SHA512 variants - Update enumerations module to export the new type
- Introduce new AuthorizationStatusEnumType enumeration - Support serialization and deserialization of authorization statuses - Include multiple status variants like Accepted, Blocked, Expired, etc. - Update enumerations module to export the new type
- Introduce new CertificateSigningUseEnumType enumeration - Support serialization and deserialization of certificate signing use types - Include variants for Charging Station, V2G, and V2G 2.0 certificates - Update enumerations module to export the new type
- Introduce new DayOfWeekEnumType enumeration - Support serialization and deserialization of days of the week - Include all seven days from Monday to Sunday - Update enumerations module to export the new type
- Introduce new EvseKindEnumType enumeration - Support serialization and deserialization of EVSE types - Include AC and DC variants - Update enumerations module to export the new type
- Introduce new ChargingStateEnumType enumeration - Support serialization and deserialization of charging states - Include variants for EV connection, charging, suspended states, and idle - Update enumerations module to export the new type
- Introduce new APNAuthenticationEnumType enumeration - Support serialization and deserialization of APN authentication methods - Include variants for PAP, CHAP, NONE, and AUTO authentication - Update enumerations module to export the new type
- Introduce new ChargingRateUnitEnumType enumeration - Support serialization and deserialization of charging rate units - Include variants for Watts (W) and Amperes (A) - Update enumerations module to export the new type
- Introduce new ConnectorStatusEnumType enumeration - Support serialization and deserialization of connector statuses - Include variants for Available, Occupied, Reserved, Unavailable, and Faulted - Update enumerations module to export the new type
- Introduce new ResetStatusEnumType enumeration - Support serialization and deserialization of reset statuses - Include variants for Accepted, Rejected, and Scheduled - Update enumerations module to export the new type
- Introduce new GetCertificateStatusEnumType enumeration - Support serialization and deserialization of certificate status retrieval - Include variants for Accepted and Failed - Update enumerations module to export the new type
… fields and methods
…earTariffsResultType, CustomDataType, and StatusInfoType
…ntiation and manipulation
…taType, TariffAssignmentType, TaxRateType, and VPNType
…, LimitMaxDischargeType, LogParametersType, MessageContentType, and MessageInfoType
…ConditionsType, TariffConditionsFixedType, and TariffTimePriceType
…ametersType, V2XFreqWattPointType, and V2XSignalWattPointType
…pe, TariffEnergyPriceType, TariffFixedType, TariffFixedPriceType, and TariffTimeType
…structors, setters, and tests
…d tests - Added `TransactionType` struct with methods for creating, getting, and setting transaction details. - Implemented optional fields handling in `TransactionType` for charging state, time start/end, ID tokens, and custom data. - Introduced `TransactionLimitType` struct with methods for managing energy and time limits, including custom data. - Enhanced `VariableAttributeType` with methods for setting persistent and constant flags, along with custom data. - Developed `VariableCharacteristicsType` to manage variable characteristics with comprehensive getter and setter methods. - Created `VariableMonitoringType` for monitoring variables with severity and custom data handling. - Added unit tests for all new methods to ensure functionality and correctness.
…ultType with associated tests
… for VariableMonitoringType
…gement - Added `SetMonitoringDataType` with methods for creating and modifying monitoring data, including custom data and severity. - Introduced `SetMonitoringResultType` with functionality to manage monitoring results, including status and custom data. - Created `SetVariableDataType` to handle variable attributes, allowing for custom data and attribute type management. - Developed `SignedMeterValueType` for handling signed meter values with methods for managing signatures and custom data. - Implemented `StreamDataElementType` for reporting stream data with methods for managing variable values and custom data. - Added `UnitOfMeasureType` to represent units of measurement with methods for managing multipliers and custom data. - Comprehensive unit tests for all new types and methods to ensure functionality and correctness.
- Implemented PriceRuleType with methods for creating, setting, and getting various pricing parameters. - Added tests for PriceRuleType to ensure correct functionality. - Introduced PriceRuleStackType to manage a collection of PriceRuleType instances. - Included methods for setting custom data and managing the duration of the price rule stack. - Added tests for PriceRuleStackType to validate its behavior. feat: Enhance RationalNumberType with custom data handling - Added methods to RationalNumberType for creating instances, setting, and getting values and exponents. - Implemented custom data support in RationalNumberType. - Created tests to verify the functionality of RationalNumberType. feat: Extend ReportDataType with custom data and variable management - Implemented ReportDataType with methods for managing component and variable attributes. - Added support for custom data, variable values, and attributes. - Developed tests to ensure the correctness of ReportDataType functionality.
…e files - Adjusted formatting in `monitoring_data.rs`, `network_connection_profile.rs`, `overstay_rule.rs`, `overstay_rule_list.rs`, `rational_number.rs`, `relative_time_interval.rs`, `report_data.rs`, `sales_tariff.rs`, `sales_tariff_entry.rs`, `sampled_value.rs`, `set_monitoring_data.rs`, `set_monitoring_result.rs`, `set_variable_data.rs`, `stream_data_element.rs`, `tariff.rs`, `tariff_conditions.rs`, `tariff_conditions_fixed.rs`, `tariff_fixed.rs`, `tax_rate.rs`, `tax_rule.rs`, `total_cost.rs`, `transaction.rs`, `unit_of_measure.rs`, `v2x_charging_parameters.rs`, `v2x_freq_watt_point.rs`, `v2x_signal_watt_point.rs`, `variable_attribute.rs`, and `variable_monitoring.rs` to enhance code clarity. - Consolidated method chaining for setter functions to a single line where applicable. - Ensured consistent formatting for function parameters and return types. - Improved test assertions for better readability.
…ultType with associated tests
I created a new PR for rebasing on main. So I closed this one. |
add function traits for datatypes/* file