ocpp/protocol/v2_0_1
OCPP 2.0.1 bindings for the protocol machines.
Thin config constructors that bind the version-generic machines —
ocpp/protocol/endpoint, ocpp/protocol/station and
ocpp/protocol/csms — to the OCPP 2.0.1 message unions and codecs in
ocpp/v2_0_1/dispatch. The machines themselves know nothing about any
OCPP version; everything version-specific enters through the values
built here:
endpoint_configwires the dispatch module’s encoders/decoders into the generic RPC endpoint, soreq/resaredispatch.Request/dispatch.Response.station_configadds the charging-station lifecycle bindings: theBootNotificationrequest to (re)send, how to read the CSMS’s registration decision out of a response, and how to build aHeartbeatrequest.csms_configadds the CSMS-side bindings: recognising an inboundBootNotificationand reading the registration decision out of the application’s reply to one.
The wire carries the boot response’s interval in seconds (per the
2.0.1 spec); the machines measure time in milliseconds, so the readers
here multiply by 1000.
2.0.1-specific semantics
OCPP 2.0.1 predates the SEND and CALLRESULTERROR frames — its RPC
framework has only CALL, CALLRESULT and CALLERROR. The generic machines
still accept SendRequested (they are version-agnostic and cannot
forbid it), so not using it is caller policy: an application bound to
2.0.1 through this module MUST NOT issue SendRequested, and a
compliant 2.0.1 peer will never put a SEND or CALLRESULTERROR frame on
the wire. Payload-wise, 2.0.1 messages do carry the CustomData
extension point; the request/response records in ocpp/v2_0_1 expose
it as an Option.
Values
pub fn csms_config(
call_timeout_ms call_timeout_ms: Int,
enforcement enforcement: csms.RegistrationEnforcement,
) -> csms.CsmsConfig(dispatch.Request, dispatch.Response)
A csms.CsmsConfig speaking OCPP
2.0.1: inbound BootNotification CALLs are the boot requests, and the
registration decision is the status of the application’s
BootNotification response. With enforcement: csms.RejectUnregistered,
non-boot CALLs from a station whose boot has not been accepted are
answered with a CALLERROR SecurityError instead of being delivered.
pub fn endpoint_config(
call_timeout_ms call_timeout_ms: Int,
) -> endpoint.Config(dispatch.Request, dispatch.Response)
An endpoint.Config speaking OCPP
2.0.1: requests and responses are the ocpp/v2_0_1/dispatch unions, with
that module’s codecs doing the action mapping. call_timeout_ms is how
long an outgoing CALL may remain unanswered before it fails with
TimedOut.
pub fn station_config(
call_timeout_ms call_timeout_ms: Int,
boot_request boot_request: boot_notification.Request,
boot_retry_ms boot_retry_ms: Int,
) -> station.StationConfig(dispatch.Request, dispatch.Response)
A station.StationConfig
speaking OCPP 2.0.1. boot_request is the BootNotification payload the
station introduces itself with (resent verbatim on every retry);
heartbeats are bare Heartbeat requests. boot_retry_ms is the fallback
wait before re-booting when the CSMS supplies no usable interval — see
the station module for the full rules.