From e9daea02a99ea90caddc27eddb2fb0615568f33c Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 28 Oct 2021 20:19:11 +0900 Subject: [PATCH] Send voice key status after recording control Change-Id: I0df6b18411a218ec5eb271fc6dba6858276db74b --- plugins/wakeup-manager/src/wakeup_manager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index 7f856ea..6ed89fd 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -21,6 +21,9 @@ #include "dependency_resolver.h" #include + +#include + namespace multiassistant { namespace wakeup @@ -518,22 +521,23 @@ bool CWakeupManager::process_plugin_event(mas_plugin_event_e event, void* data, bool start_recording = false; bool stop_recording = false; + boost::optional next_voice_key_status; if (MAS_PLUGIN_EVENT_VOICE_KEY_PRESSED == event) { if (VOICE_KEY_SUPPORT_MODE_NONE != mCurrentVoiceKeySupportMode) { start_recording = true; } - change_voice_key_status(MA_VOICE_KEY_STATUS_PRESSED); + next_voice_key_status = MA_VOICE_KEY_STATUS_PRESSED; } else if (MAS_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH == event) { if (VOICE_KEY_SUPPORT_MODE_PUSH_TO_TALK == mCurrentVoiceKeySupportMode || VOICE_KEY_SUPPORT_MODE_ALL == mCurrentVoiceKeySupportMode) { stop_recording = true; } - change_voice_key_status(MA_VOICE_KEY_STATUS_RELEASED_AFTER_PUSH); + next_voice_key_status = MA_VOICE_KEY_STATUS_RELEASED_AFTER_PUSH; } else if (MAS_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP == event) { if (VOICE_KEY_SUPPORT_MODE_PUSH_TO_TALK == mCurrentVoiceKeySupportMode) { stop_recording = true; } - change_voice_key_status(MA_VOICE_KEY_STATUS_RELEASED_AFTER_TAP); + next_voice_key_status = MA_VOICE_KEY_STATUS_RELEASED_AFTER_TAP; } if (start_recording) { @@ -586,6 +590,10 @@ bool CWakeupManager::process_plugin_event(mas_plugin_event_e event, void* data, } } + if (next_voice_key_status) { + change_voice_key_status(*next_voice_key_status); + } + MWR_LOGD("[END]"); return true; } -- 2.34.1