return true;
}
- bool isModeUpdated = checkVoiceTouchMode(asrResult);
- if (isModeUpdated) {
- _I("[VoiceTouchEngine] Voice touch mode is changed. (%d)", static_cast<int>(__currentMode));
+ voice_touch_mode_e mode = getVoiceTouchMode(asrResult);
+ if (mode == VOICE_TOUCH_MODE_INVALID) {
+ _I("[VoiceTouchEngine] This is not mode command. Try to find proper command");
+ __asrResult = asrResult;
+ __findCommandTimer = ecore_timer_add(0.0, findCommandCallback, static_cast<void *>(this));
+ } else if (mode != __currentMode) {
+ _I("[VoiceTouchEngine] Voice touch mode is changed from (%d) to (%d)", static_cast<int>(__currentMode), static_cast<int>(mode));
+ __currentMode = mode;
resetCurrentGridInfo();
__makeClickableItemResultTimer = ecore_timer_add(0.0, makeClickableItemResultCallback, static_cast<void *>(this));
} else {
- __asrResult = asrResult;
- __findCommandTimer = ecore_timer_add(0.0, findCommandCallback, static_cast<void *>(this));
+ _I("[VoiceTouchEngine] Voice touch mode is not changed. Skip operation");
}
return true;
}
}
-bool VoiceTouchEngine::checkVoiceTouchMode(const std::string &text)
+voice_touch_mode_e VoiceTouchEngine::getVoiceTouchMode(const std::string &text)
{
- _I("[VoiceTouchEngine] Input text(%s)", text.c_str());
-
string loweredText = StringUtil::makeLowerCase(text);
- voice_touch_mode_e mode = __currentMode;
+ voice_touch_mode_e mode = VOICE_TOUCH_MODE_INVALID;
if (__is_exist_in_candidates(loweredText, __SHOW_LABEL_KOKR)) {
mode = VOICE_TOUCH_MODE_TOOLTIP_TEXT;
} else if (__is_exist_in_candidates(loweredText, __SHOW_NUMBER_KOKR)) {
mode = VOICE_TOUCH_MODE_GRID;
}
- if (__currentMode != mode) {
- _I("[VoiceTouchEngine] mode is changed from (%d) to (%d)", __currentMode, mode);
- __currentMode = mode;
- return true;
- }
-
- _I("[VoiceTouchEngine] Mode is not changed");
- return false;
+ _I("[VoiceTouchEngine] Mode from text(%s) is (%d)", text.c_str(), static_cast<int>(mode));
+ return mode;
}
void VoiceTouchEngine::resetCurrentGridInfo()
enum voice_touch_mode_e {
VOICE_TOUCH_MODE_TOOLTIP_TEXT,
VOICE_TOUCH_MODE_TOOLTIP_NUMBER,
- VOICE_TOUCH_MODE_GRID
+ VOICE_TOUCH_MODE_GRID,
+ VOICE_TOUCH_MODE_INVALID
};
enum voice_result_type_e {
bool handleVoiceInput(mmi_provider_event_voice *voiceEvent);
bool handleScreenAnalyzerInput(mmi_provider_event_screen_analyzer *screenAnalyzerEvent);
- bool checkVoiceTouchMode(const std::string &text);
+ voice_touch_mode_e getVoiceTouchMode(const std::string &text);
ClickableItem * findCommand();
void makeClickedItemResult(ClickableItem* command, int timestamp, JsonProvider &provider);