/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { ActionContext } from "#behavior/context/ActionContext.js"; import type { ClientNode } from "#node/ClientNode.js"; import { ClientBdxRequest, ClientBdxResponse, ClientInvoke, ClientProbeOptions, ClientRead, ClientSubscribe, ClientSubscription, ClientSubscriptions, ClientWrite, DecodedInvokeResult, Interactable, ReadResult, Val, WriteResult } from "@matter/protocol"; import { EndpointNumber, EventNumber } from "@matter/types"; /** * A {@link ClientInteraction} that brings the node online before attempting interaction. */ export declare class ClientNodeInteraction implements Interactable { #private; constructor(node: ClientNode); close(): Promise; /** * Read chosen attributes remotely from the node. Known data versions are automatically injected into the request to * optimize the read when the fabric filter matches the node's cache, except for clusters with a changes-omitted * attribute, which the subscription does not keep current. Set `includeKnownVersions` in the request to skip * version injection and always receive a full response from the server. * * Events are returned in the result only, unless `emitEvents` is set, as the node's default subscription does. */ read(request: ClientRead & ClientNodeInteraction.Options, context?: ActionContext): ReadResult; /** * Subscribe to remote events and attributes as defined by {@link request}. * * By default, matter.js subscribes to all attributes and events of the peer and updates {@link ClientNode} state * automatically. So you normally do not need to subscribe manually. * * When providing the "sustain" flag, a SustainedSubscription is returned immediately. You need to use the events to * know when/if a subscription could be established. This class handles reconnections automatically. * When not providing the "sustain" flag, a PeerSubscription is returned after a subscription have been successfully * established; or an error is returned if this was not possible. * * Known data versions are injected as for {@link read} unless `includeKnownVersions` is set: into the initial * request, which a sustained subscription with `bootstrapWithRead` first sends as a read, and, for a sustained * subscription, into every later request it sends — each retry, each replacement of a lost subscription and each * recreate after an ICD operating mode change. Unlike a read, a subscription keeps the filters of clusters with a * changes-omitted attribute, so these requests do not transfer those clusters again each time. Events are returned in * the result only, unless `emitEvents` is set, as the node's default subscription does. */ subscribe(request: ClientSubscribe & ClientNodeInteraction.Options, context?: ActionContext): Promise; /** * Write chosen attributes remotely to the node. * The returned attribute write status information is returned. */ write(request: T, context?: ActionContext): WriteResult; /** * Invoke a command remotely on the node. * The returned command response is returned as response chunks (attr-status). * * When the number of commands exceeds the peer's MaxPathsPerInvoke limit (or 1 for older nodes), * commands are split across multiple parallel exchanges automatically by ClientInteraction. * * Single commands may be automatically batched with other commands for the same network invoked in the same * timer tick. A command with per-request options, such as an expected processing time, is sent on its own and * may reach the peer before batched commands invoked earlier. */ invoke(request: ClientInvoke, context?: ActionContext): DecodedInvokeResult; /** * Initiate a BDX Message Exchange with the node. * * The provided function is called with the established context to perform BDX operations. * * Request options may be omitted to use defaults. */ initBdx(request?: ClientBdxRequest, context?: ActionContext): Promise; probe(options?: ClientProbeOptions): Promise; get subscriptions(): ClientSubscriptions; /** * Temporary accessor of cached data, if any are stored. This will be implemented by the ClientNodeInteraction and * point to the node state of the relevant endpoint and is needed to support the old API behavior for * AttributeClient. * * @deprecated Scheduled for removal in 0.19 with the legacy controller API. */ localStateFor(endpointId: EndpointNumber): Record | undefined> | undefined; } export declare namespace ClientNodeInteraction { /** * Options of {@link ClientNodeInteraction.read} and {@link ClientNodeInteraction.subscribe}. * * @internal */ interface Options { /** * Emit the events this interaction receives to the node's event observers and its change notifications while * this is true or returns true. Set by the node's default subscription and the read that initializes a * newly-commissioned node, so other reads and subscriptions do not deliver an event to those observers a * second time, and by the legacy controller API, whose listeners are fed from the change notifications. */ emitEvents?: boolean | (() => boolean); /** * Called with the number of each event this interaction emits to the node's event observers, before the * observers run. */ eventEmitted?: (number: EventNumber) => void; } } //# sourceMappingURL=ClientNodeInteraction.d.ts.map