From e476f25d87ecd930abf8c87951b2f45b89717ce2 Mon Sep 17 00:00:00 2001 From: hj kim Date: Mon, 14 May 2018 13:25:01 +0900 Subject: Change mp_ipc_send_mssage API to get the request id Change-Id: I6877c948f7034c74527b0957cc7ce8ef150e4ea1 --- include/media_controller_private.h | 2 +- src/media_controller_client.c | 14 +++++++------- src/media_controller_ipc.c | 5 ++++- src/media_controller_server.c | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/media_controller_private.h b/include/media_controller_private.h index dc99203..c7465ea 100755 --- a/include/media_controller_private.h +++ b/include/media_controller_private.h @@ -280,7 +280,7 @@ int mc_ipc_unref_dbus_connection(GDBusConnection *conn, int *dref_count); int mc_ipc_register_listener(GList **manage_list, GDBusConnection *connection, const char *interface_name, const char *signal_name, mc_signal_received_cb callback, void *user_data); int mc_ipc_unregister_listener(GList **manage_list, GDBusConnection *connection, const char *interface_name, const char *signal_name); int mc_ipc_unregister_all_listener(GList **manage_list, GDBusConnection *connection); -int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char* signal_name, const char* message, int flags); +int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char* signal_name, const char* message, unsigned int *request_id); int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, const int type, const char *request_msg); int mc_ipc_service_connect(const int type); diff --git a/src/media_controller_client.c b/src/media_controller_client.c index 1b449c6..8a2f897 100755 --- a/src/media_controller_client.c +++ b/src/media_controller_client.c @@ -1096,7 +1096,7 @@ int mc_client_send_playback_state_command(mc_client_h client, const char *server mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_STATE_CMD, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_STATE_CMD, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1128,7 +1128,7 @@ int mc_client_send_playback_action(mc_client_h client, const char *server_name, mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_ACTION, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_ACTION, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1159,7 +1159,7 @@ int mc_client_send_playback_position_command(mc_client_h client, const char *ser mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1191,7 +1191,7 @@ int mc_client_send_shuffle_mode_command(mc_client_h client, const char *server_n mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1223,7 +1223,7 @@ int mc_client_send_repeat_mode_command(mc_client_h client, const char *server_na mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1275,7 +1275,7 @@ int mc_client_send_custom_command(mc_client_h client, const char *server_name, c mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message"); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -1309,7 +1309,7 @@ int mc_client_send_playlist_command(mc_client_h client, const char *server_name, mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret); char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name); - ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, message, 0); + ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); diff --git a/src/media_controller_ipc.c b/src/media_controller_ipc.c index 22415ae..e69ebc0 100755 --- a/src/media_controller_ipc.c +++ b/src/media_controller_ipc.c @@ -276,7 +276,7 @@ int mc_ipc_unregister_all_listener(GList **listener_list, GDBusConnection *conne return MEDIA_CONTROLLER_ERROR_NONE; } -int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, int flags) +int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, unsigned int *request_id) { GError *error = NULL; @@ -303,6 +303,9 @@ int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, cons return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } + if (request_id != NULL) + mc_util_get_request_id(request_id); + return MEDIA_CONTROLLER_ERROR_NONE; } diff --git a/src/media_controller_server.c b/src/media_controller_server.c index dfab1a3..59ffc60 100755 --- a/src/media_controller_server.c +++ b/src/media_controller_server.c @@ -401,7 +401,7 @@ static int __mc_server_send_message(media_controller_server_s *mc_server, const return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION; } - ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, signal_name, message, 0); + ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, signal_name, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); @@ -413,7 +413,7 @@ static int __mc_server_send_message(media_controller_server_s *mc_server, const if (ret != MEDIA_CONTROLLER_ERROR_NONE) { mc_error("Error mc_util_make_interface_name [%d]", ret); } else { - ret = mc_ipc_send_message(mc_server->dconn, NULL, filter_interface_name, signal_name, message, 0); + ret = mc_ipc_send_message(mc_server->dconn, NULL, filter_interface_name, signal_name, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); } @@ -904,7 +904,7 @@ int mc_server_send_command_reply(mc_server_h server, const char *client_name, in mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message"); char *interface_name = mc_util_get_interface_name(MC_CLIENT, client_name); - ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY, message, 0); + ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY, message, NULL); if (ret != MEDIA_CONTROLLER_ERROR_NONE) mc_error("Error mc_ipc_send_message [%d]", ret); -- cgit v1.2.3