*
* @remarks The callback is called in the dbus event loop.
*
- * @param[in] server_name The app_id of the updated media controller server, it can be used only in the callback. To use outside, make a copy.
- * @param[in] playback The playback information of the updated media controller server
+ * @param[in] server_name The app_id of the updated media controller server. it can be used only in the callback. To use outside, make a copy.
+ * @param[in] playback The playback information of the updated media controller server. it can be used only in the callback.
* @param[in] user_data The user data passed from the mc_client_set_playback_update_cb() function
*
* @pre mc_client_set_playback_update_cb()
*
* @remarks The callback is called in the dbus event loop.
*
- * @param[in] server_name The app_id of the updated media controller server, it can be used only in the callback. To use outside, make a copy.
- * @param[in] metadata the metadata of the updated media controller server
+ * @param[in] server_name The app_id of the updated media controller server. it can be used only in the callback. To use outside, make a copy.
+ * @param[in] metadata the metadata of the updated media controller server. it can be used only in the callback.
* @param[in] user_data The user data passed from the mc_client_set_metadata_update_cb() function
*
* @pre mc_client_set_metadata_update_cb()
* @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.
+ * @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 updated media controller server, it can be used only in the callback. To use outside, make a copy.
* @param[in] result_code The result code of custom command
* 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.
+ * @remarks The callback is called in the dbus event loop. @a data should be released using bundle_free().
*
- * @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
+ * @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.
* @param[in] data The extra data
* @param[in] user_data The user data passed from the mc_server_set_custom_command_received_cb() function
*
mc_retvm_if(exist_server == FALSE, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Error Invalid server_name");
ret = mc_util_set_command_availabe(mc_client->client_name, MC_COMMAND_CUSTOM, command);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- mc_error("Error mc_util_set_command_availabe [%d]", ret);
- return ret;
- }
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "Error mc_util_set_command_availabe [%d]", ret);
if (callback) {
char *interface_name_for_reply = mc_util_get_interface_name(MC_CLIENT, mc_client->client_name);
if (data) {
ret = bundle_encode(data, &raw_data, &size_r);
- mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, ret, "fail while encoding bundle [%d]", ret);
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "fail while encoding bundle [%d]", ret);
}
if ((size_r == 0) || (raw_data == NULL))
else
message = g_strdup_printf("%s%s%s%s%d%s%s", mc_client->client_name, MC_STRING_DELIMITER, command, MC_STRING_DELIMITER, size_r, MC_STRING_DELIMITER, (unsigned char *)raw_data);
- if (raw_data != NULL)
- bundle_free_encoded_rawdata(&raw_data);
+ MC_SAFE_FREE(raw_data);
- if (message == NULL) {
- mc_error("Error when making message");
- return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
- }
+ mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message");
char *interface_name = mc_util_get_interface_name(MC_SERVER, server_name);
ret = mc_ipc_send_message(mc_client->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CUSTOM_CMD, message, 0);
callback(sender, command, bundle_data, receiver->user_data);
+ MC_SAFE_FREE(sender);
+ MC_SAFE_FREE(command);
+
g_strfreev(params);
}
if (data) {
ret = bundle_encode(data, &raw_data, &size_r);
- if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
- mc_error("Error while encoding bundle [%d]", ret);
- return MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER;
- }
+ mc_retvm_if(ret != MEDIA_CONTROLLER_ERROR_NONE, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error while encoding bundle [%d]", ret);
}
if ((size_r == 0) || (raw_data == NULL))
else
message = g_strdup_printf("%s%s%d%s%d%s%s", mc_server->server_name, MC_STRING_DELIMITER, result_code, MC_STRING_DELIMITER, size_r, MC_STRING_DELIMITER, (unsigned char *)raw_data);
- if (raw_data)
- bundle_free_encoded_rawdata(&raw_data);
+ MC_SAFE_FREE(raw_data);
+
+ mc_retvm_if(message == NULL, MEDIA_CONTROLLER_ERROR_INVALID_OPERATION, "Error when making message");
char *interface_name = mc_util_get_interface_name(MC_CLIENT, client_name);
ret = mc_ipc_send_message(mc_server->dconn, NULL, interface_name, MC_DBUS_SIGNAL_NAME_CMD_REPLY, message, 0);
if (ret != MEDIA_CONTROLLER_ERROR_NONE)
- mc_error("fail mc_ipc_send_message [%d]", ret);
+ mc_error("Error mc_ipc_send_message [%d]", ret);
MC_SAFE_G_FREE(message);
MC_SAFE_G_FREE(interface_name);