/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ClientBdxRequest, ClientBdxResponse } from "#action/client/ClientBdx.js"; import { ClientRead } from "#action/client/ClientRead.js"; import { Interactable, InteractionSession } from "#action/Interactable.js"; import { ClientInvoke } from "#action/request/Invoke.js"; import { DecodedInvokeResult } from "#action/response/InvokeResult.js"; import { ReadResult } from "#action/response/ReadResult.js"; import { WriteResult } from "#action/response/WriteResult.js"; import { BdxMessenger } from "#bdx/BdxMessenger.js"; import { InteractionClientMessenger } from "#interaction/InteractionMessenger.js"; import { PeerAddress } from "#peer/PeerAddress.js"; import { ExchangeProvider } from "#protocol/ExchangeProvider.js"; import { Abort, ChannelType, Duration, Environment, RetrySchedule, ServerAddressUdp } from "@matter/general"; import { ClientWrite } from "./ClientWrite.js"; import { ClientSubscribe } from "./subscription/ClientSubscribe.js"; import { ClientSubscriptions } from "./subscription/ClientSubscriptions.js"; import { PeerSubscription } from "./subscription/PeerSubscription.js"; import { SustainedSubscription } from "./subscription/SustainedSubscription.js"; /** Higher processing time to give devices a bit more time to send updates. */ export declare const SUBSCRIPTION_PROCESSING_TIME: Duration; /** * Probe commands in a {@link ClientInvoke} for the Matter "Large Message Quality" ("L") flag. * * Legacy command requests carry no model reference, so callers using {@link Invoke.LegacyCommandRequest} * must continue to set the request's `largeMessage` explicitly. * * @internal — exported for unit testing. */ export declare function inferLargeMessage(request: ClientInvoke): boolean; export type SubscriptionResult = Promise; export interface ClientInteractionContext { environment: Environment; abort?: Abort.Signal; sustainRetries?: RetrySchedule.Configuration; exchangeProvider?: ExchangeProvider; address?: PeerAddress; network?: string; } export declare const DEFAULT_MIN_INTERVAL_FLOOR: Duration; /** * Defines the upper limit for the publisher-selected maximum interval for any subscription. * ◦ If the publisher is an ICD, this SHALL be set to the Idle Mode Duration or 60 minutes, whichever is greater. * ◦ Otherwise, this SHALL be set to 60 minutes. * So for a absolute maximum if nothing was provided we use the 60 minutes */ export declare const SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT: Duration; /** * Client-side implementation of the Matter protocol. */ export declare class ClientInteraction implements Interactable { #private; constructor({ environment, abort, sustainRetries, exchangeProvider, address, network }: ClientInteractionContext); close(reason?: Error): Promise; [Symbol.asyncDispose](): Promise; get subscriptions(): ClientSubscriptions; /** * Read attributes and events. */ read(request: ClientRead, session?: SessionT, extraAbort?: AbortSignal): ReadResult; /** * Probe the peer with an empty read to verify session liveness. * * Optionally sends to a different address than the session's current one via {@link addressOverride}, * without affecting other exchanges on the session. * * @returns true if the probe succeeded, false otherwise */ probe(options?: ClientProbeOptions): Promise; /** * Write to node attributes. */ write(request: T, session?: SessionT): WriteResult; /** * Invoke one or more commands. * * When the number of commands exceeds the peer's MaxPathsPerInvoke limit (or 1 for older nodes), * commands are split across multiple parallel exchanges automatically. * * Single commands are automatically batched with other commands invoked in the same timer tick * when the device supports multiple invokes per exchange and the target is not endpoint 0. A command that sets * per-request options (such as an expected processing time, an address override or timed/suppressResponse * flags) is sent on its own so it keeps them, and batches are formed and sent per network. A command sent on * its own goes out at once while batched commands wait for the batch timer, and batches of different networks * do not wait for each other, so the order on the wire can differ from the call order. */ invoke(request: ClientInvoke, session?: SessionT): DecodedInvokeResult; /** * Subscribe to attribute values and events. */ subscribe(request: T, session?: SessionT): SubscriptionResult; initBdx(request: ClientBdxRequest, session?: SessionT): Promise; get channelType(): ChannelType; /** Dedicated secure session backing this interaction, if the provider exposes one. */ get session(): import("../../index.js").SecureSession | undefined; /** Calculates the current maximum response time for a message use in additional logic like timers. */ maximumPeerResponseTime(expectedProcessingTime?: Duration, includeMaximumSendingTime?: boolean): Duration; get address(): PeerAddress; } export interface RequestContext { abort: Abort; messenger: M; [Symbol.asyncDispose](): Promise; } /** * The context of an interaction whose remainder can outlive the caller's scope. */ export interface AbandonableRequestContext extends RequestContext { /** * Hands the rest of the interaction to `task`, which runs in the background. Disposal then waits for the task * instead of the caller's scope, and {@link ClientInteraction.close} waits for it. Caller and session aborts do not * reach the task; only {@link ClientInteraction.close} stops it, through the signal it gets. The task must settle * soon after `closing` fires, or close never returns. * * @throws InternalError when the context was already abandoned or disposed */ abandon(task: (closing: AbortSignal) => Promise): void; } /** * Options for {@link ClientInteraction.probe}. */ export interface ClientProbeOptions { /** Network profile to use for the probe exchange. */ network?: string; /** Override the destination address for the probe without changing the session's channel. */ addressOverride?: ServerAddressUdp; /** Abort signal for the probe. */ abort?: AbortSignal; /** Suppress peer-loss reporting so the session stays alive even if the probe fails. */ suppressPeerLoss?: boolean; /** Cap MRP transmission attempts for this probe (default: MRP.MAX_TRANSMISSIONS). */ maxRetransmissions?: number; } //# sourceMappingURL=ClientInteraction.d.ts.map