/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Endpoint } from "#endpoint/Endpoint.js"; import { AsyncObservable, Bytes, EventEmitter, Mutex, Observable } from "@matter/general"; import { DatatypeModel } from "@matter/model"; import { BleAdvertiser, ExposedFabricInformation, MdnsAdvertiser, Val } from "@matter/protocol"; import { CommissioningFlowType, FabricIndex } from "@matter/types"; import { Behavior } from "../../Behavior.js"; import { ActionContext } from "../../context/ActionContext.js"; /** * Server behavior related to commissioning. * * Updates node state based on commissioning status. */ export declare class CommissioningServer extends Behavior { #private; static readonly id = "commissioning"; readonly state: CommissioningServer.State; readonly events: CommissioningServer.Events; internal: CommissioningServer.Internal; static early: boolean; initialize(): void; [Symbol.asyncDispose](): Promise; handleFabricChange(fabricIndex: FabricIndex, fabricAction: CommissioningServer.FabricAction): void; /** * An uncommissioned node is not yet associated with fabrics. It cannot be used until commissioned by a controller. * * The server normally invokes this method when the node starts and is not yet commissioned. You can disable by * setting {@link CommissioningServer.State#enabled} to false. Then you must invoke yourself. */ enterCommissionableMode(): Promise; /** * The server invokes this method when the node starts and is already commissioned, or immediately after * commissioning. */ protected enterOperationalMode(): void; /** * Display instructions on commissioning the device. * * The default implementation logs the QR code and credentials. */ protected initiateCommissioning(): void; /** * Define logical schema to make passcode and discriminator persistent. */ static readonly schema: DatatypeModel; } export declare namespace CommissioningServer { interface PairingCodes { manualPairingCode: string; qrPairingCode: string; } class Internal { unregisterFailsafeListener?: () => void; /** * We use this to synchronize internal state transitions that would otherwise have race conditions due to the * large number of asynchronous calls. */ mutex: Mutex; /** * Passed to the mutex for error handling purposes */ name: string; } class State { enabled?: boolean; commissioned: boolean; fabrics: Record; passcode: number; discriminator: number; flowType: CommissioningFlowType; additionalBleAdvertisementData?: Bytes; pairingCodes: PairingCodes; mdns?: MdnsAdvertiser.Options; ble?: BleAdvertiser.Options; [Val.properties](endpoint: Endpoint): { readonly pairingCodes: { manualPairingCode: string; qrPairingCode: string; }; readonly fabrics: Record; }; } class Events extends EventEmitter { commissioned: Observable<[context: ActionContext], void>; decommissioned: Observable<[context: ActionContext], void>; fabricsChanged: Observable<[fabricIndex: FabricIndex, action: FabricAction], void>; enabled$Changed: AsyncObservable<[context: ActionContext], void>; } type FabricAction = "added" | "deleted" | "updated"; } //# sourceMappingURL=CommissioningServer.d.ts.map