import { TapoCredentials } from '../types'; export declare enum ProtocolType { KLAP = "klap", PASSTHROUGH = "passthrough" } export interface ProtocolOptions { preferredProtocol?: ProtocolType; enableFallback?: boolean; connectionTimeout?: number; minRequestInterval?: number; } export interface ProtocolInfo { type: ProtocolType; isSupported: boolean; priority: number; lastUsed?: number; errorCount: number; } /** * Manages protocol selection and fallback logic * Single responsibility: Protocol detection and selection */ export declare class ProtocolSelector { protected readonly ip: string; protected readonly credentials: TapoCredentials; private protocols; private activeProtocol; private readonly options; constructor(ip: string, credentials: TapoCredentials, options?: ProtocolOptions); /** * Select the best available protocol */ selectProtocol(): Promise; /** * Get currently active protocol */ getActiveProtocol(): ProtocolType | null; /** * Test if a specific protocol works with the device */ testProtocol(protocol: ProtocolType): Promise; /** * Record a protocol error and update its health status */ recordProtocolError(protocol: ProtocolType): void; /** * Reset protocol error counts (useful for recovery) */ resetProtocolErrors(): void; /** * Get protocol information for debugging */ getProtocolInfo(): Map; /** * Check if a protocol is healthy (low error count, recently used) */ private isProtocolHealthy; /** * Get alternative protocols ordered by priority */ private getAlternativeProtocols; /** * Perform actual protocol test (to be implemented by subclasses or injected) */ protected performProtocolTest(_protocol: ProtocolType): Promise; /** * Force switch to a specific protocol */ forceProtocol(protocol: ProtocolType): void; /** * Get minimum request interval for the active protocol */ getMinRequestInterval(): number; }