@aiot-toolkit/emulator
Version:
vela emulator tool.
59 lines (58 loc) • 2.37 kB
TypeScript
import readline from 'readline';
import { IEmulatorInstanceParams } from '../typing/Instance';
import { VelaImageType } from '../typing/Vvd';
import { ChildProcessWithoutNullStreams } from 'child_process';
declare abstract class CommonEmulatorInstance {
imageType: VelaImageType;
appDir: string;
static emulatorStartedFlag: RegExp;
static appInstalledFlag: RegExp;
static appInstallFailedFlag: RegExp;
static appUninstalledFlag: RegExp;
static appStartedFlag: RegExp;
static isAppInstalled(...args: any[]): boolean;
static isAppInstallFailed(log: string): boolean;
static isAppUninstalled(log: string, packageName: string): boolean;
static isEmulatorStarted(log: string): boolean;
sn: string;
vvdName: string;
debugPort?: number | string;
stdoutReadline: readline.Interface;
stderrReadline: readline.Interface;
disposeReadlines: () => void;
onStdout: (msg: string) => void;
onErrout: (msg: string) => void;
logcatProcess: ChildProcessWithoutNullStreams;
logger: (log: string) => void;
constructor(params: IEmulatorInstanceParams);
/** 安装应用,留给子类实现 */
abstract install(rpkPath: string, options?: {
packageName?: string;
size?: number;
}): Promise<void>;
/** 卸载应用,留给子类实现 */
abstract uninstall(packageName: string): Promise<void>;
/** 重启应用 */
abstract reloadApp(appName: string, debug?: boolean): Promise<void>;
/** 关闭应用 */
abstract closeApp(appName: string): Promise<void>;
/** 启动应用,留给子类实现 */
abstract startApp(packageName: string, debug: boolean): Promise<void>;
/** 推送指定文件,返回推送结果 */
push(sourcePath: string, targetPath: string): Promise<string>;
unzip(zipPath: string, targetPath: string): Promise<void>;
/** 推送指定 rpk */
pushRpk(rpkPath: string, appPackageName: string): Promise<string>;
/**
* 判断模拟器是否 ready
*/
isConnected(): Promise<boolean>;
pushAndInstall(rpkPath: string, appName: string): Promise<void>;
/** 关闭模拟器 */
poweroff(timeout?: number): Promise<void>;
systemed(): Promise<string>;
getApplist(): Promise<string[]>;
/** 重启模拟器 */
reboot(): Promise<void>;
}
export default CommonEmulatorInstance;