import { KnxReading, KnxDatapointLink, RequiredKnxLinkOptions, ReadTimeoutStats } from '../../knx-common'; import { KnxCemiFrame } from '../../knx-common'; import { DPT } from '../../enums'; import EventEmitter from 'events'; interface IDPT { readonly type: DPT; readonly unit: string; read(): Promise>; requestValue(): Promise; addWriteListener(cb: (reading: KnxReading) => void): void; removeWriteListener(cb: (reading: KnxReading) => void): void; addResponseListener(cb: (reading: KnxReading) => void): void; removeResponseListener(cb: (reading: KnxReading) => void): void; onValue(cb: (reading: KnxReading) => void): void; offValue(cb: (reading: KnxReading) => void): void; getAddress(): string; getReadTimeoutStats(): ReadTimeoutStats; resetReadTimeoutStats(): void; getLink(): KnxDatapointLink; toString(value?: unknown): string; } /** * Base class for typed KNX group clients (DPT implementations). * * Instances are created via `KnxLink.group()`. Subclasses define encoding, * decoding, and DPT-specific write helpers. * * @typeParam T Decoded value type for this DPT. */ export declare abstract class DataPointAbstract implements IDPT { protected readonly address: string; private readonly link; private readonly options; protected cemiFrameEvent: EventEmitter; protected valueEvent: EventEmitter; protected hasSubscribed: boolean; private pendingReadReject?; private readTimeoutCount; private consecutiveReadTimeouts; protected abstract valueByteLength: number; /** KNX datapoint type identifier (e.g. `1.001`). */ abstract readonly type: DPT; /** Display unit for numeric values; empty string when not applicable. */ abstract readonly unit: string; protected abstract decode(data: Buffer, cemiFrame: KnxCemiFrame): T; /** Send a group write with a DPT-encoded value. */ protected abstract write(value: T): Promise; /** Format a decoded value for display; without `value`, returns address and DPT id. */ abstract toString(value?: T): string; /** Subscribe to incoming group writes (`APCI_GROUP_VALUE_WRITE`) for this address. */ addWriteListener(cb: (reading: KnxReading) => void): void; /** Remove a listener previously added with {@link addWriteListener} or {@link onValue}. */ removeWriteListener(cb: (reading: KnxReading) => void): void; /** Subscribe to group-read responses (`APCI_GROUP_VALUE_RESP`), e.g. after {@link requestValue}. */ addResponseListener(cb: (reading: KnxReading) => void): void; /** Remove a listener previously added with {@link addResponseListener} or {@link onValue}. */ removeResponseListener(cb: (reading: KnxReading) => void): void; /** Subscribe to both group writes and read responses with one callback. */ onValue(cb: (reading: KnxReading) => void): void; /** Remove a listener previously added with {@link onValue}. */ offValue(cb: (reading: KnxReading) => void): void; protected isCemiFrameValueByteLengthOk(cemiFrame: KnxCemiFrame): boolean; protected send(value: Buffer): Promise; private requestValueInternal; /** Send a group-read telegram without waiting for a response. */ requestValue(): Promise; /** * Send a group read and wait for a response. * * @throws `READ_TIMEOUT` when no response arrives within the link `readTimeout`. */ read(): Promise>; private readAwaitResponse; /** Return the parent KNX link used for bus communication. */ getLink(): KnxDatapointLink; constructor(address: string, link: KnxDatapointLink, options: RequiredKnxLinkOptions); /** Return the bound group address (e.g. `2/0/4`). */ getAddress(): string; /** Return cumulative and consecutive read timeout counters for this group address. */ getReadTimeoutStats(): ReadTimeoutStats; /** Reset both read timeout counters to zero. */ resetReadTimeoutStats(): void; private eventsListener; protected updateSubscription(): void; } export {}; //# sourceMappingURL=DataPointAbstract.d.ts.map