Skip to content

Traits v2_1: rebase main #165

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

Open
wants to merge 253 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
fc0657e
linting
tommymalmqvist Feb 12, 2025
8d8193a
feat: Enhance BootNotification message for OCPP v2.1
tommymalmqvist Feb 12, 2025
08bd391
feat: Add GenericStatusEnumType for OCPP v2.1
tommymalmqvist Feb 12, 2025
f8ab372
feat: Add HashAlgorithmEnumType for OCPP v2.1
tommymalmqvist Feb 12, 2025
aa67286
feat: Add AuthorizationStatusEnumType for OCPP v2.1
tommymalmqvist Feb 12, 2025
2a878cc
feat: Add CertificateSigningUseEnumType for OCPP v2.1
tommymalmqvist Feb 12, 2025
6d6e993
feat: Add OperationalStatusEnumType for OCPP v2.1
tommymalmqvist Feb 12, 2025
e639dc3
Add ChangeAvailabilityStatusEnumType
tommymalmqvist Feb 12, 2025
fa0cc62
feat: Add DayOfWeekEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
3d0c70b
feat: Add EvseKindEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
7d2d376
Added MessageFormatEnumType
tommymalmqvist Feb 13, 2025
3961d11
feat: Add ChargingStateEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
9aad755
feat: Add APNAuthenticationEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
7496bfc
feat: Add ChargingRateUnitEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
3047f64
feat: Add ConnectorStatusEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
b41a063
feat: Add ResetStatusEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
77de21e
feat: Add GetCertificateStatusEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
820ebde
feat: Add MessageTriggerEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
0cef25d
feat: Add OCPPInterfaceEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
44a3911
feat: Add OCPPTransportEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
e3ad975
feat: Add OCPPVersionEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
a3339a1
feat: Add VPNEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
fe1d65d
feat: Add DERControlEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
6134684
feat: Add EventNotificationEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
2aed6b2
feat: Add ChargingProfilePurposeEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
c9d3fbc
feat: Add ChargingLimitSourceEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
5e82285
feat: Add ChargingProfileKindEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
d842732
feat: Add ChargingProfileStatusEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
26262a0
feat: Add OperationModeEnumType for OCPP v2.1
tommymalmqvist Feb 13, 2025
a3696b9
feat: Add ChargingProfileKindEnumType and ChargingProfileStatusEnumTy…
tommymalmqvist Feb 13, 2025
74d38a0
feat: Add StatusInfoType for OCPP v2.1 status information
tommymalmqvist Feb 13, 2025
dd3834a
feat: Add AdditionalInfoType, CustomDataType, and IdTokenType for OCP…
tommymalmqvist Feb 13, 2025
3ae8af7
feat: Add Variable and Certificate-related Types for OCPP v2.1
tommymalmqvist Feb 13, 2025
c795ad5
feat: Add CancelReservation message types and status enumeration for …
tommymalmqvist Feb 13, 2025
4e7f3f7
feat: Add CertificateSigned message types for OCPP v2.1
tommymalmqvist Feb 13, 2025
965ab95
refactor: Consolidate Authorize and CertificateSigned message types
tommymalmqvist Feb 13, 2025
f85cbe3
Add enums
tommymalmqvist Feb 13, 2025
0167b94
Add grid_even_fault
tommymalmqvist Feb 13, 2025
317c98f
Fix imports
tommymalmqvist Feb 13, 2025
95c75c9
Add more types
tommymalmqvist Feb 13, 2025
3d9c1f9
refactor: Improve IslandingDetectionEnumType serialization and naming
tommymalmqvist Feb 14, 2025
22f4a4a
refactor: Remove Hash trait from ChargingScheduleUpdateType
tommymalmqvist Feb 14, 2025
276222b
refactor: Update SalesTariffEntryType validation for e_price_level
tommymalmqvist Feb 14, 2025
10fd4df
feat: Enhance IdTokenType validation and schema for OCPP v2.1
tommymalmqvist Feb 14, 2025
cb84a5a
Add message types
tommymalmqvist Feb 16, 2025
64e2891
Minor fixes
tommymalmqvist Feb 16, 2025
6902ad3
feat: Add OCPP 2.1 support and enhance schema validation
tommymalmqvist Feb 16, 2025
1ded1b2
Fix imports
tommymalmqvist Feb 16, 2025
9a75bfc
feat: Enhance CustomDataType with additional properties support
tommymalmqvist Feb 16, 2025
6ebea65
refactor: Cleanup and simplify message module imports
tommymalmqvist Feb 16, 2025
038fce2
Update tests
tommymalmqvist Feb 16, 2025
2fcbc04
refactor: Enhance ChargingLimitSourceEnumType for OCPP 2.1 flexibility
tommymalmqvist Feb 16, 2025
391fb4d
feat: Add comprehensive ConnectorEnumType for OCPP 2.1 connector types
tommymalmqvist Feb 16, 2025
2d57955
feat: Add SigningMethodEnumType for OCPP 2.1 signing methods
tommymalmqvist Feb 16, 2025
2e7cc21
refactor: Update SignedMeterValueType with improved signing method an…
tommymalmqvist Feb 16, 2025
5fbca04
add v2.1 doc (#163)
AnlangA Apr 29, 2025
b221812
Fix imports
tommymalmqvist Apr 29, 2025
5e788b3
feat: add absolute_price_schedule.rs trait
Apr 30, 2025
4284f06
feat: add ac_charging_parameters.rs trait
Apr 30, 2025
e281f9b
feat: Add validation and methods to AdditionalInfoType
Apr 30, 2025
e1e0b08
feat: Add validation and methods to AdditionalSelectedServicesType
Apr 30, 2025
f3d86c5
feat(address): add validation and methods to AddressType
Apr 30, 2025
113636f
feat(apn): add APNType constructor and methods for chaining
Apr 30, 2025
ea4c7f8
feat(authorization_data): enhance AuthorizationData with methods and …
Apr 30, 2025
3f58349
feat(battery_data): enhance BatteryDataType with detailed docs and me…
Apr 30, 2025
45b00fd
feat: Add validation and methods to CertificateHashDataChainType
Apr 30, 2025
255f02b
refactor(v2_1/datatypes): Remove Validate derive from multiple structs
Apr 30, 2025
f268492
feat(v2_1/datatypes): enhance CertificateStatusType with methods and …
Apr 30, 2025
c674fc8
feat: enhance CertificateStatusRequestInfoType with new methods and t…
Apr 30, 2025
2a8e217
feat(charging_limit): Add methods and tests for ChargingLimitType
Apr 30, 2025
06408a7
feat: Add builder methods and tests for ChargingNeedsType and DCCharg…
Apr 30, 2025
1f55fb2
feat: Add methods and tests for ChargingPeriodType and CostDimensionType
Apr 30, 2025
9b566bc
feat(charging_profile): add new methods and tests for ChargingProfile…
Apr 30, 2025
69a54ed
feat(charging_schedule): add builder methods and tests for ChargingSc…
Apr 30, 2025
b29d3da
feat(charging_schedule_period): add methods for creating and modifyin…
Apr 30, 2025
e7181bd
feat: Add builder methods and tests for ChargingProfileCriterion and …
Apr 30, 2025
1e0a9d5
feat(charging_station): add methods and tests for ChargingStationType
Apr 30, 2025
ca1ea35
feat(modem): add ModemType methods and tests
Apr 30, 2025
e0cfced
feat: Add methods to ClearChargingProfileType for easier configuratio…
Apr 30, 2025
5dbd753
feat: enhance ComponentType and ComponentVariableType with additional…
Apr 30, 2025
548e7ac
feat(variable): add methods and tests for VariableType
Apr 30, 2025
e63cfe7
feat(v2_1): add builder methods and tests for data types
Apr 30, 2025
9abe3c3
feat(cost_details): add new methods and tests for CostDetailsType
Apr 30, 2025
8aee944
format: cargo fmt
Apr 30, 2025
e769ce4
feat: add builder methods and tests for ClearMonitoringResultType, Cl…
Apr 30, 2025
cb2f166
feat: Add constructors and methods to DER data types for easier insta…
Apr 30, 2025
94e04a9
feat(v2_1): add default feature and enhance DER data types
Apr 30, 2025
f689b64
feat(freq_droop): add constructor and methods for FreqDroopType and F…
Apr 30, 2025
8abde38
feat: Add constructors and methods to EV price schedule types
Apr 30, 2025
05a256e
feat: Add builder methods and tests for EV energy offer and related t…
Apr 30, 2025
4a710cb
feat(v2_1/datatypes): Add builder methods and tests for GetVariableDa…
Apr 30, 2025
fbdc05e
feat(v2_1/datatypes): Add builder methods and tests for IdTokenInfoType
Apr 30, 2025
7de72eb
feat(v2_1/datatypes): Implement builder methods and tests for IdToken…
Apr 30, 2025
761a9a3
feat(v2_1/datatypes): Add constructors and methods for LimitAtSoCType…
Apr 30, 2025
632bb14
feat(v2_1/datatypes): Add constructors and builder methods for Tariff…
Apr 30, 2025
39b2ff4
feat(v2_1/datatypes): Add constructors and methods for V2XChargingPar…
Apr 30, 2025
7b103be
feat(v2_1/datatypes): Add constructors and methods for TariffEnergyTy…
Apr 30, 2025
23a3d42
feat(v2_1/datatypes): Implement methods for TaxRuleType including con…
Apr 30, 2025
09cd652
feat: Enhance transaction and variable data types with new methods an…
Apr 30, 2025
2ea1aa0
feat(v2_1/datatypes): Add constructors and methods for GetVariableRes…
Apr 30, 2025
fdf0012
feat(v2_1/datatypes): Update tests to use new_without_severity method…
Apr 30, 2025
0ba8509
Implement new data types and methods for monitoring and variable mana…
Apr 30, 2025
3b5c1dc
feat: Add PriceRuleType and PriceRuleStackType with custom data support
Apr 30, 2025
5073c04
Refactor code for improved readability and consistency across multipl…
Apr 30, 2025
e05f29b
feat(v2_1/datatypes): Add constructors and methods for SetVariableRes…
Apr 30, 2025
971977f
feat(v2_1/messages): add camelCase renaming to priority charging and …
May 8, 2025
752ff6f
refactor(v2_1): Update AbsolutePriceScheduleType to use DateTime<Utc>
May 8, 2025
58b6c6e
docs: Fix punctuation in README.md usage section
May 8, 2025
9ef7b37
refactor: Switch ACChargingParametersType to use Decimal for precision
May 8, 2025
483e269
feat(v2_1): enhance AbsolutePriceScheduleType with validation and new…
May 8, 2025
850b15e
feat: Add validation to AdditionalSelectedServicesType
May 8, 2025
9bfba3a
refactor: relax length validation for additional_id_token and type_
May 8, 2025
6960f7b
feat: Add validation to AddressType fields and implement unit tests
AnlangA May 8, 2025
9c04d82
refactor(APNType): move custom_data field to end of struct
May 9, 2025
2ffb38c
feat: add nested validation to data types and enhance tests
May 9, 2025
59ca3c8
feat(battery_data): enhance battery data model with validation and ne…
May 9, 2025
d7d330b
feat: Add validation to CertificateHashDataChainType
AnlangA May 10, 2025
3dc1603
feat: Add URL validation and tests to CertificateStatusRequestInfoType
AnlangA May 10, 2025
759dc12
feat: Add validation and improve CertificateStatusType
AnlangA May 10, 2025
4eb8ffe
feat(v2_1): Add validation and enhance ChargingLimitType and Charging…
AnlangA May 10, 2025
17375db
feat(v2_1/datatypes): add validation and optional fields to ChargingP…
AnlangA May 10, 2025
40bdc10
feat(v2_1): Add charging limit source to ChargingProfileCriterionType
AnlangA May 10, 2025
bcc2486
refactor(v2_1/datatypes): Update serialization and validation for Cha…
AnlangA May 10, 2025
8db4733
refactor: update ChargingSchedulePeriodType with new fields and valid…
AnlangA May 10, 2025
704597d
refactor(v2_1/datatypes): Simplify ChargingScheduleType and ChargingS…
AnlangA May 11, 2025
a6dc957
refactor(v2_1/datatypes): Reorganize custom_data fields and add tests
AnlangA May 11, 2025
4b0951e
refactor(v2_1/datatypes): Move custom_data field in ClearMonitoringRe…
AnlangA May 11, 2025
b9263a6
refactor(ClearTariffsResultType): Move custom_data field and add tests
AnlangA May 11, 2025
b45f484
feat(v2_1): add validation and tests for ComponentType and ComponentV…
AnlangA May 11, 2025
d41ae23
Add validation to params field and comprehensive tests
AnlangA May 11, 2025
480a9c4
refactor:Set v2_1 as default feature and enhance ConsumptionCostType
AnlangA May 11, 2025
3d5b705
Merge branch 'traits_v2_1' of https://github.com/AnlangA/rust-ocpp in…
AnlangA May 11, 2025
430e8eb
Reorder fields and add validation tests for CompositeScheduleType
AnlangA May 11, 2025
960d8fb
Add validation to custom_data field in ConstantStreamDataType
AnlangA May 11, 2025
b179b99
Add detailed validation test error messages and custom data tests
AnlangA May 11, 2025
291d5f7
Add detailed test assertions with error messages
AnlangA May 11, 2025
68efd18
Make charging_periods optional with validation
AnlangA May 11, 2025
d68d65b
refactor(v2_1/datatypes): Use Decimal for volume in CostDimensionType
AnlangA May 11, 2025
3cb1626
feat(DCChargingParametersType): Add SoC, full SoC, and use Decimal fo…
AnlangA May 11, 2025
45726e5
feat(DERChargingParametersType): Add comprehensive DER charging param…
AnlangA May 11, 2025
eeda5b5
refactor(v2_1): add arbitrary precision to Decimal fields in DERCharg…
AnlangA May 11, 2025
c365cbe
refactor(v2_1/datatypes): Update serialization and deserialization te…
AnlangA May 11, 2025
fb42c31
refactor(DERCurveGetType): Move custom_data field and add validation …
May 12, 2025
4dedd1f
refactor: switch DERCurvePointsType to use Decimal for precision
May 12, 2025
59169a8
refactor(v2_1/datatypes/der_curve): Use rust_decimal for precision in…
May 12, 2025
73a15d5
feat(v2_1/datatypes): add validation and tests for EnterServiceGetType
May 12, 2025
67db9c5
refactor(enter_service): Use Decimal for precision in EnterServiceType
May 12, 2025
afc0401
feat: add price rules to EVAbsolutePriceScheduleEntryType
May 12, 2025
3eaeb89
feat(ev_absolute_price_schedule): add default, display, and JSON conv…
May 12, 2025
90b702a
refactor(EVPowerScheduleEntryType): use Decimal for power and add val…
May 12, 2025
e9790e0
refactor(v2_1/datatypes): Use Decimal for precision in EV data types
AnlangA May 12, 2025
22460b6
refactor: Update data types to use Decimal for precision and add vali…
AnlangA May 12, 2025
a815725
refactor(v2_1/datatypes): Update FixedPFType to use Decimal for preci…
AnlangA May 12, 2025
2db8481
refactor(charging_needs): add nested validation to available_energy_t…
AnlangA May 12, 2025
c0029db
Merge branch 'traits_v2_1' of https://github.com/AnlangA/rust-ocpp in…
AnlangA May 12, 2025
b49e3dc
feat(v2_1/datatypes): Add is_default field to FixedVarGetType
AnlangA May 12, 2025
2252167
refactor(v2_1/datatypes): Add skip_serializing_if and default to Deci…
AnlangA May 12, 2025
259a4a1
refactor(fixed_pf): Remove redundant serde skip_serializing_if attribute
AnlangA May 12, 2025
616717c
Update dependencies and fix Cargo.lock
AnlangA May 12, 2025
369ecff
style: Fix serde attribute formatting in FixedVarType
AnlangA May 12, 2025
6ee24db
feat(freq_droop_get): add is_default field and display, from impl
AnlangA May 13, 2025
fb72b2c
feat(freq_droop): enhance frequency droop settings with new fields an…
AnlangA May 13, 2025
5aa3652
Change attribute_type to use AttributeEnumType
AnlangA May 13, 2025
6012ca6
Update Cargo.toml
AnlangA May 13, 2025
cdd8524
Merge branch 'traits_v2_1' of https://github.com/AnlangA/rust-ocpp in…
AnlangA May 13, 2025
810ea56
Remove default v2_1 feature to require explicit version
AnlangA May 13, 2025
e05a451
refactor(v2_1/datatypes): Add nested validation to GetVariableDataTyp…
AnlangA May 13, 2025
8b728db
refactor(GetVariableResultType): enhance structure and validation
AnlangA May 13, 2025
d296337
feat(gradient): add soft gradient and use Decimal for rates
AnlangA May 13, 2025
04b4769
refactor(v2_1/datatypes): Remove is_superseded from GradientGetType
AnlangA May 13, 2025
3f531fe
feat(hysteresis): add hysteresis high/low/delay/gradient fields
AnlangA May 13, 2025
ae4530d
refactor(v2_1/datatypes): Simplify IdTokenInfoType creation and usage…
AnlangA May 13, 2025
d183692
refactor(id_token): Rename 'type' to 'type_' in IdTokenType
AnlangA May 13, 2025
4d276b8
refactor(v2_1/datatypes): Update LimitAtSoCType to use Decimal for po…
AnlangA May 13, 2025
23427f3
refactor(id_token_info): simplify and enhance IdTokenInfoType initial…
AnlangA May 13, 2025
326805a
feat(id_token): add additional_info method and validation tests
AnlangA May 13, 2025
53f5f69
feat(v2_1/datatypes): Add is_default field to LimitMaxDischargeGetType
AnlangA May 13, 2025
e354d5f
Merge remote-tracking branch 'origin/traits_v2_1' into traits_v2_1
AnlangA May 13, 2025
5796e23
feat(v2_1/datatypes): enhance LimitMaxDischargeType with new fields a…
AnlangA May 13, 2025
5954b1c
refactor(v2_1/datatypes): Remove redundant parameter from LimitMaxDis…
AnlangA May 13, 2025
d82cf8d
refactor(v2_1/datatypes): Remove discharge_limit from LimitMaxDischar…
AnlangA May 13, 2025
147f979
feat(log_parameters): enhance LogParametersType with validation and d…
AnlangA May 13, 2025
b317053
feat(message_content): enhance MessageContentType with builder and va…
AnlangA May 13, 2025
1ee12ca
feat(message_info): enhance MessageInfoType with new fields and valid…
AnlangA May 13, 2025
b65347d
feat(meter_value): enhance MeterValueType with detailed docs and vali…
AnlangA May 13, 2025
9977ba5
feat(modem): enhance validation and method chaining in ModemType
AnlangA May 14, 2025
2ab9262
refactor(monitoring_data): enhance validation and method chaining cla…
AnlangA May 14, 2025
e3e309c
refactor(NetworkConnectionProfileType): update fields and methods for…
AnlangA May 14, 2025
69fdcf0
refactor(ocsp_request_data): enhance OCSP request data structure and …
AnlangA May 14, 2025
351bfeb
feat(overstay_rule_list): add power and time thresholds, update valid…
AnlangA May 14, 2025
00df778
feat(overstay_rule): enhance overstay rule with new fields and methods
AnlangA May 14, 2025
9cab2b7
refactor(v2_1/datatypes): Update ConstantStreamData tests for new param
AnlangA May 14, 2025
16f339d
feat: Add interval and values to PeriodicEventStreamParamsType
AnlangA May 14, 2025
7f7b379
feat(periodic_event_stream_params): add validation to custom_data
AnlangA May 14, 2025
a838c52
feat(price_level_schedule): add new fields and methods to PriceLevelS…
AnlangA May 14, 2025
a91f899
Update price level range and description in schedule entry
AnlangA May 14, 2025
73fd0ad
feat(v2_1/datatypes): Add placeholders and validate price rule stack
AnlangA May 14, 2025
ed916fb
refactor(v2_1/datatypes): Simplify PriceRuleType creation in tests
AnlangA May 14, 2025
03e70dd
refactor(v2_1/datatypes): Use RationalNumberType in ChargingSchedule …
AnlangA May 14, 2025
f5b0770
refactor(price_rule_stack): use RationalNumberType in tests
AnlangA May 14, 2025
2e41311
refactor(price_rule): update PriceRuleType to use RationalNumberType …
AnlangA May 14, 2025
14c75b0
refactor(price_rule): restructure PriceRuleType, add validation and c…
AnlangA May 14, 2025
8a5013a
refactor(price): switch to rust_decimal for price fields
AnlangA May 14, 2025
e27bb6c
refactor(v2_1/datatypes): Use Decimal for PriceType in tests
AnlangA May 14, 2025
0ba9abe
feat: enhance reactive power params and add tests for rational number
AnlangA May 14, 2025
1fe5201
refactor(v2_1/datatypes): Move custom_data field in RelativeTimeInter…
AnlangA May 14, 2025
393cd47
Reformat imports with consistent ordering and grouping
AnlangA May 14, 2025
8090a93
refactor(v2_1/datatypes): Use Decimal for precision in charging param…
AnlangA May 14, 2025
67ceba6
refactor(v2_1/datatypes): Format and optimize code for readability an…
AnlangA May 14, 2025
ccade29
refactor(report_data): add validation and reorder fields in ReportDat…
AnlangA May 14, 2025
1ea7a5f
feat(sales_tariff): enhance validation and structure in sales tariff …
AnlangA May 14, 2025
bf68d30
Change SalesTariff ID from string to integer and improve docs
AnlangA May 14, 2025
21c090b
Refactor SetMonitoringDataType to use new schema
AnlangA May 14, 2025
37ce573
Add monitor type and severity to SetMonitoringResultType
AnlangA May 14, 2025
ead05c6
Fix code formatting and trailing newlines
AnlangA May 14, 2025
fc7bff0
Refactor variable monitoring functionality
AnlangA May 15, 2025
a8a0a2d
Format code with consistent spacing and line breaks
AnlangA May 15, 2025
19703a3
Refactor SetVariableResult with improved field organization
AnlangA May 15, 2025
c60ebd3
Refactor SignedMeterValueType to align with OCPP spec
AnlangA May 15, 2025
71529e0
Update string length limits and refactor StreamDataElementType
AnlangA May 15, 2025
b05d12f
Fix code formatting in StreamDataElementType and tests
AnlangA May 15, 2025
3165bb2
Redesign TariffType to better model EV charging price structures
AnlangA May 15, 2025
706be5c
Refactor TariffAssignmentType to use DateTime<Utc> and improve naming
AnlangA May 15, 2025
af1c0bd
Reimplement TariffConditionsType to use V2.1 spec
AnlangA May 15, 2025
828c065
Improve code formatting in test assertions
AnlangA May 15, 2025
bc6839a
Refactor TariffConditionsFixedType with multiple condition fields
AnlangA May 15, 2025
b391787
Update TariffEnergyType to support multiple price elements
AnlangA May 15, 2025
6c2eb09
Refactor TariffEnergyPriceType with price_kwh and conditions
AnlangA May 15, 2025
9d99553
Add trailing newline in tariff_energy_price.rs
AnlangA May 15, 2025
72274e0
Refactor TariffFixedPriceType with price_fixed field
AnlangA May 15, 2025
31928d2
Fix code formatting in tariff tests
AnlangA May 15, 2025
4a521a7
Update TariffTimeType to support multiple price elements
AnlangA May 15, 2025
dc0bea0
refactor: replace f64 with Decimal for precision in pricing and condi…
AnlangA May 15, 2025
937c06a
Improve tariff module with accurate descriptions and slices
AnlangA May 15, 2025
df6779c
Update tax_rule and total_cost to match ISO 15118-20 spec
AnlangA May 15, 2025
e1dcfeb
Update price and usage fields to match OCPP 2.1 spec
AnlangA May 15, 2025
566e063
Replace float values with Decimal in TotalPrice and TotalUsage
AnlangA May 15, 2025
7ac7949
Enhance TotalUsageType with f64 constructor and validation
AnlangA May 15, 2025
7295c14
Refactor transaction datatype to match OCPP specification
AnlangA May 15, 2025
8b5aedb
Fix UnitOfMeasureType implementation and constructor usage
AnlangA May 15, 2025
02b62c6
Refactor V2XFreqWattPointType to use Decimal instead of f64
AnlangA May 15, 2025
ba463c7
Change V2XSignalWattPoint signal from f64 to i32
AnlangA May 15, 2025
409da92
Update VariableType to make instance field optional
AnlangA May 15, 2025
9fa2b64
Refactor VariableAttributeType to use enumerated attributes
AnlangA May 15, 2025
120088b
Update VariableMonitoringType with required fields
AnlangA May 15, 2025
7d48af4
Add v2_ feature that includes v2_0_1 and v2_1
AnlangA May 15, 2025
9e18255
Format code blocks with multiline assertions
AnlangA May 15, 2025
2908f80
Fix VPN import ordering in network_connection_profile tests
AnlangA May 15, 2025
8ad739d
Reorder imports and format code
AnlangA May 15, 2025
f782b78
fix: make data_enum.rs
AnlangA May 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
776 changes: 488 additions & 288 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-ocpp"
description = "ocpp 1.6 and 2.0.1 libraries"
description = "ocpp 1.6, 2.0.1 and 2.1 libraries"
readme = "README.md"
license = "MIT OR Apache-2.0"
version = "3.0.1"
Expand All @@ -23,31 +23,35 @@ exclude = ["docs/", "src/tests"]
all-features = true

[features]
default = ["v2_0_1"]
# No default feature, so each version must be explicitly enabled
v1_6 = []
v2_0_1 = []
v2_1 = []


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1", default-features = false, features = ["derive"] }
chrono = { version = "0.4.39", default-features = false, features = [
"now",
"serde",
"alloc",
] }
uuid = { version = "1", default-features = false, features = ["v4"] }
validator = { version = "0.19.0", default-features = false, features = [
validator = { version = "0.20.0", default-features = false, features = [
"derive",
] }
regex = "1.11.1"
rust_decimal = { version = "1.36.0", features = [
"serde-with-arbitrary-precision",
] }
rust_decimal_macros = "1.36.0"
serde_json = "1"
lazy_static = "1.4"
jsonschema = "0.30.0"

[dev-dependencies]
chrono = { version = "0.4.39", default-features = false, features = ["clock"] }
serde_json = "1"
mockall = "0.13.1"
jsonschema = "0.28"
rust_decimal_macros = "1.36.0"
jsonschema = "0.30.0"
57 changes: 27 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,39 @@
The `rust-ocpp` libs implements the Open Charge Point Protocol
used in charging stations. You can read more on the official [Open Charge Alliance](https://www.openchargealliance.org/) website.

Both OCPP v1.6 and v2.0.1 are implemented and validated using the official json schemas from Open Charge Alliance.
OCPP versions v1.6, v2.0.1, and v2.1 are implemented and validated using the official json schemas from Open Charge Alliance.

You can find the tests in `schema_validation.rs` for both `v.1.6` and `v2.0.1`
You can find the tests in `schema_validation.rs` for all supported versions.

## repo structure

`src/` : library files for v1.6 and v2.0.1
`src/` : library files for v1.6, v2.0.1, and v2.1

`docs/` : official ocpp specification

## How to Use

Add `rust-ocpp` as a dependency in your `Cargo.toml`. It will default to version `2.0.1` of OCPP.
Add `rust-ocpp` as a dependency in your `Cargo.toml`. Note that there is no default version - you must explicitly specify which OCPP version(s) you want to use via feature flags.

```toml
[dependencies]
rust-ocpp = "3.0"
```

To use `1.6` you need to specify a protocol version with a feature flag:
To use a specific version, specify it with a feature flag:

```toml
[dependencies]
rust-ocpp = { version = "1.0", features = ["v1_6"] }
rust-ocpp = { version = "2.0", features = ["v1_6"] } # For OCPP 1.6
rust-ocpp = { version = "2.0", features = ["v2_0_1"] } # For OCPP 2.0.1
rust-ocpp = { version = "2.0", features = ["v2_1"] } # For OCPP 2.1
```

or use both versions
You can also use multiple versions:

```toml
[dependencies]
rust-ocpp = { version = "1.0", features = ["v2_0_1", "v1_6"] }
rust-ocpp = { version = "2.0", features = ["v2_0_1", "v2_1"] }
```

## How to Build
Expand All @@ -59,7 +61,7 @@ Once you have Rust and Cargo installed, you can build the library using the foll
cd rust-ocpp
```

3. Build the library using Cargo for both `1.6` and `2.0.1`:
3. Build the library using Cargo for all versions:

```bash
cargo build --all-features
Expand All @@ -68,14 +70,14 @@ Once you have Rust and Cargo installed, you can build the library using the foll
This command will compile the library and its dependencies. If the build is successful, you will find the compiled
artifacts in the `target/debug` directory.

4. Run the tests on both versions:
4. Run the tests on all versions:

```bash
cargo test --all-features

```

This command will execute the tests for both OCPP versions. If all tests pass, it means that the library is
This command will execute the tests for all OCPP versions. If all tests pass, it means that the library is
functioning correctly.

5. Build a specific version:
Expand All @@ -93,6 +95,12 @@ Once you have Rust and Cargo installed, you can build the library using the foll
cargo build --features v2_0_1
```

To build `v2_1`:

```bash
cargo build --features v2_1
```

6. (Optional) Build for release:

If you want to build the library for release, with optimizations enabled, you can use the following command:
Expand All @@ -119,35 +127,23 @@ please check the project's issue tracker on GitHub or open a new issue for assis

## Testing

`rust-ocpp` provides testing against json schemas for both OCPP v1.6 and v2.0.1 versions. To run the tests, you can use
`rust-ocpp` provides testing against json schemas for all supported OCPP versions. To run the tests, you can use
Cargo's built-in test runner.

### Running Tests

To run the tests for a specific version, use the appropriate feature flag when running the tests.

For OCPP v1.6 tests:

```bash
cargo test --features v1_6
```

For OCPP v2.0.1 tests:
To run the tests for a specific version, use the appropriate feature flag:

```bash
cargo test --features v2_0_1
cargo test --features v1_6 # For OCPP 1.6 tests
cargo test --features v2_0_1 # For OCPP 2.0.1 tests
cargo test --features v2_1 # For OCPP 2.1 tests
```

To run all tests:
To run all tests for all versions:

```bash
cargo test
```

or for a specific version

```bash
cargo test --features v1_6
cargo test --all-features
```

### Test Coverage
Expand All @@ -172,6 +168,7 @@ Use `rustfmt` before you PR.
pre-commit config is available. You can read more about it at [pre-commits](https://pre-commit.com) website and checkout their repo on [github](https://github.com/pre-commit/pre-commit)

## Releasing a new version

1. Update the version of the library and push the changes to the main branch.
2. Create a [new release](https://github.com/codelabsab/rust-ocpp/releases/new) on GitHub with the new version number and some release notes (optional).

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/ocpp/v2.1/OCPP-2.1_part2_appendices_v20.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ pub mod tests;
pub mod v1_6;
#[cfg(feature = "v2_0_1")]
pub mod v2_0_1;
#[cfg(feature = "v2_1")]
pub mod v2_1;
2 changes: 2 additions & 0 deletions src/tests/schema_validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
mod v1_6;
#[cfg(all(test, feature = "v2_0_1"))]
mod v2_0_1;
#[cfg(all(test, feature = "v2_1"))]
mod v2_1;
41 changes: 41 additions & 0 deletions src/tests/schema_validation/schemas/v2.1/AFRRSignalRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "urn:OCPP:Cp:2:2025:1:AFRRSignalRequest",
"comment": "OCPP 2.1 Edition 1 (c) OCA, Creative Commons Attribution-NoDerivatives 4.0 International Public License",
"definitions": {
"CustomDataType": {
"description": "This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.",
"javaType": "CustomData",
"type": "object",
"properties": {
"vendorId": {
"type": "string",
"maxLength": 255
}
},
"required": [
"vendorId"
]
}
},
"type": "object",
"additionalProperties": false,
"properties": {
"timestamp": {
"description": "Time when signal becomes active.\r\n",
"type": "string",
"format": "date-time"
},
"signal": {
"description": "Value of signal in _v2xSignalWattCurve_. \r\n",
"type": "integer"
},
"customData": {
"$ref": "#/definitions/CustomDataType"
}
},
"required": [
"timestamp",
"signal"
]
}
70 changes: 70 additions & 0 deletions src/tests/schema_validation/schemas/v2.1/AFRRSignalResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "urn:OCPP:Cp:2:2025:1:AFRRSignalResponse",
"comment": "OCPP 2.1 Edition 1 (c) OCA, Creative Commons Attribution-NoDerivatives 4.0 International Public License",
"definitions": {
"GenericStatusEnumType": {
"javaType": "GenericStatusEnum",
"type": "string",
"additionalProperties": false,
"enum": [
"Accepted",
"Rejected"
]
},
"StatusInfoType": {
"description": "Element providing more information about the status.\r\n",
"javaType": "StatusInfo",
"type": "object",
"additionalProperties": false,
"properties": {
"reasonCode": {
"description": "A predefined code for the reason why the status is returned in this response. The string is case-insensitive.\r\n",
"type": "string",
"maxLength": 20
},
"additionalInfo": {
"description": "Additional text to provide detailed information.\r\n",
"type": "string",
"maxLength": 1024
},
"customData": {
"$ref": "#/definitions/CustomDataType"
}
},
"required": [
"reasonCode"
]
},
"CustomDataType": {
"description": "This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.",
"javaType": "CustomData",
"type": "object",
"properties": {
"vendorId": {
"type": "string",
"maxLength": 255
}
},
"required": [
"vendorId"
]
}
},
"type": "object",
"additionalProperties": false,
"properties": {
"status": {
"$ref": "#/definitions/GenericStatusEnumType"
},
"statusInfo": {
"$ref": "#/definitions/StatusInfoType"
},
"customData": {
"$ref": "#/definitions/CustomDataType"
}
},
"required": [
"status"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "urn:OCPP:Cp:2:2025:1:AdjustPeriodicEventStreamRequest",
"comment": "OCPP 2.1 Edition 1 (c) OCA, Creative Commons Attribution-NoDerivatives 4.0 International Public License",
"definitions": {
"PeriodicEventStreamParamsType": {
"javaType": "PeriodicEventStreamParams",
"type": "object",
"additionalProperties": false,
"properties": {
"interval": {
"description": "Time in seconds after which stream data is sent.\r\n",
"type": "integer",
"minimum": 0.0
},
"values": {
"description": "Number of items to be sent together in stream.\r\n",
"type": "integer",
"minimum": 0.0
},
"customData": {
"$ref": "#/definitions/CustomDataType"
}
}
},
"CustomDataType": {
"description": "This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.",
"javaType": "CustomData",
"type": "object",
"properties": {
"vendorId": {
"type": "string",
"maxLength": 255
}
},
"required": [
"vendorId"
]
}
},
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "integer",
"minimum": 0.0
},
"params": {
"$ref": "#/definitions/PeriodicEventStreamParamsType"
},
"customData": {
"$ref": "#/definitions/CustomDataType"
}
},
"required": [
"id",
"params"
]
}
Loading