7e9631d33234c71d212dbd979f2860927ea9d520
[platform/core/uifw/mmi-framework.git] / src / mmifw.h
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 #ifndef __MMIFW_H__
25 #define __MMIFW_H__
26
27 #include <Ecore.h>
28 #include <rpc-port/rpc-port.h>
29 #include <mmifw-event-types.h>
30
31 #define MMIFW_API __attribute__ ((visibility("default")))
32
33 MMIFW_API extern int MMI_EVENT_FOCUS;
34 MMIFW_API extern int MMI_EVENT_STATE_CHANGE;
35 MMIFW_API extern int MMI_EVENT_WAKE_UP;
36 MMIFW_API extern int MMI_EVENT_KEY;
37 MMIFW_API extern int MMI_EVENT_GESTURE;
38 MMIFW_API extern int MMI_EVENT_VOICE;
39 MMIFW_API extern int MMI_EVENT_ACTION;
40 MMIFW_API extern int MMI_EVENT_FEEDBACK;
41
42 typedef void* mmifw_rpc_h;
43 typedef Eina_Bool mmi_bool;
44 typedef Ecore_Event_Handler mmi_event_listener;
45 typedef Ecore_Event_Handler_Cb mmi_evnt_handler_cb;
46 typedef mmi_bool (*mmi_event_handler_cb)(void *data, int ev_type, void *event);
47
48 typedef enum
49 {
50         MMI_RESULT_NONE,
51         MMI_RESULT_FAIL,
52         MMI_RESULT_SUCCESS
53 } mmi_result;
54
55 typedef enum
56 {
57         MMI_STATE_NONE,
58         MMI_STATE_INITIATION,
59         MMI_STATE_EXPLORATION,
60         MMI_STATE_EXECUTION,
61         MMI_STATE_FEEDBACK,
62         MMI_STATE_OBSERVATION,
63         MMI_STATE_TERMINATION
64 } mmi_state;
65
66 struct _mmi_struct
67 {
68         mmifw_rpc_h rpc_h;
69         const char *sender_id;
70         bool connected;
71         int uid;
72         int state;
73         const char *stub_appid;
74 };
75
76 typedef struct _mmi_struct* mmi_handle;
77
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81
82 MMIFW_API int mmi_init(void);
83 MMIFW_API int mmi_shutdown(void);
84 MMIFW_API mmi_handle mmi_instance_create(const char *app_id);
85 MMIFW_API void mmi_instance_destroy(mmi_handle h);
86
87 MMIFW_API mmi_event_listener *mmi_event_add_listener(mmi_handle h, int ev_type, mmi_event_handler_cb func, const void *data);
88 MMIFW_API mmi_result mmi_request_send_get_focus(mmi_handle h);
89 MMIFW_API mmi_state mmi_state_get_current_state(mmi_handle h);
90 MMIFW_API mmi_result mmi_request_send_set_state(mmi_handle h, mmi_state state);
91 MMIFW_API void *mmi_event_remove_listener(mmi_handle h, mmi_event_listener *listener);
92 MMIFW_API void mmi_event_remove_all_listeners(mmi_handle h);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif //__MMIFW_H__