/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { AsyncObservable, AsyncObservableValue, Duration, Timestamp } from "@matter/general"; import { IcdPeerSchedule } from "./IcdPeerSchedule.js"; /** * Per-peer wakefulness for a LIT (Long Idle Time) ICD peer, for the peer's lifetime on a fabric. * * Tracks two boolean signals so a controller knows when it may send and whether a peer is still reachable: * * - {@link awake} — send-now: the peer is in its estimated Active Mode. Any message from the peer wakes it like a * Check-In does, for `activeModeThreshold`. * - {@link available} — not-offline. While the controller holds a subscription to the peer, the subscription's own * liveness decides and the peer counts as available. Otherwise the peer's next Check-In is due after its Active * Mode plus `idleModeDuration`; when that passes, {@link checkInMissed} emits. * * {@link IcdPeerSchedule} derives both deadlines; this class holds the timers and observables. `awake` implies * `available`. A LIT peer without observed activity starts asleep and unavailable. A peer that does not require * awaiting (`requiresAwait === false`: not LIT) is always awake and available with no timers. */ export declare class IcdPeerWakefulness { #private; /** Emits when send-now state changes. `.value` reads the current boolean. */ get awake(): AsyncObservableValue<[any, ...any[]]>; /** Wait until the peer is awake, at most `timeout` and until `abort` aborts. Returns what ended the wait. */ awaitAwake(timeout: Duration, abort?: AbortSignal): Promise<"awake" | "timeout" | "aborted">; /** Emits when reachability state changes. `.value` reads the current boolean. */ get available(): AsyncObservableValue<[any, ...any[]]>; /** * Emits the new {@link requiresAwait} value when the peer's operating mode flips (SIT⇄LIT) at runtime. A sustained * subscription recreates itself on this edge so the underlying Matter subscription is renegotiated for the new mode * rather than carried over. {@link suspend} and {@link resume} do not emit it. */ get operatingModeChanged(): AsyncObservableValue<[any, ...any[]]>; /** * Emits when the next Check-In of a peer the controller is awaiting becomes overdue — never while subscribed, on a * mode flip, on resume, or on teardown. */ get checkInMissed(): AsyncObservable<[], void>; /** * Deadline of the peer's next Check-In, on the {@link Time.nowUs} clock. Undefined when the peer needs no * awaiting, while the controller holds a subscription to it (the peer then sends reports instead), before any * activity, and once the deadline has passed. */ get nextCheckInDue(): Timestamp | undefined; /** * How long the controller waits by default for the peer to wake: until {@link nextCheckInDue}, but at least the * longest the peer may idle. */ get nextCheckInWithin(): Duration; get requiresAwait(): boolean; set requiresAwait(value: boolean); /** Replace the peer's timings. */ setTimings(timings: IcdPeerSchedule.Timings): void; /** The peer sent a Check-In, entering Active Mode, with its current `activeModeThreshold`. */ noteCheckIn(activeModeThreshold?: Duration): void; /** The peer is active: a message from it arrived, or it answered the controller. */ noteActive(): void; /** The peer promised to stay active for `promised`. */ noteStayActive(promised: Duration): void; /** * Register a subscription the controller holds to the peer. While any is held, the peer reports instead of * sending Check-Ins, so the subscription's own liveness decides availability. */ holdSubscription(): Disposable; /** * Stop awaiting the peer, for example while it is not registered: timers stop and consumers parked on the * awake/available edge are released. The observed activity is kept for {@link resume}. */ suspend(): void; /** Await the peer again after {@link suspend}. */ resume(): void; /** Suspend for good; later calls cannot arm timers again. */ close(): void; [Symbol.dispose](): void; } //# sourceMappingURL=IcdPeerWakefulness.d.ts.map