restructure about code which related tidl interface 99/281599/1
authordyamy-lee <dyamy.lee@samsung.com>
Thu, 15 Sep 2022 00:20:07 +0000 (09:20 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Tue, 20 Sep 2022 04:53:20 +0000 (13:53 +0900)
- tidl interface changed, following the design change.
- this patch removes not used callback functions in mmi-api-handler,
   and in mmi-client, mmi-manager.
- this patch add new callbacks for handling tidl logics.

Change-Id: I9545543febedbd46a762a68cecb8bc03a76c74cd

12 files changed:
src/mmimgr/mmi-api-handler.c
src/mmimgr/mmi-api-handler.h
src/mmimgr/mmi-client.c
src/mmimgr/mmi-client.h
src/mmimgr/mmi-common.h
src/mmimgr/mmi-core.c
src/mmimgr/mmi-manager.c
src/mmimgr/mmi-manager.h
src/modules/ref_fusion/mmi-ref-fusion.c
tests/mmi-client-tests.cpp
tests/mmi-manager-main-tests.cpp
tidl/mmi.tidl

index 2206da5..2aded0d 100644 (file)
 #include "mmi-manager-dbg.h"
 #include "mmi-manager.h"
 #include "mmi-client.h"
+#include "mmi-common.h"
 
 #include <stdlib.h>
 #include <rpc-port.h>
 #include <rpc-port-internal.h>
+#include <glib.h>
 
 static bool _init_done = false;
 
@@ -84,273 +86,143 @@ static void _on_terminate(rpc_port_stub_mmi_context_h context, void *user_data)
        free(sender);
 }
 
-static int _register_cb(rpc_port_stub_mmi_context_h context, rpc_port_stub_mmi_focus_event_cb_h focus_cb, rpc_port_stub_mmi_state_change_event_cb_h state_cb, rpc_port_stub_mmi_wakeup_event_cb_h wakeup_cb, rpc_port_stub_mmi_key_event_cb_h key_cb, rpc_port_stub_mmi_gesture_event_cb_h gesture_cb, rpc_port_stub_mmi_voice_event_cb_h voice_cb, rpc_port_stub_mmi_action_event_cb_h action_cb, rpc_port_stub_mmi_feedback_event_cb_h feedback_cb, void *user_data)
+static int _register_input_event_cb(rpc_port_stub_mmi_context_h context, int input_event_type, rpc_port_stub_mmi_result_cb_h callback, void *user_data)
 {
-       int r;
+       int ret;
        char *sender = NULL;
-       mmi_client *mc = NULL;
-
-       r = rpc_port_stub_mmi_context_get_sender(context, &sender);
-       if (r || !sender)
-       {
-               LOGE("Failed to get sender from context ! (error:%d)\n", r);
-               return -1;
-       }
-
-       mc = client_manager_get_client(sender);
-       if (!mc)
-       {
-               LOGE("Failed to get client information from sender !\n");
-               goto err;
-       }
-
-       if (!client_manager_set_client_focus_cb_handle(mc, (void *)focus_cb))
-       {
-               LOGE("Failed to set focus event handler to client info !\n");
-               goto err;
-       }
+       mmi_client *mclient = NULL;
 
-       if (!client_manager_set_client_state_change_cb_handle(mc, (void *)state_cb))
-       {
-               LOGE("Failed to set state_change event handler to client info !\n");
-               goto err;
-       }
-
-       if (!client_manager_set_client_wakeup_cb_handle(mc, (void *)wakeup_cb))
-       {
-               LOGE("Failed to set wakeup event handler to client info !\n");
-               goto err;
-       }
-
-       if (!client_manager_set_client_key_cb_handle(mc, (void *)key_cb))
-       {
-               LOGE("Failed to set key event handler to client info !\n");
-               goto err;
-       }
+       LOGI("register input event and callback");
 
-       if (!client_manager_set_client_gesture_cb_handle(mc, (void *)gesture_cb))
-       {
-               LOGE("Failed to set gesture event handler to client info !\n");
-               goto err;
+       ret = rpc_port_stub_mmi_context_get_sender(context, &sender);
+       if (ret != RPC_PORT_ERROR_NONE || sender == NULL) {
+               LOGE("Failed to get sender from context ! (error:%d)\n", ret);
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       if (!client_manager_set_client_voice_cb_handle(mc, (void *)voice_cb))
-       {
-               LOGE("Failed to set voice event handler to client info !\n");
-               goto err;
+       mclient = client_manager_get_client(sender);
+       if (mclient == NULL) {
+               LOGE("Failed to get client information from sender !\n");
+               free(sender);
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       if (!client_manager_set_client_action_cb_handle(mc, (void *)action_cb))
-       {
-               LOGE("Failed to set action event handler to client info !\n");
-               goto err;
+       ret = client_manager_register_input_event(mclient, input_event_type, callback);
+       if (ret != MMI_ERROR_NONE) {
+               LOGE("Fail to register input event(%d)", ret);
+               return MMI_ERROR_OPERATION_FAILED;
        }
 
-       if (!client_manager_set_client_feedback_cb_handle(mc, (void *)feedback_cb))
-       {
-               LOGE("Failed to set feedback event handler to client info !\n");
-               goto err;
-       }
+       LOGD("register input_event_type and callback. total %d", g_list_length(mclient->result_cb_list));
 
        free(sender);
-       return 0;
-err:
-       if (sender)
-               free(sender);
-       return -1;
+       return MMI_ERROR_NONE;
 }
 
-static void _deregister_cb(rpc_port_stub_mmi_context_h context, void *user_data)
+static int _activate_input_event_cb(rpc_port_stub_mmi_context_h context, int input_event_type, void *user_data)
 {
-       int r;
+       int ret;
        char *sender = NULL;
-       mmi_client *mc = NULL;
-
-       r = rpc_port_stub_mmi_context_get_sender(context, &sender);
-       if (r || !sender)
-       {
-               LOGE("Failed to get sender from context ! (error:%d)\n", r);
-               return;
-       }
-
-       mc = client_manager_get_client(sender);
-       if (!mc)
-       {
-               LOGE("Failed to get client information from sender !\n");
-               goto err;
-       }
-
-       if (NULL != client_manager_set_client_focus_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset focus event handler of client !\n");
-               goto err;
-       }
-
-       if (NULL != client_manager_set_client_state_change_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset state_change event handler of client !\n");
-               goto err;
-       }
+       mmi_client *mclient = NULL;
 
-       if (NULL != client_manager_set_client_wakeup_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset wakeup event handler of client !\n");
-               goto err;
-       }
+       LOGI("activate input event");
 
-       if (NULL != client_manager_set_client_key_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset key event handler of client !\n");
-               goto err;
+       ret = rpc_port_stub_mmi_context_get_sender(context, &sender);
+       if (ret != RPC_PORT_ERROR_NONE || sender == NULL) {
+               LOGE("Failed to get sender from context ! (error:%d)\n", ret);
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       if (NULL != client_manager_set_client_gesture_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset gesture event handler of client !\n");
-               goto err;
-       }
-
-       if (NULL != client_manager_set_client_voice_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset voice event handler of client !\n");
-               goto err;
+       mclient = client_manager_get_client(sender);
+       if (mclient == NULL) {
+               LOGE("Failed to get client information from sender !\n");
+               free(sender);
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       if (NULL != client_manager_set_client_action_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset action event handler of client !\n");
-               goto err;
-       }
+       LOGD("(Prev)Activate input event(%d) activated(%d)", input_event_type, mclient->activate_event_type);
 
-       if (NULL != client_manager_set_client_feedback_cb_handle(mc, NULL))
-       {
-               LOGE("Failed to unset feedback event handler of client !\n");
-               goto err;
+       ret = client_manager_activate_input_event(mclient, input_event_type);
+       if(ret != MMI_ERROR_NONE) {
+               LOGE("Fail to activate input event(%d)", ret);
+               return ret;
        }
 
+       LOGD("Activate input event(%d) activated(%d)", input_event_type, mclient->activate_event_type);
 
-       free(sender);
-       return;
-err:
-       if (sender)
-               free(sender);
-       return;
+       return MMI_ERROR_NONE;
 }
 
-static void _get_focus_cb(rpc_port_stub_mmi_context_h context, void *user_data)
+static int _deactivate_input_event_cb(rpc_port_stub_mmi_context_h context, int input_event_type, void *user_data)
 {
-       int r;
+       int ret;
        char *sender = NULL;
-       mmi_client *mc = NULL;
-
-       r = rpc_port_stub_mmi_context_get_sender(context, &sender);
-       if (r || !sender)
-       {
-               LOGE("Failed to get sender from context ! (error:%d)\n", r);
-               goto err;
-       }
+       mmi_client *mclient = NULL;
 
-       LOGI("Get focus request came from a client(%s) !\n", sender);
+       LOGI("deactivate input event");
 
-       mc = client_manager_get_client(sender);
-       if (!mc)
-       {
-               LOGE("Failed to get client info from sender(=%s)]n", sender);
-               goto err;
+       ret = rpc_port_stub_mmi_context_get_sender(context, &sender);
+       if (ret != RPC_PORT_ERROR_NONE || sender == NULL) {
+               LOGE("Failed to get sender from context ! (error:%d)\n", ret);
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       r = mmi_manager_set_focus_client(mc);
-       if (r)
-       {
-               LOGE("Failed returned mmi_manager_set_focus_client ! (error:%d)\n", r);
-               goto err;
-       }
-
-       free(sender);
-       return;
-err:
-       if (sender)
+       mclient = client_manager_get_client(sender);
+       if (mclient == NULL) {
+               LOGE("Failed to get client information from sender !\n");
                free(sender);
-       if (mc)
-               free(mc);
-}
-
-static void _set_state_cb(rpc_port_stub_mmi_context_h context, int state, void *user_data)
-{
-       int r;
-       char *sender = NULL;
-       mmi_client *mc = NULL;
-
-       r = rpc_port_stub_mmi_context_get_sender(context, &sender);
-       if (r || !sender)
-       {
-               LOGE("Failed to get sender from context ! (error:%d)\n", r);
-               goto err;
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       LOGI("Get focus request came from a client(%s) !\n", sender);
+       LOGD("(Prev)Deactivate input event(%d) activated(%d)", input_event_type, mclient->activate_event_type);
 
-       mc = client_manager_get_client(sender);
-       if (!mc)
-       {
-               LOGE("Failed to get client info from sender(=%s)]n", sender);
-               goto err;
+       ret = client_manager_deactivate_input_event(mclient, input_event_type);
+       if(ret != MMI_ERROR_NONE) {
+               LOGE("Fail to activate input event(%d)", ret);
+               return ret;
        }
 
-       r = mmi_manager_set_state(mc, state);
-       if (r)
-       {
-               LOGE("Failed returned mmi_manager_set_state(=%d) ! (error:%d)\n", state, r);
-               goto err;
-       }
+       LOGD("Deactivate input event(%d) activated(%d)", input_event_type, mclient->activate_event_type);
 
-       free(sender);
-       return;
-err:
-       if (sender)
-               free(sender);
-       if (mc)
-               free(mc);
+       return MMI_ERROR_NONE;
 }
 
-void
-mmi_api_handler_init(void)
+int mmi_api_handler_initialize(void)
 {
        int r;
+       LOGD("mmi_api_handler_initialize");
 
-       if (_init_done)
-               return;
+       if (_init_done) {
+               LOGE("Already initialized");
+               return MMI_ERROR_NONE;
+       }
 
        r = rpc_port_register_proc_info(_stub_appid, NULL);
-       if (r != RPC_PORT_ERROR_NONE)
-       {
+       if (r != RPC_PORT_ERROR_NONE) {
                LOGE("Failed to register proc info ! (error:%d)\n", r);
-               goto err;
+               return MMI_ERROR_OPERATION_FAILED;
        }
 
        rpc_port_stub_mmi_callback_s callback = {
                _on_create,
                _on_terminate,
-               _register_cb,
-               _deregister_cb,
-               _get_focus_cb,
-               _set_state_cb
+               _register_input_event_cb,
+               _activate_input_event_cb,
+               _deactivate_input_event_cb,
        };
 
        r = rpc_port_stub_mmi_register(&callback, NULL);
-       if (r != 0)
-       {
+       if (r != RPC_PORT_ERROR_NONE) {
                LOGE("Failed to register callbacks (error:%d)\n", r);
-               goto err;
+               return MMI_ERROR_OPERATION_FAILED;
        }
 
        _init_done = true;
-err:
-       return;
+       return MMI_ERROR_NONE;
 }
 
 void
-mmi_api_handler_shutdown(void)
+mmi_api_handler_deinitialize(void)
 {
        if (!_init_done)
                return;
index 9b82b8d..81ae12e 100644 (file)
@@ -30,8 +30,8 @@
 extern "C" {
 #endif
 
-void mmi_api_handler_init(void);
-void mmi_api_handler_shutdown(void);
+int mmi_api_handler_initialize(void);
+void mmi_api_handler_deinitialize(void);
 
 #ifdef __cplusplus
 }
index 6dbf057..d94c6ee 100644 (file)
 #include <Eina.h>
 #include <stdlib.h>
 
-struct _mmi_client
-{
-       char *sender;
-       uid_t uid;
-       pid_t pid;
-       mmi_state state;
-       bool has_focus;
-
-       rpc_port_stub_mmi_focus_event_cb_h focus_cb_h;
-       rpc_port_stub_mmi_state_change_event_cb_h state_change_cb_h;
-       rpc_port_stub_mmi_wakeup_event_cb_h wakeup_cb_h;
-       rpc_port_stub_mmi_key_event_cb_h key_cb_h;
-       rpc_port_stub_mmi_gesture_event_cb_h gesture_cb_h;
-       rpc_port_stub_mmi_voice_event_cb_h voice_cb_h;
-       rpc_port_stub_mmi_action_event_cb_h action_cb_h;
-       rpc_port_stub_mmi_feedback_event_cb_h feedback_cb_h;
-};
-
 Eina_Hash *_client_hash = NULL;
 static Eina_Bool _init_done = false;
 
+unsigned long long input_event_caps[MMI_INPUT_EVENT_TYPE_VOICE_RECOGNITION+1] =
+{
+       //MMI_INPUT_EVENT_TYPE_NONE
+       MODALITY_PROVIDER_CAP_NONE,
+       //MMI_INPUT_EVENT_TYPE_VOICE_TOUCH
+       MODALITY_PROVIDER_CAP_KEY_EVENT |
+       MODALITY_PROVIDER_CAP_VOICE_EVENT |
+       MODALITY_PROVIDER_CAP_SCREEN_ANALYZER_EVENT,
+       //MMI_INPUT_EVENT_TYPE_VOICE_RECOGNITION
+       MODALITY_PROVIDER_CAP_KEY_EVENT |
+       MODALITY_PROVIDER_CAP_VOICE_EVENT,
+};
+
 static Eina_Bool
 _client_hash_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
 {
@@ -117,61 +112,64 @@ client_manager_get_client(const char* sender)
 int
 client_manager_remove_client(const char *sender)
 {
-       mmi_client *mc = NULL;
+       LOGI("client_manager_remove_client");
 
-       if (!sender)
-               return -1;
+       mmi_client *mclient = NULL;
 
-       mc = eina_hash_find(_client_hash, sender);
-       if (!mc)
-       {
-               LOGE("Failed to find client info from sender(=%s)\n", sender);
-               goto err;
+       if (sender == NULL) {
+               LOGE("A sender is already NULL");
+               return MMI_ERROR_NONE;
        }
 
-       if (mc->has_focus)
-               mmi_manager_remove_focus_client(mc);
-       else
-               mmi_manager_remove_client_from_focus_candidates(mc);
+       mclient = eina_hash_find(_client_hash, sender);
+       if (mclient == NULL) {
+               LOGE("Failed to find client info from sender(%s)\n", sender);
+               return MMI_ERROR_INVALID_PARAMETER;
+       }
 
-       if (!eina_hash_del(_client_hash, sender, mc))
-       {
-               LOGE("Failed to remove client info using sender(=%s) !\n", sender);
-               goto err;
+       if (eina_hash_del(_client_hash, sender, mclient) == EINA_FALSE) {
+               LOGE("Failed to remove client info using sender(%s) !\n", sender);
+
+               if (mclient && mclient->sender)
+                       free(mclient->sender);
+               if (mclient)
+                       free(mclient);
+               mclient = NULL;
+
+               return MMI_ERROR_INVALID_PARAMETER;
        }
 
-       if (mc->sender)
-               free(mc->sender);
+       if (mclient->sender)
+               free(mclient->sender);
 
-       if (mc->focus_cb_h)     rpc_port_stub_mmi_focus_event_cb_destroy(mc->focus_cb_h);
-       if (mc->state_change_cb_h) rpc_port_stub_mmi_state_change_event_cb_destroy(mc->state_change_cb_h);
-       if (mc->wakeup_cb_h) rpc_port_stub_mmi_wakeup_event_cb_destroy(mc->wakeup_cb_h);
-       if (mc->key_cb_h) rpc_port_stub_mmi_key_event_cb_destroy(mc->key_cb_h);
-       if (mc->gesture_cb_h) rpc_port_stub_mmi_gesture_event_cb_destroy(mc->gesture_cb_h);
-       if (mc->voice_cb_h) rpc_port_stub_mmi_voice_event_cb_destroy(mc->voice_cb_h);
-       if (mc->action_cb_h) rpc_port_stub_mmi_action_event_cb_destroy(mc->action_cb_h);
-       if (mc->feedback_cb_h) rpc_port_stub_mmi_feedback_event_cb_destroy(mc->feedback_cb_h);
-
-       mc->focus_cb_h = NULL;
-       mc->state_change_cb_h = NULL;
-       mc->wakeup_cb_h = NULL;
-       mc->key_cb_h = NULL;
-       mc->gesture_cb_h = NULL;
-       mc->voice_cb_h = NULL;
-       mc->action_cb_h = NULL;
-       mc->feedback_cb_h = NULL;
-
-       free(mc);
-       mc = NULL;
-
-       return 0;
-err:
-       if (mc && mc->sender)
-               free(mc->sender);
-       if (mc)
-               free(mc);
-       mc = NULL;
-       return -1;
+       GList *iter = NULL;
+       mmi_result_cb_s *data = NULL;
+
+       if (g_list_length(mclient->result_cb_list) > 0) {
+               iter = g_list_first(mclient->result_cb_list);
+               while (iter != NULL) {
+                       data = iter->data;
+                       if (data != NULL) {
+                               data->input_event_type = 0;
+                               data->activated = false;
+                               rpc_port_stub_mmi_result_cb_destroy(data->result_cb_h);
+
+                               free(data);
+                               data = NULL;
+
+                               GList *temp = iter;
+                               iter = g_list_next(iter);
+                               mclient->result_cb_list = g_list_remove_link(mclient->result_cb_list, temp);
+                       }
+               }
+       }
+
+       mclient->result_cb_list = NULL;
+
+       free(mclient);
+       mclient = NULL;
+
+       return MMI_ERROR_NONE;
 }
 
 int
@@ -212,44 +210,6 @@ client_manager_get_client_pid(mmi_client *client)
        return client->pid;
 }
 
-mmi_state
-client_manager_set_client_state(mmi_client *client, mmi_state state)
-{
-       if (!client)
-               return MMI_STATE_NONE;
-
-       client->state = state;
-       return state;
-}
-
-mmi_state
-client_manager_get_client_state(mmi_client *client)
-{
-       if (!client)
-               return MMI_STATE_NONE;
-
-       return client->state;
-}
-
-bool
-client_manager_set_client_has_focus(mmi_client *client, bool has_focus)
-{
-       if (!client)
-               return false;
-
-       client->has_focus = has_focus;
-       return client->has_focus;
-}
-
-bool
-client_manager_get_client_has_focus(mmi_client *client)
-{
-       if (!client)
-               return false;
-
-       return client->has_focus;
-}
-
 const char *
 client_manager_get_client_sender(mmi_client *client)
 {
@@ -295,599 +255,126 @@ client_manager_shutdown(void)
        _init_done = false;
 }
 
-void *
-client_manager_set_client_focus_cb_handle(mmi_client *client, void *focus_cb_h)
-{
-       int r;
-
-       if (!client || !focus_cb_h)
-               return NULL;
-
-       r = rpc_port_stub_mmi_focus_event_cb_clone(focus_cb_h, &client->focus_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone focus event handle ! (error:%d)\n", r);
-               return NULL;
-       }
-
-       return client->focus_cb_h;
-}
-
-void *
-client_manager_get_client_focus_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->focus_cb_h;
-}
-
-
-void *
-client_manager_set_client_state_change_cb_handle(mmi_client *client, void *state_change_cb_h)
-{
-       int r;
-
-       if (!client || !state_change_cb_h)
-               return NULL;
-
-       r = rpc_port_stub_mmi_state_change_event_cb_clone(state_change_cb_h, &client->state_change_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone state_change event handle ! (error:%d)\n", r);
-               return NULL;
-       }
-
-       return client->state_change_cb_h;
-}
-
-void *
-client_manager_get_client_state_change_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->state_change_cb_h;
-}
-
-void *
-client_manager_set_client_wakeup_cb_handle(mmi_client *client, void *wakeup_cb_h)
+int client_manager_register_input_event(mmi_client *client, int input_event_type, rpc_port_stub_mmi_result_cb_h result_cb_h)
 {
-       int r;
+       LOGI("client_manager_register_input_event");
 
-       if (!client || !wakeup_cb_h)
-               return NULL;
-
-       r = rpc_port_stub_mmi_wakeup_event_cb_clone(wakeup_cb_h, &client->wakeup_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone wakeup event handle ! (error:%d)\n", r);
-               return NULL;
+       mmi_result_cb_s* input_result_callback = (mmi_result_cb_s*)calloc(1, sizeof(mmi_result_cb_s));
+       if (input_result_callback == NULL) {
+               LOGE("Fail to allocate memory");
+               return MMI_ERROR_OUT_OF_MEMORY;
        }
 
-       return client->wakeup_cb_h;
-}
-
-void *
-client_manager_get_client_wakeup_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->wakeup_cb_h;
-}
-
-void *
-client_manager_set_client_key_cb_handle(mmi_client *client, void *key_cb_h)
-{
-       int r;
-
-       if (!client || !key_cb_h)
-               return NULL;
-
-       r = rpc_port_stub_mmi_key_event_cb_clone(key_cb_h, &client->key_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone key event handle ! (error:%d)\n", r);
-               return NULL;
+       int ret = rpc_port_stub_mmi_result_cb_clone(result_cb_h, &input_result_callback->result_cb_h);
+       if (ret != RPC_PORT_ERROR_NONE) {
+               LOGE("Fail to clone mmi_result_cb(%d)", ret);
+               return MMI_ERROR_OPERATION_FAILED;
        }
 
-       return client->key_cb_h;
-}
-
-void *
-client_manager_get_client_key_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->key_cb_h;
-}
+       input_result_callback->input_event_type = input_event_type;
+       input_result_callback->activated = false;
 
-void *
-client_manager_set_client_gesture_cb_handle(mmi_client *client, void *gesture_cb_h)
-{
-       int r;
+       client->result_cb_list = g_list_append(client->result_cb_list, input_result_callback);
 
-       if (!client || !gesture_cb_h)
-               return NULL;
+       LOGD("Add result callback to client");
 
-       r = rpc_port_stub_mmi_gesture_event_cb_clone(gesture_cb_h, &client->gesture_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone gesture event handle ! (error:%d)\n", r);
-               return NULL;
-       }
-
-       return client->gesture_cb_h;
+       return MMI_ERROR_NONE;
 }
 
-void *
-client_manager_get_client_gesture_cb_handle(mmi_client *client)
+int client_manager_activate_input_event(mmi_client *client, int input_event_type)
 {
-       if (!client)
-               return NULL;
-
-       return client->gesture_cb_h;
-}
-
-void *
-client_manager_set_client_voice_cb_handle(mmi_client *client, void *voice_cb_h)
-{
-       int r;
+       LOGI("client_manager_activate_input_event(%d)", input_event_type);
 
-       if (!client || !voice_cb_h)
-               return NULL;
+       int ret;
+       mmi_state state = MMI_STATE_NONE;
+       unsigned long long caps = MODALITY_PROVIDER_CAP_NONE;
 
-       r = rpc_port_stub_mmi_voice_event_cb_clone(voice_cb_h, &client->voice_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone voice event handle ! (error:%d)\n", r);
-               return NULL;
+       if (client->activate_event_type != MMI_INPUT_EVENT_TYPE_NONE) {
+               LOGE("Already activate input event(%d)", client->activate_event_type);
+               return MMI_ERROR_OPERATION_FAILED;
        }
 
-       return client->voice_cb_h;
-}
+       caps = input_event_caps[input_event_type];
+       LOGI("caps=%llu!\n", caps);
 
-void *
-client_manager_get_client_voice_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
+       GList *iter = NULL;
+       mmi_result_cb_s *data = NULL;
 
-       return client->voice_cb_h;
-}
+       if (g_list_length(client->result_cb_list) > 0) {
+               iter = g_list_first(client->result_cb_list);
+               while (iter != NULL) {
+                       data = iter->data;
+                       if (data != NULL) {
+                               int type = data->input_event_type;
 
-void *
-client_manager_set_client_action_cb_handle(mmi_client *client, void *action_cb_h)
-{
-       int r;
+                               if (type == input_event_type) {
+                                       ret = mmi_provider_set_op_mode_on_caps(caps, MODALITY_PROVIDER_MODE_PROPAGATE_EVENT);
+                                       if (ret == -1) {
+                                               LOGE("Failed on setting op_mode(%d) on caps(%llu) !\n", MODALITY_PROVIDER_MODE_PROPAGATE_EVENT, caps);
+                                               return MMI_ERROR_OPERATION_FAILED;
+                                       }
 
-       if (!client || !action_cb_h)
-               return NULL;
+                                       client->activate_event_type = input_event_type;
+                                       data->activated = true;
 
-       r = rpc_port_stub_mmi_action_event_cb_clone(action_cb_h, &client->action_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone action event handle ! (error:%d)\n", r);
-               return NULL;
+                                       LOGD("Activate input event(%d) activated(%d)", type, data->activated);
+                                       return MMI_ERROR_NONE;
+                               }
+                       }
+                       iter = g_list_next(iter);
+               }
        }
 
-       return client->action_cb_h;
-}
+       LOGE("Fail to get client result_cb_list");
 
-void *
-client_manager_get_client_action_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->action_cb_h;
+       return MMI_ERROR_INVALID_PARAMETER;
 }
 
-void *
-client_manager_set_client_feedback_cb_handle(mmi_client *client, void *feedback_cb_h)
+int client_manager_deactivate_input_event(mmi_client *client, int input_event_type)
 {
-       int r;
+       LOGI("client_manager_deactivate_input_event");
 
-       if (!client || !feedback_cb_h)
-               return NULL;
+       int ret;
+       mmi_state state = MMI_STATE_NONE;
+       unsigned long long caps = MODALITY_PROVIDER_CAP_NONE;
 
-       r = rpc_port_stub_mmi_feedback_event_cb_clone(feedback_cb_h, &client->feedback_cb_h);
-       if (r)
-       {
-               LOGE("Failed to clone feedback event handle ! (error:%d)\n", r);
-               return NULL;
+       if (client->activate_event_type == MMI_INPUT_EVENT_TYPE_NONE) {
+               LOGE("No activated input event(%d)", client->activate_event_type);
+               return MMI_ERROR_NONE;
        }
 
-       return client->feedback_cb_h;
-}
-
-void *
-client_manager_get_client_feedback_cb_handle(mmi_client *client)
-{
-       if (!client)
-               return NULL;
-
-       return client->feedback_cb_h;
-}
+       caps = input_event_caps[input_event_type];
+       LOGI("caps=%llu!\n", caps);
 
-int
-client_manager_send_focus_event(mmi_client *client, focus_event_arg *args)
-{
-       int r;
-       rpc_port_stub_focus_event_h focus_event_h = NULL;
-       focus_event_arg *ev = (focus_event_arg *)args;
+       GList *iter = NULL;
+       mmi_result_cb_s *data = NULL;
 
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
+       if (g_list_length(client->result_cb_list) > 0) {
+               iter = g_list_first(client->result_cb_list);
+               while (iter != NULL) {
+                       data = iter->data;
+                       if (data != NULL) {
+                               int type = data->input_event_type;
 
-       if (!client->focus_cb_h)
-       {
-               LOGE("Given client doesn't have focus_cb handle !\n");
-               return -1;
-       }
+                               if (type == input_event_type && data->activated == true) {
+                                       ret = mmi_provider_set_op_mode_on_caps(caps, MODALITY_PROVIDER_MODE_DROP_EVENT);
+                                       if (ret == -1) {
+                                               LOGE("Failed on setting op_mode(%d) on caps(%llu) !\n", MODALITY_PROVIDER_MODE_DROP_EVENT, caps);
+                                               return MMI_ERROR_OPERATION_FAILED;
+                                       }
 
-       r = rpc_port_stub_focus_event_create(&focus_event_h);
-       if (r)
-       {
-               LOGE("Failed to create focus_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_focus_event_set_type(focus_event_h, ev->type);
-       rpc_port_stub_focus_event_set_timestamp(focus_event_h, ev->timestamp);
-       rpc_port_stub_focus_event_set_focus_in(focus_event_h, ev->focus_in);
+                                       client->activate_event_type = MMI_INPUT_EVENT_TYPE_NONE;
+                                       data->activated = false;
 
-       r = rpc_port_stub_mmi_focus_event_cb_invoke(client->focus_cb_h, focus_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke focus_event_cb ! (error:%d)\n", r);
-               goto err;
+                                       LOGD("Deactivate input event(%d) activated(%d)", type, data->activated);
+                                       return MMI_ERROR_NONE;
+                               }
+                       }
+                       iter = g_list_next(iter);
+               }
        }
 
-       return 0;
-err:
-       if (focus_event_h)
-               rpc_port_stub_focus_event_destroy(focus_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_state_change_event(mmi_client *client, state_change_event_arg *args)
-{
-       int r;
-       rpc_port_stub_state_change_event_h state_change_event_h = NULL;
-       state_change_event_arg *ev = (state_change_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->state_change_cb_h)
-       {
-               LOGE("Given client doesn't have state_change_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_state_change_event_create(&state_change_event_h);
-       if (r)
-       {
-               LOGE("Failed to create state_change_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_state_change_event_set_type(state_change_event_h, ev->type);
-       rpc_port_stub_state_change_event_set_timestamp(state_change_event_h, ev->timestamp);
-       rpc_port_stub_state_change_event_set_state(state_change_event_h, ev->state);
-       rpc_port_stub_state_change_event_set_old_state(state_change_event_h, ev->old_state);
-
-       r = rpc_port_stub_mmi_state_change_event_cb_invoke(client->state_change_cb_h, state_change_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke state_change_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (state_change_event_h)
-               rpc_port_stub_state_change_event_destroy(state_change_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_wakeup_event(mmi_client *client, wakeup_event_arg *args)
-{
-       int r;
-       rpc_port_stub_wakeup_event_h wakeup_event_h = NULL;
-       wakeup_event_arg *ev = (wakeup_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->wakeup_cb_h)
-       {
-               LOGE("Given client doesn't have wakeup_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_wakeup_event_create(&wakeup_event_h);
-       if (r)
-       {
-               LOGE("Failed to create wakeup_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_wakeup_event_set_type(wakeup_event_h, ev->type);
-       rpc_port_stub_wakeup_event_set_timestamp(wakeup_event_h, ev->timestamp);
-       rpc_port_stub_wakeup_event_set_source(wakeup_event_h, ev->source);
-
-       r = rpc_port_stub_mmi_wakeup_event_cb_invoke(client->wakeup_cb_h, wakeup_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke wakeup_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (wakeup_event_h)
-               rpc_port_stub_wakeup_event_destroy(wakeup_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_key_event(mmi_client *client, key_event_arg *args)
-{
-       int r;
-       rpc_port_stub_key_event_h key_event_h = NULL;
-       key_event_arg *ev = (key_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->key_cb_h)
-       {
-               LOGE("Given client doesn't have key_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_key_event_create(&key_event_h);
-       if (r)
-       {
-               LOGE("Failed to create key_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_key_event_set_type(key_event_h, ev->type);
-       rpc_port_stub_key_event_set_timestamp(key_event_h, ev->timestamp);
-       rpc_port_stub_key_event_set_key_down(key_event_h, ev->key_down);
-       rpc_port_stub_key_event_set_keycode(key_event_h, ev->keycode);
-       rpc_port_stub_key_event_set_keyname(key_event_h, ev->keyname);
-       rpc_port_stub_key_event_set_source(key_event_h, ev->source);
-
-       r = rpc_port_stub_mmi_key_event_cb_invoke(client->key_cb_h, key_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke key_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (key_event_h)
-               rpc_port_stub_key_event_destroy(key_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_gesture_event(mmi_client *client, gesture_event_arg *args)
-{
-       int r;
-       rpc_port_stub_gesture_event_h gesture_event_h = NULL;
-       gesture_event_arg *ev = (gesture_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->gesture_cb_h)
-       {
-               LOGE("Given client doesn't have gesture_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_gesture_event_create(&gesture_event_h);
-       if (r)
-       {
-               LOGE("Failed to create gesture_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_gesture_event_set_type(gesture_event_h, ev->type);
-       rpc_port_stub_gesture_event_set_timestamp(gesture_event_h, ev->timestamp);
-       rpc_port_stub_gesture_event_set_source(gesture_event_h, ev->source);
-
-       r = rpc_port_stub_mmi_gesture_event_cb_invoke(client->gesture_cb_h, gesture_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke gesture_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (gesture_event_h)
-               rpc_port_stub_gesture_event_destroy(gesture_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_voice_event(mmi_client *client, voice_event_arg *args)
-{
-       int r;
-       rpc_port_stub_voice_event_h voice_event_h = NULL;
-       voice_event_arg *ev = (voice_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->voice_cb_h)
-       {
-               LOGE("Given client doesn't have voice_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_voice_event_create(&voice_event_h);
-       if (r)
-       {
-               LOGE("Failed to create voice_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_voice_event_set_type(voice_event_h, ev->type);
-       rpc_port_stub_voice_event_set_timestamp(voice_event_h, ev->timestamp);
-       rpc_port_stub_voice_event_set_source(voice_event_h, ev->source);
-
-       r = rpc_port_stub_mmi_voice_event_cb_invoke(client->voice_cb_h, voice_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke voice_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (voice_event_h)
-               rpc_port_stub_voice_event_destroy(voice_event_h);
-
-       return -1;
-}
-
-int
-client_manager_send_action_event(mmi_client *client, action_event_arg *args)
-{
-       int r;
-       rpc_port_stub_action_event_h action_event_h = NULL;
-       rpc_port_stub_array_string_h array_string_h = NULL;
-       action_event_arg *ev = (action_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->action_cb_h)
-       {
-               LOGE("Given client doesn't have action_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_action_event_create(&action_event_h);
-       if (r)
-       {
-               LOGE("Failed to create action_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       r = rpc_port_stub_array_string_create(&array_string_h);
-       if (r)
-       {
-               LOGE("Failed to create array_string_h ! (error:%d)\n", r);
-               rpc_port_stub_action_event_destroy(action_event_h);
-               return -1;
-       }
-
-       rpc_port_stub_action_event_set_type(action_event_h, ev->type);
-       rpc_port_stub_action_event_set_timestamp(action_event_h, ev->timestamp);
-       rpc_port_stub_action_event_set_cmd(action_event_h, ev->cmd);
-       rpc_port_stub_action_event_set_nargs(action_event_h, ev->nargs);
-       rpc_port_stub_action_event_set_source(action_event_h, ev->source);
-       rpc_port_stub_array_string_set(array_string_h, ev->args, ev->nargs);
-       rpc_port_stub_action_event_set_args(action_event_h, array_string_h);
-
-       r = rpc_port_stub_mmi_action_event_cb_invoke(client->action_cb_h, action_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke action_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (action_event_h)
-               rpc_port_stub_action_event_destroy(action_event_h);
-       if (array_string_h)
-               rpc_port_stub_array_string_destroy(array_string_h);
-
-       return -1;
-}
-
-int
-client_manager_send_feedback_event(mmi_client *client, feedback_event_arg *args)
-{
-       int r;
-       rpc_port_stub_feedback_event_h feedback_event_h = NULL;
-       feedback_event_arg *ev = (feedback_event_arg *)args;
-
-       if (!client || !args)
-       {
-               LOGE("Invalid client or args was given !\n");
-               return -1;
-       }
-
-       if (!client->feedback_cb_h)
-       {
-               LOGE("Given client doesn't have feedback_cb handle !\n");
-               return -1;
-       }
-
-       r = rpc_port_stub_feedback_event_create(&feedback_event_h);
-       if (r)
-       {
-               LOGE("Failed to create feedback_event_h ! (error:%d)\n", r);
-               return -1;
-       }
-
-       rpc_port_stub_feedback_event_set_type(feedback_event_h, ev->type);
-       rpc_port_stub_feedback_event_set_timestamp(feedback_event_h, ev->timestamp);
-       rpc_port_stub_feedback_event_set_feedback(feedback_event_h, ev->feedback);
-       rpc_port_stub_feedback_event_set_comment(feedback_event_h, ev->comment);
-
-       r = rpc_port_stub_mmi_feedback_event_cb_invoke(client->feedback_cb_h, feedback_event_h);
-       if (r)
-       {
-               LOGE("Failed to invoke feedback_event_cb ! (error:%d)\n", r);
-               goto err;
-       }
-
-       return 0;
-err:
-       if (feedback_event_h)
-               rpc_port_stub_feedback_event_destroy(feedback_event_h);
+       LOGE("Fail to get client result_cb_list");
 
-       return -1;
+       return MMI_ERROR_INVALID_PARAMETER;
 }
index a70044d..0551e6d 100644 (file)
 #define __MMI_CLIENT_H__
 
 #include "mmi-common.h"
+#include "mmi_stub.h"
 #include <sys/types.h>
+#include <glib.h>
+
+typedef struct {
+       int input_event_type;
+       rpc_port_stub_mmi_result_cb_h result_cb_h;
+       bool activated;
+} mmi_result_cb_s;
+
+struct _mmi_client
+{
+       char *sender;
+       uid_t uid;
+       pid_t pid;
+       mmi_state state;
+       int activate_event_type;
+
+       GList* result_cb_list;
+};
 
 typedef struct _mmi_client mmi_client;
 
@@ -40,40 +59,13 @@ int client_manager_set_client_uid(mmi_client *client, uid_t uid);
 int client_manager_get_client_uid(mmi_client *client);
 int client_manager_set_client_pid(mmi_client *client, pid_t pid);
 int client_manager_get_client_pid(mmi_client *client);
-mmi_state client_manager_set_client_state(mmi_client *client, mmi_state state);
-mmi_state client_manager_get_client_state(mmi_client *client);
-bool client_manager_set_client_has_focus(mmi_client *client, bool has_focus);
-bool client_manager_get_client_has_focus(mmi_client *client);
 const char *client_manager_get_client_sender(mmi_client *client);
 
-void *client_manager_set_client_focus_cb_handle(mmi_client *client, void *focus_cb_h);
-void *client_manager_get_client_focus_cb_handle(mmi_client *client);
-void *client_manager_set_client_state_change_cb_handle(mmi_client *client, void *state_change_cb_h);
-void *client_manager_get_client_state_change_cb_handle(mmi_client *client);
-void *client_manager_set_client_wakeup_cb_handle(mmi_client *client, void *wakeup_cb_h);
-void *client_manager_get_client_wakeup_cb_handle(mmi_client *client);
-void *client_manager_set_client_key_cb_handle(mmi_client *client, void *key_cb_h);
-void *client_manager_get_client_key_cb_handle(mmi_client *client);
-void *client_manager_set_client_gesture_cb_handle(mmi_client *client, void *gesture_cb_h);
-void *client_manager_get_client_gesture_cb_handle(mmi_client *client);
-void *client_manager_set_client_voice_cb_handle(mmi_client *client, void *voice_cb_h);
-void *client_manager_get_client_voice_cb_handle(mmi_client *client);
-void *client_manager_set_client_action_cb_handle(mmi_client *client, void *action_cb_h);
-void *client_manager_get_client_action_cb_handle(mmi_client *client);
-void *client_manager_set_client_feedback_cb_handle(mmi_client *client, void *feedback_cb_h);
-void *client_manager_get_client_feedback_cb_handle(mmi_client *client);
-
-int client_manager_send_focus_event(mmi_client *client, focus_event_arg *args);
-int client_manager_send_state_change_event(mmi_client *client, state_change_event_arg *args);
-int client_manager_send_wakeup_event(mmi_client *client, wakeup_event_arg *args);
-int client_manager_send_key_event(mmi_client *client, key_event_arg *args);
-int client_manager_send_gesture_event(mmi_client *client, gesture_event_arg *args);
-int client_manager_send_voice_event(mmi_client *client, voice_event_arg *args);
-int client_manager_send_action_event(mmi_client *client, action_event_arg *args);
-int client_manager_send_feedback_event(mmi_client *client, feedback_event_arg *args);
-
 void client_manager_init(void);
 void client_manager_shutdown(void);
+int client_manager_register_input_event(mmi_client *client, int input_event_type, rpc_port_stub_mmi_result_cb_h result_cb_h);
+int client_manager_activate_input_event(mmi_client *client, int input_event_type);
+int client_manager_deactivate_input_event(mmi_client *client, int input_event_type);
 
 #ifdef __cplusplus
 }
index 69f4e29..b2bafe1 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <stdbool.h>
 #include <glib.h>
+#include <tizen.h>
 
 #ifndef MMI_API
 #define MMI_API __attribute__ ((visibility("default")))
@@ -346,4 +347,20 @@ typedef struct _mmi_fusion_module_data mmi_fusion_module_data;
 typedef struct _mmi_fusion_module mmi_fusion_module;
 typedef struct _mmi_fusion_handle mmi_fusion_handle;
 
+#define TIZEN_ERROR_MMI        -0x030F0000
+
+typedef enum {
+       MMI_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       MMI_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */
+       MMI_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+       MMI_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       MMI_ERROR_OUT_OF_NETWORK = TIZEN_ERROR_NETWORK_DOWN, /**< Network is down */
+       MMI_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from the daemon */
+       MMI_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+       MMI_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< MMI NOT supported */
+       MMI_ERROR_OPERATION_FAILED = TIZEN_ERROR_MMI | 0x01, /**< Operation failed */
+} mmi_error_e;
+
+typedef void (*mmi_result_cb)(int input_event_type, const char *result_out, void *user_data);
+
 #endif //__MMI_COMMON_H__
index 69ca00c..94bbaeb 100644 (file)
@@ -62,8 +62,6 @@ static void __output_modality_received_cb(const char *app_id, int type, void *ev
                arg.keycode = key_event->keycode;
                arg.keyname = key_event->keyname;
                arg.source = key_event->source;
-
-               client_manager_send_key_event(g_client, &arg);
        }
        else if (type == MMI_PROVIDER_EVENT_VOICE) {
                mmi_provider_event_voice *voice_event = (mmi_provider_event_voice *)event;
@@ -72,8 +70,6 @@ static void __output_modality_received_cb(const char *app_id, int type, void *ev
                arg.type = voice_event->type;
                arg.timestamp = voice_event->timestamp;
                arg.source = voice_event->source;
-
-               client_manager_send_voice_event(g_client, &arg);
        }
        else if (type == MMI_PROVIDER_EVENT_GESTURE) {
                mmi_provider_event_gesture *gesture_event = (mmi_provider_event_gesture *)event;
@@ -82,8 +78,6 @@ static void __output_modality_received_cb(const char *app_id, int type, void *ev
                arg.type = gesture_event->type;
                arg.timestamp = gesture_event->timestamp;
                arg.source = gesture_event->source;
-
-               client_manager_send_gesture_event(g_client, &arg);
        }
        else if (type == MMI_PROVIDER_EVENT_VOICE_TOUCH) {
                // TODO: implement
index 695d90c..3f2b602 100644 (file)
 #include <Eina.h>
 
 static Eina_Bool _init_done = false;
-static Eina_List *_focus_candidates = NULL;
-static int _focus_candidates_cnt = 0;
 static mmi_client* _cur_focus_client = NULL;
-Ecore_Event_Handler *_event_handlers[2];
 Ecore_Event_Handler *_exit_event_handlers;
 
-int
-mmi_manager_remove_client_from_focus_candidates(mmi_client *client)
-{
-       if (!client)
-               return -1;
-
-       if (client != eina_list_data_find(_focus_candidates, client))
-       {
-               return -1;
-       }
-
-       _focus_candidates = eina_list_remove(_focus_candidates, client);
-       LOGI("Client(=%s) has been removed from focus_candidates !\n",
-               client_manager_get_client_sender(client));
-       _focus_candidates_cnt--;
-       return 0;
-}
-
-int
-_add_focus_change_event(mmi_client *cur_focus, mmi_client *new_focus)
-{
-       mmi_manager_event_focus_change *ev = NULL;
-       ev = calloc(1, sizeof(mmi_manager_event_focus_change));
-
-       if (!ev)
-       {
-               LOGE("Failed to allocate memory for focus change !\n");
-               return -1;
-       }
-
-       ev->timestamp = ecore_time_get();
-       ev->cur_focus = cur_focus;
-       ev->new_focus = new_focus;
-
-       ecore_event_add(MMI_MANAGER_EVENT_FOCUS_CHANGE, ev, NULL, NULL);
-       return 0;
-}
-
-int
-mmi_manager_remove_focus_client(mmi_client *client)
-{
-       mmi_client *new_focus = NULL;
-
-       if (!client || (client != _cur_focus_client) || !client_manager_get_client_has_focus(client))
-       {
-               LOGE("Invalid client was given !\n");
-               return -1;
-       }
-
-       new_focus = eina_list_nth(_focus_candidates, 0);
-       if(new_focus)
-               mmi_manager_remove_client_from_focus_candidates(new_focus);
-       return _add_focus_change_event(NULL, new_focus);
-}
-
-int
-mmi_manager_set_focus_client(mmi_client *client)
-{
-       if (!client)
-               return -1;
-
-       LOGI("...");
-
-       return _add_focus_change_event(_cur_focus_client, client);
-}
-
-int
-mmi_manager_set_state(mmi_client *client, mmi_state state)
-{
-       mmi_fusion_handle *fusion = NULL;
-
-       if (!client)
-               return -1;
-
-       if (client_manager_get_client_state(client) == state)
-       {
-               LOGI("Given state equals to the current state(=%d) of client !\n", state);
-               return 0;
-       }
-
-       LOGI("...");
-
-       fusion = modality_fusions_get_client_fusion(client);
-       if (!fusion)
-       {
-               LOGE("Failed to get fusion handle from client(%p)\n", client);
-               return 0;
-       }
-
-       if (state == modality_fusion_get_state(fusion))
-       {
-               LOGE("Given state equals to existing state(%d) of fusion !\n", state);
-               return 0;
-       }
-
-       if (state != modality_fusion_set_state(fusion, state))
-       {
-               LOGE("Failed to set state(%d) on fusion !\n", state);
-               return 0;
-       }
-
-       mmi_manager_event_state_change *ev = NULL;
-       ev = calloc(1, sizeof(mmi_manager_event_state_change));
-
-       if (!ev)
-       {
-               LOGE("Failed to allocate memory for state change !\n");
-               goto err;
-       }
-
-       ev->timestamp = ecore_time_get();
-       ev->client = client;
-       ev->from_state = client_manager_get_client_state(client);
-       ev->to_state = state;
-
-       ecore_event_add(MMI_MANAGER_EVENT_STATE_CHANGE, ev, NULL, NULL);
-       return 0;
-err:
-       return -1;
-}
-
-mmi_client *
-mmi_manager_get_focus_client(void)
-{
-       return _cur_focus_client;
-}
-
-static void
-_event_init()
-{
-       MMI_MANAGER_EVENT_FOCUS_CHANGE = ecore_event_type_new();
-       MMI_MANAGER_EVENT_STATE_CHANGE = ecore_event_type_new();
-}
-
-static void
-_event_shutdown()
-{
-       MMI_MANAGER_EVENT_FOCUS_CHANGE = -1;
-       MMI_MANAGER_EVENT_STATE_CHANGE = -1;
-}
-
-static Eina_Bool
-_focus_change_cb(void *data EINA_UNUSED, int type, void *event)
-{
-       int r;
-       focus_event_arg arg;
-
-       LOGI("...");
-
-       mmi_manager_event_focus_change *ev = (mmi_manager_event_focus_change *)event;
-
-       arg.type = MMI_EVENT_FOCUS_TYPE_OUT;
-       arg.timestamp = ecore_time_get();
-       arg.focus_in = false;
-
-       if (ev->cur_focus)
-       {
-               r = client_manager_send_focus_event(ev->cur_focus, &arg);
-               client_manager_set_client_has_focus(ev->cur_focus, false);
-               if (r)
-                       LOGE("Failed to send focus event(=%d) to client(%p) !\n",
-                                       MMI_EVENT_FOCUS_TYPE_OUT, ev->cur_focus);
-       }
-
-       arg.type = MMI_EVENT_FOCUS_TYPE_IN;
-       arg.timestamp = ecore_time_get();
-       arg.focus_in = true;
-
-       if (ev->new_focus)
-       {
-               r = client_manager_send_focus_event(ev->new_focus, &arg);
-               client_manager_set_client_has_focus(ev->new_focus, true);
-               if (r)
-                       LOGE("Failed to send focus event(=%d) to client(%p) !\n",
-                                       MMI_EVENT_FOCUS_TYPE_IN, ev->new_focus);
-       }
-
-       LOGI("Focused client has been changed. (%s -> %s)\n",
-                       ev->cur_focus ? client_manager_get_client_sender(ev->cur_focus) : "NONE",
-                       client_manager_get_client_sender(ev->new_focus));
-
-       if (ev->cur_focus)
-       {
-               _focus_candidates = eina_list_prepend(_focus_candidates, ev->cur_focus);
-               _focus_candidates_cnt++;
-       }
-
-       _cur_focus_client = ev->new_focus;
-
-       return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_state_change_cb(void *data EINA_UNUSED, int type, void *event)
-{
-       int r;
-       state_change_event_arg arg;
-
-       LOGI("...");
-
-       mmi_manager_event_state_change *ev = (mmi_manager_event_state_change *)event;
-
-       arg.type = MMI_EVENT_STATE_CHANGE_TYPE_STATE_CHANGE;
-       arg.timestamp = ecore_time_get();
-       arg.state = ev->to_state;
-       arg.old_state = ev->from_state;
-
-       if (ev->client)
-       {
-               if (ev->to_state != client_manager_set_client_state(ev->client, ev->to_state))
-               {
-                       LOGE("Failed to set client state ! (client:%p, state=%d)\n",
-                                       ev->client, ev->to_state);
-                       return ECORE_CALLBACK_PASS_ON;
-               }
-
-               r = client_manager_send_state_change_event(ev->client, &arg);
-               if (r)
-                       LOGE("Failed to send state cnahnge event(=%d) to client(%p) !\n",
-                                       MMI_EVENT_STATE_CHANGE_TYPE_STATE_CHANGE, ev->client);
-       }
-       else
-       {
-               LOGE("Abnormal state change event ! (No client info !)\n");
-               return ECORE_CALLBACK_PASS_ON;
-       }
-
-       LOGI("State of client(%p) has been changed. (%d->%d)\n", ev->client, ev->from_state, ev->to_state);
-
-       return ECORE_CALLBACK_PASS_ON;
-}
-
 static Eina_Bool
 _mmi_manager_exit_cb(void *data EINA_UNUSED, int type, void *event)
 {
@@ -284,10 +49,6 @@ _mmi_manager_exit_cb(void *data EINA_UNUSED, int type, void *event)
 static void
 _event_handler_init()
 {
-       _event_handlers[0] = ecore_event_handler_add(MMI_MANAGER_EVENT_FOCUS_CHANGE,
-                               _focus_change_cb, NULL);
-       _event_handlers[1] = ecore_event_handler_add(MMI_MANAGER_EVENT_STATE_CHANGE,
-                               _state_change_cb, NULL);
        _exit_event_handlers = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,
                                _mmi_manager_exit_cb, NULL);
 }
@@ -295,10 +56,7 @@ _event_handler_init()
 static void
 _event_handler_shutdown()
 {
-       ecore_event_handler_del(_event_handlers[0]);
-       ecore_event_handler_del(_event_handlers[1]);
        ecore_event_handler_del(_exit_event_handlers);
-       _event_handlers[0] = _event_handlers[1] = NULL;
        _exit_event_handlers = NULL;
 }
 
@@ -309,13 +67,12 @@ mmi_manager_init()
                return;
 
        ecore_init();
-       _event_init();
 
        mmi_core_init();
        modality_providers_init();
        modality_fusions_init();
        client_manager_init();
-       mmi_api_handler_init();
+       mmi_api_handler_initialize();
 
        _event_handler_init();
 
@@ -358,17 +115,14 @@ mmi_manager_shutdown()
 
        _event_handler_shutdown();
 
-       mmi_api_handler_shutdown();
+       mmi_api_handler_deinitialize();
        client_manager_shutdown();
        modality_fusions_shutdown();
        modality_providers_shutdown();
        mmi_core_shutdown();
 
        ecore_shutdown();
-       _event_shutdown();
 
        _init_done = false;
-       _focus_candidates = NULL;
-       _focus_candidates_cnt = 0;
        _cur_focus_client = NULL;
 }
index 7635af7..b6a768b 100644 (file)
@@ -48,11 +48,6 @@ typedef struct
 extern "C" {
 #endif
 
-int mmi_manager_set_focus_client(mmi_client *client);
-int mmi_manager_set_state(mmi_client *client, mmi_state state);
-int mmi_manager_remove_client_from_focus_candidates(mmi_client *client);
-int mmi_manager_remove_focus_client(mmi_client *client);
-
 mmi_client* mmi_manager_get_focus_client(void);
 
 void mmi_manager_init(void);
index 8bf0a97..b22878a 100644 (file)
@@ -92,7 +92,7 @@ _focus_change_cb(void *data EINA_UNUSED, int type, void *event)
        else if (ev->cur_focus)
        {
                //Set op_mode to MODALITY_PROVIDER_MODE_DROP_EVENT
-               state = client_manager_get_client_state(ev->cur_focus);
+               //state = client_manager_get_client_state(ev->cur_focus);
                LOGI("state=%d, ev->cur_focus(%p) !\n", state, ev->cur_focus);
        }
 
index 9a86413..07a5a26 100644 (file)
@@ -24,6 +24,7 @@
 #include "mmi-client.h"
 #include "mmi-manager.h"
 #include "mmi-manager-tests.h"
+#include <glib.h>
 
 class MMIClientTest : public ::testing::Test
 {
@@ -123,22 +124,18 @@ TEST_F(MMIClientTest, MMIClientSetGetClientPID)
        client_manager_shutdown();
 }
 
-TEST_F(MMIClientTest, MMIClientSetGetClientState)
+TEST_F(MMIClientTest, MMIClientGetClientSender)
 {
        const char *app_id = "org.tizen.mmi-system-ux-test";
+       const char *sender = nullptr;
        mmi_client *mc = nullptr;
-       mmi_state state = MMI_STATE_NONE;
        int res = 0;
 
        client_manager_init();
        mc = client_manager_add_client(app_id);
 
-       state = client_manager_get_client_state(mc);
-       EXPECT_EQ(state, MMI_STATE_NONE);
-       state = client_manager_set_client_state(mc, MMI_STATE_INITIATION);
-       EXPECT_EQ(state, MMI_STATE_INITIATION);
-       state = client_manager_get_client_state(mc);
-       EXPECT_EQ(state, MMI_STATE_INITIATION);
+       sender = client_manager_get_client_sender(mc);
+       EXPECT_NE(sender, nullptr);
 
        res = client_manager_remove_client(app_id);
        EXPECT_EQ(res, 0);
@@ -146,41 +143,64 @@ TEST_F(MMIClientTest, MMIClientSetGetClientState)
        client_manager_shutdown();
 }
 
-TEST_F(MMIClientTest, MMIClientSetGetClientHasFocus)
+void voice_touch_callback(int input_event_type, const char *result_out, void *user_data)
+{
+}
+
+TEST_F(MMIClientTest, MMIClientRegisterInputEvent)
 {
+       int res = 0;
        const char *app_id = "org.tizen.mmi-system-ux-test";
+       void *h = nullptr, *ret_h;
        mmi_client *mc = nullptr;
-       bool has_focus = false;
-       int res = 0;
+       int input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+       rpc_port_stub_mmi_result_cb_h callback = (rpc_port_stub_mmi_result_cb_s*)voice_touch_callback;
 
        client_manager_init();
        mc = client_manager_add_client(app_id);
 
-       has_focus = client_manager_get_client_has_focus(mc);
-       EXPECT_EQ(has_focus, false);
-       has_focus = client_manager_set_client_has_focus(mc, true);
-       EXPECT_EQ(has_focus, true);
-       has_focus = client_manager_get_client_has_focus(mc);
-       EXPECT_EQ(has_focus, true);
+       res = client_manager_register_input_event(mc, input_event_type, callback);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
+
+       GList *iter = nullptr;
+       mmi_result_cb_s *data = nullptr;
+
+       int num = g_list_length(mc->result_cb_list);
+       EXPECT_EQ(num, 1);
+
+       if (g_list_length(mc->result_cb_list) > 0) {
+               iter = g_list_first(mc->result_cb_list);
+               while (iter != nullptr) {
+                       data = (mmi_result_cb_s *)iter->data;
+                       if (data != nullptr) {
+                               EXPECT_EQ(data->input_event_type, input_event_type);
+                       }
+                       iter = g_list_next(iter);
+               }
+       }
 
        res = client_manager_remove_client(app_id);
        EXPECT_EQ(res, 0);
 
+       mc = client_manager_get_client(app_id);
+       EXPECT_EQ(mc, nullptr);
+
        client_manager_shutdown();
 }
 
-TEST_F(MMIClientTest, MMIClientGetClientSender)
+TEST_F(MMIClientTest, MMIClientRegisterInputEventFail)
 {
+       int res = 0;
        const char *app_id = "org.tizen.mmi-system-ux-test";
-       const char *sender = nullptr;
+       void *h = nullptr, *ret_h;
        mmi_client *mc = nullptr;
-       int res = 0;
+       int input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
 
        client_manager_init();
        mc = client_manager_add_client(app_id);
 
-       sender = client_manager_get_client_sender(mc);
-       EXPECT_NE(sender, nullptr);
+       res = client_manager_register_input_event(mc, input_event_type, nullptr);
+       EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
 
        res = client_manager_remove_client(app_id);
        EXPECT_EQ(res, 0);
@@ -188,115 +208,75 @@ TEST_F(MMIClientTest, MMIClientGetClientSender)
        client_manager_shutdown();
 }
 
-TEST_F(MMIClientTest, MMIClientSetGetClientEventCB)
+TEST_F(MMIClientTest, MMIClientActivateInputEvent)
 {
        int res = 0;
        const char *app_id = "org.tizen.mmi-system-ux-test";
-       void *h = nullptr, *ret_h;
        mmi_client *mc = nullptr;
-
-       int *_event_cb = (int *)calloc(1, sizeof(int));
+       int input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+       rpc_port_stub_mmi_result_cb_h callback = (rpc_port_stub_mmi_result_cb_s*)voice_touch_callback;
 
        client_manager_init();
        mc = client_manager_add_client(app_id);
 
-       //focus_event_cb
-       h = client_manager_set_client_focus_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
-
-       ret_h = client_manager_get_client_focus_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
-
-       //state_event_cb
-       h = client_manager_set_client_state_change_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
-
-       ret_h = client_manager_get_client_state_change_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
+       res = client_manager_register_input_event(mc, input_event_type, callback);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
 
-       //wakeup_event_cb
-       h = client_manager_set_client_wakeup_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
+       res = client_manager_activate_input_event(mc, input_event_type);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
 
-       ret_h = client_manager_get_client_wakeup_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
-
-       //key_event_cb
-       h = client_manager_set_client_key_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
-
-       ret_h = client_manager_get_client_key_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
-
-       //gesture_event_cb
-       h = client_manager_set_client_gesture_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
-
-       ret_h = client_manager_get_client_gesture_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
+       res = client_manager_remove_client(app_id);
+       EXPECT_EQ(res, 0);
 
-       //voice_event_cb
-       h = client_manager_set_client_voice_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
+       mmi_manager_shutdown();
+}
 
-       ret_h = client_manager_get_client_voice_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
+TEST_F(MMIClientTest, MMIClientActivateInputEventFail)
+{
+       int res = 0;
+       const char *app_id = "org.tizen.mmi-system-ux-test";
+       mmi_client *mc = nullptr;
+       int input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+       rpc_port_stub_mmi_result_cb_h callback = (rpc_port_stub_mmi_result_cb_s*)voice_touch_callback;
 
-       //action_event_cb
-       h = client_manager_set_client_action_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
+       client_manager_init();
+       mc = client_manager_add_client(app_id);
 
-       ret_h = client_manager_get_client_action_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
+       res = client_manager_register_input_event(mc, input_event_type, callback);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
 
-       //feedback_event_cb
-       h = client_manager_set_client_feedback_cb_handle(mc, (void *)_event_cb);
-       EXPECT_NE(h, nullptr);
+       res = client_manager_activate_input_event(mc, input_event_type);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
 
-       ret_h = client_manager_get_client_feedback_cb_handle(mc);
-       EXPECT_EQ(h, ret_h);
+       res = client_manager_activate_input_event(mc, input_event_type);
+       EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
 
        res = client_manager_remove_client(app_id);
        EXPECT_EQ(res, 0);
 
-       free(_event_cb);
-
-       client_manager_shutdown();
+       mmi_manager_shutdown();
 }
 
-TEST_F(MMIClientTest, MMIClientSendClientEvent)
+TEST_F(MMIClientTest, MMIClientActivateInputEventFail2)
 {
+       int res = 0;
        const char *app_id = "org.tizen.mmi-system-ux-test";
        mmi_client *mc = nullptr;
-       int res = 0;
-       mmi_manager_init();
+       int input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+       rpc_port_stub_mmi_result_cb_h callback = (rpc_port_stub_mmi_result_cb_s*)voice_touch_callback;
 
+       client_manager_init();
        mc = client_manager_add_client(app_id);
-       EXPECT_NE(mc, nullptr);
 
-       /* TODO: set focus_cb handle using client_manager_set_client_key_cb_handle()
-       error says 'Given client doesn't have focus_cb handle !'
+       res = client_manager_register_input_event(mc, input_event_type, callback);
+       EXPECT_EQ(res, MMI_ERROR_NONE);
 
-       focus_event_arg arg;
-
-       arg.type = MMI_EVENT_FOCUS_TYPE_OUT;
-       arg.timestamp = ecore_time_get();
-       arg.focus_in = false;
-
-       PRINT("\n\nTC: client_manager_send_focus_event(FOCUS_IN)\n\n");
-       res = client_manager_send_focus_event(mc, &arg);
-       client_manager_set_client_has_focus(mc, false);
-       EXPECT_EQ(res, 0);
+       mc = client_manager_add_client(app_id);
+       EXPECT_NE(mc, nullptr);
 
-       arg.type = MMI_EVENT_FOCUS_TYPE_OUT;
-       arg.timestamp = ecore_time_get();
-       arg.focus_in = true;
+       res = client_manager_activate_input_event(mc, MMI_INPUT_EVENT_TYPE_VOICE_RECOGNITION);
+       EXPECT_EQ(res, MMI_ERROR_INVALID_PARAMETER);
 
-       PRINT("\n\nTC: client_manager_send_focus_event(FOCUS_OUT)\n\n");
-       res = client_manager_send_focus_event(mc, &arg);
-       client_manager_set_client_has_focus(mc, true);
-       EXPECT_EQ(res, 0);
-       */
        res = client_manager_remove_client(app_id);
        EXPECT_EQ(res, 0);
 
index e996e81..11523e8 100644 (file)
@@ -51,119 +51,4 @@ TEST_F(MMIMANAGERMainTest, MMIMANAGERMainInit)
        mmi_manager_shutdown();
 }
 
-TEST_F(MMIMANAGERMainTest, MMIMANAGERMainSetGetFocusClient)
-{
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_client *mc = NULL, *mc_temp = NULL;
-       int res = 0;
-
-       mmi_manager_init();
-       mc = client_manager_add_client(app_id);
-
-       res = mmi_manager_set_focus_client(mc);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc, mc_temp);
-
-       res = client_manager_remove_client(app_id);
-       mmi_manager_shutdown();
-}
-
-TEST_F(MMIMANAGERMainTest, MMIMANAGERMainSetState)
-{
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_client *mc = NULL;
-       int res = 0;
-
-       mmi_manager_init();
-       mc = client_manager_add_client(app_id);
-
-       res = mmi_manager_set_state(mc, MMI_STATE_INITIATION);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mmi_state state = client_manager_get_client_state(mc);
-       EXPECT_EQ(state, MMI_STATE_INITIATION);
-
-       res = client_manager_remove_client(app_id);
-       mmi_manager_shutdown();
-}
-
-TEST_F(MMIMANAGERMainTest, MMIMANAGERMainRemoveClientFromFocusCandidate)
-{
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       const char *app_id_new = "org.tizen.mmi-system-ux-test-new";
-       int res = 0;
-       mmi_client *mc = NULL, *mc_new = NULL, *mc_temp = NULL;
-
-       mmi_manager_init();
-       mc = client_manager_add_client(app_id);
-       res = mmi_manager_set_focus_client(mc);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc, mc_temp);
-
-       mc_new = client_manager_add_client(app_id_new);
-       res = mmi_manager_set_focus_client(mc_new);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc_new, mc_temp);
-
-       res = mmi_manager_remove_client_from_focus_candidates(mc);
-       EXPECT_EQ(res, 0);
-
-       res = client_manager_remove_client(app_id);
-       res = client_manager_remove_client(app_id_new);
-       mmi_manager_shutdown();
-}
-
-TEST_F(MMIMANAGERMainTest, MMIMANAGERMainRemoveFocusClient)
-{
-       int res = 0;
-       mmi_client *mc = NULL, *mc_new = NULL, *mc_temp = NULL;
-       const char *app_id = "org.tizen.mmi-system-ux-test3";
-       const char *app_id_new = "org.tizen.mmi-system-ux-test_new4";
-
-       mmi_manager_init();
-       mc = client_manager_add_client(app_id);
-       res = mmi_manager_set_focus_client(mc);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc, mc_temp);
-
-       mc_new = client_manager_add_client(app_id_new);
-       res = mmi_manager_set_focus_client(mc_new);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc_new, mc_temp);
-
-       res = mmi_manager_remove_focus_client(mc_new);
-       EXPECT_EQ(res, 0);
-
-       wait_for_dispatch();
-
-       mc_temp = mmi_manager_get_focus_client();
-       EXPECT_EQ(mc, mc_temp);
-
-       res = client_manager_remove_client(app_id);
-       res = client_manager_remove_client(app_id_new);
-       mmi_manager_shutdown();
-}
-
 } // namespace
index 165e688..ed51938 100644 (file)
@@ -1,79 +1,8 @@
-struct focus_event {
-   int type;
-   int timestamp;
-   bool focus_in;
-}
-
-struct state_change_event {
-   int type;
-   int timestamp;
-   int state;
-   int old_state;
-}
-
-struct wakeup_event {
-   int type;
-   int timestamp;
-   string source;
-}
-
-struct key_event {
-   int type;
-   int timestamp;
-   bool key_down;
-   int keycode;
-   string keyname;
-   string source;
-}
-
-struct gesture_event {
-   int type;
-   int timestamp;
-   string source;
-}
-
-struct voice_event {
-   int type;
-   int timestamp;
-   string source;
-}
-
-struct action_event {
-   int type;
-   int timestamp;
-   string cmd;
-   array<string> args;
-   int nargs;
-   string source;
-}
-
-struct feedback_event {
-   int type;
-   int timestamp;
-   string feedback;
-   string comment;
-}
-
 interface mmi {
-   void focus_event_cb(focus_event args) delegate;
-   void state_change_event_cb(state_change_event args) delegate;
-   void wakeup_event_cb(wakeup_event args) delegate;
-   void key_event_cb(key_event args) delegate;
-   void gesture_event_cb(gesture_event args) delegate;
-   void voice_event_cb(voice_event args) delegate;
-   void action_event_cb(action_event args) delegate;
-   void feedback_event_cb(feedback_event args) delegate;
+       void result_cb(int input_event_type, string result_out) delegate;
 
-   int register_cb(focus_event_cb focus_cb,
-                   state_change_event_cb state_cb,
-                   wakeup_event_cb wakeup_cb,
-                   key_event_cb key_cb,
-                   gesture_event_cb gesture_cb,
-                   voice_event_cb voice_cb,
-                   action_event_cb action_cb,
-                   feedback_event_cb feedback_cb);
-   void deregister_cb() async;
-   void get_focus() async;
-   void set_state(int state) async;
-}
+       int register_input_event(int input_event_type, result_cb callback);
 
+       int activate_input_event(int input_event_type);
+       int deactivate_input_event(int input_event_type);
+}