ocpi_kit/v2_2_1/mod.rs
1//! The OCPI **2.2.1** wire model, described as a delta from [`v2_3_0`](crate::v2_3_0).
2//!
3//! OCPI 2.2.1 is still the most widely deployed version, and most of it is byte-identical to
4//! 2.3.0. Rather than transcribing the whole specification twice, this module **re-exports every
5//! type whose wire format is unchanged** and defines only what actually differs. A
6//! [`GeoLocation`](crate::v2_3_0::locations::GeoLocation) is therefore literally the same Rust type in both
7//! versions and needs no conversion; a [`Price`] is not, and
8//! [`convert`](crate::convert) knows how to carry one across.
9//!
10//! # What OCPI 2.3.0 changed
11//!
12//! | Type | 2.2.1 | 2.3.0 |
13//! |---|---|---|
14//! | [`types::Price`] | `{excl_vat, incl_vat?}` | `{before_taxes, taxes[]}` |
15//! | [`types::Role`] | has `HUB` | `HUB` removed; hubs use `Credentials.hub_party_id` |
16//! | [`credentials::Credentials`] | no `hub_party_id` | `hub_party_id` added |
17//! | [`tariffs::Tariff`] | `min/max_price: Price` | `PriceLimit`, plus `tax_included`, `preauthorize_amount` |
18//! | [`locations::Location`] | — | `parking_places`, `help_phone` added |
19//! | [`locations::Evse`] | — | `parking`, `accepted_service_providers` added |
20//! | [`locations::Connector`] | — | `capabilities` added |
21//! | [`locations::ConnectorType`] | closed enum | `OpenEnum`, plus `MCS`, `SAE_J3400` |
22//! | [`locations::ParkingRestriction`] | 5 values | `OpenEnum`, plus `EMPLOYEES`, `TAXIS`, `TENANTS` |
23//! | [`tokens::TokenType`] | closed enum | `OpenEnum`, plus `EMAID` |
24//! | *payments* | absent | new module |
25//!
26//! # Closed enums, decoded leniently
27//!
28//! OCPI 2.2.1 has **no** `OpenEnum`: by the letter of the specification an unrecognised
29//! `ConnectorType` is a decode error. This crate keeps the value anyway — losing a page of
30//! Locations over one unfamiliar plug is worse than the alternative, and OCPI 2.3.0
31//! reclassified exactly these enums as open for the same reason — and reports it through
32//! [`Validate`](crate::types::Validate). See
33//! [`ocpi_lenient_enum!`](crate::ocpi_lenient_enum).
34//!
35//! Spec: <https://github.com/ocpi/ocpi>, `release-2.2.1-bugfixes`
36
37pub mod cdrs;
38pub mod commands;
39pub mod credentials;
40pub mod hub_client_info;
41pub mod locations;
42pub mod sessions;
43pub mod tariffs;
44pub mod tokens;
45pub mod types;
46
47/// The *Charging Profiles* module of OCPI 2.2.1.
48///
49/// Wire-identical to [`v2_3_0::charging_profiles`](crate::v2_3_0::charging_profiles).
50///
51/// Spec: 2.2.1 §mod_charging_profiles_module
52pub mod charging_profiles {
53 pub use crate::v2_3_0::charging_profiles::*;
54}
55
56/// The *Versions* module of OCPI 2.2.1.
57///
58/// Wire-identical to [`v2_3_0::versions`](crate::v2_3_0::versions). The `ModuleId` and
59/// `VersionNumber` enums are version-neutral by design, so discovery against a 2.2.1 peer that
60/// advertises a 2.3.0 module still works.
61///
62/// Spec: 2.2.1 §versions_module
63pub mod versions {
64 pub use crate::v2_3_0::versions::*;
65}
66
67pub use cdrs::Cdr;
68pub use credentials::Credentials;
69pub use locations::{Connector, Evse, Location};
70pub use sessions::Session;
71pub use tariffs::Tariff;
72pub use tokens::Token;
73pub use types::{Price, Role};
74pub use versions::{Endpoint, Version, VersionDetails};
75
76/// The version number this module implements.
77pub const VERSION: crate::VersionNumber = crate::VersionNumber::V2_2_1;