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

@@ -552,6 +552,25 @@ module.exports = syrup.serial()
})
}
plugin.getRingerMode = function() {
return runServiceCommand(
apk.wire.MessageType.GET_RINGER_MODE
, new apk.wire.GetRingerModeRequest()
)
.timeout(10000)
.then(function(data) {
var response = apk.wire.GetRingerModeResponse.decode(data)
// Reflection to decode enums to their string values, otherwise
// we only get an integer
var ringerMode = apk.builder.lookup('jp.co.cyberagent.stf.proto.RingerMode')
.children[response.mode].name
if (response.success) {
return ringerMode
}
throw new Error('Unable to get ringer mode')
})
}
plugin.setWifiEnabled = function(enabled) {
return runServiceCommand(
apk.wire.MessageType.SET_WIFI_ENABLED