/** * @license * Copyright 2025-2026 Open Home Foundation * SPDX-License-Identifier: Apache-2.0 */ import type { WebRtcCallbackData } from "@matter-server/ws-client"; import { AsyncObservable, FabricId, FabricIndex, NodeId, Observable } from "@matter/main"; import { OperationalCredentials } from "@matter/main/clusters"; import { WebRtcTransportProvider } from "@matter/main/clusters/web-rtc-transport-provider"; import { EndpointNumber } from "@matter/main/types"; import { CommissioningController } from "@project-chip/matter.js"; import type { DecodedAttributeReportValue, DecodedEventReportValue } from "@project-chip/matter.js/cluster"; import { NodeStates } from "@project-chip/matter.js/device"; import { AttributeResponseStatus, AttributesData, CommissioningRequest, CommissioningResponse, DiscoveryRequest, DiscoveryResponse, InvokeRequest, MatterNodeData, OpenCommissioningWindowRequest, OpenCommissioningWindowResponse, WriteAttributeRequest } from "../types/CommandHandler.js"; import { AccessControlEntry, AttributeWriteResult, BindingTarget, MatterSoftwareVersion, NodePingResult } from "../types/WebSocketMessageTypes.js"; export declare class ControllerCommandHandler { #private; events: { started: AsyncObservable; attributeChanged: Observable<[nodeId: NodeId, data: DecodedAttributeReportValue], void>; eventChanged: Observable<[nodeId: NodeId, data: DecodedEventReportValue], void>; nodeAdded: Observable<[nodeId: NodeId], void>; nodeStateChanged: Observable<[nodeId: NodeId, state: NodeStates], void>; /** Emitted when node availability changes (for sending node_updated events) */ nodeAvailabilityChanged: Observable<[nodeId: NodeId, available: boolean], void>; nodeStructureChanged: Observable<[nodeId: NodeId], void>; nodeDecommissioned: Observable<[nodeId: NodeId], void>; nodeEndpointAdded: Observable<[nodeId: NodeId, endpointId: EndpointNumber], void>; nodeEndpointRemoved: Observable<[nodeId: NodeId, endpointId: EndpointNumber], void>; webRtcCallback: Observable<[WebRtcCallbackData], void>; }; constructor(controllerInstance: CommissioningController, bleEnabled: boolean, bleProxyEnabled: boolean, otaEnabled: boolean); /** * Format a NodeId as a PeerAddress string for logging. * Uses the controller's fabric index when available, otherwise "?" is used. */ formatNode(nodeId: NodeId): string; get started(): boolean; get bleEnabled(): boolean; get bleProxyEnabled(): boolean; start(): Promise; /** `originatingEndpointId` is server-injected; any client-supplied value in `payload` is overwritten. */ sendWebRtcProviderCommand(args: { nodeId: NodeId; endpointId: EndpointNumber; commandName: "ProvideOffer" | "SolicitOffer"; payload: Record; }): Promise; close(): Promise; /** * Initialize the controller, register all commissioned nodes (populates attribute caches), * and start connecting them to the network. * * Guarded by #connected so it runs exactly once, even if called multiple times * (e.g. when WebServer.start() registers handlers for multiple listen addresses). */ initializeNodes(): Promise; getNodeIds(): NodeId[]; hasNode(nodeId: NodeId): boolean; /** * Whether a node id is already reserved on the fabric, either by a commissioned peer or the commissioner itself. * Authoritative against matter.js rather than the locally tracked node set, which can drift from the fabric. */ isNodeIdInUse(nodeId: NodeId): boolean; /** * Alias for decommissionNode to match NodeCommandHandler interface. */ removeNode(nodeId: NodeId): Promise; interviewNode(nodeId: NodeId): Promise; /** * Get full node details in WebSocket API format. * @param nodeId The node ID * @param lastInterviewDate Optional last interview date (tracked externally) */ getNodeDetails(nodeId: NodeId, lastInterviewDate?: Date): MatterNodeData; /** * Read multiple attributes from a node by path strings. * Supports wildcards in paths. Batches up to 9 paths per read call. */ handleReadAttributes(nodeId: NodeId, attributePaths: string[], fabricFiltered?: boolean): Promise; /** * Set the fabric label. Pass null or empty string to reset to "Home". * Note: matter.js requires non-empty labels (1-32 chars), so null/empty resets to default. */ setFabricLabel(label: string): Promise; handleWriteAttribute(data: WriteAttributeRequest): Promise; handleInvoke(data: InvokeRequest): Promise; commissionNode(data: CommissioningRequest): Promise; getCommissionerNodeId(): NodeId | undefined; getCommissionerFabricData(): Promise<{ fabricId: FabricId; compressedFabricId: bigint; fabricIndex: number; }>; /** Discover commissionable devices */ handleDiscovery({ findBy }: DiscoveryRequest): Promise; getNodeIpAddresses(nodeId: NodeId, preferCache?: boolean): Promise; /** * Ping a node on all its known IP addresses. * @param nodeId The node ID to ping * @param attempts Number of ping attempts per IP (default: 1) * @returns A record of IP addresses to ping success status */ pingNode(nodeId: NodeId, attempts?: number): Promise; decommissionNode(nodeId: NodeId): Promise; openCommissioningWindow(data: OpenCommissioningWindowRequest): Promise; getFabrics(nodeId: NodeId): Promise<{ fabricId: any; vendorId: any; fabricIndex: any; label: any; }[]>; removeFabric(nodeId: NodeId, fabricIndex: FabricIndex): Promise; /** * Set Access Control List entries on a node. * Writes to the ACL attribute on the AccessControl cluster (endpoint 0). */ setAclEntry(nodeId: NodeId, entries: AccessControlEntry[]): Promise; /** * Set bindings on a specific endpoint of a node. * Writes to the Binding attribute on the Binding cluster. */ setNodeBinding(nodeId: NodeId, endpointId: EndpointNumber, bindings: BindingTarget[]): Promise; /** * Check if a software update is available for a node. * First checks the cached updates from OTA events, then queries the DCL if not found. */ checkNodeUpdate(nodeId: NodeId): Promise; /** * Trigger a software update for a node. * @param nodeId The node to update * @param softwareVersion The target software version to update to */ updateNode(nodeId: NodeId, softwareVersion: number): Promise; } //# sourceMappingURL=ControllerCommandHandler.d.ts.map