Implement get ringer mode.

This commit is contained in:
Valverde Antonio
2014-08-15 18:49:37 +09:00
parent a727889be5
commit d7d80c4327
8 changed files with 73 additions and 5 deletions

View File

@@ -24,7 +24,7 @@ module.exports = syrup.serial()
, reply.okay()
])
})
.error(function(err) {
.catch(function(err) {
log.error('Setting ringer mode failed', err.stack)
push.send([
channel
@@ -32,4 +32,26 @@ module.exports = syrup.serial()
])
})
})
router.on(wire.RingerGetMessage, function(channel) {
var reply = wireutil.reply(options.serial)
log.info('Getting ringer mode')
service.getRingerMode()
.timeout(30000)
.then(function(mode) {
push.send([
channel
, reply.okay('success', mode)
])
})
.catch(function(err) {
log.error('Getting ringer mode failed', err.stack)
push.send([
channel
, reply.fail(err.message)
])
})
})
})