2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "mmi-common.h"
22 #include "TouchModule.h"
23 #include "mmi-manager-dbg.h"
24 #include "mmi_output_modality.h"
27 static TouchModule *g_touch_module = nullptr;
29 static void __refresh_screen_inform_event_free(void *data EINA_UNUSED, void *event)
31 mmi_event_refresh_screen_inform *ev = (mmi_event_refresh_screen_inform *)event;
35 static tizen_profile_e __get_tizen_profile()
37 tizen_profile_e profile;
38 char *profileName = NULL;
40 system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
41 switch (*profileName) {
44 profile = _PROFILE_TV;
48 profile = _PROFILE_MOBILE;
51 profile = _PROFILE_COMMON;
58 EXPORT_API void output_modality_initialize()
60 LOGD("initialize output modality");
61 g_touch_module = new TouchModule();
64 EXPORT_API void output_modality_shutdown()
66 LOGD("shutdown output modality");
68 delete g_touch_module;
69 g_touch_module = NULL;
73 EXPORT_API int output_modality_voice_touch(mmi_output_modality_voice_touch modality)
75 mmi_voice_touch_mode mode = (mmi_voice_touch_mode)modality.mode;
78 if (MMI_VOICE_TOUCH_MODE_TOOLTIP == mode) {
79 if (TIZEN_PROFILE_TV) {
80 LOGD("voice touch by tooltip in TV");
81 if (modality.object_id == NULL) {
82 LOGE("mmi_output_modality_voice_touch modality's object id is NULL");
85 std::string objID = std::string(modality.object_id, strlen(modality.object_id));
86 ret = g_touch_module->ClickByObjectId(objID);
89 LOGD("voice touch by tooltip in others");
90 ret = g_touch_module->ClickByCoordinate(modality.coord_x, modality.coord_y);
92 } else if (MMI_VOICE_TOUCH_MODE_GRID == mode) {
93 LOGD("voice touch by grid");
94 ret = g_touch_module->ClickByCoordinate(modality.coord_x, modality.coord_y);
96 LOGE("mode(%d) is not supported", mode);
99 LOGD("voice touch done");
101 mmi_event_refresh_screen_inform *ev = (mmi_event_refresh_screen_inform *)calloc(1, sizeof(mmi_event_refresh_screen_inform));
103 LOGE("mmi_event_refresh_screen_inform malloc failed");
108 ecore_event_add(MMI_EVENT_REFRESH_SCREEN_INFORM, ev, __refresh_screen_inform_event_free, NULL);