io.appium.settings
Version:
App for dealing with Android settings
33 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setBluetoothState = setBluetoothState;
exports.unpairAllBluetoothDevices = unpairAllBluetoothDevices;
const constants_1 = require("../constants");
/**
* Change the state of bluetooth on the device under test.
*
* @param on - True to enable and false to disable it
*/
async function setBluetoothState(on) {
if ((await this.adb.getApiLevel()) < 30) {
await this.checkBroadcast([
'-a',
constants_1.BLUETOOTH_SETTING_ACTION,
'-n',
constants_1.BLUETOOTH_SETTING_RECEIVER,
'--es',
'setstatus',
on ? 'enable' : 'disable',
], `${on ? 'enable' : 'disable'} bluetooth`);
}
else {
await this.adb.setBluetoothOn(on);
}
}
/**
* Unpairs all previously paired bluetooth devices if any exist
*/
async function unpairAllBluetoothDevices() {
await this.checkBroadcast(['-a', constants_1.BLUETOOTH_UNPAIR_ACTION, '-n', constants_1.BLUETOOTH_UNPAIR_RECEIVER], 'unpair all bluetooth devices');
}
//# sourceMappingURL=bluetooth.js.map