Mute devices when they're being used if the --mute-master option is given.

This commit is contained in:
Simo Kinnunen
2015-07-29 19:06:42 +09:00
parent aca27428b0
commit d9d47cc3bf
7 changed files with 65 additions and 2 deletions

View File

@@ -671,6 +671,20 @@ module.exports = syrup.serial()
return Promise.resolve(true)
}
plugin.setMasterMute = function(mode) {
return runServiceCommand(
apk.wire.MessageType.SET_MASTER_MUTE
, new apk.wire.SetMasterMuteRequest(mode)
)
.timeout(10000)
.then(function(data) {
var response = apk.wire.SetMasterMuteResponse.decode(data)
if (!response.success) {
throw new Error('Unable to set master mute')
}
})
}
function runServiceCommand(type, cmd) {
var resolver = Promise.defer()
var id = Math.floor(Math.random() * 0xFFFFFF)