1
0
Fork 0
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:
Valverde Antonio 2014-06-30 19:13:28 +09:00
parent 98148cdc7f
commit d9281bb30a
8 changed files with 64 additions and 4 deletions

View file

@ -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)