ocpp/v2_0_1/datatype/unit_of_measure
OCPP 2.0.1 UnitOfMeasure data type (schema UnitOfMeasureType).
to_json/decoder map to/from its OCPP-J JSON object; new (when
present) builds a value from the required fields only.
Types
Represents a UnitOfMeasure with a multiplier
| Field | Type | Req | Description |
|---|---|---|---|
custom_data | CustomData | — | |
multiplier | Int | — | Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0. |
unit | String | — | Unit of the value. Default = “Wh” if the (default) measurand is an “Energy” type. This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices. If an applicable unit is available in that list, otherwise a “custom” unit might be used. (max 20 chars) |
Schema: UnitOfMeasureType
pub type UnitOfMeasure {
UnitOfMeasure(
custom_data: option.Option(custom_data.CustomData),
multiplier: option.Option(Int),
unit: option.Option(String),
)
}
Constructors
-
UnitOfMeasure( custom_data: option.Option(custom_data.CustomData), multiplier: option.Option(Int), unit: option.Option(String), )
Values
pub fn decoder() -> decode.Decoder(UnitOfMeasure)
Decode a UnitOfMeasure from its OCPP-J JSON object, enforcing schema constraints.
pub fn new() -> UnitOfMeasure
Construct a UnitOfMeasure from its required fields, with every optional field set to None.
pub fn to_json(value: UnitOfMeasure) -> json.Json
Encode a UnitOfMeasure to its OCPP-J JSON object.