import type { CommandBase, CommandLifeCycle } from "./command"; import { type Vector2 } from "./types"; export declare class DeviceEmitter { private emitter; on(eventName: K, listener: (command: CommandBase) => void): void; off(eventName: K, listener: (command: CommandBase) => void): void; emit(eventName: K, arg?: T): void; } /** * The Device instance is binding with specific serial number of adb device. * */ export declare class Device { /** * The folder where adb.exe is located */ private readonly adbPath; /** * Adb creates a string to uniquely identify the device by its port number. Here's an example serial number: emulator-5554 */ readonly serialNumber: string; /** * Check whether device is connected before issue a command */ autoCheckConnected: boolean; deviceResolution: Vector2; commandResolution: Vector2; private get resolutionRatio(); private _connected; /** * Determines whether the device is connected */ get connected(): boolean; private _running; /** * Determines whether the command is running */ get running(): boolean; private readonly _eventEmmiter; constructor(adbPath: string, serialNumber: string, connectStatus: boolean); checkConnected(retry?: number): Promise; /** * Issue command by text * @param commandText */ issueShellCommandText(commandText: string): Promise; /** * Issue specified command * @param command */ issueShellCommand(command: CommandBase): Promise; /** * Issue specified commands * @param commands */ issueShellCommands(commands: CommandBase[]): Promise; /** * Add listener to command life cycle event * @param eventName * @param listener */ on(eventName: CommandLifeCycle, listener: (command: CommandBase) => void): void; /** * Remove Listener to command life cycle event * @param eventName * @param listener */ off(eventName: CommandLifeCycle, listener: (command: CommandBase) => void): void; /** * Get resolution of this device * @returns */ getResolution(): Promise; getAllPackages(): Promise; getSystemPackages(): Promise; getThirdPartyPackages(): Promise; private parsePackages; existPackage(packageName: string): Promise; /** * Check if activity is running top * @param activityName * @returns */ isCurrentActivity(packageName: string, activityName?: string): Promise; /** * Start an app if not at the current focus * @param packageName * @param activityName */ startApp(packageName: string, activityName: string, timeout?: number): Promise; /** * Close an app * @param packageName */ closeApp(packageName: string, timeout?: number): Promise; /** * Take a screencap and pull it out * @param options */ getScreencap(options?: { fileName?: string; pullPath?: string; }): Promise; }