mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:23:28 +02:00
Implement enable/disable bluetooth of device (#754)
Signed-off-by: Jussi Vatjus-Anttila <jussiva@gmail.com>
This commit is contained in:
committed by
GitHub
parent
63ad4f138e
commit
e958a599cb
@@ -675,6 +675,35 @@ module.exports = syrup.serial()
|
||||
})
|
||||
}
|
||||
|
||||
plugin.setBluetoothEnabled = function(enabled) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.SET_BLUETOOTH_ENABLED
|
||||
, new apk.wire.SetBluetoothEnabledRequest(enabled)
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.SetBluetoothEnabledResponse.decode(data)
|
||||
if (!response.success) {
|
||||
throw new Error('Unable to set Bluetooth')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
plugin.getBluetoothStatus = function() {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.GET_BLUETOOTH_STATUS
|
||||
, new apk.wire.GetBluetoothStatusRequest()
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.GetBluetoothStatusResponse.decode(data)
|
||||
if (response.success) {
|
||||
return response.status
|
||||
}
|
||||
throw new Error('Unable to get Bluetooth status')
|
||||
})
|
||||
}
|
||||
|
||||
plugin.getSdStatus = function() {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.GET_SD_STATUS
|
||||
|
||||
Reference in New Issue
Block a user