@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
28 lines • 875 B
JavaScript
import Command from '../../command.js';
import DeviceClient from '../../DeviceClient.js';
export default class HostDevicesCommand extends Command {
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(this.connection.parent, id),
};
});
}
}
//# sourceMappingURL=HostDevicesCommand.js.map