/** * ADB utilities for Quest device communication */ /** Set the global ADB device target (IP:port or serial). */ export declare function setAdbDevice(device: string | undefined): void; /** Get the global ADB device target. */ export declare function getAdbDevice(): string | undefined; /** Build ADB args with -s prefix when a target device is set. */ export declare function adbArgs(...args: string[]): string[]; /** * Check if ADB is available on PATH */ export declare function checkADBPath(): string; /** * Check if ADB devices are connected (with auto-recovery for server issues) */ export declare function checkADBDevices(retryCount?: number): Promise; /** * Check if a port is already listening on localhost */ export declare function isPortListening(port: number): Promise; /** Find the first free port at or above `preferred`, using `isFree` to test * each candidate. Pure control flow; `isFree` is injected for testing. */ export declare function firstFreePort(preferred: number, isFree: (port: number) => Promise): Promise; /** Resolve the actual CDP forward port for a device: start from the device's * deterministic preferred port and probe upward past any in-use port. * `isFree` defaults to "nothing is listening on this port". */ export declare function resolveCdpPort(serial: string, isFree?: (port: number) => Promise): Promise; /** * Idempotently set up ADB port forwarding for a given port */ export declare function ensurePortForwarding(port: number, browser?: string, cdpPortOverride?: number): Promise; /** * Check if browser is running */ export declare function isBrowserRunning(browser?: string): Promise; /** * Launch browser with a URL using am start */ export declare function launchBrowser(url: string, browser?: string): Promise; /** * Get CDP port */ export declare function getCDPPort(browser?: string, cdpPortOverride?: number): Promise; /** * Set up only CDP forwarding (for external URLs that don't need reverse forwarding) */ export declare function ensureCDPForwarding(browser?: string, cdpPortOverride?: number): Promise; /** * Re-detect CDP socket after browser launch and update forwarding if needed. * This handles the case where the initial forwarding used the generic socket * (before the browser had a PID), but the browser created a PID-specific socket. */ export declare function refreshCDPForwarding(browser?: string, cdpPortOverride?: number): Promise; /** * Check if USB file transfer is authorized on Quest * After reboot, user must click notification to allow file access */ export declare function checkUSBFileTransfer(): Promise; /** * Check if Quest display is awake * Screenshots cannot be taken when the display is off */ export declare function checkQuestAwake(): Promise; export interface BatteryInfo { level: number; state: 'fast charging' | 'charging' | 'not charging'; } /** Read the device's stable hardware serial (ro.serialno) for the given * transport address. Returns the trimmed serial, or throws on failure. */ export declare function readSerial(address: string): Promise; /** * Get Quest battery info as structured data */ export declare function getBatteryInfo(): Promise; /** * Format battery info as a human-readable string */ export declare function formatBatteryInfo(info: BatteryInfo): string; export type AdbRecoveryVia = 'connect' | 'reconnect' | 'kill-server'; export type AdbHealthStatus = { kind: 'healthy'; } | { kind: 'recovered'; via: AdbRecoveryVia; } | { kind: 'failed'; error: string; }; export interface AdbHealthEvents { onConnecting?: () => void; onReconnecting?: () => void; onRestartingServer?: () => void; onRecovered?: (via: AdbRecoveryVia) => void; onFailed?: (error: string) => void; } /** * Ensure the connected ADB device responds to a shell probe. If the probe * fails, attempt recovery in three stages (TCP-only stages skip for USB): * 1. TCP target not in `adb devices`: `adb connect ` (first connect). * 2. TCP target in `adb devices` but probe failed: `adb disconnect` + `adb connect`. * 3. Fallback: `adb kill-server` + `adb start-server`. * Reports progress via optional callbacks; healthy path is silent. */ export declare function ensureAdbHealthy(events?: AdbHealthEvents): Promise; //# sourceMappingURL=adb.d.ts.map