/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ActionContext } from "#behavior/context/ActionContext.js"; import { Duration, MaybePromise, Observable, Timer } from "@matter/general"; import { Switch } from "@matter/types/clusters/switch"; declare const SwitchServerBase: import("../../index.js").ClusterBehavior.Type, import("@matter/types").ClusterType.Concrete, new () => {}, "switch">; /** * This is the default server implementation of {@link SwitchBehavior}. * * This implementation includes all features of {@link Switch.Cluster} and implements all mandatory commands. * You should use {@link SwitchServer.with} to specialize the class for the features your implementation * supports. * * To support all features and events the implementation adds some custom state attributes that can - or are required * to - be used. These are: * * `rawPosition` - The raw position of the switch. This is the position as reported by the device and is not yet * debounced. If the position is already debounced, just set the `currentPosition` attribute. The debouncing uses the * `debounceDelay` attribute value as timeframe in milliseconds and sets the `currentPosition` attribute when the value * is stable for this timeframe. * * `debounceDelay` - The timeframe in milliseconds to wait until a newly reported position is considered stable. * * `longPressDelay` - The timeframe in milliseconds to wait until a position is considered "long" pressed. This * attribute is REQUIRED if the device supports the Momentary Switch LongPress (MSL) feature. * * `multiPressDelay` - The timeframe in milliseconds starting with a stable release to detect multi-presses. This * attribute is REQUIRED if the device supports the Momentary Switch MultiPress (MSM) feature. * * `momentaryNeutralPosition` - The number of the position considered as the neutral position for the momentary switch. * This defaults to position 0 but can be changed by settings this attribute. it is available as soon as the Momentary * Switch (MS) feature is used. */ export declare class SwitchBaseServer extends SwitchServerBase { #private; protected internal: SwitchBaseServer.Internal; readonly state: SwitchBaseServer.State; readonly events: SwitchBaseServer.Events; static readonly schema: import("@matter/model").ClusterModel; initialize(): MaybePromise; /** Method to reset the state of the Switch to start a clean new cycle. Mainly relevant for automated testing. */ resetState(): void; [Symbol.asyncDispose](): Promise; } export declare namespace SwitchBaseServer { class Internal { /** Timer to debounce the raw position. */ debounceTimer?: Timer; /** Timer to detect a long press. */ longPressTimer?: Timer; /** Timer to detect multi presses. */ multiPressTimer?: Timer; /** Counter to count the number of presses. */ currentNumberOfPressesCounter: number; /** Indicator if the multi press sequence was aborted. */ multiPressReportingAborted: boolean; /** Position previously reported in events. */ previouslyReportedPosition: number; /** Position of the previous multi press. */ previousMultiPressPosition: number | null; /** Position of the current long press. */ currentLongPressPosition: number | null; /** Flag to indicate if the current press is a long press. */ currentIsLongPress: boolean; /** Position of the current unstable position which is debounced */ currentUnstablePosition: number; } class State extends SwitchServerBase.State { /** Raw position of the switch. Set this to debounce the value. */ rawPosition: number; /** * Debounce Delay to wait until a newly reported raw position is considered stable and written to the * currentPosition attribute. */ debounceDelay?: Duration; /** Time to wait until a value is considered "long" pressed */ longPressDelay: Duration; /** Timeframe starting with a stable release to detect multi-presses. */ multiPressDelay: Duration; /** Number of the position considered as the neutral position for the momentary switch. */ momentaryNeutralPosition: number; numberOfPositions: number; multiPressMax: number; } /** Enhance the relevant events for rawPosition attribute. */ class Events extends SwitchServerBase.Events { rawPosition$Changed: Observable<[value: number, oldValue: number, context?: ActionContext | undefined], void>; rawPosition$Changing: Observable<[value: number, oldValue: number, context?: ActionContext | undefined], void>; } } declare const SwitchServer_base: import("../../index.js").ClusterBehavior.Type & { readonly id: "switch"; }; export declare class SwitchServer extends SwitchServer_base { } export {}; //# sourceMappingURL=SwitchServer.d.ts.map