229d3aa09fb791deb24277d55563a6afdc0f50df
[platform/core/uifw/mmi-framework.git] / src / mmifw.c
1 /*
2 * Copyright © 2021 Samsung Electronics co., Ltd. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #include "mmifw.h"
25 #include  <rpc-port/rpc-port.h>
26 #include "interface/mmifw_proxy.h"
27
28 #define ERR(x)
29
30 int MMI_EVENT_FOCUS;
31 int MMI_EVENT_STATE_CHANGE;
32 int MMI_EVENT_WAKE_UP;
33 int MMI_EVENT_KEY;
34 int MMI_EVENT_GESTURE;
35 int MMI_EVENT_VOICE;
36 int MMI_EVENT_ACTION;
37 int MMI_EVENT_FEEDBACK;
38
39 rpc_port_proxy_mmifw_h rpc_h;
40
41 static int _mmi_init_count = 0;
42
43 MMIFW_API int
44 mmi_init(void)
45 {
46         if (++_mmi_init_count != 1)
47                 return _mmi_init_count;
48
49         ecore_init();
50
51         MMI_EVENT_FOCUS = ecore_event_type_new();
52         MMI_EVENT_STATE_CHANGE = ecore_event_type_new();
53         MMI_EVENT_WAKE_UP = ecore_event_type_new();
54         MMI_EVENT_KEY = ecore_event_type_new();
55         MMI_EVENT_GESTURE = ecore_event_type_new();
56         MMI_EVENT_VOICE = ecore_event_type_new();
57         MMI_EVENT_ACTION = ecore_event_type_new();
58         MMI_EVENT_FEEDBACK = ecore_event_type_new();
59
60         return _mmi_init_count;
61 err:
62         ecore_shutdown();
63         return --_mmi_init_count;
64 }
65
66 MMIFW_API int
67 mmi_shutdown(void)
68 {
69         if (_mmi_init_count <= 0)
70         {
71                 ERR("Init count must be greater than 0.");
72                 return 0;
73         }
74
75         _mmi_init_count--;
76
77         MMI_EVENT_FOCUS = -1;
78         MMI_EVENT_STATE_CHANGE = -1;
79         MMI_EVENT_WAKE_UP = -1;
80         MMI_EVENT_KEY = -1;
81         MMI_EVENT_GESTURE = -1;
82         MMI_EVENT_VOICE = -1;
83         MMI_EVENT_ACTION = -1;
84         MMI_EVENT_FEEDBACK = -1;
85
86         ecore_shutdown();
87         return _mmi_init_count;
88 }
89
90 MMIFW_API mmi_handle
91 mmi_instance_create(const char *app_id)
92 {
93         mmi_handle h;
94
95         (void) app_id;
96
97         return h;
98 }
99
100 MMIFW_API mmi_event_listener *
101 mmi_event_add_listener(mmi_handle h, int ev_type, mmi_event_handler_cb func, const void *data)
102 {
103         mmi_event_listener *listener;
104
105         (void) h;
106         (void) ev_type;
107         (void) func;
108         (void) data;
109
110         return listener;
111 }
112
113 MMIFW_API mmi_result
114 mmi_request_send_get_focus(mmi_handle h)
115 {
116         mmi_result res;
117
118         (void) h;
119
120         return res;
121 }
122
123 MMIFW_API mmi_state
124 mmi_state_get_current_state(mmi_handle h)
125 {
126         mmi_state state;
127
128         (void) h;
129
130         return state;
131 }
132
133 MMIFW_API mmi_result
134 mmi_request_send_set_state(mmi_handle h, mmi_state state)
135 {
136         mmi_result res;
137
138         (void) h;
139         (void) state;
140
141         return res;
142 }
143
144 MMIFW_API void *
145 mmi_event_remove_listener(mmi_handle h, mmi_event_listener *listener)
146 {
147         (void) h;
148         (void) listener;
149
150         return (void *)0;
151 }
152
153 MMIFW_API void
154 mmi_event_remove_all_listeners(mmi_handle h)
155 {
156         (void) h;
157 }
158
159 MMIFW_API void
160 mmi_instance_destroy(mmi_handle h)
161 {
162         (void) h;
163 }
164