mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Implement set Wifi on/off.
This commit is contained in:
parent
9a31fbbfca
commit
6f7fdffe3d
9 changed files with 81 additions and 1 deletions
|
@ -521,6 +521,20 @@ module.exports = syrup.serial()
|
|||
})
|
||||
}
|
||||
|
||||
plugin.setWifiEnabled = function(enabled) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.SET_WIFI_ENABLED
|
||||
, new apk.wire.SetWifiEnabledRequest(enabled)
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.SetWifiEnabledResponse.decode(data)
|
||||
if (!response.success) {
|
||||
throw new Error('Unable to set Wifi')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function runServiceCommand(type, cmd) {
|
||||
var resolver = Promise.defer()
|
||||
var id = Math.floor(Math.random() * 0xFFFFFF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue