Feature add query mic status (#1656)

* Feature: Add query mic status

Adds the message bus message `mycroft.mic.get_status` which responds with data on if mic is muted or not.
pull/1662/head
Aditya Mehra 2018-06-27 23:21:33 +09:30 committed by Åke
parent fa4173a2d3
commit 3ae4746099
1 changed files with 9 additions and 0 deletions

View File

@ -99,6 +99,14 @@ def handle_mic_unmute(event):
loop.unmute()
def handle_mic_get_status(event):
"""
Query microphone mute status.
"""
data = {'muted': loop.is_muted()}
ws.emit(event.response(data))
def handle_paired(event):
IdentityManager.update(event.data)
@ -153,6 +161,7 @@ def main():
ws.on('recognizer_loop:wake_up', handle_wake_up)
ws.on('mycroft.mic.mute', handle_mic_mute)
ws.on('mycroft.mic.unmute', handle_mic_unmute)
ws.on('mycroft.mic.get_status', handle_mic_get_status)
ws.on("mycroft.paired", handle_paired)
ws.on('recognizer_loop:audio_output_start', handle_audio_start)
ws.on('recognizer_loop:audio_output_end', handle_audio_end)