Expand description
Integrate CLS.EEDI controls and metering with an authenticated EEBUS peer.
Use meter_snapshot to project complete MGCP or MPC reads. Use
crate::metering::controllable_total_power to combine signed watt readings
from the provisioned fleet. LimitAdapter handles LPC and LPP writes.
Establish the binding and drain earlier session events. Read the complete limit
descriptions and current limit list. The host correlates each incoming reply
by peer endpoints and read counter, leaving both reply events on the guard
engine for LimitAdapter::new. Forward the prepared datagram promptly. The SPINE time
period starts at equipment receipt. Retain unrelated incoming traffic for the
application and deliver only this session’s responses here. After receiving
completion, reclaim the engine with into_engine and process buffered traffic
(including discovery and binding changes) before constructing the next adapter.
use cls_eedi::eebus::{AdapterError, LimitAdapter};
use cls_eedi::engine::Clock;
use eebus::model::Datagram;
fn exchange(adapter: &mut LimitAdapter<'_>, id: &str, now: Clock,
transport: impl FnOnce(Datagram) -> Datagram) -> Result<(), AdapterError> {
adapter.dispatch(id, now)?;
let packet = adapter.poll_transmit().expect("dispatched write");
let response = transport(packet);
let completion = adapter.handle_datagram(&response, now)?;
// Persist completed state before publishing completion.acknowledgement.
assert!(completion.is_some());
Ok(())
}Structs§
- Completion
- A verified result and the corresponding local protocol transition.
- Limit
Adapter - Exclusively owns the guard engine while a limit may be retried by that engine. Drop on timeout or disconnect. This discards queued frames and retransmission timers. The local journal retains the consumed dispatch for reconciliation.
Enums§
- Adapter
Error - Reason a write or a session handoff could not proceed.
- Meter
Error - Inconsistent configuration or metadata. No partial meter is returned on error.
- Meter
Profile - The use case provisioned on this peer. An MPC meter represents a CLS.EEDI controllable source directly only when it covers the entire configured fleet.
Constants§
- MAX_
METER_ LIST_ ROWS - Maximum rows in each measurement, parameter or value list accepted by the adapter.
Functions§
- confirm_
pairing - Record a completed SHIP pairing using identity from the open connection.
- meter_
snapshot - Project complete SPINE snapshots for one electrical boundary into a fresh meter.