@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
35 lines • 1.3 kB
JavaScript
import { program } from 'commander';
import { getClientDevice } from './cli-common.js';
for (const type of ['bluetooth', 'data', 'wifi']) {
program
.command(`${type}-off [serials...]`)
.description('Disable bluetooth.')
.action(async (serials) => {
const devices = await getClientDevice(serials);
const process = async (device) => {
if (await device.extra.setSvc(type, false)) {
console.log(`[${device.serial}] ${type} disabled`);
}
else {
console.log(`[${device.serial}] failed ${type} already disabled`);
}
};
await Promise.all(devices.map(process));
});
program
.command(`${type}-on [serials...]`)
.description('Enable bluetooth.')
.action(async (serials) => {
const devices = await getClientDevice(serials);
const process = async (device) => {
if (await device.extra.setSvc(type, true)) {
console.log(`[${device.serial}] ${type} enabled`);
}
else {
console.log(`[${device.serial}] failed ${type} already enabled`);
}
};
await Promise.all(devices.map(process));
});
}
//# sourceMappingURL=cli-connectivity.js.map