UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

23 lines 755 B
import Command from '../../command.js'; // Possible replies: // "unable to connect to 192.168.2.2:5555" // "connected to 192.168.2.2:5555" // "already connected to 192.168.2.2:5555" const RE_OK = /connected to|already connected/; export default class HostConnectCommand extends Command { async execute(host, port) { await this._send(`host:connect:${host}:${port}`); await this.readOKAY(); const value = await this.parser.readValue('utf8'); if (RE_OK.test(value)) { if (value.includes("already connected")) return false; else return true; } else { throw new Error(value); } } } //# sourceMappingURL=HostConnectCommand.js.map