2 * Copyright (c) 2020 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.
17 #ifndef __TIZEN_UIX_GESTURE_DEFS_H__
18 #define __TIZEN_UIX_GESTURE_DEFS_H__
20 #include <tzplatform_config.h>
22 #include <system_info.h>
28 #define HAPI __attribute__((visibility("hidden")))
30 #define GESTURE_SHARED_RESOURCE_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "gesture")
32 #define DBUS_NAME "org.freedesktop.DBus"
33 #define DBUS_OBJECT_PATH "/org/freedesktop/DBus"
34 #define DBUS_INTERFACE_NAME "org.freedesktop.DBus"
36 #define GESTURE_DBUS_NAME "org.tizen.gesture.server"
37 #define GESTURE_OBJECT_PATH "/org/tizen/gesture/server"
38 #define GESTURE_INTERFACE_NAME "org.tizen.gesture_service"
39 #define GESTURE_ENGINE_INTERFACE_NAME "org.tizen.gesture_engine"
40 #define GESTURE_CLIENT_INTERFACE_NAME "org.tizen.gesture_client"
42 #define GESTURE_MSG_SERVICE_REGISTER "gesture_service_register"
43 #define GESTURE_CLIENT_MSG_INITIALIZE_ENGINE "gesture_client_initialize_engine"
44 #define GESTURE_CLIENT_MSG_DEINITIALIZE_ENGINE "gesture_client_deinitialize_engine"
45 #define GESTURE_CLIENT_MSG_START_RECOGNITION "gesture_client_start_recognition"
46 #define GESTURE_CLIENT_MSG_STOP_RECOGNITION "gesture_client_stop_recognition"
47 #define GESTURE_CLIENT_MSG_FOREACH_RESULT_TIME "gesture_client_foreach_result_time"
48 #define GESTURE_CLIENT_MSG_FOREACH_SUPPORTED_TYPE "gesture_client_foreach_supported_type"
49 #define GESTURE_CLIENT_MSG_IS_SUPPORT_GESTURE_TYPE "gesture_client_is_support_gesture_type"
50 #define GESTURE_CLIENT_MSG_ENGINE_GET_INFO "gesture_client_engine_get_info"
52 #define GESTURE_CLIENT_SIGNAL_GET_RESULT "get_result"
53 #define GESTURE_CLIENT_SIGNAL_GET_ERROR "get_error"
54 #define GESTURE_CLIENT_SIGNAL_GET_MOTION_STATUS "get_motion_status"
55 #define GESTURE_CLIENT_SIGNAL_GET_ENGINE_INFO "get_engine_info"
57 #define GESTURE_ENGINE_MSG_MAIN_START "gesture_engine_main_start"
58 #define GESTURE_ENGINE_MSG_SEND_RESULT "gesture_engine_send_result"
59 #define GESTURE_ENGINE_MSG_SEND_ERROR "gesture_engine_send_error"
60 #define GESTURE_ENGINE_MSG_SEND_MOTION_STATUS "gesture_engine_send_motion_status"
61 #define GESTURE_ENGINE_MSG_IS_SUPPORT_GESTURE_TYPE "gesture_engine_is_support_gesture_type"
62 #define GESTURE_ENGINE_MSG_GET_ENGINE_INFO "gesture_engine_get_engine_info"
64 #define GESTURE_ENGINE_SIGNAL_ENGINE_INITIALIZE "engine_initialize"
65 #define GESTURE_ENGINE_SIGNAL_ENGINE_DEINITIALIZE "engine_deinitialize"
66 #define GESTURE_ENGINE_SIGNAL_ENGINE_START "engine_start"
67 #define GESTURE_ENGINE_SIGNAL_ENGINE_STOP "engine_stop"
68 #define GESTURE_ENGINE_SIGNAL_FOREACH_RESULT_TIME "engine_foreach_result_time"
69 #define GESTURE_ENGINE_SIGNAL_FOREACH_SUPPORTED_TYPE "engine_foreach_supported_type"
70 #define GESTURE_ENGINE_SIGNAL_IS_SUPPORT_GESTURE_TYPE "engine_is_support_gesture_type"
71 #define GESTURE_ENGINE_SIGNAL_GET_ENGINE_INFO "engine_get_engine_info"
73 #define GESTURE_PRIVILEGE_APPLAUNCH "http://tizen.org/privilege/appmanager.launch"
74 #define GESTURE_FEATURE_GESTURE "tizen.org/feature/sensor.gesture_recognition"
75 #define CHECK_GESTURE_FEATURE() \
77 bool is_supported = false; \
78 if (!system_info_get_platform_bool(GESTURE_FEATURE_GESTURE, &is_supported)) { \
79 if (is_supported == false) { \
80 LOGE("sensor.gesture_recognition feature not supported"); \
81 return HAND_GESTURE_ERROR_NOT_SUPPORTED; \
87 GESTURE_CLIENT_LIB_NONE,
88 GESTURE_CLIENT_LIB_GESTURE,
89 GESTURE_CLIENT_LIB_ENGINE,
93 #define IF_FAIL_RETURN_TAG(cond, ret, tag, fmt, arg...) \
94 do { if (!(cond)) { tag(fmt, ##arg); return ret; } } while (0)
96 #define IF_FAIL_RETURN(cond, ret) \
97 do { if (!(cond)) { return ret; } } while (0)
99 #define IF_FAIL_VOID_TAG(cond, tag, fmt, arg...) \
100 do { if (!(cond)) { tag(fmt, ##arg); return; } } while (0)
102 #define IF_FAIL_VOID(cond) \
103 do { if (!(cond)) { return; } } while (0)
105 #define IF_FAIL_CATCH_TAG(cond, tag, fmt, arg...) \
106 do { if (!(cond)) { tag(fmt, ##arg); goto CATCH; } } while (0)
108 #define IF_FAIL_CATCH(cond) \
109 do { if (!(cond)) { goto CATCH; } } while (0)
111 #define IS_FAILED(X) ((X) != ERR_NONE)
113 #define ASSERT_ALLOC(X) IF_FAIL_RETURN_TAG(X, HAND_GESTURE_ERROR_OUT_OF_MEMORY, LOGE, "Memory allocation failed")
114 #define ASSERT_NOT_NULL(X) IF_FAIL_RETURN_TAG(X, HAND_GESTURE_ERROR_INVALID_PARAMETER, LOGE, "Parameter null")
120 #endif /* __TIZEN_UIX_GESTURE_DEFS_H__ */