mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:33:30 +02:00
Implement get Wifi status.
This commit is contained in:
@@ -13,9 +13,7 @@ module.exports = syrup.serial()
|
||||
|
||||
router.on(wire.WifiSetEnabledMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
|
||||
log.info('Setting Wifi "%s"', message.enabled)
|
||||
|
||||
service.setWifiEnabled(message.enabled)
|
||||
.timeout(30000)
|
||||
.then(function() {
|
||||
@@ -25,7 +23,27 @@ module.exports = syrup.serial()
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
log.error('Setting wifi enabled failed', err.stack)
|
||||
log.error('Setting Wifi enabled failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
, reply.fail(err.message)
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
router.on(wire.WifiGetStatusMessage, function(channel){
|
||||
var reply = wireutil.reply(options.serial)
|
||||
log.info('Getting Wifi status')
|
||||
service.getWifiStatus()
|
||||
.timeout(30000)
|
||||
.then(function(enabled) {
|
||||
push.send([
|
||||
channel
|
||||
, reply.okay(enabled ? 'wifi_enabled' : 'wifi_disabled')
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
log.error('Getting Wifi status failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
, reply.fail(err.message)
|
||||
|
||||
Reference in New Issue
Block a user