Skip to main content

Module standard

Module standard 

Source
Expand description

Value sets the specification defines for fields its JSON schemas type as bare strings.

A field like Variable.name or SecurityEventNotification.type is just {"type": "string", "maxLength": N} in the schema, with the permitted values listed in a specification appendix instead. Those appendix tables are vendored under csv/ and generated into this module.

Nothing here changes a wire type. OCPP permits vendor-specific values for these fields, so the message structs keep their heapless::String fields and these enums sit alongside:

§Open and closed value sets

The sets a deployment realistically extends – components, variables, configuration keys – are open: they carry an Other variant, so a third-party value survives a deserialize/serialize round trip. Use from_wire_or_other to accept any value, from_wire to ask whether a value is one the specification defines, and is_standardized to tell them apart afterwards. Their equality and hashing compare the wire string, so Other("X") and the X variant are one value.

The rest are closed: one byte, Copy, and from_wire returning None is the only outcome for an unrecognized value. An open set is neither Copy nor one byte – it is as wide as the field’s maxLength – which is why it is opt-in per set.

use ocpp_types::v21::common::Variable;
use ocpp_types::v21::standard::VariableName;

let variable = Variable {
    name: heapless::String::try_from(VariableName::HeartbeatInterval.as_str()).unwrap(),
    custom_data: None,
    instance: None,
};

Structs§

DeviceModelEntry
One (component, variable) pair of the standardized device model.
UnknownValue
Returned by FromStr for a value the specification doesn’t define.
ValueTooLong
Returned when a value is longer than the specification’s maxLength for its field.

Enums§

AdditionalInfoType
Standardized AdditionalInfo.type values.
ChargingLimitSource
Standardized chargingLimitSource values.
ComponentName
Standardized Component.name values.
ConnectorType
Standardized Connector component ConnectorType values.
IdTokenType
Standardized IdToken.type values.
PaymentBrand
Standardized paymentBrand values, for the ad hoc payment flow.
PaymentRecognition
Standardized paymentRecognition values, for the ad hoc payment flow.
ReasonCode
Standardized StatusInfo.reasonCode values.
SecurityEvent
Standardized SecurityEventNotificationRequest.type values.
SigningMethod
Standardized signingMethod values, for ISO 15118 price schedule signatures.
Unit
Standardized UnitOfMeasure.unit values.
VariableName
Standardized Variable.name values.

Constants§

DEVICE_MODEL
Every (component, variable) pair the standardized device model defines (438).