cremalink.ecam.session module

The ECAM write-gate session.

Display-verified on Soul LAN: 0x90/0xA9 writes only commit when a session has been announced by writing the machine’s device_connected property to the current unix timestamp (same properties payload mechanism as data_request). The session lives ~300 s; writes past ~240 s are re-announced. Without the announce, writes stage transiently (0xF0) or are ignored (0x0F).

On striker machines the session instead uses the 0xE8 handshake plus the 84 0f 03 02 app-id registration, after which the registered 4-byte app id rides as the transport trailer.

cremalink.ecam.session.DEFAULT_REFRESH_SECONDS = 240

Refresh well inside the ~300 s observed TTL (the app uses 240 s).

class cremalink.ecam.session.SessionGate(profile: ~cremalink.ecam.machine_profiles.MachineProfile, announce: ~collections.abc.Callable[[], ~typing.Any], *, refresh_seconds: int = 240, clock: ~collections.abc.Callable[[], float] = <built-in function time>)[source]

Bases: object

Tracks session freshness and performs announces on demand.

Constructed per device/transport — per-entry state only. announce is the profile-appropriate way to (re)open the session:

  • non-striker: write_property(connected_property, unix_ts)

  • striker: the 0xE8 handshake + 84 0f 03 02 registration callback (run once), returning the registered app-id bytes.

announced_at

unix time of the last successful announce (0 = never).

ensure_fresh(now: float | None = None) → bool[source]

Announce the session when stale. Returns True iff an announce ran.

invalidate() → None[source]

Force the next gated write to re-announce (e.g. after an ack indicated the write was ignored).

is_fresh(now: float | None = None) → bool[source]

Whether the current session is still inside the refresh window.

property uses_timestamp_announce: bool

Non-striker machines announce via the device_connected ts.