Skip to main content

Module schema

Module schema 

Source
Expand description

Generated protobuf schema types (spec §27), compiled by build.rs from the vendored proto/moddef/v1/*.proto via protox + prost-build. Under std, pbjson-generated serde impls give protojson-semantics JSON (and, via document, YAML) for every message.

Maps use BTreeMap (btree_map=.), which keeps the types alloc-only and binary encoding deterministic — conformance tests compare byte-for-byte with Go-produced .moddef goldens.

Modules§

value_type
Nested message and enum types in ValueType.

Structs§

ArrayType
§8.1 / §14.1 ARRAY logical type. Either a fixed length or a runtime count_ref (a register holding the live element count).
Availability
§17.1 Conditional point/block presence.
BitField
§13 Named bit field within a register (boolean / small enum). value_type may reference an enum. This is the legacy/simple form; see RegisterField (§13.1).
Clamp
ComposedMapping
§14 Mantissa/exponent composed value: value = mantissa * base^exponent. base MUST NOT be zero (MDE406).
DateTimeSpec
§8.5 Date/time value encoding spec.
DeviceProfile
§16 A device model, family, or reusable abstract device.
DeviceVariant
§18 Firmware/hardware/regional/option variant of a base profile.
Discovery
EnumRef
EnumType
§12 Enum type definition (reusable, referenced by points/fields).
EnumValue
FlagSet
§13.2 Set of independently-true boolean flags (bit index -> flag name).
Import
§19 Import of an external ModDef document or package.
Mapping
§9, §14, §14.1 Physical location and encoding of a point’s raw data.
MeasurandAlias
§24 Maps an external naming system (e.g. OCPP) to a measurand tuple.
MeasurandDefinition
§9.2 / §22 A named measurand definition (typically from a stdlib package).
MeasurandRef
§22 / §25 Reference to a measurand from a point. Either resolve measurand_id or supply an inline semantic tuple (or both, with the tuple as override).
ModDefDocument
§6 A complete ModDef document.
NaValue
§8.4 Unavailable / sentinel value (post-decode, pre-scale raw pattern).
Point
§5.3 A user-visible data point exposed by a device.
PointOverride
PointRef
Reference to another point within the same device profile.
Rational
§10.1 Rational scale/offset. denominator MUST NOT be zero (MDE405). Zero is {0, 1}. See spec/adr/0003.
RegisterBlock
§17 A group of related points over a contiguous (or discovered) range.
RegisterField
§13.1 Typed sub-field over a register window (its own type/scale/unit).
ScaleRef
§10.4 Register-referenced (dynamic) scaling.
SelectorCase
SelectorRef
§10.5 Value/scale/unit selected by another register.
StringEncoding
§15 String encoding details. Register length comes from Mapping.length_words.
StructField
StructRef
StructType
§8.1 STRUCT logical type definition.
Transform
§10.2 Value transform pipeline: value = raw * scale + offset, then clamp. Exactly one of scale and scale_ref may be set.
ValueType
§8 Logical value type. JSON/YAML: tagged object keyed by the oneof field name, e.g. {primitive: DECIMAL} or {enum_ref: {type_id: “…”}}. See ADR-0001.
WriteConstraints
WriteEncoding
§11.5 Distinct write-side encoding.
WriteSemantics
§11.2/§11.3/§11.4 Write semantics for writable / command points.

Enums§

AccessMode
§11.1 Access modes.
Accumulation
§22.6 Accumulation kind.
AddressSpace
§7 Address spaces. 0-based offsets within each space.
Aggregation
§22.4 Aggregation across phases / time.
ByteOrder
§9.1 Byte order within a 16-bit word. Default when omitted: BIG_ENDIAN (spec/adr/0004).
Charset
§15 String charset / padding / termination.
ComposedKind
§14 Kind of composed (multi-register) value.
DateTimeEncoding
§8.5 Date/time value encoding.
Direction
§22.2 Flow direction for directional quantities.
DiscoveryKind
§7.3 Dynamic / discovered addressing for a register block.
MeasurementLocation
§22.5 Where the measurement is taken.
Padding
PhaseRef
§22.3 Phase / reference. Wire form mirrors OCPP (L1-N, L1-L2, …).
PrimitiveType
§8.1 Logical/primitive types exposed to clients.
ScaleMode
§10.4 Mode for register-referenced (dynamic) scaling.
StorageType
§8.2 Physical storage types.
Termination
Transport
§16 Supported Modbus transports for a device profile.
WordOrder
§9.2 Word order for multi-word values. Default when omitted: WORD_BIG_ENDIAN.
WriteBehavior
§11.3 Write behavior for writable / command points.