#include <chrono>
#include <Ecore.h>
+#include <map>
#include "mmi_iu_log.h"
#include "StringUtil.h"
static const vector<string> __SHOW_GRID_KOKR = {"그리드", "그리드 모드", "그리드로 보여줘", "그리드 보여줘"};
static const vector<string> __REFRESH_WINDOW_INFO = {"화면 갱신해줘", "화면 업데이트", "리프레시", "새로고침", "새로 고침"};
static const vector<string> __TURN_OF_REQUEST = {"동작 그만", "이제 그만"};
+static const map<string, int> __OPERATION_REQUEST = {
+ {"뒤로", MMI_VOICE_TOUCH_OPERATION_PRESS_BACK},
+ {"위", MMI_VOICE_TOUCH_OPERATION_PRESS_UP}, {"위로", MMI_VOICE_TOUCH_OPERATION_PRESS_UP},
+ {"아래", MMI_VOICE_TOUCH_OPERATION_PRESS_DOWN}, {"아래로", MMI_VOICE_TOUCH_OPERATION_PRESS_DOWN},
+ {"왼쪽", MMI_VOICE_TOUCH_OPERATION_PRESS_LEFT}, {"왼쪽으로", MMI_VOICE_TOUCH_OPERATION_PRESS_LEFT},
+ {"오른쪽", MMI_VOICE_TOUCH_OPERATION_PRESS_RIGHT}, {"오른쪽으로", MMI_VOICE_TOUCH_OPERATION_PRESS_RIGHT},
+ {"선택", MMI_VOICE_TOUCH_OPERATION_PRESS_RETURN}, {"선택해줘", MMI_VOICE_TOUCH_OPERATION_PRESS_RETURN}, {"클릭", MMI_VOICE_TOUCH_OPERATION_PRESS_RETURN},
+ {"트레이 열어", MMI_VOICE_TOUCH_OPERATION_TRAY_ON}, {"트레이 올려", MMI_VOICE_TOUCH_OPERATION_TRAY_ON},
+ {"트레이 닫아", MMI_VOICE_TOUCH_OPERATION_TRAY_OFF}, {"트레이 내려", MMI_VOICE_TOUCH_OPERATION_TRAY_OFF},
+ {"패널 열어", MMI_VOICE_TOUCH_OPERATION_PANEL_ON}, {"패널 내려", MMI_VOICE_TOUCH_OPERATION_PANEL_ON},
+ {"패널 닫아", MMI_VOICE_TOUCH_OPERATION_PANEL_OFF}, {"패널 올려", MMI_VOICE_TOUCH_OPERATION_PANEL_OFF},
+ };
static const int __DEFAULT_DISPLAY_WIDTH = 1920;
static const int __DEFAULT_DISPLAY_HEIGHT = 1080;
__touchModality.object_id = nullptr;
__touchModality.coord_x = 0;
__touchModality.coord_y = 0;
+ __touchModality.operation = -1;
__currentMode = VOICE_TOUCH_MODE_TOOLTIP_TEXT;
return true;
}
+ auto operationIterator = __OPERATION_REQUEST.find(asrResult);
+ if (operationIterator != __OPERATION_REQUEST.end()) {
+ int operation = operationIterator->second;
+ makeOperation(timestamp, operation);
+ invokeOutputModalityCallback(&__touchModality);
+ return true;
+ }
+
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");
setTouchModality(item, timestamp);
}
+void VoiceTouchEngine::makeOperation(int timestamp, int operation)
+{
+ _I("[VoiceTouchEngine] Make operation. timestamp(%d). operation(%d)", timestamp, operation);
+ setOperationModality(timestamp, operation);
+}
+
void VoiceTouchEngine::setRejectedEventResult(int timestamp, JsonProvider &provider)
{
_I("[VoiceTouchEngine] Set command rejected event into output. timestamp(%d)", timestamp);
__touchModality.object_id = item.objectId.c_str();
__touchModality.coord_x = item.coordX + (item.width / 2);
__touchModality.coord_y = item.coordY + (item.height / 2);
+ __touchModality.operation = -1;
+}
+
+void VoiceTouchEngine::setOperationModality(int timestamp, int operation)
+{
+ __touchModality.timestamp = timestamp;
+ __touchModality.mode = MMI_VOICE_TOUCH_MODE_OPERATION;
+ __touchModality.object_id = nullptr;
+ __touchModality.coord_x = 0;
+ __touchModality.coord_y = 0;
+ __touchModality.operation = operation;
}
bool VoiceTouchEngine::handleScreenAnalyzerInput(mmi_provider_event_screen_analyzer *screenAnalyzerEvent)