#include <glib.h>
#include <dlog.h>
#include <string.h>
+#include <mime_type.h>
+#include <aul.h>
#include <glib.h>
#include <gio/gio.h>
}
/* Get the session bus. */
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_gdbus_get_session_gconn();
retv_if(g_conn == NULL, FALSE);
properties_proxy = g_dbus_proxy_new_sync(g_conn, G_DBUS_PROXY_FLAGS_NONE,
NULL, BT_OBEXD_DBUS_NAME,
GDBusProxy *session_proxy;
GError *err = NULL;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_gdbus_get_session_gconn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
retv_if(sending_info->session_path == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
GError *err = NULL;
GDBusConnection *g_conn;
GDBusProxy *client_proxy;
- char *mime_type = NULL;
+ char mime_type[BT_MIME_TYPE_MAX_LEN + 1] = { 0 };
if (sending_info == NULL)
return;
if (file_offset < sending_info->file_count) {
/* Get the session bus. */
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_gdbus_get_session_gconn();
ret_if(g_conn == NULL);
client_proxy = g_dbus_proxy_new_sync(g_conn, G_DBUS_PROXY_FLAGS_NONE,
BT_OBEX_OBJECT_PUSH_INTERFACE,
NULL, &err);
ret_if(client_proxy == NULL);
- if (headed_plugin_info->plugin_headed_enabled) {
- if (headed_plugin_info->headed_plugin->bt_get_mime_type(sending_info->file_name_array[file_offset],
- &mime_type) == BLUETOOTH_ERROR_NONE) {
+ if (aul_get_mime_from_file(sending_info->file_name_array[file_offset],
+ mime_type, BT_MIME_TYPE_MAX_LEN) == AUL_R_OK) {
BT_DBG("MLME type = %s", mime_type);
/* For IOPT compliance, change "text/x-iMelody" to "audio/imelody"
strncpy(mime_type, "text/x-vcard", BT_MIME_TYPE_MAX_LEN);
BT_DBG("over writing mime type to = %s", mime_type);
}
- }
}
BT_DBG("Calling SendFile");
if (err != NULL) {
BT_ERR("Calling SendFile failed: [%s]\n", err->message);
g_clear_error(&err);
- g_free(mime_type);
return;
}
__bt_sending_release();
}
- g_free(mime_type);
BT_DBG("-");
}
BT_CHECK_PARAMETER(file_name_array, return);
/* Get the session bus. */
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_gdbus_get_session_gconn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
client_proxy = g_dbus_proxy_new_sync(g_conn, G_DBUS_PROXY_FLAGS_NONE,
} else {
/* Insert data in the queue */
data = g_malloc0(sizeof(bt_sending_data_t));
+ if (data == NULL)
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
data->file_path = g_new0(char *, file_count + 1);
data->address = g_strdup(address);
data->file_count = file_count;