import type { RouterInstance, MessageHandler, Header } from './router.js'; import type { Device } from './devices.js'; import type { Command } from './commands/index.js'; declare const RESPONSE_MODES: readonly ["auto", "ack-only", "response", "both"]; export type ResponseMode = typeof RESPONSE_MODES[number]; type SendReturnType = A extends 'ack-only' ? Promise : A extends 'response' | 'both' | 'auto' ? Promise : Promise; export interface SendOptions { /** * Controls response behavior for the command. * * Available options: * - 'auto': Use the command's default behavior (recommended) * - 'ack-only': Wait for acknowledgment packet (confirms receipt) * - 'response': Wait for response data packet (Get commands) * - 'both': Wait for both ack and response (maximum reliability) */ responseMode?: A; signal?: AbortSignal; } export interface ClientOptions { router: RouterInstance; defaultTimeoutMs?: number; source?: number; onMessage?: MessageHandler; } export interface ClientInstance { readonly router: RouterInstance; readonly source: number; dispose(): void; broadcast(command: Command): void; unicast(command: Command, device: Device): void; send(command: Command, device: Device): Promise; send(command: Command, device: Device, options: SendOptions): SendReturnType; onMessage(header: Header, payload: Uint8Array, serialNumber: string): void; } /** * Creates a high-level client for communicating with LIFX devices. * * The Client provides methods for sending commands to devices with automatic * timeout handling, retry logic, and response correlation. It uses the Router * for message routing and supports both acknowledged and unacknowledged messaging patterns. * * @param options Configuration options * @returns A new client instance * @example * ```javascript * const client = Client({ router }); * const response = await client.send(GetColorCommand(), device); * ``` * @performance Optimized for high-throughput scenarios with minimal allocations */ export declare function Client(options: ClientOptions): ClientInstance; export {}; //# sourceMappingURL=client.d.ts.map