Request event for refreshing clickable object 72/281772/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 21 Sep 2022 07:12:29 +0000 (16:12 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Thu, 22 Sep 2022 00:46:21 +0000 (09:46 +0900)
Change-Id: I98990c427a2a83cd7478a4344c76b86f85df092b
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
src/mmimgr/iu/VoiceTouchEngine.cpp

index 5461ffb..87741ac 100644 (file)
@@ -35,6 +35,7 @@ static const string __SHOW_GRID_INVOCATION = "show grid";
 static const vector<string> __SHOW_NUMBER_KOKR = {"힌트 보여줘", "숫자 힌트 보여줘", "숫자 보여줘", "숫자"};
 static const vector<string> __SHOW_LABEL_KOKR = {"힌트 메세지 보여줘", "텍스트 보여줘", "텍스트", "텍스트 힌트 보여줘"};
 static const vector<string> __SHOW_GRID_KOKR = {"그리드", "그리드 모드", "그리드로 보여줘", "그리드 보여줘"};
+static const vector<string> __REFRESH_WINDOW_INFO = {"화면 갱신해줘", "화면 업데이트", "리프레시", "새로고침", "새로 고침"};
 
 static const int __DEFAULT_DISPLAY_WIDTH = 1920;
 static const int __DEFAULT_DISPLAY_HEIGHT = 1080;
@@ -144,6 +145,35 @@ bool VoiceTouchEngine::setInputModalityData(std::string appId, int modalityType,
        return false;
 }
 
+static bool __is_exist_in_candidates(const string &text, const vector<string> &candidates)
+{
+       for (auto &candidate : candidates) {
+               if (0 == text.compare(candidate)) {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+static void __refresh_screen_inform_event_free(void *data EINA_UNUSED, void *event)
+{
+       mmi_event_refresh_screen_inform *ev = (mmi_event_refresh_screen_inform *)event;
+       free(ev);
+}
+
+static void __invoke_event_for_refreshing_window()
+{
+       mmi_event_refresh_screen_inform *ev = (mmi_event_refresh_screen_inform *)calloc(1, sizeof(mmi_event_refresh_screen_inform));
+       if (ev == NULL) {
+               LOGE("mmi_event_refresh_screen_inform malloc failed");
+               return;
+       }
+
+       ev->seconds = 2.0;
+       ecore_event_add(MMI_EVENT_REFRESH_SCREEN_INFORM, ev, __refresh_screen_inform_event_free, nullptr);
+}
+
 bool VoiceTouchEngine::handleVoiceInput(mmi_provider_event_voice *voiceEvent)
 {
        _I("[VoiceTouchEngine] Voice modality");
@@ -171,6 +201,13 @@ bool VoiceTouchEngine::handleVoiceInput(mmi_provider_event_voice *voiceEvent)
        setFinalAsrResult(asrResult, timestamp, provider);
        invokeOutputResultCallback(provider.jsonToString());
 
+       bool isRefreshNeed = __is_exist_in_candidates(asrResult, __REFRESH_WINDOW_INFO);
+       if (isRefreshNeed) {
+               _I("[VoiceTouchEngine] Request to refresh clickable object information.");
+               __invoke_event_for_refreshing_window();
+               return true;
+       }
+
        bool isModeUpdated = checkVoiceTouchMode(asrResult);
        if (isModeUpdated) {
                _I("[VoiceTouchEngine] Voice touch mode is changed. (%d)", static_cast<int>(__currentMode));
@@ -262,17 +299,6 @@ void VoiceTouchEngine::makeClickedItemResult(ClickableItem* command, int timesta
        }
 }
 
-static bool __is_exist_in_candidates(const string &text, const vector<string> &candidates)
-{
-       for (auto &candidate : candidates) {
-               if (0 == text.compare(candidate)) {
-                       return true;
-               }
-       }
-
-       return false;
-}
-
 bool VoiceTouchEngine::checkVoiceTouchMode(const std::string &text)
 {
        _I("[VoiceTouchEngine] Input text(%s)", text.c_str());