@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
34 lines • 1.18 kB
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"));
const DeviceClient_1 = __importDefault(require("../../DeviceClient"));
class HostDevicesCommand extends command_1.default {
async execute() {
await this._send('host:devices');
await this.readOKAY();
return this._readDevices();
}
// copyed to HostTrackDevicesCommand.ts
async _readDevices() {
const value = await this.parser.readValue('ascii');
return this._parseDevices(value);
}
_parseDevices(value) {
return value
.split('\n')
.filter((e) => e)
.map((line) => {
const [id, type] = line.split(/\s+/);
return {
id,
type: type,
getClient: () => new DeviceClient_1.default(this.connection.parent, id),
};
});
}
}
exports.default = HostDevicesCommand;
//# sourceMappingURL=HostDevicesCommand.js.map