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:

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

Values

pub const v1_6: Version

OCPP 1.6 (ocpp/v1_6).

pub const v2_0_1: Version

OCPP 2.0.1 (ocpp/v2_0_1).

pub const v2_1: Version

OCPP 2.1 (ocpp/v2_1).

Search Document