@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
27 lines • 935 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = __importDefault(require("../../command"));
// Possible replies:
// "No such device 192.168.2.2:5555"
// ""
// "disconnected 192.168.2.2:5555"
const RE_OK = /^$/;
const RE_DISC = /^disconnected.*$/;
class HostDisconnectCommand extends command_1.default {
async execute(host, port) {
await this._send(`host:disconnect:${host}:${port}`);
await this.readOKAY();
const value = await this.parser.readValue("ascii");
if (RE_OK.test(value) || RE_DISC.test(value)) {
return `${host}:${port}`;
}
else {
throw new Error(value);
}
}
}
exports.default = HostDisconnectCommand;
//# sourceMappingURL=HostDisconnectCommand.js.map