summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyong Min <jiyong.min@samsung.com>2018-06-21 08:46:20 +0900
committerJiyong Min <jiyong.min@samsung.com>2018-06-26 06:28:06 +0000
commit75626de6aed0295baabbfcacc5c3e8b28355fb1e (patch)
tree6d16e18a6bd2556de41d7b45b1d53bd09916dba5
parentde8df3657296df850533095da844a4e5d9fef521 (diff)
downloadmedia-controller-75626de6aed0295baabbfcacc5c3e8b28355fb1e.tar.gz
media-controller-75626de6aed0295baabbfcacc5c3e8b28355fb1e.tar.bz2
media-controller-75626de6aed0295baabbfcacc5c3e8b28355fb1e.zip
Add ACR-1235 and sync media-controller from 4.0submit/tizen/20180627.041748
Change-Id: I8a6cdd068741f195de0350aad936eb8778774493
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt2
-rwxr-xr-xinclude/media_controller_client.h145
-rwxr-xr-xinclude/media_controller_private.h18
-rwxr-xr-xinclude/media_controller_server.h231
-rwxr-xr-xinclude/media_controller_type.h20
-rwxr-xr-xpackaging/capi-media-controller.spec3
-rwxr-xr-xsrc/media_controller_client.c154
-rwxr-xr-xsrc/media_controller_ipc.c56
-rwxr-xr-xsrc/media_controller_server.c212
-rwxr-xr-xsrc/media_controller_util.c26
-rwxr-xr-xtest/client_test/media_controller_client_test.c74
-rwxr-xr-xtest/server_test/media_controller_server_test.c101
12 files changed, 820 insertions, 222 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78c61d2..9723bd0 100644..100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ SET(service "media")
SET(submodule "controller")
# for package file
-SET(dependents "capi-base-common glib-2.0 gio-2.0 dlog sqlite3 db-util aul bundle libtzplatform-config cynara-client cynara-session cynara-creds-socket")
+SET(dependents "capi-base-common glib-2.0 gio-2.0 dlog sqlite3 db-util aul bundle libtzplatform-config cynara-client cynara-session cynara-creds-socket uuid")
SET(fw_name "${project_prefix}-${service}-${submodule}")
PROJECT(${fw_name})
diff --git a/include/media_controller_client.h b/include/media_controller_client.h
index 5fff6f8..9ed8617 100755
--- a/include/media_controller_client.h
+++ b/include/media_controller_client.h
@@ -133,10 +133,11 @@ typedef void (*mc_repeat_mode_changed_cb)(const char *server_name, mc_repeat_mod
typedef bool (*mc_activated_server_cb)(const char *server_name, void *user_data);
/**
+ * @deprecated Deprecated since 4.0. Use mc_cmd_reply_received_cb() instead.
* @brief Called when receiving the command processing result from the server.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
- * @remarks The callback is called in the dbus event loop. @a data should be released using @c bundle_free().
+ * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().
*
* @param[in] server_name The app_id of the media controller server which sent the reply, It can be used only in the callback. To use outside, make a copy.
* @param[in] result_code The result code of custom command
@@ -147,7 +148,26 @@ typedef bool (*mc_activated_server_cb)(const char *server_name, void *user_data)
*
* @see mc_client_send_custom_command()
*/
-typedef void (*mc_command_reply_received_cb)(const char *server_name, int result_code, bundle *data, void *user_data);
+typedef void (*mc_command_reply_received_cb)(const char *server_name, int result_code, bundle *data, void *user_data) TIZEN_DEPRECATED_API;
+
+/**
+ * @brief Called when the result of the command from the server is received.
+ * @since_tizen 4.0
+ *
+ * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().
+ *
+ * @param[in] server_name The app_id of the media controller server which sent the reply, It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The id of the command request
+ * @param[in] result_code The result code of the action
+ * @param[in] data The extra data
+ * @param[in] user_data The user data passed from the mc_client_send_custom_command() function
+ *
+ * @pre mc_client_send_custom_cmd()
+ * @pre mc_client_set_cmd_reply_cb()
+ *
+ * @see mc_client_send_custom_cmd()
+ */
+typedef void (*mc_cmd_reply_received_cb)(const char *server_name, const char *request_id, int result_code, bundle *data, void *user_data);
/**
* @brief Called when requesting the list of subscribed servers.
@@ -194,7 +214,7 @@ typedef void (*mc_playlist_updated_cb)(const char *server_name, mc_playlist_upda
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
- * @remarks The @a client should be released using @c mc_client_destroy(). And you can create only one client handle for each process.
+ * @remarks The @a client should be released using @c mc_client_destroy(). You can create only one client handle for each process.
*
* @param[out] client The handle to the media controller client
* @return @c 0 on success,
@@ -454,6 +474,49 @@ int mc_client_set_playlist_update_cb(mc_client_h client, mc_playlist_updated_cb
int mc_client_unset_playlist_update_cb(mc_client_h client);
/**
+ * @brief Sets the callback for receiving the result of the command from the media controller server.
+ * @details The media controller client which calls this function will receives the result of the command from all media controller servers.
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.client
+ *
+ * @param[in] client The handle to the media controller client
+ * @param[in] callback The callback to be invoked when the reply is received
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller client handle by calling mc_client_create().
+ * @see mc_client_create()
+ * @see mc_client_unset_cmd_reply_received_cb()
+ * @see mc_client_destroy()
+ */
+int mc_client_set_cmd_reply_received_cb(mc_client_h client, mc_cmd_reply_received_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the callback for receiving common reply of the media controller server.
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.client
+ *
+ * @param[in] client The handle to the media controller client
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller client handle by calling mc_client_create().
+ * @see mc_client_create()
+ * @see mc_client_set_cmd_reply_received_cb()
+ * @see mc_client_destroy()
+ */
+int mc_client_unset_cmd_reply_received_cb(mc_client_h client);
+
+/**
* @brief Subscribes media controller server for monitoring status.
* @details If media controller client subscribe media controller server, \n
* the media controller client receive callback from subscribed media controller server. \n
@@ -799,7 +862,7 @@ int mc_client_get_server_playlist(mc_client_h client, const char *server_name, c
int mc_client_foreach_server(mc_client_h client, mc_activated_server_cb callback, void *user_data);
/**
- * @deprecated Deprecated since 5.0. Use mc_client_send_playback_action() instead.
+ * @deprecated Deprecated since 4.0. Use mc_client_send_playback_action_cmd() instead.
* @brief Sends the playback state command to server.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -822,14 +885,18 @@ int mc_client_send_playback_state_command(mc_client_h client, const char *server
/**
* @brief Sends the playback action command to server.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
* @param[in] client The handle to the media controller client
* @param[in] server_name The app_id of the media controller server
* @param[in] action The playback action command to send to the media controller server
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -838,19 +905,24 @@ int mc_client_send_playback_state_command(mc_client_h client, const char *server
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @see mc_client_get_server_playback_info()
+ * @see mc_client_set_cmd_reply_received_cb()
*/
-int mc_client_send_playback_action(mc_client_h client, const char *server_name, mc_playback_action_e action);
+int mc_client_send_playback_action_cmd(mc_client_h client, const char *server_name, mc_playback_action_e action, char **request_id);
/**
* @brief Sends the playback position command to server.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
* @param[in] client The handle to the media controller client
* @param[in] server_name The app_id of the media controller server
* @param[in] position The position of the playback in milliseconds to send to media controller server.
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -859,19 +931,24 @@ int mc_client_send_playback_action(mc_client_h client, const char *server_name,
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @see mc_client_get_server_playback_info()
+ * @see mc_client_set_cmd_reply_received_cb()
*/
-int mc_client_send_playback_position_command(mc_client_h client, const char *server_name, unsigned long long position);
+int mc_client_send_playback_position_cmd(mc_client_h client, const char *server_name, unsigned long long position, char **request_id);
/**
* @brief Sends the shuffle mode command to server.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
* @param[in] client The handle to the media controller client
* @param[in] server_name The app_id of the media controller server
* @param[in] shuffle_mode The shuffle mode to send to media controller server
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -880,19 +957,24 @@ int mc_client_send_playback_position_command(mc_client_h client, const char *ser
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @see mc_client_get_server_playback_info()
+ * @see mc_client_set_cmd_reply_received_cb()
*/
-int mc_client_send_shuffle_mode_command(mc_client_h client, const char *server_name, mc_shuffle_mode_e shuffle_mode);
+int mc_client_send_shuffle_mode_cmd(mc_client_h client, const char *server_name, mc_shuffle_mode_e shuffle_mode, char **request_id);
/**
* @brief Sends the repeat mode command to server.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
* @param[in] client The handle to the media controller client
* @param[in] server_name The app_id of the media controller server
* @param[in] repeat_mode The repeat mode to send to media controller server
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -901,8 +983,9 @@ int mc_client_send_shuffle_mode_command(mc_client_h client, const char *server_n
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
* @see mc_client_get_server_playback_info()
+ * @see mc_client_set_cmd_reply_received_cb()
*/
-int mc_client_send_repeat_mode_command(mc_client_h client, const char *server_name, mc_repeat_mode_e repeat_mode);
+int mc_client_send_repeat_mode_cmd(mc_client_h client, const char *server_name, mc_repeat_mode_e repeat_mode, char **request_id);
/**
* @brief Sends the custom command to server.
@@ -926,22 +1009,53 @@ int mc_client_send_repeat_mode_command(mc_client_h client, const char *server_na
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
*/
-int mc_client_send_custom_command(mc_client_h client, const char *server_name, const char *command, bundle *data, mc_command_reply_received_cb callback, void *user_data);
+int mc_client_send_custom_command(mc_client_h client, const char *server_name, const char *command, bundle *data, mc_command_reply_received_cb callback, void *user_data) TIZEN_DEPRECATED_API;
/**
* @brief Sends the playlist command to server.
* @details The media controller client can send "index" of the playlist to the media controller server with playback action and position.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.client
*
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
* @param[in] client The handle to the media controller client
* @param[in] server_name The app_id of the media controller server
* @param[in] playlist_name The playlist name of the server
* @param[in] index The index of the media in playlist to send to the media controller server
* @param[in] action The playback action command to send to the media controller server
* @param[in] position The position of the playback in milliseconds to send to media controller server
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller client handle by calling mc_client_create().
+ * @see mc_client_create()
+ * @see mc_client_set_cmd_reply_received_cb()
+ */
+int mc_client_send_playlist_cmd(mc_client_h client, const char *server_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position, char **request_id);
+
+/**
+ * @brief Sends the custom command to server.
+ * @details If the server sends the result of the command, the media controller client will get the result of the custom command by mc_cmd_reply_received_cb() callback.
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.client
+ *
+ * @remarks The @a request_id should be released using free().\n
+ * If the @a request_id is null, the server will not send the reply of the command.
+ *
+ * @param[in] client The handle to the media controller client
+ * @param[in] server_name The app_id of the media controller server
+ * @param[in] command The command to be sent
+ * @param[in] data The extra data
+ * @param[out] request_id The id of the command request, it will be passed to the mc_cmd_reply_received_cb() function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -949,8 +1063,9 @@ int mc_client_send_custom_command(mc_client_h client, const char *server_name, c
* @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
* @pre Create a media controller client handle by calling mc_client_create().
* @see mc_client_create()
+ * @see mc_client_set_cmd_reply_received_cb()
*/
-int mc_client_send_playlist_command(mc_client_h client, const char *server_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position);
+int mc_client_send_custom_cmd(mc_client_h client, const char *server_name, const char *command, bundle *data, char **request_id);
/**
* @brief Destroys client.
diff --git a/include/media_controller_private.h b/include/media_controller_private.h
index 34ff2ff..e426949 100755
--- a/include/media_controller_private.h
+++ b/include/media_controller_private.h
@@ -163,9 +163,11 @@ extern "C" {
#define MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD "shuffle_cmd"
#define MC_DBUS_SIGNAL_NAME_REPEAT_CMD "repeat_cmd"
#define MC_DBUS_SIGNAL_NAME_CUSTOM_CMD "custom_cmd"
-#define MC_DBUS_SIGNAL_NAME_CMD_REPLY "custom_cmd_reply"
-#define MC_DBUS_SIGNAL_NAME_PLAYLIST "playlist"
+#define MC_DBUS_SIGNAL_NAME_CMD_REPLY "cmd_reply"
+#define MC_DBUS_SIGNAL_NAME_PLAYLIST "playlist"
#define MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST "pb_playlist"
+#define MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND "custom_command"
+#define MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND_REPLY "custom_command_reply"
#define MC_COMMAND_PLAYBACKSTATE "_pb_state_cmd_"
@@ -175,7 +177,8 @@ extern "C" {
#define MC_COMMAND_REPEAT "_repeat_cmd_"
#define MC_COMMAND_CUSTOM "_custom_cmd_"
#define MC_COMMAND_PLAY_PLAYLIST "_playlist_cmd_"
-
+#define MC_COMMAND_CUSTOMACTION "_custom_action_"
+#define MC_COMMAND_CMDREPLY "_cmd_reply_"
#define MC_DB_CMD_CREATE_SERVER "DB_CMD_CREATE_SERVER" /* Create New Server Table*/
#define MC_DB_CMD_UPDATE_SERVER_LIST "DB_CMD_UPDATE_SERVER_LIST" /* Update Server Name*/
@@ -254,6 +257,7 @@ typedef struct {
media_controller_receiver_s repeat_mode_reciever;
media_controller_receiver_s custom_cmd_reciever;
media_controller_receiver_s play_playlist_reciever;
+ media_controller_receiver_s custom_command_reciever;
} media_controller_server_s;
typedef struct {
@@ -272,10 +276,11 @@ typedef struct {
media_controller_receiver_s repeat_cb;
media_controller_receiver_s reply_cb;
media_controller_receiver_s playlist_cb;
+ media_controller_receiver_s cmd_reply_cb;
} media_controller_client_s;
/* formal callback to receive signal */
-typedef void(*mc_signal_received_cb)(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data);
+typedef void(*mc_signal_received_cb)(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data);
typedef struct {
GDBusConnection *dbus_conn;
char *interface_name;
@@ -293,7 +298,7 @@ char* mc_util_get_interface_name(const char *type, const char *name);
int mc_util_make_filter_interface_name(const char *prefix, const char *filter, char **interface_name);
int mc_util_set_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command);
int mc_util_get_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command);
-int mc_util_get_request_id(unsigned int *req_id);
+char *mc_util_generate_uuid(void);
int mc_util_bundle_to_string(bundle *bundle_data, char **str_data);
int mc_safe_strtoi(const char *buffer, int *value);
int mc_safe_strtoull(const char *buffer, unsigned long long *value);
@@ -304,7 +309,8 @@ 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, unsigned int *request_id);
+int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char* signal_name, const char* message, char **request_id);
+int mc_ipc_send_reply(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, const char *request_id);
int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, mc_priv_type_e priv_type, const char *request_msg);
int mc_ipc_service_connect(mc_priv_type_e type);
diff --git a/include/media_controller_server.h b/include/media_controller_server.h
index 613627b..7a7a5fa 100755
--- a/include/media_controller_server.h
+++ b/include/media_controller_server.h
@@ -35,7 +35,7 @@ extern "C" {
*/
/**
- * @deprecated Deprecated since 5.0.
+ * @deprecated Deprecated since 4.0. Use mc_server_playback_action_cmd_received_cb() instead.
* @brief Called when the server receives the playback state from the client.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -53,75 +53,89 @@ typedef void (*mc_server_playback_state_command_received_cb)(const char* client_
/**
* @brief Called when the server receives the playback action command from the client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
- * @remarks The callback is called in the dbus event loop.
+ * @remarks The callback is called in the dbus event loop.\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The request_id of the media controller client.
* @param[in] action The received playback action
- * @param[in] user_data The user data passed from the mc_server_set_playback_action_received_cb() function
+ * @param[in] user_data The user data passed from the mc_server_set_playback_action_cmd_received_cb() function
*
- * @pre mc_server_set_playback_action_received_cb()
+ * @pre mc_server_set_playback_action_cmd_received_cb()
*
- * @see mc_server_set_playback_action_received_cb()
+ * @see mc_server_set_playback_action_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
*/
-typedef void (*mc_server_playback_action_received_cb)(const char* client_name, mc_playback_action_e action, void *user_data);
+typedef void (*mc_server_playback_action_cmd_received_cb)(const char* client_name, const char *request_id, mc_playback_action_e action, void *user_data);
/**
* @brief Called when the server receives the playback position from the client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
- * @remarks The callback is called in the dbus event loop.
+ * @remarks The callback is called in the dbus event loop.\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The request_id of the media controller client.
* @param[in] position The received playback position (milliseconds)
- * @param[in] user_data The user data passed from the mc_server_set_playback_position_command_received_cb() function
+ * @param[in] user_data The user data passed from the mc_server_set_playback_position_cmd_received_cb() function
*
- * @pre mc_server_set_playback_position_command_received_cb()
+ * @pre mc_server_set_playback_position_cmd_received_cb()
*
- * @see mc_server_set_playback_position_command_received_cb()
+ * @see mc_server_set_playback_position_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
*/
-typedef void (*mc_server_playback_position_command_received_cb)(const char* client_name, unsigned long long position, void *user_data);
+typedef void (*mc_server_playback_position_cmd_received_cb)(const char* client_name, const char *request_id, unsigned long long position, void *user_data);
/**
* @brief Called when the server receives the shuffle mode from the client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
- * @remarks The callback is called in the dbus event loop.
+ * @remarks The callback is called in the dbus event loop.\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The request_id of the media controller client.
* @param[in] shuffle_mode The received shuffle_mode
- * @param[in] user_data The user data passed from the mc_server_set_shuffle_mode_command_received_cb() function
+ * @param[in] user_data The user data passed from the mc_server_set_shuffle_mode_cmd_received_cb() function
*
- * @pre mc_server_set_shuffle_mode_command_received_cb()
+ * @pre mc_server_set_shuffle_mode_cmd_received_cb()
*
- * @see mc_server_set_shuffle_mode_command_received_cb()
+ * @see mc_server_set_shuffle_mode_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
*/
-typedef void (*mc_server_shuffle_mode_command_received_cb)(const char* client_name, mc_shuffle_mode_e shuffle_mode, void *user_data);
+typedef void (*mc_server_shuffle_mode_cmd_received_cb)(const char* client_name, const char *request_id, mc_shuffle_mode_e shuffle_mode, void *user_data);
/**
* @brief Called when the server receives the repeat mode from the client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
- * @remarks The callback is called in the dbus event loop.
+ * @remarks The callback is called in the dbus event loop.\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The request_id of the media controller client.
* @param[in] repeat_mode The received repeat mode
- * @param[in] user_data The user data passed from the mc_server_set_repeat_mode_command_received_cb() function
+ * @param[in] user_data The user data passed from the mc_server_set_repeat_mode_cmd_received_cb() function
*
- * @pre mc_server_set_repeat_mode_command_received_cb()
+ * @pre mc_server_set_repeat_mode_cmd_received_cb()
*
- * @see mc_server_set_repeat_mode_command_received_cb()
+ * @see mc_server_set_repeat_mode_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
*/
-typedef void (*mc_server_repeat_mode_command_received_cb)(const char* client_name, mc_repeat_mode_e repeat_mode, void *user_data);
+typedef void (*mc_server_repeat_mode_cmd_received_cb)(const char* client_name, const char *request_id, mc_repeat_mode_e repeat_mode, void *user_data);
/**
+ * @deprecated Deprecated since 4.0. Use mc_server_custom_cmd_received_cb() instead.
* @brief Called when the Server receives custom command from the client.
* @details This callback is called when server receives custom command from client.
* If there is reply for command, call mc_server_send_command_reply() function.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
- * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().
+ * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
* @param[in] command The received command. It can be used only in the callback. To use outside, make a copy.
@@ -132,26 +146,52 @@ typedef void (*mc_server_repeat_mode_command_received_cb)(const char* client_nam
*
* @see mc_server_set_custom_command_received_cb()
*/
-typedef void (*mc_server_custom_command_received_cb)(const char* client_name, const char *command, bundle *data, void *user_data);
+typedef void (*mc_server_custom_command_received_cb)(const char* client_name, const char *command, bundle *data, void *user_data) TIZEN_DEPRECATED_API;
/**
* @brief Called when the Server receives playlist command from the client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
- * @remarks The callback is called in the dbus event loop.
+ * @remarks The callback is called in the dbus event loop. \n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
*
* @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The request_id of the media controller client.
* @param[in] playlist_name The name of the server playlist. It can be used only in the callback. To use outside, make a copy.
* @param[in] index The index of the media in playlist. It can be used only in the callback. To use outside, make a copy.
* @param[in] action The received playback action
* @param[in] position The received playback position (milliseconds)
- * @param[in] user_data The user data passed from the mc_server_set_playlist_command_received_cb() function
+ * @param[in] user_data The user data passed from the mc_server_set_playlist_cmd_received_cb() function
+ *
+ * @pre mc_server_set_playlist_cmd_received_cb()
+ *
+ * @see mc_server_set_playlist_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
+ */
+typedef void (*mc_server_playlist_cmd_received_cb)(const char* client_name, const char *request_id, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position, void *user_data);
+
+/**
+ * @brief Called when the Server receives custom command from the client.
+ * @details This callback is called when server receives custom command from client.
+ * If you want to reply to the command, call mc_server_send_cmd_reply() function.
+ * @since_tizen 4.0
+ *
+ * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().\n
+ * If @a request_id is not null, the server should send the reply to the client with the @a request_id.
+ *
+ * @param[in] client_name The app_id of the media controller client. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] request_id The id of the command request
+ * @param[in] command The received command. It can be used only in the callback. To use outside, make a copy.
+ * @param[in] data The extra data
+ * @param[in] user_data The user data passed from the mc_server_set_custom_cmd_received_cb() function
*
- * @pre mc_server_set_playlist_command_received_cb()
+ * @pre mc_server_set_custom_cmd_received_cb()
*
- * @see mc_server_set_playlist_command_received_cb()
+ * @see mc_server_set_custom_cmd_received_cb()
+ * @see mc_server_unset_custom_cmd_received_cb()
+ * @see mc_server_send_cmd_reply()
*/
-typedef void (*mc_server_playlist_command_received_cb)(const char* client_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position, void *user_data);
+typedef void (*mc_server_custom_cmd_received_cb)(const char* client_name, const char *request_id, const char *command, bundle *data, void *user_data);
/**
* @brief Creates a media controller server.
@@ -160,7 +200,7 @@ typedef void (*mc_server_playlist_command_received_cb)(const char* client_name,
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
*
- * @remarks The @a server should be released using mc_server_destroy(). And you can create only one server handle for each process.
+ * @remarks The @a server should be released using mc_server_destroy(). You can create only one server handle for each process.
*
* @param[out] server The handle to media controller server
* @return @c 0 on success,
@@ -419,7 +459,7 @@ int mc_server_update_playlist(mc_server_h server, mc_playlist_update_mode_e mode
int mc_server_set_playback_state_command_received_cb(mc_server_h server, mc_server_playback_state_command_received_cb callback, void *user_data) TIZEN_DEPRECATED_API;
/**
- * @deprecated Deprecated since 5.0. Use mc_server_unset_playback_action_received_cb() instead.
+ * @deprecated Deprecated since 4.0. Use mc_server_unset_playback_action_cmd_received_cb() instead.
* @brief Unsets the callback for receiving playback state command from client.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -440,7 +480,7 @@ int mc_server_unset_playback_state_command_received_cb(mc_server_h server) TIZEN
/**
* @brief Sets the callback for receiving playback action command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -457,11 +497,11 @@ int mc_server_unset_playback_state_command_received_cb(mc_server_h server) TIZEN
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_playback_action_received_cb(mc_server_h server, mc_server_playback_action_received_cb callback, void *user_data);
+int mc_server_set_playback_action_cmd_received_cb(mc_server_h server, mc_server_playback_action_cmd_received_cb callback, void *user_data);
/**
* @brief Unsets the callback for receiving playback action command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -476,11 +516,11 @@ int mc_server_set_playback_action_received_cb(mc_server_h server, mc_server_play
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_unset_playback_action_received_cb(mc_server_h server);
+int mc_server_unset_playback_action_cmd_received_cb(mc_server_h server);
/**
* @brief Sets the callback for receiving playback position command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -497,11 +537,11 @@ int mc_server_unset_playback_action_received_cb(mc_server_h server);
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_playback_position_command_received_cb(mc_server_h server, mc_server_playback_position_command_received_cb callback, void *user_data);
+int mc_server_set_playback_position_cmd_received_cb(mc_server_h server, mc_server_playback_position_cmd_received_cb callback, void *user_data);
/**
* @brief Unsets the callback for receiving playback position command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -516,11 +556,11 @@ int mc_server_set_playback_position_command_received_cb(mc_server_h server, mc_s
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_unset_playback_position_command_received_cb(mc_server_h server);
+int mc_server_unset_playback_position_cmd_received_cb(mc_server_h server);
/**
* @brief Sets the callback for receiving shuffle mode command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -537,11 +577,11 @@ int mc_server_unset_playback_position_command_received_cb(mc_server_h server);
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_shuffle_mode_command_received_cb(mc_server_h server, mc_server_shuffle_mode_command_received_cb callback, void *user_data);
+int mc_server_set_shuffle_mode_cmd_received_cb(mc_server_h server, mc_server_shuffle_mode_cmd_received_cb callback, void *user_data);
/**
* @brief Unsets the callback for receiving shuffle mode command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -556,11 +596,11 @@ int mc_server_set_shuffle_mode_command_received_cb(mc_server_h server, mc_server
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_unset_shuffle_mode_command_received_cb(mc_server_h server);
+int mc_server_unset_shuffle_mode_cmd_received_cb(mc_server_h server);
/**
* @brief Sets the callback for receiving repeat mode command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -577,11 +617,11 @@ int mc_server_unset_shuffle_mode_command_received_cb(mc_server_h server);
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_repeat_mode_command_received_cb(mc_server_h server, mc_server_repeat_mode_command_received_cb callback, void *user_data);
+int mc_server_set_repeat_mode_cmd_received_cb(mc_server_h server, mc_server_repeat_mode_cmd_received_cb callback, void *user_data);
/**
* @brief Unsets the callback for receiving repeat mode command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -596,9 +636,10 @@ int mc_server_set_repeat_mode_command_received_cb(mc_server_h server, mc_server_
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_unset_repeat_mode_command_received_cb(mc_server_h server);
+int mc_server_unset_repeat_mode_cmd_received_cb(mc_server_h server);
/**
+ * @deprecated Deprecated since 4.0. Use mc_server_set_custom_cmd_received_cb() instead.
* @brief Sets the callback for receiving custom command from client.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -617,9 +658,10 @@ int mc_server_unset_repeat_mode_command_received_cb(mc_server_h server);
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_custom_command_received_cb(mc_server_h server, mc_server_custom_command_received_cb callback, void *user_data);
+int mc_server_set_custom_command_received_cb(mc_server_h server, mc_server_custom_command_received_cb callback, void *user_data) TIZEN_DEPRECATED_API;
/**
+ * @deprecated Deprecated since 4.0. Use mc_server_unset_custom_cmd_received_cb() instead.
* @brief Unsets the callback for receiving custom command from client.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -636,9 +678,10 @@ int mc_server_set_custom_command_received_cb(mc_server_h server, mc_server_custo
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_unset_custom_command_received_cb(mc_server_h server);
+int mc_server_unset_custom_command_received_cb(mc_server_h server) TIZEN_DEPRECATED_API;
/**
+ * @deprecated Deprecated since 4.0. Use mc_server_send_cmd_reply() instead.
* @brief Sends a reply for the requested command to the client.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
@@ -661,11 +704,11 @@ int mc_server_unset_custom_command_received_cb(mc_server_h server);
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_send_command_reply(mc_server_h server, const char *client_name, int result_code, bundle *data);
+int mc_server_send_command_reply(mc_server_h server, const char *client_name, int result_code, bundle *data) TIZEN_DEPRECATED_API;
/**
* @brief Sets the callback for receiving playlist command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
@@ -682,16 +725,82 @@ int mc_server_send_command_reply(mc_server_h server, const char *client_name, in
* @see mc_server_create()
* @see mc_server_destroy()
*/
-int mc_server_set_playlist_command_received_cb(mc_server_h server, mc_server_playlist_command_received_cb callback, void *user_data);
+int mc_server_set_playlist_cmd_received_cb(mc_server_h server, mc_server_playlist_cmd_received_cb callback, void *user_data);
/**
* @brief Unsets the callback for receiving playlist command from client.
- * @since_tizen 5.0
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.server
+ *
+ * @param[in] server The handle to media controller server
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller server handle by calling mc_server_create().
+ * @see mc_server_create()
+ * @see mc_server_destroy()
+ */
+int mc_server_unset_playlist_cmd_received_cb(mc_server_h server);
+
+/**
+ * @brief Sets the callback for receiving custom command from client.
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.server
+ *
+ * @param[in] server The handle to media controller server
+ * @param[in] callback The callback to be invoked when media controller server receives custom command from client.
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller server handle by calling mc_server_create().
+ * @see mc_server_create()
+ * @see mc_server_destroy()
+ */
+int mc_server_set_custom_cmd_received_cb(mc_server_h server, mc_server_custom_cmd_received_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the callback for receiving custom command from client.
+ * @since_tizen 4.0
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mediacontroller.server
+ *
+ * @param[in] server The handle to media controller server
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
+ * @retval #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
+ * @pre Create a media controller server handle by calling mc_server_create().
+ * @see mc_server_create()
+ * @see mc_server_destroy()
+ */
+int mc_server_unset_custom_cmd_received_cb(mc_server_h server);
+
+/**
+ * @brief Replys the result of the requested command to the client.
+ * @since_tizen 4.0
*
* @privlevel public
* @privilege %http://tizen.org/privilege/mediacontroller.server
*
+ * @remarks When the server receives a command, this function can be called by mc_server_playback_action_cmd_received_cb(), mc_server_playback_position_cmd_received_cb(), mc_server_shuffle_mode_cmd_received_cb(), mc_server_repeat_mode_cmd_received_cb(), mc_server_playlist_cmd_received_cb() and mc_server_custom_cmd_received_cb().\n
+ * If @a request_id is null, this function will return #MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER.
+ *
* @param[in] server The handle to media controller server
+ * @param[in] client_name The app_id of the media controller client
+ * @param[in] request_id The id of the command request, received in the mc_server_custom_cmd_received_cb() function.
+ * @param[in] result_code The result code of custom command
+ * @param[in] data The extra data
* @return @c 0 on success,
* otherwise a negative error value
* @retval #MEDIA_CONTROLLER_ERROR_NONE Successful
@@ -699,9 +808,15 @@ int mc_server_set_playlist_command_received_cb(mc_server_h server, mc_server_pla
* @retval #MEDIA_CONTROLLER_ERROR_PERMISSION_DENIED Permission denied
* @pre Create a media controller server handle by calling mc_server_create().
* @see mc_server_create()
+ * @see mc_server_playback_action_cmd_received_cb()
+ * @see mc_server_playback_position_cmd_received_cb()
+ * @see mc_server_shuffle_mode_cmd_received_cb()
+ * @see mc_server_repeat_mode_cmd_received_cb()
+ * @see mc_server_playlist_cmd_received_cb()
+ * @see mc_server_custom_cmd_received_cb()
* @see mc_server_destroy()
*/
-int mc_server_unset_playlist_command_received_cb(mc_server_h server);
+int mc_server_send_cmd_reply(mc_server_h server, const char *client_name, const char *request_id, int result_code, bundle *data);
/**
* @brief Destroys media controller server.
diff --git a/include/media_controller_type.h b/include/media_controller_type.h
index 970b4e4..d33c65c 100755
--- a/include/media_controller_type.h
+++ b/include/media_controller_type.h
@@ -109,19 +109,19 @@ typedef enum {
MC_PLAYBACK_STATE_PLAYING, /**< Playing */
MC_PLAYBACK_STATE_PAUSED, /**< Paused */
MC_PLAYBACK_STATE_STOPPED, /**< Stopped */
- MC_PLAYBACK_STATE_NEXT_FILE, /**< Next file (Deprecated since 5.0)*/
- MC_PLAYBACK_STATE_PREV_FILE, /**< Previous file (Deprecated since 5.0)*/
- MC_PLAYBACK_STATE_FAST_FORWARD, /**< Fast forward (Deprecated since 5.0)*/
- MC_PLAYBACK_STATE_REWIND, /**< Rewind (Deprecated since 5.0)*/
- MC_PLAYBACK_STATE_MOVING_TO_NEXT, /**< Moving to the next item (Since 5.0)*/
- MC_PLAYBACK_STATE_MOVING_TO_PREVIOUS, /**< Moving to the previous item (Since 5.0)*/
- MC_PLAYBACK_STATE_FAST_FORWARDING, /**< Fast forwarding (Since 5.0)*/
- MC_PLAYBACK_STATE_REWINDING, /**< Rewinding (Since 5.0)*/
+ MC_PLAYBACK_STATE_NEXT_FILE, /**< Next file (Deprecated since 4.0)*/
+ MC_PLAYBACK_STATE_PREV_FILE, /**< Previous file (Deprecated since 4.0)*/
+ MC_PLAYBACK_STATE_FAST_FORWARD, /**< Fast forward (Deprecated since 4.0)*/
+ MC_PLAYBACK_STATE_REWIND, /**< Rewind (Deprecated since 4.0)*/
+ MC_PLAYBACK_STATE_MOVING_TO_NEXT, /**< Moving to the next item (Since 4.0)*/
+ MC_PLAYBACK_STATE_MOVING_TO_PREVIOUS, /**< Moving to the previous item (Since 4.0)*/
+ MC_PLAYBACK_STATE_FAST_FORWARDING, /**< Fast forwarding (Since 4.0)*/
+ MC_PLAYBACK_STATE_REWINDING, /**< Rewinding (Since 4.0)*/
} mc_playback_states_e;
/**
* @brief Enumeration for the media playback action.
- * @since_tizen 5.0
+ * @since_tizen 4.0
*/
typedef enum {
MC_PLAYBACK_ACTION_PLAY, /**< Play */
@@ -150,7 +150,7 @@ typedef enum {
typedef enum {
MC_REPEAT_MODE_ON = 0, /**< Repeat mode on for all media*/
MC_REPEAT_MODE_OFF, /**< Repeat mode off */
- MC_REPEAT_MODE_ONE_MEDIA, /**< Repeat mode on for one media (Since 5.0)*/
+ MC_REPEAT_MODE_ONE_MEDIA, /**< Repeat mode on for one media (Since 4.0)*/
} mc_repeat_mode_e;
/**
diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec
index 8a60700..570d452 100755
--- a/packaging/capi-media-controller.spec
+++ b/packaging/capi-media-controller.spec
@@ -1,6 +1,6 @@
Name: capi-media-controller
Summary: A media controller library in Tizen Native API
-Version: 0.1.61
+Version: 0.1.62
Release: 1
Group: Multimedia/API
License: Apache-2.0
@@ -22,6 +22,7 @@ BuildRequires: pkgconfig(libsystemd-login)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
+BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(capi-appfw-app-control)
%define upgrade_script_path /usr/share/upgrade/scripts
diff --git a/src/media_controller_client.c b/src/media_controller_client.c
index b466a47..4129bc7 100755
--- a/src/media_controller_client.c
+++ b/src/media_controller_client.c
@@ -19,7 +19,7 @@
#include "media_controller_db.h"
#include <bundle_internal.h>
-static void __client_server_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_server_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *reciever = (media_controller_receiver_s *)user_data;
@@ -29,7 +29,7 @@ static void __client_server_cb(const char *interface_name, const char *signal_na
mc_retm_if(reciever->callback == NULL, "server_state_cb is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_debug("__client_server_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_server_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid server data");
@@ -39,7 +39,7 @@ static void __client_server_cb(const char *interface_name, const char *signal_na
g_strfreev(params);
}
-static void __client_playback_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_playback_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *reciever = (media_controller_receiver_s *)user_data;
@@ -50,7 +50,7 @@ static void __client_playback_cb(const char *interface_name, const char *signal_
mc_retm_if(reciever->callback == NULL, "playback_cb is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_debug("__client_playback_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_playback_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
playback = (media_controller_playback_s *)calloc(1, sizeof(media_controller_playback_s));
mc_retm_if(playback == NULL, "Error allocation memory");
@@ -73,7 +73,7 @@ static void __client_playback_cb(const char *interface_name, const char *signal_
g_strfreev(params);
}
-static void __client_metadata_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_metadata_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
mc_metadata_h metadata = NULL;
@@ -84,7 +84,7 @@ static void __client_metadata_cb(const char *interface_name, const char *signal_
mc_retm_if(mc_client->metadata_cb.callback == NULL, "metadata_cb is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_debug("__client_metadata_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_metadata_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
ret = mc_db_get_metadata_info(mc_client->db_handle, message, &metadata);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
@@ -95,7 +95,7 @@ static void __client_metadata_cb(const char *interface_name, const char *signal_
mc_client_destroy_metadata(metadata);
}
-static void __client_shuffle_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_shuffle_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *reciever = (media_controller_receiver_s *)user_data;
@@ -104,7 +104,7 @@ static void __client_shuffle_cb(const char *interface_name, const char *signal_n
mc_retm_if(reciever->callback == NULL, "shuffle_cb is NULL");
- mc_debug("__client_shuffle_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_shuffle_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid shuffle mode data");
@@ -114,7 +114,7 @@ static void __client_shuffle_cb(const char *interface_name, const char *signal_n
g_strfreev(params);
}
-static void __client_repeat_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_repeat_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *reciever = (media_controller_receiver_s *)user_data;
@@ -123,7 +123,7 @@ static void __client_repeat_cb(const char *interface_name, const char *signal_na
mc_retm_if(reciever->callback == NULL, "repeat_cb is NULL");
- mc_debug("__client_repeat_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_repeat_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid repeat mode data");
@@ -133,7 +133,7 @@ static void __client_repeat_cb(const char *interface_name, const char *signal_na
g_strfreev(params);
}
-static void __client_reply_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_reply_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
int enc_size = 0;
@@ -145,7 +145,7 @@ static void __client_reply_cb(const char *interface_name, const char *signal_nam
mc_command_reply_received_cb callback = (mc_command_reply_received_cb)reciever->callback;
mc_retm_if(reciever->callback == NULL, "reply_cb is NULL");
- mc_debug("__client_reply_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_reply_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid custom data");
@@ -159,7 +159,39 @@ static void __client_reply_cb(const char *interface_name, const char *signal_nam
g_strfreev(params);
}
-static void __client_playlist_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __client_cmd_reply_received_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
+{
+ gchar **params = NULL;
+ int result_code = 0;
+ int enc_size = 0;
+ bundle *bundle_data = NULL;
+
+ media_controller_receiver_s *reciever = (media_controller_receiver_s *)user_data;
+ mc_retm_if(reciever == NULL, "reciever is NULL");
+
+ mc_cmd_reply_received_cb callback = (mc_cmd_reply_received_cb)reciever->callback;
+ mc_retm_if(reciever->callback == NULL, "reply_cb is NULL");
+
+ mc_debug("__client_cmd_reply_received_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
+
+ params = g_strsplit(message, MC_STRING_DELIMITER, 0);
+ mc_retm_if(params == NULL, "invalid custom data");
+
+ if (params[1] != NULL)
+ mc_retm_if(MEDIA_CONTROLLER_ERROR_NONE != mc_safe_strtoi(params[1], &result_code), "getting result_code is failed");
+
+ if (params[2] != NULL)
+ mc_retm_if(MEDIA_CONTROLLER_ERROR_NONE != mc_safe_strtoi(params[2], &enc_size), "getting message is failed");
+
+ if (enc_size > 0)
+ bundle_data = bundle_decode((bundle_raw *)params[3], enc_size);
+
+ callback(params[0], request_id, result_code, bundle_data, reciever->user_data);
+
+ g_strfreev(params);
+}
+
+static void __client_playlist_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
gchar **params = NULL;
@@ -173,7 +205,7 @@ static void __client_playlist_cb(const char *interface_name, const char *signal_
mc_retm_if(mc_client->playlist_cb.callback == NULL, "playlist_cb is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_debug("__client_playlist_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__client_playlist_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid custom data");
@@ -370,7 +402,7 @@ static int __mc_parse_server_name(const char *interface_name, char **server_name
return MEDIA_CONTROLLER_ERROR_NONE;
}
-static int __mc_client_send_command(mc_client_h client, const char *server_name, const char *command_type, const char *command, const char *signal_name, const char *message, unsigned int *request_id)
+static int __mc_client_send_command(mc_client_h client, const char *server_name, const char *command_type, const char *command, const char *signal_name, const char *message, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_client_s *mc_client = (media_controller_client_s *)client;
@@ -647,6 +679,46 @@ int mc_client_unset_playlist_update_cb(mc_client_h client)
return ret;
}
+int mc_client_set_cmd_reply_received_cb(mc_client_h client, mc_cmd_reply_received_cb callback, void *user_data)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_client_s *mc_client = (media_controller_client_s *)client;
+
+ mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+ mc_retvm_if(callback == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "callback is NULL");
+ mc_retvm_if(mc_client->cmd_reply_cb.callback != NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "callback is already set");
+
+ mc_client->cmd_reply_cb.callback = callback;
+ mc_client->cmd_reply_cb.user_data = user_data;
+
+ char *interface_name = mc_util_get_interface_name(MC_CLIENT, mc_client->client_name);
+ ret = mc_ipc_register_listener(&mc_client->listeners, mc_client->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY,
+ __client_cmd_reply_received_cb, (void *)&(mc_client->cmd_reply_cb));
+
+ MC_SAFE_FREE(interface_name);
+
+ return ret;
+}
+
+int mc_client_unset_cmd_reply_received_cb(mc_client_h client)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_client_s *mc_client = (media_controller_client_s *)client;
+
+ mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+
+ char *interface_name = mc_util_get_interface_name(MC_CLIENT, mc_client->client_name);
+ ret = mc_ipc_unregister_listener(&mc_client->listeners, mc_client->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY);
+
+ mc_client->cmd_reply_cb.callback = NULL;
+ mc_client->cmd_reply_cb.user_data = NULL;
+ mc_client->cmd_reply_cb.filter_list = NULL;
+
+ MC_SAFE_FREE(interface_name);
+
+ return ret;
+}
+
int mc_client_subscribe(mc_client_h client, const mc_subscription_type_e subscription_type, const char *server_name)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
@@ -1110,7 +1182,7 @@ int mc_client_send_playback_state_command(mc_client_h client, const char *server
char *message = NULL;
media_controller_client_s *mc_client = (media_controller_client_s *)client;
- mc_warning("DEPRECATION WARNING: mc_client_send_playback_state_command() is deprecated and will be removed from next release. Use mc_client_send_playback_action() instead.");
+ mc_warning("DEPRECATION WARNING: mc_client_send_playback_state_command() is deprecated and will be removed from next release. Use mc_client_send_playback_action_cmd() instead.");
mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
mc_retvm_if(((state < MC_PLAYBACK_STATE_PLAYING) || (state > MC_PLAYBACK_STATE_REWIND)), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "state is invalid");
@@ -1125,7 +1197,7 @@ int mc_client_send_playback_state_command(mc_client_h client, const char *server
return ret;
}
-int mc_client_send_playback_action(mc_client_h client, const char *server_name, mc_playback_action_e action)
+int mc_client_send_playback_action_cmd(mc_client_h client, const char *server_name, mc_playback_action_e action, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
@@ -1138,14 +1210,14 @@ int mc_client_send_playback_action(mc_client_h client, const char *server_name,
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, action);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAYBACKACTION, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_ACTION, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAYBACKACTION, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_ACTION, message, request_id);
MC_SAFE_G_FREE(message);
return ret;
}
-int mc_client_send_playback_position_command(mc_client_h client, const char *server_name, unsigned long long position)
+int mc_client_send_playback_position_cmd(mc_client_h client, const char *server_name, unsigned long long position, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
@@ -1157,14 +1229,14 @@ int mc_client_send_playback_position_command(mc_client_h client, const char *ser
message = g_strdup_printf("%s%s%llu", mc_client->client_name, MC_STRING_DELIMITER, position);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAYBACKPOSITION, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAYBACKPOSITION, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, message, request_id);
MC_SAFE_G_FREE(message);
return ret;
}
-int mc_client_send_shuffle_mode_command(mc_client_h client, const char *server_name, mc_shuffle_mode_e shuffle_mode)
+int mc_client_send_shuffle_mode_cmd(mc_client_h client, const char *server_name, mc_shuffle_mode_e shuffle_mode, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
@@ -1177,14 +1249,14 @@ int mc_client_send_shuffle_mode_command(mc_client_h client, const char *server_n
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, shuffle_mode);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_SHUFFLE, NULL, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_SHUFFLE, NULL, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, message, request_id);
MC_SAFE_G_FREE(message);
return ret;
}
-int mc_client_send_repeat_mode_command(mc_client_h client, const char *server_name, mc_repeat_mode_e repeat_mode)
+int mc_client_send_repeat_mode_cmd(mc_client_h client, const char *server_name, mc_repeat_mode_e repeat_mode, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
@@ -1197,7 +1269,7 @@ int mc_client_send_repeat_mode_command(mc_client_h client, const char *server_na
message = g_strdup_printf("%s%s%d", mc_client->client_name, MC_STRING_DELIMITER, repeat_mode);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_REPEAT, NULL, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_REPEAT, NULL, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, message, request_id);
MC_SAFE_G_FREE(message);
@@ -1211,6 +1283,8 @@ int mc_client_send_custom_command(mc_client_h client, const char *server_name, c
char *bundle_str = NULL;
media_controller_client_s *mc_client = (media_controller_client_s *)client;
+ mc_warning("DEPRECATION WARNING: mc_client_send_custom_command() is deprecated and will be removed from next release. Use mc_client_send_custom_cmd() instead.");
+
mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
@@ -1218,7 +1292,7 @@ int mc_client_send_custom_command(mc_client_h client, const char *server_name, c
char *interface_name_for_reply = mc_util_get_interface_name(MC_CLIENT, mc_client->client_name);
mc_client->reply_cb.callback = callback;
mc_client->reply_cb.user_data = user_data;
- mc_ipc_register_listener(&mc_client->listeners, mc_client->dconn, interface_name_for_reply, MC_DBUS_SIGNAL_NAME_CMD_REPLY, __client_reply_cb, (void *)&(mc_client->reply_cb));
+ mc_ipc_register_listener(&mc_client->listeners, mc_client->dconn, interface_name_for_reply, MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND_REPLY, __client_reply_cb, (void *)&(mc_client->reply_cb));
MC_SAFE_FREE(interface_name_for_reply);
}
@@ -1229,14 +1303,14 @@ int mc_client_send_custom_command(mc_client_h client, const char *server_name, c
MC_SAFE_G_FREE(bundle_str);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message");
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_CUSTOM, command, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_CUSTOM, command, MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND, message, NULL);
MC_SAFE_G_FREE(message);
return ret;
}
-int mc_client_send_playlist_command(mc_client_h client, const char *server_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position)
+int mc_client_send_playlist_cmd(mc_client_h client, const char *server_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position, char **request_id)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
@@ -1251,7 +1325,31 @@ int mc_client_send_playlist_command(mc_client_h client, const char *server_name,
message = g_strdup_printf("%s%s%s%s%s%s%d%s%llu", mc_client->client_name, MC_STRING_DELIMITER, playlist_name, MC_STRING_DELIMITER, index, MC_STRING_DELIMITER, action, MC_STRING_DELIMITER, position);
mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail making message [%d]", ret);
- ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAY_PLAYLIST, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, message, NULL);
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_PLAY_PLAYLIST, NULL, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, message, request_id);
+
+ MC_SAFE_G_FREE(message);
+
+ return ret;
+}
+
+int mc_client_send_custom_cmd(mc_client_h client, const char *server_name, const char *command, bundle *data, char **request_id)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ char *message = NULL;
+ char *bundle_str = NULL;
+ media_controller_client_s *mc_client = (media_controller_client_s *)client;
+
+ mc_retvm_if(mc_client == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+ mc_retvm_if(!MC_STRING_VALID(server_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid server_name");
+
+ ret = mc_util_bundle_to_string(data, &bundle_str);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "Error when make string from bundle");
+
+ message = g_strdup_printf("%s%s%s%s%s", mc_client->client_name, MC_STRING_DELIMITER, command, MC_STRING_DELIMITER, bundle_str);
+ MC_SAFE_G_FREE(bundle_str);
+ mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message");
+
+ ret = __mc_client_send_command(client, server_name, MC_COMMAND_CUSTOMACTION, command, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, message, request_id);
MC_SAFE_G_FREE(message);
diff --git a/src/media_controller_ipc.c b/src/media_controller_ipc.c
index 972b118..c044539 100755
--- a/src/media_controller_ipc.c
+++ b/src/media_controller_ipc.c
@@ -22,7 +22,7 @@
#define MAX_RETRY_COUNT 3
#define MAX_WAIT_COUNT 100
-#define MC_SVC_NAME "mediacontroller"
+#define DEFAULT_REQ_ID "DEF_REQ_ID"
/* This checks if service daemon is running */
static int __is_service_activated(mc_priv_type_e priv_type)
@@ -53,14 +53,18 @@ static void __mc_ipc_signal_cb(GDBusConnection *connection,
mc_debug("__mc_ipc_signal_cb Received :");
gchar *message = NULL;
- unsigned int request_id = 0;
+ gchar * request_id = NULL;
- g_variant_get(parameters, "(u&s)", &request_id, &message);
+ g_variant_get(parameters, "(s&s)", &request_id, &message);
if (!message) {
mc_error("g_variant_get() fail");
return;
}
+ if ((request_id != NULL) && (!g_strcmp0(request_id, DEFAULT_REQ_ID))) {
+ request_id = NULL;
+ }
+
char *key = __make_key_for_map(interface_name, signal_name);
if (key == NULL) {
mc_error("fail to get key");
@@ -71,7 +75,7 @@ static void __mc_ipc_signal_cb(GDBusConnection *connection,
for (i = 0; i < listener_cnt; i++) {
listener = (mc_ipc_listener_s *)g_list_nth_data(*listener_list, i);
if (listener && !g_strcmp0(listener->key, key)) {
- mc_debug("Received : [%s] (req_id = %ld) from %s.%s", message, request_id, listener->interface_name, listener->signal_name);
+ mc_debug("Received : [%s] (req_id = %s) from %s.%s", message, request_id, listener->interface_name, listener->signal_name);
listener->callback(listener->interface_name, listener->signal_name, message, request_id, listener->user_data);
break;
}
@@ -277,10 +281,10 @@ 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, unsigned int *request_id)
+int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, char **request_id)
{
GError *error = NULL;
- unsigned int req_id = 0;
+ char *req_id = (char*)"DEF_REQ_ID";
mc_retvm_if(connection == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "connection is NULL");
mc_retvm_if(!MC_STRING_VALID(signal_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid signal_name");
@@ -288,8 +292,42 @@ int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, cons
mc_debug("emit signal - interface_name [%s], signal_name [%s]", interface_name, signal_name);
- if (request_id != NULL)
- mc_util_get_request_id(&req_id);
+ if (request_id != NULL) {
+ req_id = mc_util_generate_uuid();
+ *request_id = g_strdup(req_id);
+
+ mc_secure_debug("req_id[%s]", req_id);
+ }
+
+ gboolean emmiting = g_dbus_connection_emit_signal(
+ connection,
+ dbus_name,
+ MC_DBUS_PATH,
+ interface_name,
+ signal_name,
+ g_variant_new("(ss)", req_id, message),
+ &error);
+ if (!emmiting) {
+ mc_error("g_dbus_connection_emit_signal failed : %s", error ? error->message : "none");
+ if (error) {
+ mc_error("Error in g_dbus_connection_emit_signal");
+ g_error_free(error);
+ }
+ return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
+ }
+
+ return MEDIA_CONTROLLER_ERROR_NONE;
+}
+
+int mc_ipc_send_reply(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, const char *request_id)
+{
+ GError *error = NULL;
+
+ mc_retvm_if(connection == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "connection is NULL");
+ mc_retvm_if(!MC_STRING_VALID(signal_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid signal_name");
+ mc_retvm_if(!MC_STRING_VALID(message), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid message");
+
+ mc_debug("emit signal - interface_name [%s], signal_name [%s]", interface_name, signal_name);
gboolean emmiting = g_dbus_connection_emit_signal(
connection,
@@ -297,7 +335,7 @@ int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, cons
MC_DBUS_PATH,
interface_name,
signal_name,
- g_variant_new("(us)", req_id, message),
+ g_variant_new("(ss)", request_id, message),
&error);
if (!emmiting) {
mc_error("g_dbus_connection_emit_signal failed : %s", error ? error->message : "none");
diff --git a/src/media_controller_server.c b/src/media_controller_server.c
index d4ba492..caa866b 100755
--- a/src/media_controller_server.c
+++ b/src/media_controller_server.c
@@ -103,7 +103,7 @@ static int __mc_server_destoy(media_controller_server_s *mc_server)
return ret;
}
-static void __server_playback_state_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_playback_state_command_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -115,7 +115,7 @@ static void __server_playback_state_command_cb(const char *interface_name, const
mc_server_playback_state_command_received_cb callback = receiver->callback;
mc_retm_if(receiver->callback == NULL, "playback_state_command_received_cb is NULL");
- mc_debug("__server_playback_state_command_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_playback_state_command_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid playback state command");
@@ -137,7 +137,7 @@ static void __server_playback_state_command_cb(const char *interface_name, const
g_strfreev(params);
}
-static void __server_playback_action_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_playback_action_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -146,10 +146,10 @@ static void __server_playback_action_cb(const char *interface_name, const char *
mc_retm_if(receiver == NULL, "reciever is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_server_playback_action_received_cb callback = receiver->callback;
+ mc_server_playback_action_cmd_received_cb callback = receiver->callback;
mc_retm_if(receiver->callback == NULL, "playback_action_command_received_cb is NULL");
- mc_debug("__server_playback_action_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_playback_action_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid playback_action command");
@@ -166,12 +166,12 @@ static void __server_playback_action_cb(const char *interface_name, const char *
return;
}
- callback(params[0], (mc_playback_action_e)value, receiver->user_data);
+ callback(params[0], request_id, (mc_playback_action_e)value, receiver->user_data);
g_strfreev(params);
}
-static void __server_playback_position_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_playback_position_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -180,10 +180,10 @@ static void __server_playback_position_command_cb(const char *interface_name, co
mc_retm_if(receiver == NULL, "reciever is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_server_playback_position_command_received_cb callback = receiver->callback;
- mc_retm_if(receiver->callback == NULL, "playback_position_command_received_cb is NULL");
+ mc_server_playback_position_cmd_received_cb callback = receiver->callback;
+ mc_retm_if(receiver->callback == NULL, "playback_position_cmd_received_cb is NULL");
- mc_debug("__server_playback_position_command_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_playback_position_cmd_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid playback_position command");
@@ -200,12 +200,12 @@ static void __server_playback_position_command_cb(const char *interface_name, co
return;
}
- callback(params[0], value, receiver->user_data);
+ callback(params[0], request_id, value, receiver->user_data);
g_strfreev(params);
}
-static void __server_shuffle_mode_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_shuffle_mode_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -214,10 +214,10 @@ static void __server_shuffle_mode_command_cb(const char *interface_name, const c
mc_retm_if(receiver == NULL, "reciever is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_server_shuffle_mode_command_received_cb callback = receiver->callback;
- mc_retm_if(receiver->callback == NULL, "shuffle_mode_command_received_cb is NULL");
+ mc_server_shuffle_mode_cmd_received_cb callback = receiver->callback;
+ mc_retm_if(receiver->callback == NULL, "shuffle_mode_cmd_received_cb is NULL");
- mc_debug("__server_shuffle_mode_command_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_shuffle_mode_cmd_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid shuffle_mode command");
@@ -234,12 +234,12 @@ static void __server_shuffle_mode_command_cb(const char *interface_name, const c
return;
}
- callback(params[0], (mc_shuffle_mode_e)value, receiver->user_data);
+ callback(params[0], request_id, (mc_shuffle_mode_e)value, receiver->user_data);
g_strfreev(params);
}
-static void __server_repeat_mode_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_repeat_mode_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -248,10 +248,10 @@ static void __server_repeat_mode_command_cb(const char *interface_name, const ch
mc_retm_if(receiver == NULL, "reciever is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_server_repeat_mode_command_received_cb callback = receiver->callback;
- mc_retm_if(receiver->callback == NULL, "repeat_mode_command_received_cb is NULL");
+ mc_server_repeat_mode_cmd_received_cb callback = receiver->callback;
+ mc_retm_if(receiver->callback == NULL, "repeat_mode_cmd_received_cb is NULL");
- mc_debug("__server_repeat_mode_command_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_repeat_mode_cmd_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid repeat_mode command");
@@ -268,12 +268,12 @@ static void __server_repeat_mode_command_cb(const char *interface_name, const ch
return;
}
- callback(params[0], (mc_repeat_mode_e)value, receiver->user_data);
+ callback(params[0], request_id, (mc_repeat_mode_e)value, receiver->user_data);
g_strfreev(params);
}
-static void __server_custom_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_custom_command_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
int enc_size = 0;
@@ -287,7 +287,7 @@ static void __server_custom_command_cb(const char *interface_name, const char *s
mc_server_custom_command_received_cb callback = receiver->callback;
mc_retm_if(receiver->callback == NULL, "custom_command_received_cb is NULL");
- mc_debug("__server_custom_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_custom_cb(%s, %s, %s, %s, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid custom data");
@@ -315,7 +315,7 @@ static void __server_custom_command_cb(const char *interface_name, const char *s
g_strfreev(params);
}
-static void __server_play_playlist_command_cb(const char *interface_name, const char *signal_name, const char *message, const unsigned int request_id, void *user_data)
+static void __server_play_playlist_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
{
gchar **params = NULL;
media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
@@ -325,10 +325,10 @@ static void __server_play_playlist_command_cb(const char *interface_name, const
mc_retm_if(receiver == NULL, "reciever is NULL");
mc_retm_if(message == NULL, "message is NULL");
- mc_server_playlist_command_received_cb callback = receiver->callback;
- mc_retm_if(receiver->callback == NULL, "mc_server_playlist_command_received_cb is NULL");
+ mc_server_playlist_cmd_received_cb callback = receiver->callback;
+ mc_retm_if(receiver->callback == NULL, "mc_server_playlist_cmd_received_cb is NULL");
- mc_debug("__server_play_playlist_command_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
+ mc_debug("__server_play_playlist_cmd_cb(%s, %s, %s, %ld, %p)", interface_name, signal_name, message, request_id, user_data);
params = g_strsplit(message, MC_STRING_DELIMITER, 0);
mc_retm_if(params == NULL, "invalid play_playlist command");
@@ -351,7 +351,49 @@ static void __server_play_playlist_command_cb(const char *interface_name, const
return;
}
- callback(params[0], params[1], params[2], (mc_playback_action_e)action, position, receiver->user_data);
+ callback(params[0], request_id, params[1], params[2], (mc_playback_action_e)action, position, receiver->user_data);
+
+ g_strfreev(params);
+}
+
+static void __server_custom_cmd_cb(const char *interface_name, const char *signal_name, const char *message, const char *request_id, void *user_data)
+{
+ gchar **params = NULL;
+ int enc_size = 0;
+ char *sender = NULL;
+ char *command = NULL;
+ bundle *bundle_data = NULL;
+
+ media_controller_receiver_s *receiver = (media_controller_receiver_s *)user_data;
+ mc_retm_if(receiver == NULL, "reciever is NULL");
+
+ mc_server_custom_cmd_received_cb callback = receiver->callback;
+ mc_retm_if(receiver->callback == NULL, "custom_command_received_cb is NULL");
+
+ mc_debug("__server_custom_cb(%s, %s, %s, %llu, %p)", interface_name, signal_name, message, request_id, user_data);
+
+ params = g_strsplit(message, MC_STRING_DELIMITER, 0);
+ mc_retm_if(params == NULL, "invalid custom data");
+
+ if (params[0])
+ sender = strdup(params[0]);
+
+ if (mc_util_get_command_available(MC_PRIV_TYPE_SERVER, sender, MC_COMMAND_CUSTOMACTION, params[1]) != MEDIA_CONTROLLER_ERROR_NONE) {
+ mc_error("Error permission denied");
+ MC_SAFE_FREE(sender);
+ g_strfreev(params);
+ return;
+ }
+
+ command = strdup(params[1]);
+ enc_size = atoi(params[2]);
+ if (enc_size > 0)
+ bundle_data = bundle_decode((bundle_raw *)params[3], enc_size);
+
+ callback(sender, request_id, command, bundle_data, receiver->user_data);
+
+ MC_SAFE_FREE(sender);
+ MC_SAFE_FREE(command);
g_strfreev(params);
}
@@ -661,7 +703,7 @@ int mc_server_set_playback_state_command_received_cb(mc_server_h server, mc_serv
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
- mc_warning("DEPRECATION WARNING: mc_server_set_playback_state_command_received_cb() is deprecated and will be removed from next release. Use mc_server_set_playback_action_received_cb() instead.");
+ mc_warning("DEPRECATION WARNING: mc_server_set_playback_state_command_received_cb() is deprecated and will be removed from next release. Use mc_server_set_playback_action_cmd_received_cb() instead.");
mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
mc_retvm_if(callback == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "callback is NULL");
@@ -682,7 +724,7 @@ int mc_server_unset_playback_state_command_received_cb(mc_server_h server)
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
- mc_warning("DEPRECATION WARNING: mc_server_set_playback_state_command_received_cb() is deprecated and will be removed from next release. Use mc_server_unset_playback_action_received_cb() instead.");
+ mc_warning("DEPRECATION WARNING: mc_server_set_playback_state_command_received_cb() is deprecated and will be removed from next release. Use mc_server_unset_playback_action_cmd_received_cb() instead.");
mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
@@ -697,7 +739,7 @@ int mc_server_unset_playback_state_command_received_cb(mc_server_h server)
return ret;
}
-int mc_server_set_playback_action_received_cb(mc_server_h server, mc_server_playback_action_received_cb callback, void *user_data)
+int mc_server_set_playback_action_cmd_received_cb(mc_server_h server, mc_server_playback_action_cmd_received_cb callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -716,7 +758,7 @@ int mc_server_set_playback_action_received_cb(mc_server_h server, mc_server_play
return ret;
}
-int mc_server_unset_playback_action_received_cb(mc_server_h server)
+int mc_server_unset_playback_action_cmd_received_cb(mc_server_h server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -734,7 +776,7 @@ int mc_server_unset_playback_action_received_cb(mc_server_h server)
return ret;
}
-int mc_server_set_playback_position_command_received_cb(mc_server_h server, mc_server_playback_position_command_received_cb callback, void *user_data)
+int mc_server_set_playback_position_cmd_received_cb(mc_server_h server, mc_server_playback_position_cmd_received_cb callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -746,14 +788,14 @@ int mc_server_set_playback_position_command_received_cb(mc_server_h server, mc_s
mc_server->playback_position_reciever.user_data = user_data;
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, __server_playback_position_command_cb, (void *)&(mc_server->playback_position_reciever));
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_POS_CMD, __server_playback_position_cmd_cb, (void *)&(mc_server->playback_position_reciever));
MC_SAFE_FREE(interface_name);
return ret;
}
-int mc_server_unset_playback_position_command_received_cb(mc_server_h server)
+int mc_server_unset_playback_position_cmd_received_cb(mc_server_h server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -771,7 +813,7 @@ int mc_server_unset_playback_position_command_received_cb(mc_server_h server)
return ret;
}
-int mc_server_set_shuffle_mode_command_received_cb(mc_server_h server, mc_server_shuffle_mode_command_received_cb callback, void *user_data)
+int mc_server_set_shuffle_mode_cmd_received_cb(mc_server_h server, mc_server_shuffle_mode_cmd_received_cb callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -783,14 +825,14 @@ int mc_server_set_shuffle_mode_command_received_cb(mc_server_h server, mc_server
mc_server->shuffle_mode_reciever.user_data = user_data;
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, __server_shuffle_mode_command_cb, (void *)&(mc_server->shuffle_mode_reciever));
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_SHUFFLE_CMD, __server_shuffle_mode_cmd_cb, (void *)&(mc_server->shuffle_mode_reciever));
MC_SAFE_FREE(interface_name);
return ret;
}
-int mc_server_unset_shuffle_mode_command_received_cb(mc_server_h server)
+int mc_server_unset_shuffle_mode_cmd_received_cb(mc_server_h server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -808,7 +850,7 @@ int mc_server_unset_shuffle_mode_command_received_cb(mc_server_h server)
return ret;
}
-int mc_server_set_repeat_mode_command_received_cb(mc_server_h server, mc_server_repeat_mode_command_received_cb callback, void *user_data)
+int mc_server_set_repeat_mode_cmd_received_cb(mc_server_h server, mc_server_repeat_mode_cmd_received_cb callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -820,14 +862,14 @@ int mc_server_set_repeat_mode_command_received_cb(mc_server_h server, mc_server_
mc_server->repeat_mode_reciever.user_data = user_data;
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, __server_repeat_mode_command_cb, (void *)&(mc_server->repeat_mode_reciever));
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_REPEAT_CMD, __server_repeat_mode_cmd_cb, (void *)&(mc_server->repeat_mode_reciever));
MC_SAFE_FREE(interface_name);
return ret;
}
-int mc_server_unset_repeat_mode_command_received_cb(mc_server_h server)
+int mc_server_unset_repeat_mode_cmd_received_cb(mc_server_h server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -853,11 +895,11 @@ int mc_server_set_custom_command_received_cb(mc_server_h server, mc_server_custo
mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
mc_retvm_if(callback == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "callback is NULL");
- mc_server->custom_cmd_reciever.callback = callback;
- mc_server->custom_cmd_reciever.user_data = user_data;
+ mc_server->custom_command_reciever.callback = callback;
+ mc_server->custom_command_reciever.user_data = user_data;
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, __server_custom_command_cb, (void *)&(mc_server->custom_cmd_reciever));
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND, __server_custom_command_cb, (void *)&(mc_server->custom_command_reciever));
MC_SAFE_FREE(interface_name);
@@ -872,10 +914,10 @@ int mc_server_unset_custom_command_received_cb(mc_server_h server)
mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_unregister_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD);
+ ret = mc_ipc_unregister_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND);
- mc_server->custom_cmd_reciever.callback = NULL;
- mc_server->custom_cmd_reciever.user_data = NULL;
+ mc_server->custom_command_reciever.callback = NULL;
+ mc_server->custom_command_reciever.user_data = NULL;
MC_SAFE_FREE(interface_name);
@@ -896,11 +938,11 @@ int mc_server_send_command_reply(mc_server_h server, const char *client_name, in
mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "Error when make string from bundle");
message = g_strdup_printf("%s%s%d%s%s", mc_server->server_name, MC_STRING_DELIMITER, result_code, MC_STRING_DELIMITER, bundle_str);
- MC_SAFE_FREE(bundle_str);
+ MC_SAFE_G_FREE(bundle_str);
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, NULL);
+ ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_COMMAND_REPLY, message, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
mc_error("Error mc_ipc_send_message [%d]", ret);
@@ -910,7 +952,7 @@ int mc_server_send_command_reply(mc_server_h server, const char *client_name, in
return ret;
}
-int mc_server_set_playlist_command_received_cb(mc_server_h server, mc_server_playlist_command_received_cb callback, void *user_data)
+int mc_server_set_playlist_cmd_received_cb(mc_server_h server, mc_server_playlist_cmd_received_cb callback, void *user_data)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -922,14 +964,14 @@ int mc_server_set_playlist_command_received_cb(mc_server_h server, mc_server_pla
mc_server->play_playlist_reciever.user_data = user_data;
char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
- ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, __server_play_playlist_command_cb, (void *)&(mc_server->play_playlist_reciever));
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_PLAYBACK_PLAYLIST, __server_play_playlist_cmd_cb, (void *)&(mc_server->play_playlist_reciever));
MC_SAFE_FREE(interface_name);
return ret;
}
-int mc_server_unset_playlist_command_received_cb(mc_server_h server)
+int mc_server_unset_playlist_cmd_received_cb(mc_server_h server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
media_controller_server_s *mc_server = (media_controller_server_s *)server;
@@ -947,6 +989,72 @@ int mc_server_unset_playlist_command_received_cb(mc_server_h server)
return ret;
}
+int mc_server_set_custom_cmd_received_cb(mc_server_h server, mc_server_custom_cmd_received_cb callback, void *user_data)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_server_s *mc_server = (media_controller_server_s *)server;
+
+ mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+ mc_retvm_if(callback == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "callback is NULL");
+
+ mc_server->custom_cmd_reciever.callback = callback;
+ mc_server->custom_cmd_reciever.user_data = user_data;
+
+ char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
+ ret = mc_ipc_register_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, __server_custom_cmd_cb, (void *)&(mc_server->custom_cmd_reciever));
+
+ MC_SAFE_FREE(interface_name);
+
+ return ret;
+}
+
+int mc_server_unset_custom_cmd_received_cb(mc_server_h server)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ media_controller_server_s *mc_server = (media_controller_server_s *)server;
+
+ mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+
+ char *interface_name = mc_util_get_interface_name(MC_SERVER, mc_server->server_name);
+ ret = mc_ipc_unregister_listener(&mc_server->listeners, mc_server->dconn, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD);
+
+ mc_server->custom_cmd_reciever.callback = NULL;
+ mc_server->custom_cmd_reciever.user_data = NULL;
+
+ MC_SAFE_FREE(interface_name);
+
+ return ret;
+}
+
+int mc_server_send_cmd_reply(mc_server_h server, const char *client_name, const char *request_id, int result_code, bundle *data)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+ char *message = NULL;
+ char *bundle_str = NULL;
+ media_controller_server_s *mc_server = (media_controller_server_s *)server;
+
+ mc_retvm_if(mc_server == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Handle is NULL");
+ mc_retvm_if(!MC_STRING_VALID(client_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "client_name is NULL");
+ mc_retvm_if(!MC_STRING_VALID(request_id), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "request_id is NULL");
+
+ ret = mc_util_bundle_to_string(data, &bundle_str);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "Error when make string from bundle");
+
+ message = g_strdup_printf("%s%s%d%s%s", mc_server->server_name, MC_STRING_DELIMITER, result_code, MC_STRING_DELIMITER, bundle_str);
+ MC_SAFE_G_FREE(bundle_str);
+ 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_reply(mc_server->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY, message, request_id);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ mc_error("Error mc_ipc_send_message [%d]", ret);
+
+ MC_SAFE_G_FREE(message);
+ MC_SAFE_G_FREE(interface_name);
+
+ return ret;
+}
+
int mc_server_create(mc_server_h *server)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
diff --git a/src/media_controller_util.c b/src/media_controller_util.c
index 0a147e7..4e674e3 100755
--- a/src/media_controller_util.c
+++ b/src/media_controller_util.c
@@ -18,13 +18,12 @@
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
+#include <uuid/uuid.h>
#include "media_controller_private.h"
//#define UNIT_TEST /* for testsuite */
#define MAX_NAME_LENGTH 255
-static GMutex mutex_req_id;
-
static void _mc_util_check_valid_name(const char *name, char **valid_name)
{
char old_word[MAX_NAME_LENGTH] = {0, };
@@ -176,24 +175,21 @@ int mc_util_get_command_available(mc_priv_type_e priv_type, const char *name, co
return ret;
}
-int mc_util_get_request_id(unsigned int *req_id)
+char *mc_util_generate_uuid(void)
{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
- static unsigned int request_id = 0;
-
- mc_retvm_if(req_id == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "invalid parameter");
+ uuid_t uuid_value;
+ static char uuid_unparsed[37];
- g_mutex_lock(&mutex_req_id);
+RETRY_GEN:
+ uuid_generate(uuid_value);
+ uuid_unparse(uuid_value, uuid_unparsed);
- if (request_id + 1 == UINT_MAX) {
- request_id = 0;
+ if (strlen(uuid_unparsed) < 36) {
+ mc_debug("INVALID UUID : %s. RETRY GENERATE.", uuid_unparsed);
+ goto RETRY_GEN;
}
- request_id++;
- *req_id = request_id;
- g_mutex_unlock(&mutex_req_id);
-
- return ret;
+ return uuid_unparsed;
}
int mc_util_bundle_to_string(bundle *bundle_data, char **str_data)
diff --git a/test/client_test/media_controller_client_test.c b/test/client_test/media_controller_client_test.c
index b41a24f..e31e26f 100755
--- a/test/client_test/media_controller_client_test.c
+++ b/test/client_test/media_controller_client_test.c
@@ -47,6 +47,17 @@ static unsigned long long g_playback_position;
static mc_shuffle_mode_e g_shuffle_mode;
static mc_repeat_mode_e g_repeat_mode;
+typedef enum {
+ TEST_REQ_PB_ACT_CMD,
+ TEST_REQ_PB_POS_CMD,
+ TEST_REQ_SHUFFLE_CMD,
+ TEST_REQ_REPEAT_CMD,
+ TEST_REQ_PLAYLIST_CMD,
+ TEST_REQ_CUSTOM_CMD,
+ TEST_REQ_MAX,
+} test_req_e;
+static char *g_request_id[TEST_REQ_MAX];
+
GMainLoop *mainloop = NULL;
#define MAX_STRING_LEN 2048
@@ -153,6 +164,34 @@ void _mc_command_reply_received_cb(const char *server_name, int result_code, bun
mc_debug("[Client:%s] Command Reply (key1: %s)received from server[%s] result code[%d]", _client->client_name, value, server_name, result_code);
}
+void _mc_cmd_reply_received_cb(const char *server_name, const char *request_id, int result_code, bundle *data, void *user_data)
+{
+ char *value = NULL;
+ media_controller_client_s *_client = (media_controller_client_s *)g_mc_client;
+
+ mc_error("[No-Errror][Id:%s]", request_id);
+
+ unsigned int i = 0;
+ unsigned int found = 0;
+ for (i = 0; i < TEST_REQ_MAX; i++) {
+ if (strcmp(request_id, g_request_id[i]) == 0) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ mc_error("[Client:%s] Wrong request_id", _client->client_name, request_id);
+ }
+ if (strcmp(request_id, g_request_id[TEST_REQ_CUSTOM_CMD]) == 0) {
+ if (data)
+ bundle_get_str(data, "key1", &value);
+
+ mc_debug("[Client:%s] Custom Command Reply (key1: %s)received from server[%s] result code[%d]", _client->client_name, request_id, value, server_name, result_code);
+ } else {
+ mc_error("[Client:%s] Reply result code[%d] from server[%s]", _client->client_name, request_id, result_code, server_name);
+ }
+}
+
static gboolean _create()
{
g_print("== create \n");
@@ -207,6 +246,9 @@ static gboolean _set_callback()
ret = mc_client_set_playlist_update_cb(g_mc_client, _mc_playlist_update_cb, NULL);
mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_playlist_update_cb [%d]", ret);
+ ret = mc_client_set_cmd_reply_received_cb(g_mc_client, _mc_cmd_reply_received_cb, NULL);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_set_reply_received_cb [%d]", ret);
+
mc_debug_fleave();
return ret;
@@ -236,6 +278,9 @@ static gboolean _unset_callback()
ret = mc_client_unset_playlist_update_cb(g_mc_client);
mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_unset_playlist_update_cb [%d]", ret);
+ ret = mc_client_unset_cmd_reply_received_cb(g_mc_client);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, FALSE, "Fail to mc_client_unset_reply_received_cb [%d]", ret);
+
mc_debug_fleave();
return TRUE;
@@ -388,14 +433,14 @@ static gboolean _send()
return FALSE;
}
- ret = mc_client_send_playback_action(g_mc_client, g_server_name, action);
+ ret = mc_client_send_playback_action_cmd(g_mc_client, g_server_name, action, &g_request_id[TEST_REQ_PB_ACT_CMD]);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
g_print("Fail to send playback action command [%d]", ret);
return FALSE;
}
g_playback_position += 1000;
- ret = mc_client_send_playback_position_command(g_mc_client, g_server_name, g_playback_position);
+ ret = mc_client_send_playback_position_cmd(g_mc_client, g_server_name, g_playback_position, &g_request_id[TEST_REQ_PB_POS_CMD]);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
g_print("Fail to send playback position command [%d]", ret);
return FALSE;
@@ -405,7 +450,7 @@ static gboolean _send()
g_shuffle_mode = MC_SHUFFLE_MODE_ON;
else
g_shuffle_mode = MC_SHUFFLE_MODE_OFF;
- ret = mc_client_send_shuffle_mode_command(g_mc_client, g_server_name, g_shuffle_mode);
+ ret = mc_client_send_shuffle_mode_cmd(g_mc_client, g_server_name, g_shuffle_mode, &g_request_id[TEST_REQ_SHUFFLE_CMD]);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
g_print("Fail to send shuffle mode command [%d]", ret);
return FALSE;
@@ -415,13 +460,14 @@ static gboolean _send()
g_repeat_mode = MC_REPEAT_MODE_ON;
else
g_repeat_mode = MC_REPEAT_MODE_OFF;
- ret = mc_client_send_repeat_mode_command(g_mc_client, g_server_name, g_repeat_mode);
+
+ ret = mc_client_send_repeat_mode_cmd(g_mc_client, g_server_name, g_repeat_mode, &g_request_id[TEST_REQ_REPEAT_CMD]);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
g_print("Fail to send shuffle mode command [%d]", ret);
return FALSE;
}
- ret = mc_client_send_playlist_command(g_mc_client, g_server_name, g_playlist_name, "1", MC_PLAYBACK_ACTION_PLAY, 300);
+ ret = mc_client_send_playlist_cmd(g_mc_client, g_server_name, g_playlist_name, "1", MC_PLAYBACK_ACTION_PLAY, 300, &g_request_id[TEST_REQ_PLAYLIST_CMD]);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
g_print("Fail to send play playlist item [%d]", ret);
return FALSE;
@@ -446,6 +492,24 @@ static gboolean _send()
}
bundle_free(bundle_data);
+ bundle_data = bundle_create();
+ bundle_add_str(bundle_data, "key1", "val1_2");
+ bundle_add_str(bundle_data, "key2", "val2_2");
+ bundle_add_str(bundle_data, "key3", "val3_2");
+ bundle_add_str(bundle_data, "key4", "val4_2");
+
+ ret = mc_client_send_custom_cmd(g_mc_client, g_server_name, "Custom Command2", bundle_data, &g_request_id[TEST_REQ_CUSTOM_CMD]);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
+ bundle_free(bundle_data);
+ mc_error("Fail to send custom command %d", ret);
+ return FALSE;
+ }
+ bundle_free(bundle_data);
+
+ unsigned int i = 0;
+ for (i = 0; i < TEST_REQ_MAX; i++)
+ mc_error("[No-Errror][%02u][Id:%s]", i, g_request_id[i]);
+
g_print("== success send command \n");
return TRUE;
diff --git a/test/server_test/media_controller_server_test.c b/test/server_test/media_controller_server_test.c
index 64759a6..24f0146 100755
--- a/test/server_test/media_controller_server_test.c
+++ b/test/server_test/media_controller_server_test.c
@@ -77,27 +77,47 @@ int g_menu_set_state = CURRENT_STATE_SET_MODE_NONE;
void __playback_state_command_received_cb(const char *client_name, mc_playback_states_e state, void *user_data)
{
- mc_debug("[%s] recieved playback state:[%d] from [%s]", client_name, state, client_name);
+ g_print("[%s] recieved playback state:[%d] from [%s]\n", client_name, state, client_name);
}
-void __playback_action_received_cb(const char *client_name, mc_playback_action_e action, void *user_data)
+void __playback_action_received_cb(const char *client_name, const char *request_id, mc_playback_action_e action, void *user_data)
{
- mc_debug("[%s] recieved playback action:[%d] from [%s]", client_name, action, client_name);
+ int ret = 0;
+ g_print("[%s][%s] recieved playback action:[%d] from [%s]\n", client_name, request_id, action, client_name);
+
+ ret = mc_server_send_cmd_reply(g_mc_server, client_name, request_id, 0, NULL);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ g_print("Fail to mc_server_send_command_reply\n");
}
-void __playback_position_command_received_cb(const char *client_name, unsigned long long position, void *user_data)
+void __playback_position_cmd_received_cb(const char *client_name, const char *request_id, unsigned long long position, void *user_data)
{
- mc_debug("[%s] recieved playback position:[%llu] from [%s]", client_name, position, client_name);
+ int ret = 0;
+ g_print("[%s][%s] recieved playback position:[%llu] from [%s]\n", client_name, request_id, position, client_name);
+
+ ret = mc_server_send_cmd_reply(g_mc_server, client_name, request_id, 0, NULL);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ g_print("Fail to mc_server_send_command_reply\n");
}
-void __shuffle_mode_command_received_cb(const char *client_name, mc_shuffle_mode_e shuffle_mode, void *user_data)
+void __shuffle_mode_cmd_received_cb(const char *client_name, const char *request_id, mc_shuffle_mode_e shuffle_mode, void *user_data)
{
- mc_debug("[%s] recieved shuffle mode:[%d] from [%s]", client_name, shuffle_mode, client_name);
+ int ret = 0;
+ g_print("[%s][%s] recieved shuffle mode:[%d] from [%s]\n", client_name, request_id, shuffle_mode, client_name);
+
+ ret = mc_server_send_cmd_reply(g_mc_server, client_name, request_id, 0, NULL);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ g_print("Fail to mc_server_send_command_reply\n");
}
-void __repeat_mode_command_received_cb(const char *client_name, mc_repeat_mode_e repeat_mode, void *user_data)
+void __repeat_mode_cmd_received_cb(const char *client_name, const char *request_id, mc_repeat_mode_e repeat_mode, void *user_data)
{
- mc_debug("[%s] recieved repeat mode:[%d] from [%s]", client_name, repeat_mode, client_name);
+ int ret = 0;
+
+ g_print("[%s][%s] recieved repeat mode:[%d] from [%s]\n", client_name, request_id, repeat_mode, client_name);
+ ret = mc_server_send_cmd_reply(g_mc_server, client_name, request_id, 0, NULL);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ g_print("Fail to mc_server_send_command_reply\n");
}
void __playlist_play_received_cb(const char* client_name, const char *playlist_name, const char *index, mc_playback_action_e action, unsigned long long position, void *user_data)
@@ -124,8 +144,8 @@ void __custom_command_received_cb(const char *client_name, const char *command,
bundle_data = g_strdup_printf("%s, %s, %s, %s", get_value1, get_value2, get_value3, get_value4);
}
- mc_debug("[%s] recieved command:[%s] from [%s]", client_name, command, client_name);
- mc_debug("[%s] recieved bundle:[%s] from [%s]", client_name, bundle_data, client_name);
+ g_print("[%s] recieved command:[%s] from [%s]\n", client_name, command, client_name);
+ g_print("[%s] recieved bundle:[%s] from [%s]\n", client_name, bundle_data, client_name);
bundle *bundle_reply = bundle_create();
bundle_add_str(bundle_reply, "key1", "result1");
@@ -135,7 +155,44 @@ void __custom_command_received_cb(const char *client_name, const char *command,
ret = mc_server_send_command_reply(g_mc_server, client_name, 0, bundle_reply);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("Fail to mc_server_send_command_reply");
+ g_print("Fail to mc_server_send_command_reply\n");
+
+ bundle_free(bundle_reply);
+ if (bundle_data != NULL)
+ g_free(bundle_data);
+}
+
+void __custom_cmd_received_cb(const char *client_name, const char *request_id, const char *command, bundle *data, void *user_data)
+{
+ int ret = MEDIA_CONTROLLER_ERROR_NONE;
+
+ char *bundle_data = NULL;
+ char *get_value1 = NULL;
+ char *get_value2 = NULL;
+ char *get_value3 = NULL;
+ char *get_value4 = NULL;
+
+ if (data) {
+ bundle_get_str(data, "key1", &get_value1);
+ bundle_get_str(data, "key2", &get_value2);
+ bundle_get_str(data, "key3", &get_value3);
+ bundle_get_str(data, "key4", &get_value4);
+
+ bundle_data = g_strdup_printf("%s, %s, %s, %s", get_value1, get_value2, get_value3, get_value4);
+ }
+
+ g_print("[%s] recieved request_id:[%s] command:[%s] from [%s]\n", client_name, request_id, command, client_name);
+ g_print("[%s] recieved bundle:[%s] from [%s]\n", client_name, bundle_data, client_name);
+
+ bundle *bundle_reply = bundle_create();
+ bundle_add_str(bundle_reply, "key1", "result1_2");
+ bundle_add_str(bundle_reply, "key2", "result2_2");
+ bundle_add_str(bundle_reply, "key3", "result3_2");
+ bundle_add_str(bundle_reply, "key4", "result4_2");
+
+ ret = mc_server_send_cmd_reply(g_mc_server, client_name, request_id, 0, bundle_reply);
+ if (ret != MEDIA_CONTROLLER_ERROR_NONE)
+ g_print("Fail to mc_server_send_command_reply\n");
bundle_free(bundle_reply);
if (bundle_data != NULL)
@@ -236,27 +293,27 @@ static gboolean _set_cb()
return FALSE;
}
- ret = mc_server_set_playback_action_received_cb(g_mc_server, __playback_action_received_cb, NULL);
+ ret = mc_server_set_playback_action_cmd_received_cb(g_mc_server, __playback_action_received_cb, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- g_print("Fail to set mc_server_set_playback_action_received_cb");
+ g_print("Fail to set mc_server_set_playback_action_cmd_received_cb");
return FALSE;
}
- ret = mc_server_set_playback_position_command_received_cb(g_mc_server, __playback_position_command_received_cb, NULL);
+ ret = mc_server_set_playback_position_cmd_received_cb(g_mc_server, __playback_position_cmd_received_cb, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- g_print("Fail to set mc_server_set_playback_position_command_received_cb");
+ g_print("Fail to set mc_server_set_playback_position_cmd_received_cb");
return FALSE;
}
- ret = mc_server_set_shuffle_mode_command_received_cb(g_mc_server, __shuffle_mode_command_received_cb, NULL);
+ ret = mc_server_set_shuffle_mode_cmd_received_cb(g_mc_server, __shuffle_mode_cmd_received_cb, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- g_print("Fail to set mc_server_set_shuffle_mode_command_received_cb");
+ g_print("Fail to set mc_server_set_shuffle_mode_cmd_received_cb");
return FALSE;
}
- ret = mc_server_set_repeat_mode_command_received_cb(g_mc_server, __repeat_mode_command_received_cb, NULL);
+ ret = mc_server_set_repeat_mode_cmd_received_cb(g_mc_server, __repeat_mode_cmd_received_cb, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- g_print("Fail to set mc_server_set_repeat_mode_command_received_cb");
+ g_print("Fail to set mc_server_set_repeat_mode_cmd_received_cb");
return FALSE;
}
@@ -266,9 +323,9 @@ static gboolean _set_cb()
return FALSE;
}
- ret = mc_server_set_playlist_command_received_cb(g_mc_server, __playlist_play_received_cb, NULL);
+ ret = mc_server_set_custom_cmd_received_cb(g_mc_server, __custom_cmd_received_cb, NULL);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- g_print("Fail to set mc_server_set_playlist_command_received_cb");
+ g_print("Fail to set mc_server_set_custom_cmd_received_cb");
return FALSE;
}