ocpp
OCPP — Open Charge Point Protocol message models for Gleam.
Supports OCPP 1.6, 2.0.1 and 2.1 over the JSON/WebSocket (OCPP-J) transport.
Each version namespaces one module per spec entity, mirroring how the spec is organised:
ocpp/v2_1/message/<action>— the action’sRequest/Responsepayload types with their OCPP-J codecs (boot_notification.Request,boot_notification.response_decoder()).ocpp/v2_1/datatype/<type>— one shared datatype with barenew/to_json/decoder(composite_schedule.new(...)).ocpp/v2_1/enum/<enum>— one enumeration with bare constructors (authorization_status.Accepted) and its token codecs.ocpp/v2_1/dispatch— the action-string ↔ typed-payload mapping.
One module per entity is deliberate, not fragmentation: many OCPP
enums share member names (Accepted, Rejected, Failed, …), and
two types in one Gleam module cannot both define an Accepted
constructor. Consolidating would force prefixed variants like
RegistrationStatusAccepted; per-entity modules are the only layout
that gives bare, collision-free names that mirror the spec.
The OCPP-J wire framing lives in ocpp/transport/json/frame. Payload
types are transport-agnostic: a future SOAP transport can reuse them
behind parallel codecs without touching the type layer.
The sans-IO protocol layer — the OCPP-J RPC endpoint machine, the
charging-station and CSMS role machines, and their per-version
bindings — lives under ocpp/protocol. It is pure (no processes,
sockets, or clocks); see that module’s docs for the machine shape.
Types
The OCPP protocol versions modelled by this library. Gleam forbids
underscores in variant names, so the variants compress the dots; the
v1_6/v2_0_1/v2_1 constants below mirror the version namespaces
exactly for construction sites (patterns still use the variants).
pub type Version {
V16
V201
V21
}
Constructors
-
V16 -
V201 -
V21