mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Implement get Wifi status.
This commit is contained in:
parent
98148cdc7f
commit
d9281bb30a
8 changed files with 64 additions and 4 deletions
|
@ -535,6 +535,21 @@ module.exports = syrup.serial()
|
|||
})
|
||||
}
|
||||
|
||||
plugin.getWifiStatus = function() {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.GET_WIFI_STATUS
|
||||
, new apk.wire.GetWifiStatusRequest()
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.GetWifiStatusResponse.decode(data)
|
||||
if (response.success) {
|
||||
return response.status
|
||||
}
|
||||
throw new Error('Unable to get Wifi status')
|
||||
})
|
||||
}
|
||||
|
||||
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