remove ecore event and handling functions 86/281586/1
authordyamy-lee <dyamy.lee@samsung.com>
Mon, 22 Aug 2022 09:01:02 +0000 (18:01 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 20 Sep 2022 04:44:42 +0000 (13:44 +0900)
Following change of the architecture, these ecore events and handling functions will not use.
So, remove all these in src and tests, too.

Change-Id: I9a8a7f128b21ce1cf2236dd550561472595737c8

src/mmi-ipc.c
src/mmi.c
src/mmi.h
tests/mmi-main-test.cpp

index ef787bf..1b20f80 100644 (file)
@@ -87,7 +87,6 @@ static void _on_connected(rpc_port_proxy_mmi_h h, void *user_data)
        }
        _connected = 1;
        ev->connected = true;
-       ecore_event_add(MMI_EVENT_CONNECTION, ev, NULL, user_data);
 
        LOGI("...");
        return;
@@ -110,7 +109,6 @@ static void _on_disconnected(rpc_port_proxy_mmi_h h, void *user_data)
 
        _connected = 0;
        ev->connected = false;
-       ecore_event_add(MMI_EVENT_CONNECTION, ev, NULL, user_data);
 
        LOGI("...");
 }
index f94881f..200ab4d 100644 (file)
--- a/src/mmi.c
+++ b/src/mmi.c
 
 #define ERR(x)
 
-int MMI_EVENT_CONNECTION;
-int MMI_EVENT_FOCUS;
-int MMI_EVENT_STATE_CHANGE;
-int MMI_EVENT_WAKE_UP;
-int MMI_EVENT_KEY;
-int MMI_EVENT_GESTURE;
-int MMI_EVENT_VOICE;
-int MMI_EVENT_ACTION;
-int MMI_EVENT_FEEDBACK;
-
 static int _mmi_init_count = 0;
-Eina_List *listener_list = NULL;
 
 MMI_API int
 mmi_init(void)
@@ -48,28 +37,6 @@ mmi_init(void)
 
        ecore_init();
 
-       Eina_List *l = NULL;
-       mmi_event_listener *listener = NULL;
-
-       if (listener_list)
-       {
-               EINA_LIST_FOREACH(listener_list, l, listener)
-                       ecore_event_handler_del(listener);
-
-               listener_list = eina_list_free(listener_list);
-               listener_list = NULL;
-       }
-
-       MMI_EVENT_CONNECTION = ecore_event_type_new();
-       MMI_EVENT_FOCUS = ecore_event_type_new();
-       MMI_EVENT_STATE_CHANGE = ecore_event_type_new();
-       MMI_EVENT_WAKE_UP = ecore_event_type_new();
-       MMI_EVENT_KEY = ecore_event_type_new();
-       MMI_EVENT_GESTURE = ecore_event_type_new();
-       MMI_EVENT_VOICE = ecore_event_type_new();
-       MMI_EVENT_ACTION = ecore_event_type_new();
-       MMI_EVENT_FEEDBACK = ecore_event_type_new();
-
        return _mmi_init_count;
 }
 
@@ -84,28 +51,6 @@ mmi_shutdown(void)
 
        _mmi_init_count--;
 
-       MMI_EVENT_CONNECTION = -1;
-       MMI_EVENT_FOCUS = -1;
-       MMI_EVENT_STATE_CHANGE = -1;
-       MMI_EVENT_WAKE_UP = -1;
-       MMI_EVENT_KEY = -1;
-       MMI_EVENT_GESTURE = -1;
-       MMI_EVENT_VOICE = -1;
-       MMI_EVENT_ACTION = -1;
-       MMI_EVENT_FEEDBACK = -1;
-
-       Eina_List *l = NULL;
-       mmi_event_listener *listener = NULL;
-
-       if (listener_list)
-       {
-               EINA_LIST_FOREACH(listener_list, l, listener)
-                       ecore_event_handler_del(listener);
-
-               listener_list = eina_list_free(listener_list);
-               listener_list = NULL;
-       }
-
        ecore_main_loop_quit();
        return _mmi_init_count;
 }
@@ -142,103 +87,6 @@ err:
        return NULL;
 }
 
-MMI_API mmi_event_listener *
-mmi_event_add_listener(mmi_handle h, int ev_type, mmi_event_handler_cb func, const void *data)
-{
-       mmi_event_listener *listener;
-
-       (void) h;
-
-       listener = ecore_event_handler_add(ev_type, func, data);
-       listener_list = eina_list_append(listener_list, listener);
-       return listener;
-}
-
-MMI_API mmi_result
-mmi_request_send_get_focus(mmi_handle h)
-{
-       mmi_result res = MMI_RESULT_SUCCESS;
-
-       if (!h)
-       {
-               ERR("Given mmi_handle is invalid !\n");
-               return MMI_RESULT_FAIL;
-       }
-
-       if (mmi_ipc_is_connected())
-       {
-               ERR("Connected\n");
-       }
-       else
-       {
-               ERR("Not connected yet !\n");
-               res = MMI_RESULT_FAIL;
-       }
-
-       LOGI("Get_focus request has been sent !\n");
-
-       return res;
-}
-
-MMI_API mmi_state
-mmi_state_get_current_state(mmi_handle h)
-{
-       if (!h)
-       {
-               ERR("Given mmi_handle is invalid !\n");
-               return MMI_STATE_NONE;
-       }
-
-       h->state = mmi_ipc_get_state();
-       return h->state;
-}
-
-MMI_API mmi_result
-mmi_request_send_set_state(mmi_handle h, mmi_state state)
-{
-       mmi_result res = MMI_RESULT_SUCCESS;
-
-       if (!h)
-       {
-               ERR("Given mmi_handle is invalid !\n");
-               return MMI_RESULT_FAIL;
-       }
-
-       if (state == h->state)
-       {
-               ERR("Given state equals to the current state. Ignored !\n");
-               return res;
-       }
-
-       return res;
-}
-
-MMI_API void
-mmi_event_remove_listener(mmi_handle h, mmi_event_listener *listener)
-{
-       (void) h;
-
-       if (listener_list)
-               listener_list = eina_list_remove(listener_list, listener);
-       if (listener)
-               ecore_event_handler_del(listener);
-}
-
-MMI_API void
-mmi_event_remove_all_listeners(mmi_handle h)
-{
-       Eina_List *l = NULL;
-       mmi_event_listener *listener = NULL;
-
-       (void) h;
-
-       EINA_LIST_FOREACH(listener_list, l, listener)
-               ecore_event_handler_del(listener);
-
-       listener_list = eina_list_free(listener_list);
-       listener_list = NULL;
-}
-
 MMI_API void
 mmi_instance_destroy(mmi_handle *h)
 {
index 6a15eef..a8d845b 100644 (file)
--- a/src/mmi.h
+++ b/src/mmi.h
 
 #define MMI_API __attribute__ ((visibility("default")))
 
-MMI_API extern int MMI_EVENT_CONNECTION;
-MMI_API extern int MMI_EVENT_FOCUS;
-MMI_API extern int MMI_EVENT_STATE_CHANGE;
-MMI_API extern int MMI_EVENT_WAKE_UP;
-MMI_API extern int MMI_EVENT_KEY;
-MMI_API extern int MMI_EVENT_GESTURE;
-MMI_API extern int MMI_EVENT_VOICE;
-MMI_API extern int MMI_EVENT_ACTION;
-MMI_API extern int MMI_EVENT_FEEDBACK;
-
 typedef void* mmi_rpc_h;
 typedef Eina_Bool mmi_bool;
-typedef Ecore_Event_Handler mmi_event_listener;
-typedef Ecore_Event_Handler_Cb mmi_evnt_handler_cb;
-typedef mmi_bool (*mmi_event_handler_cb)(void *data, int ev_type, void *event);
 
 typedef enum
 {
@@ -55,12 +42,6 @@ typedef enum
 typedef enum
 {
        MMI_STATE_NONE,
-       MMI_STATE_INITIATION,
-       MMI_STATE_EXPLORATION,
-       MMI_STATE_EXECUTION,
-       MMI_STATE_FEEDBACK,
-       MMI_STATE_OBSERVATION,
-       MMI_STATE_TERMINATION
 } mmi_state;
 
 typedef struct
@@ -83,13 +64,6 @@ MMI_API int mmi_shutdown(void);
 MMI_API mmi_handle mmi_instance_create(const char *app_id);
 MMI_API void mmi_instance_destroy(mmi_handle *h);
 
-MMI_API mmi_event_listener *mmi_event_add_listener(mmi_handle h, int ev_type, mmi_event_handler_cb func, const void *data);
-MMI_API mmi_result mmi_request_send_get_focus(mmi_handle h);
-MMI_API mmi_state mmi_state_get_current_state(mmi_handle h);
-MMI_API mmi_result mmi_request_send_set_state(mmi_handle h, mmi_state state);
-MMI_API void mmi_event_remove_listener(mmi_handle h, mmi_event_listener *listener);
-MMI_API void mmi_event_remove_all_listeners(mmi_handle h);
-
 #ifdef __cplusplus
 }
 #endif
index ede6eaf..d6b5f09 100644 (file)
@@ -40,16 +40,6 @@ public:
        }
 };
 
-void wait_for_state_change(mmi_handle h, mmi_state state)
-{
-       int timer = 0;
-       while (state != mmi_state_get_current_state(h) && timer < MAX_WAIT_TIME)
-       {
-               ecore_main_loop_iterate();
-               timer++;
-       }
-}
-
 TEST_F(MMIMainTest, MMIMainInit)
 {
        int res = mmi_init();
@@ -114,213 +104,3 @@ TEST_F(MMIMainTest, MMIMainInstanceCreateFail)
        if(res)
                mmi_shutdown();
 }
-
-static Eina_Bool
-_cb_focus(void *data, int type, void *event)
-{
-       if (!event)
-               return ECORE_CALLBACK_PASS_ON;
-
-       EXPECT_TRUE(true);
-       return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_cb_connection(void *data, int type, void *event)
-{
-       if (!event)
-               return ECORE_CALLBACK_PASS_ON;
-
-       EXPECT_TRUE(true);
-       return ECORE_CALLBACK_PASS_ON;
-}
-
-TEST_F(MMIMainTest, MMIMainEventAddSingleListener)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-       mmi_event_listener * handler = NULL;
-
-       EXPECT_NE(h, nullptr);
-
-       if(h){
-               handler = mmi_event_add_listener(h, MMI_EVENT_CONNECTION, _cb_connection, h);
-       }
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       EXPECT_NE(handler, nullptr);
-
-       if(handler)
-               mmi_event_remove_listener(h, handler);
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
-
-TEST_F(MMIMainTest, MMIMainEventAddSingleListenerFail)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-       mmi_event_listener * handler =NULL;
-
-       EXPECT_NE(h, nullptr);
-
-       if(h){
-               handler = mmi_event_add_listener(h, MMI_EVENT_CONNECTION, NULL, NULL);
-       }
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       EXPECT_EQ(handler, nullptr);
-
-       if(handler)
-               mmi_event_remove_listener(h, handler);
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
-
-TEST_F(MMIMainTest, MMIMainEventAddSingleListenerSecondFail)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-       mmi_event_listener * handler =NULL;
-
-       EXPECT_NE(h, nullptr);
-
-       if(h){
-               handler = mmi_event_add_listener(h, 100, _cb_connection, NULL);
-       }
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       EXPECT_EQ(handler, nullptr);
-
-       if(handler)
-               mmi_event_remove_listener(h, handler);
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
-
-TEST_F(MMIMainTest, MMIMainRequestSendGetFocus)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-
-       EXPECT_NE(h, nullptr);
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       if(h){
-               mmi_result mmi_res = mmi_request_send_get_focus(h);
-               EXPECT_EQ(mmi_res, MMI_RESULT_SUCCESS);
-       }
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
-
-TEST_F(MMIMainTest, MMIMainRequestSendSetGetState)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-
-       EXPECT_NE(h, nullptr);
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       if(h){
-               mmi_result mmi_res = mmi_request_send_get_focus(h);
-               EXPECT_EQ(mmi_res, MMI_RESULT_SUCCESS);
-
-               mmi_state state = MMI_STATE_INITIATION;
-               mmi_res  = mmi_request_send_set_state(h, state);
-               EXPECT_EQ(mmi_res, MMI_RESULT_SUCCESS);
-
-               wait_for_state_change(h, MMI_STATE_INITIATION);
-
-               state = mmi_state_get_current_state(h);
-               EXPECT_EQ(state, MMI_STATE_NONE);
-       }
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
-
-TEST_F(MMIMainTest, MMIMainEventRemoveAllListener)
-{
-       int res = mmi_init();
-       const char *app_id = "org.tizen.mmi-system-ux-test";
-       mmi_handle h = mmi_instance_create(app_id);
-       mmi_event_listener * handler = NULL;
-       mmi_event_listener * handler2 = NULL;
-
-       EXPECT_NE(h, nullptr);
-       EXPECT_EQ(handler, nullptr);
-
-       wait_for_connect();
-
-       EXPECT_TRUE(mmi_ipc_is_connected());
-
-       if(h){
-               handler = mmi_event_add_listener(h, MMI_EVENT_CONNECTION, _cb_connection, h);
-               handler2 = mmi_event_add_listener(h, MMI_EVENT_FOCUS, _cb_focus, h);
-       }
-
-       EXPECT_NE(handler, nullptr);
-       EXPECT_NE(handler2, nullptr);
-
-       if(handler) {
-               mmi_event_remove_all_listeners(h);
-       }
-
-       if(h){
-               mmi_instance_destroy(&h);
-               EXPECT_EQ(h, nullptr);
-       }
-
-       if(res)
-               mmi_shutdown();
-}
\ No newline at end of file