mmi-client: add apis for setting/getting each mmifw event callback handle for a client 24/264024/1
authorSung-Jin Park <sj76.park@samsung.com>
Sun, 18 Jul 2021 15:46:30 +0000 (00:46 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 13 Sep 2021 11:24:05 +0000 (20:24 +0900)
Change-Id: I4b7203e0268c1047ed2bc0d840662bd6f7322749
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/mmi-client.c
src/mmi-client.h

index 6edc310..043f68b 100644 (file)
 
 struct _mmi_client
 {
-        char *sender;
-        uid_t uid;
-        pid_t pid;
-        mmi_state state;
+       char *sender;
+       uid_t uid;
+       pid_t pid;
+       mmi_state state;
+
+       rpc_port_focus_event_h focus_cb_h;
+       rpc_port_state_change_event_h state_change_cb_h;
+       rpc_port_wakeup_event_h wakeup_cb_h;
+       rpc_port_key_event_h key_cb_h;
+       rpc_port_gesture_event_h gesture_cb_h;
+       rpc_port_voice_event_h voice_cb_h;
+       rpc_port_action_event_h action_cb_h;
+       rpc_port_feedback_event_h feedback_cb_h;
 };
 
 Eina_Hash *_client_hash = NULL;
@@ -231,3 +240,220 @@ 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_focus_event_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_state_change_event_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 r;
+
+       if (!client || !wakeup_cb_h)
+               return NULL;
+
+       r = rpc_port_wakeup_event_clone(wakeup_cb_h, &client->wakeup_cb_h);
+       if (r)
+       {
+               LOGE("Failed to clone wakeup event handle ! (error:%d)\n", r);
+               return NULL;
+       }
+
+       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_key_event_clone(key_cb_h, &client->key_cb_h);
+       if (r)
+       {
+               LOGE("Failed to clone key event handle ! (error:%d)\n", r);
+               return NULL;
+       }
+
+       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;
+}
+
+void *
+client_manager_set_client_gesture_cb_handle(mmi_client *client, void *gesture_cb_h)
+{
+       int r;
+
+       if (!client || !gesture_cb_h)
+               return NULL;
+
+       r = rpc_port_gesture_event_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;
+}
+
+void *
+client_manager_get_client_gesture_cb_handle(mmi_client *client)
+{
+       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;
+
+       if (!client || !voice_cb_h)
+               return NULL;
+
+       r = rpc_port_voice_event_clone(voice_cb_h, &client->voice_cb_h);
+       if (r)
+       {
+               LOGE("Failed to clone voice event handle ! (error:%d)\n", r);
+               return NULL;
+       }
+
+       return client->voice_cb_h;
+}
+
+void *
+client_manager_get_client_voice_cb_handle(mmi_client *client)
+{
+       if (!client)
+               return NULL;
+
+       return client->voice_cb_h;
+}
+
+void *
+client_manager_set_client_action_cb_handle(mmi_client *client, void *action_cb_h)
+{
+       int r;
+
+       if (!client || !action_cb_h)
+               return NULL;
+
+       r = rpc_port_action_event_clone(action_cb_h, &client->action_cb_h);
+       if (r)
+       {
+               LOGE("Failed to clone action event handle ! (error:%d)\n", r);
+               return NULL;
+       }
+
+       return client->action_cb_h;
+}
+
+void *
+client_manager_get_client_action_cb_handle(mmi_client *client)
+{
+       if (!client)
+               return NULL;
+
+       return client->action_cb_h;
+}
+
+void *
+client_manager_set_client_feedback_cb_handle(mmi_client *client, void *feedback_cb_h)
+{
+       int r;
+
+       if (!client || !feedback_cb_h)
+               return NULL;
+
+       r = rpc_port_feedback_event_clone(feedback_cb_h, &client->feedback_cb_h);
+       if (r)
+       {
+               LOGE("Failed to clone feedback event handle ! (error:%d)\n", r);
+               return NULL;
+       }
+
+       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;
+}
index ca0755e..feb07aa 100644 (file)
@@ -43,6 +43,23 @@ 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);
 
+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);
+
 void client_manager_init(void);
 void client_manager_shutdown(void);