void _free_transfer_info(opc_transfer_info_t *node);
void _remove_transfer_info(opc_transfer_info_t *node);
int _request_file_send(opc_transfer_info_t *node);
-void _bt_send_message_to_ui(int transfer_id,
- char *name,
- int percentage,
- gboolean completed,
- int error_type);
void _bt_create_warning_popup(int error_type, char *msg);
-void _bt_update_transfer_list_view(const char *table);
gboolean _bt_update_sent_data_status(int uid, bt_app_tr_status_t status);
void _bt_rm_all_send_data(void);
void _bt_rm_all_recv_data(void);
+void _bt_update_transfer_list_view(char *db);
gboolean _bt_add_recv_transfer_status_data(char *device_name,
- char *filepath, char *type,
- unsigned int size, int status);
+ char *filepath, char *type,
+ unsigned int size, int status);
#ifdef __cplusplus
}
#define UI_PACKAGE "org.tizen.bluetooth-share-ui"
#define UI_PKG_PATH "/usr/apps/org.tizen.bluetooth-share-ui/bin/bluetooth-share-ui"
+
typedef void (*bt_app_cb) (void *, void *, void *);
typedef struct {
bool opp_transfer_abort;
};
+int _bt_init_obex_server(void);
void _bt_terminate_bluetooth_share(void);
-int _bt_init_obex_server(void);
#ifdef __cplusplus
}
CREATE_TR_LIST
} bt_notification_launch_type_e;
-notification_h _bt_create_notification(bt_qp_type_t type);
notification_h _bt_insert_notification(struct bt_appdata *ad, bt_notification_type_e type, int index, int total);
int _bt_update_notification(struct bt_appdata *ad, notification_h noti,
- char *title, char *content, char *icon_path);
-
+ char *title,
+ char *content,
+ char *icon_path);
int _bt_update_notification_progress(notification_h noti,
- int id, int val);
-
-gboolean _bt_get_notification_text(int priv_id, char *str);
+ int id,
+ int val);
int _bt_get_notification_priv_id(notification_h noti);
int _bt_delete_notification(notification_h noti);
-int _bt_set_notification_property(notification_h noti, int flag);
-
int _bt_get_notification_priv_id(notification_h noti);
int _bt_set_notification_app_launch(notification_h noti,
- bt_notification_launch_type_e launch_type,
- const char *transfer_type,
- const char *filename,
- const char *progress_cnt,
- int transfer_id);
+ bt_notification_launch_type_e launch_type,
+ const char *transfer_type,
+ const char *filename,
+ const char *progress_cnt,
+ int transfer_id);
gboolean _bt_update_notification_status(struct bt_appdata *ad);
void _bt_unregister_notification_cb(struct bt_appdata *ad);
-
#ifdef __cplusplus
}
#endif
#define BT_ICON_NOTIFICATION_RECEIVED QP_PRELOAD_NOTI_ICON_PATH"/noti_download_complete.png"
#define BT_ICON_NOTIFICATION_RECEIVED_INDICATOR ICONDIR"/B03_Processing_download_complete.png"
-
#ifdef __cplusplus
}
#endif
BT_FILE_OTHER /**<OTHER*/
} bt_file_type_t;
+bt_obex_server_authorize_into_t server_auth_info;
+
int _bt_get_transfer_id_by_noti_id(int noti_id);
void _bt_clear_receive_noti_list(void);
if (is_block) {
if (block_sleep_count < 0) {
- DBG("block_sleep_count[%d] is invalid. It is set to 0.\n",
+ INFO("block_sleep_count[%d] is invalid. It is set to 0.\n",
block_sleep_count);
block_sleep_count = 0;
} else if (block_sleep_count == 0) {
result = display_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
if (result != 0) {
- DBG("LCD Lock is failed with result code [%d]\n", result);
+ INFO("LCD Lock is failed with result code [%d]\n", result);
}
} else {
result = 0;
}
} else {
if (block_sleep_count <= 0) {
- DBG("block_sleep_count[%d] is invalid. It is set to 0.\n",
+ INFO("block_sleep_count[%d] is invalid. It is set to 0.\n",
block_sleep_count);
block_sleep_count = 0;
} else if (block_sleep_count == 1) {
result = display_unlock_state(LCD_OFF, PM_RESET_TIMER);
if (result != 0) {
- DBG("LCD Unlock is failed with result code [%d]\n",
+ INFO("LCD Unlock is failed with result code [%d]\n",
result);
}
} else {
ret = vconf_get_int(VCONFKEY_BT_STATUS, (void *)&bt_device_state);
if (ret != 0) {
- DBG("Get vconf failed\n");
+ ERR("Get vconf failed\n");
return -1;
}
if (state == TRUE) {
block_cnt++;
- if (bt_device_state & BT_STATUS_TRANSFER)
- return 0;
+ retv_if(bt_device_state & BT_STATUS_OFF, 0);
+ retv_if(bt_device_state & BT_STATUS_TRANSFER, 0);
bt_device_state |= BT_STATUS_TRANSFER;
event_val = EVT_VAL_BT_TRANSFERING;
} else {
DBG("event_value: %s", event_val);
if (__bt_eventsystem_set_value(SYS_EVENT_BT_STATE, EVT_KEY_BT_TRANSFERING_STATE,
- event_val) != ES_R_OK)
+ event_val) != ES_R_OK)
ERR("Fail to set value");
ret = vconf_set_int(VCONFKEY_BT_STATUS, bt_device_state);
if (ret != 0) {
- DBG("Set vconf failed\n");
+ ERR("Set vconf failed\n");
return -1;
}
return 0;
static void __popup_res_cb(int res)
{
- DBG("+\n");
+ DBG("+");
struct bt_appdata *ad = app_state;
if (ad->popups.syspopup_request == FALSE) {
- DBG("This event is not mine\n");
- return;
+ DBG("This event is not mine\n");
+ return;
}
- DBG(" res : %d\n", res);
+ DBG(" res : %d", res);
/* Inorder to support calling popup from callback, we have to make
* syspopup_request false here and also should not assign
* ad->popups.popup_cb = NULL */
if (NULL != ad->popups.popup_cb) {
if (res == 0)
ad->popups.popup_cb(ad->popups.popup_cb_data,
- NULL,
- (void *)POPUP_RESPONSE_OK);
+ NULL, (void *)POPUP_RESPONSE_OK);
else if (res == 1)
ad->popups.popup_cb(ad->popups.popup_cb_data,
- NULL,
- (void *)POPUP_RESPONSE_CANCEL);
+ NULL,
+ (void *)POPUP_RESPONSE_CANCEL);
else if (res == 2)
ad->popups.popup_cb(ad->popups.popup_cb_data,
- NULL,
- (void *)POPUP_RESPONSE_TIMEOUT);
+ NULL,
+ (void *)POPUP_RESPONSE_TIMEOUT);
}
- DBG("-\n");
+ DBG("-");
}
static opc_transfer_info_t *__add_transfer_info(DBusMessage *msg)
INFO("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", addr[0],
addr[1], addr[2], addr[3], addr[4], addr[5]);
INFO(" cnt( %d )", cnt);
+ DBG(" name ( %s )", name);
data = g_new0(opc_transfer_info_t, 1);
data->content = g_new0(char *, cnt + 1);
for (i = 0; i < cnt; i++) {
char *ptr = g_slist_nth_data(list, i);
+ DBG("%s", ptr);
if (g_strcmp0(type, "text") == 0)
data->file_path[i] = _bt_share_create_transfer_file(ptr);
else
return data;
}
-
-
void _free_transfer_info(opc_transfer_info_t *node)
{
int i;
- DBG("+\n");
+ DBG("+");
ret_if(node == NULL);
for (i = 0; i < node->file_cnt; i++) {
- _bt_remove_tmp_file(node->file_path[i]);
+ //_bt_remove_tmp_file(node->file_path[i]);
g_free(node->file_path[i]);
g_free(node->content[i]);
+ g_free(node->type[i]);
}
g_free(node->file_path);
g_free(node->content);
g_free(node->type);
+ g_free(node->size);
g_free(node);
- DBG("-\n");
+ DBG("-");
}
void _remove_transfer_info(opc_transfer_info_t *node)
{
- DBG("+\n");
+ DBG("+");
ret_if(node == NULL);
bt_transfer_list = g_slist_remove(bt_transfer_list, node);
_free_transfer_info(node);
- DBG("-\n");
+ DBG("-");
}
int _request_file_send(opc_transfer_info_t *node)
{
struct bt_appdata *ad = app_state;
int ret;
- DBG("+\n");
+ DBG("+");
retv_if(ad == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
retv_if(node == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
ret = bluetooth_opc_push_files((bluetooth_device_address_t *)node->addr,
- node->file_path);
+ node->file_path);
if (ret != BLUETOOTH_ERROR_NONE) {
- DBG("bluetooth_opc_push_files failed : %d", ret);
+ ERR("bluetooth_opc_push_files failed : %d", ret);
return ret;
}
__bt_create_send_data(node);
- DBG("-\n");
+ DBG("-");
return BLUETOOTH_ERROR_NONE;
}
static int __bt_get_owner_info(DBusMessage *msg, char **name,
- char **previous, char **current)
+ char **previous, char **current)
{
DBusMessageIter item_iter;
dbus_message_iter_init(msg, &item_iter);
if (dbus_message_iter_get_arg_type(&item_iter)
- != DBUS_TYPE_STRING) {
+ != DBUS_TYPE_STRING) {
ERR("This is bad format dbus\n");
return BLUETOOTH_ERROR_INTERNAL;
}
dbus_message_iter_next(&item_iter);
if (dbus_message_iter_get_arg_type(&item_iter)
- != DBUS_TYPE_STRING) {
+ != DBUS_TYPE_STRING) {
ERR("This is bad format dbus\n");
return BLUETOOTH_ERROR_INTERNAL;
}
dbus_message_iter_next(&item_iter);
if (dbus_message_iter_get_arg_type(&item_iter)
- != DBUS_TYPE_STRING) {
+ != DBUS_TYPE_STRING) {
ERR("This is bad format dbus\n");
return BLUETOOTH_ERROR_INTERNAL;
}
}
static DBusHandlerResult __event_filter(DBusConnection *sys_conn,
- DBusMessage *msg, void *data)
+ DBusMessage *msg, void *data)
{
int ret;
char *member;
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
member = (char *)dbus_message_get_member(msg);
- DBG("member (%s)\n", member);
+ INFO("member (%s)", member);
- if (dbus_message_is_signal(msg, BT_SYSPOPUP_INTERFACE, BT_SYSPOPUP_METHOD_RESPONSE)) {
+ if (dbus_message_is_signal
+ (msg, BT_SYSPOPUP_INTERFACE, BT_SYSPOPUP_METHOD_RESPONSE)) {
int res = 0;
dbus_message_get_args(msg, NULL,
- DBUS_TYPE_INT32, &res,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_INT32, &res, DBUS_TYPE_INVALID);
__popup_res_cb(res);
- } else if (dbus_message_is_signal(msg, BT_UG_IPC_INTERFACE, BT_UG_IPC_METHOD_SEND)) {
+ } else if (dbus_message_is_signal
+ (msg, BT_UG_IPC_INTERFACE, BT_UG_IPC_METHOD_SEND)) {
opc_transfer_info_t *node;
#ifdef CYNARA_ENABLE
ret = _request_file_send(node);
if (ret == BLUETOOTH_ERROR_IN_PROGRESS) {
- DBG("Aleady OPC progressing. Once completed previous job, will be started\n");
+ INFO("Aleady OPC progressing. Once completed previous job, will be started");
} else if (ret != BLUETOOTH_ERROR_NONE) {
_bt_create_warning_popup(BLUETOOTH_ERROR_INTERNAL, BT_STR_UNABLE_TO_SEND);
g_slist_free_full(bt_transfer_list,
- (GDestroyNotify)_free_transfer_info);
+ (GDestroyNotify) _free_transfer_info);
bt_transfer_list = NULL;
}
} else if (dbus_message_is_signal(msg, BT_SHARE_UI_INTERFACE, BT_SHARE_UI_SIGNAL_OPPABORT)) {
int noti_id = 0;
if (!dbus_message_get_args(msg, NULL,
- DBUS_TYPE_STRING, &transfer_type,
- DBUS_TYPE_INT32, ¬i_id,
- DBUS_TYPE_INVALID)) {
+ DBUS_TYPE_STRING, &transfer_type,
+ DBUS_TYPE_INT32, ¬i_id,
+ DBUS_TYPE_INVALID)) {
ERR("OPP abort handling failed");
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
bluetooth_obex_server_cancel_transfer(noti_id);
}
} else if (dbus_message_is_signal(msg, BT_SHARE_UI_INTERFACE,
- BT_SHARE_UI_SIGNAL_SEND_FILE)) {
+ BT_SHARE_UI_SIGNAL_SEND_FILE)) {
opc_transfer_info_t *node;
#ifdef CYNARA_ENABLE
ret = _request_file_send(node);
if (ret == BLUETOOTH_ERROR_IN_PROGRESS) {
- DBG("Aleady OPC progressing. Once completed previous job, will be started\n");
+ INFO("Aleady OPC progressing. Once completed previous job, will be started");
} else if (ret != BLUETOOTH_ERROR_NONE) {
_bt_create_warning_popup(BLUETOOTH_ERROR_INTERNAL, BT_STR_UNABLE_TO_SEND);
g_slist_free_full(bt_transfer_list,
- (GDestroyNotify)_free_transfer_info);
+ (GDestroyNotify) _free_transfer_info);
bt_transfer_list = NULL;
}
} else if (dbus_message_is_signal(msg, BT_SHARE_UI_INTERFACE,
- BT_SHARE_UI_SIGNAL_INFO_UPDATE)) {
+ BT_SHARE_UI_SIGNAL_INFO_UPDATE)) {
int tr_uid = 0;
int tr_type = 0;
dbus_message_get_args(msg, NULL,
- DBUS_TYPE_INT32, &tr_uid,
- DBUS_TYPE_INT32, &tr_type,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_INT32, &tr_uid,
+ DBUS_TYPE_INT32, &tr_type,
+ DBUS_TYPE_INVALID);
- DBG("tr_uid = %d, tr_type = %d \n", tr_uid, tr_type);
+ INFO("tr_uid = %d, tr_type = %d ", tr_uid, tr_type);
__bt_share_update_tr_info(tr_uid, tr_type);
} else if (dbus_message_is_signal(msg, BT_SHARE_FRWK_INTERFACE,
- BT_SHARE_FRWK_SIGNAL_DEINIT)) {
+ BT_SHARE_FRWK_SIGNAL_DEINIT)) {
/* Deinitialize the obex server */
if (bluetooth_obex_server_deinit() == BLUETOOTH_ERROR_NONE) {
DBG("Obex Server deinit");
return TRUE;
}
-void _bt_send_message_to_ui(int transfer_id, char *name, int percentage, gboolean completed, int error_type)
+void _bt_update_transfer_list_view(char *db)
{
DBusMessage *msg = NULL;
- DBG("+\n");
ret_if(dbus_connection == NULL);
- ret_if(name == NULL);
msg = dbus_message_new_signal(BT_SHARE_ENG_OBJECT,
- BT_SHARE_ENG_INTERFACE,
- BT_SHARE_ENG_SIGNAL_PROGRESS);
+ BT_SHARE_ENG_INTERFACE,
+ BT_SHARE_ENG_SIGNAL_UPDATE_VIEW);
if (!msg) {
- ERR("Unable to allocate memory\n");
+ ERR("Unable to allocate memory");
return;
}
+
if (!dbus_message_append_args(msg,
- DBUS_TYPE_INT32, &transfer_id,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &percentage,
- DBUS_TYPE_BOOLEAN, &completed,
- DBUS_TYPE_INT32, &error_type,
- DBUS_TYPE_INVALID)) {
- ERR("Event sending failed\n");
+ DBUS_TYPE_STRING, &db,
+ DBUS_TYPE_INVALID)) {
+ ERR("Event sending failed");
dbus_message_unref(msg);
return;
}
- DBG("Dbus send message append request is done.\n");
dbus_message_set_destination(msg, BT_SHARE_UI_INTERFACE);
dbus_connection_send(dbus_connection, msg, NULL);
dbus_message_unref(msg);
- DBG("-\n");
- return;
}
-
void _bt_create_warning_popup(int error_type, char *msg)
{
/* If bluetooth-share-ui process is not running */
char str[BT_TEXT_LEN_MAX] = { 0, };
bundle *b;
- DBG("error_type: %d", error_type);
+ DBG("error_type: %d",error_type);
switch (error_type) {
- case BLUETOOTH_ERROR_SERVICE_NOT_FOUND:
- case BLUETOOTH_ERROR_NOT_CONNECTED:
- case BLUETOOTH_ERROR_ACCESS_DENIED:
- case BLUETOOTH_ERROR_OUT_OF_MEMORY:
- case BLUETOOTH_ERROR_INTERNAL:
- case BLUETOOTH_ERROR_CANCEL:
- snprintf(str, BT_TEXT_LEN_MAX, "%s",
- msg);
- break;
- default:
- return;
+ case BLUETOOTH_ERROR_SERVICE_NOT_FOUND:
+ case BLUETOOTH_ERROR_NOT_CONNECTED:
+ case BLUETOOTH_ERROR_ACCESS_DENIED:
+ case BLUETOOTH_ERROR_OUT_OF_MEMORY:
+ case BLUETOOTH_ERROR_INTERNAL:
+ case BLUETOOTH_ERROR_CANCEL:
+ snprintf(str, BT_TEXT_LEN_MAX, "%s",
+ msg);
+ break;
+ default:
+ return;
}
b = bundle_create();
return;
}
-void _bt_update_transfer_list_view(const char *table)
-{
- DBusMessage *msg = NULL;
- ret_if(dbus_connection == NULL);
-
- msg = dbus_message_new_signal(BT_SHARE_ENG_OBJECT,
- BT_SHARE_ENG_INTERFACE,
- BT_SHARE_ENG_SIGNAL_UPDATE_VIEW);
- if (!msg) {
- ERR("Unable to allocate memory\n");
- return;
- }
-
- if (!dbus_message_append_args(msg,
- DBUS_TYPE_STRING, &table,
- DBUS_TYPE_INVALID)) {
- DBG("Event sending failed\n");
- dbus_message_unref(msg);
- return;
- }
-
- dbus_message_set_destination(msg, BT_SHARE_UI_INTERFACE);
- dbus_connection_send(dbus_connection, msg, NULL);
- dbus_message_unref(msg);
-}
-
static time_t __bt_get_current_timedata(void)
{
time_t t;
static char *__bt_conv_addr_type_to_addr_string(char *addr)
{
- char address[BT_ADDR_STR_LEN_MAX] = {0,};
+ char address[BT_ADDR_STR_LEN_MAX] = { 0, };
retv_if(addr == NULL, NULL);
snprintf(address, BT_ADDR_STR_LEN_MAX,
- "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+ "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
+ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
return g_strdup(address);
}
sqlite3 *db = NULL;
- DBG("Name [%s]\n", node->name);
+ DBG("Name [%s]", node->name);
db = bt_share_open_db();
if (!db)
return;
session_id = bt_share_get_last_session_id(db, BT_DB_OUTBOUND);
- DBG("Last session id = %d\n", session_id);
+
+ INFO("Last session id = %d", session_id);
for (count = 0; count < node->file_cnt; count++) {
bt_tr_data_t *tmp;
tmp = g_malloc0(sizeof(bt_tr_data_t));
DBG("tmp->file_path : %s", tmp->file_path);
tmp->content = g_strdup(node->content[count]);
- tmp->dev_name = g_strdup(node->name);
- tmp->type = g_strdup(node->type[count]);
+ tmp->dev_name = g_strdup(node->name);
+ tmp->type = g_strdup(node->type[count]);
tmp->timestamp = __bt_get_current_timedata();
tmp->addr = __bt_conv_addr_type_to_addr_string(node->addr);
tmp->size = node->size[count];
bt_share_add_tr_data(db, BT_DB_OUTBOUND, tmp);
__bt_tr_data_free(tmp);
-
}
if (ad->tr_send_list) {
{
DBG("_bt_update_sent_data_status \n");
- DBG("uid = %d \n", uid);
+ INFO("uid = %d", uid);
sqlite3 *db = NULL;
bt_tr_data_t *tmp;
}
gboolean _bt_add_recv_transfer_status_data(char *device_name,
- char *filepath, char *type,
- unsigned int size, int status)
+ char *filepath, char *type,
+ unsigned int size, int status)
{
if (device_name == NULL || filepath == NULL)
return FALSE;
sqlite3 *db = NULL;
bt_tr_data_t *tmp;
- DBG("Name [%s]\n", device_name);
+ DBG("Name [%s]", device_name);
db = bt_share_open_db();
if (!db)
tmp->tr_status = status;
tmp->file_path = g_strdup(filepath);
- tmp->dev_name = g_strdup(device_name);
+ tmp->dev_name = g_strdup(device_name);
tmp->timestamp = __bt_get_current_timedata();
tmp->type = g_strdup(type);
tmp->size = size;
static void __bt_share_update_tr_info(int tr_uid, int tr_type)
{
- DBG("__bt_share_update_tr_info tr_uid = %d \n", tr_uid);
+ DBG("__bt_share_update_tr_info tr_uid = %d", tr_uid);
+
int status = -1;
struct bt_appdata *ad = app_state;
- char str[NOTIFICATION_TEXT_LEN_MAX] = { 0 };
bt_tr_data_t *info = NULL;
sqlite3 *db = NULL;
ad->send_noti = NULL;
ad->send_data.tr_success = 0;
ad->send_data.tr_fail = 0;
+ DBG("clear all");
bt_share_remove_tr_data_by_notification(db, BT_DB_OUTBOUND);
bt_share_close_db(db);
} else {
info = bt_share_get_tr_data(db, BT_DB_OUTBOUND, tr_uid);
if (info != NULL) {
status = info->tr_status;
- g_free(info);
+ __bt_tr_data_free(info);
}
bt_share_remove_tr_data_by_id(db, BT_DB_OUTBOUND, tr_uid);
else
return;
- if ((ad->send_data.tr_success + ad->send_data.tr_fail) != 0) {
- snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS,
- ad->send_data.tr_success, ad->send_data.tr_fail);
-
- _bt_update_notification(ad, ad->send_noti,
- NULL, NULL, NULL);
+ if ((ad->send_data.tr_success +
+ ad->send_data.tr_fail) != 0) {
+ _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
} else {
_bt_delete_notification(ad->send_noti);
}
info = bt_share_get_tr_data(db, BT_DB_INBOUND, tr_uid);
if (info != NULL) {
status = info->tr_status;
- g_free(info);
+ __bt_tr_data_free(info);
}
bt_share_remove_tr_data_by_id(db, BT_DB_INBOUND, tr_uid);
else
return;
- if ((ad->recv_data.tr_success + ad->recv_data.tr_fail) != 0) {
- snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS,
- ad->recv_data.tr_success, ad->recv_data.tr_fail);
-
- _bt_update_notification(ad, ad->receive_noti,
- NULL, NULL, NULL);
+ if ((ad->recv_data.tr_success +
+ ad->recv_data.tr_fail) != 0) {
+ _bt_update_notification(ad, ad->receive_noti, NULL, NULL, NULL);
} else {
_bt_delete_notification(ad->receive_noti);
}
}
} else {
- ERR("Invalid transfer type \n");
+ ERR("Invalid transfer type");
+ bt_share_close_db(db);
}
return;
}
-
return;
_bt_deinit_vconf_notification();
- _bt_delete_notification(ad->send_noti);
- _bt_delete_notification(ad->receive_noti);
_bt_delete_notification(ad->opc_noti);
_bt_clear_receive_noti_list();
ad->send_noti = NULL;
bluetooth_obex_server_deinit();
_bt_unregister_notification_cb(ad);
+ g_free(server_auth_info.filename);
+ server_auth_info.filename = NULL;
+
DBG("Terminating bluetooth-share daemon");
}
DBG("-");
}
-static void __bt_update_notification_status_values()
+static void __bt_update_transfer_status_values(void)
{
struct bt_appdata *ad = app_state;
GSList *tr_data_list = NULL;
GSList *list_iter = NULL;
bt_tr_data_t *info = NULL;;
- char str[NOTIFICATION_TEXT_LEN_MAX] = { 0 };
- notification_h noti = NULL;
sqlite3 *db = NULL;
/* Update notification status durning BT off */
}
DBG("Initialize transfer information");
+
db = bt_share_open_db();
if (!db)
return;
info->tr_status = BT_TR_FAIL;
bt_share_update_tr_data(db, BT_DB_OUTBOUND, info->id, info);
} else {
- ERR("Invalid status\n");
+ ERR("Invalid status");
}
list_iter = g_slist_next(list_iter);
}
- if ((ad->send_data.tr_success + ad->send_data.tr_fail) != 0) {
- snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS,
- ad->send_data.tr_success, ad->send_data.tr_fail);
-
- noti = _bt_create_notification(BT_NOTI_T);
- //_bt_set_notification_app_launch(noti,
- // CREATE_TR_LIST,
- // NOTI_TR_TYPE_OUT, NULL, NULL);
- _bt_set_notification_property(noti, QP_NO_DELETE | QP_NO_TICKER);
-// _bt_insert_notification(noti,
-// BT_STR_SENT, str,
-// BT_ICON_QP_SEND);
- ad->send_noti = noti;
- }
-
bt_share_release_tr_data_list(tr_data_list);
tr_data_list = NULL;
list_iter = NULL;
list_iter = g_slist_next(list_iter);
}
-
- if ((ad->recv_data.tr_success + ad->recv_data.tr_fail) != 0) {
-
- snprintf(str, sizeof(str), "%s %d %d", BT_TR_STATUS,
- ad->recv_data.tr_success, ad->recv_data.tr_fail);
- DBG("str = [%s] \n", str);
-
- noti = _bt_create_notification(BT_NOTI_T);
- //_bt_set_notification_app_launch(noti, CREATE_TR_LIST,
- // NOTI_TR_TYPE_IN, NULL, NULL);
- _bt_set_notification_property(noti, QP_NO_DELETE | QP_NO_TICKER);
-// _bt_insert_notification(noti,
-// BT_STR_RECEIVED, str,
-// BT_ICON_QP_RECEIVE);
- ad->receive_noti = noti;
- }
-
bt_share_release_tr_data_list(tr_data_list);
tr_data_list = NULL;
list_iter = NULL;
bt_share_close_db(db);
- return;
-}
-
-static notification_h __bt_update_notification_adapter_status(void)
-{
- notification_h noti;
- notification_error_e ret;
-
- noti = _bt_create_notification(BT_NOTI_T);
- if (!noti)
- return NULL;
-
- ret = notification_set_property(noti, QP_NO_DELETE | QP_NO_TICKER);
- if (ret != NOTIFICATION_ERROR_NONE) {
- goto failed;
- }
-
- ret = notification_set_application(noti, "ug-bluetooth-efl");
- if (ret != NOTIFICATION_ERROR_NONE) {
- goto failed;
- }
-
- ret = notification_set_display_applist(noti,
- NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
- if (ret != NOTIFICATION_ERROR_NONE) {
- goto failed;
- }
-
-// _bt_insert_notification(noti,
-// BT_STR_BLUETOOTH_ON, BT_STR_BLUETOOTH_AVAILABLE,
-// BT_ICON_QP_BT_ON);
- return noti;
-
-failed:
- ERR("Fail to register notification");
- notification_free(noti);
- return NULL;
+ DBG("[Send] success %d, fail %d", ad->send_data.tr_success, ad->send_data.tr_fail);
+ DBG("[Receive] success %d, fail %d", ad->recv_data.tr_success, ad->recv_data.tr_fail);
+ return;
}
static int __bt_lang_changed_cb(void *data, void *user_data)
failed:
if (dbus_error_is_set(&err)) {
- ERR("D-Bus Error: %s\n", err.message);
+ ERR("D-Bus Error: %s", err.message);
dbus_error_free(&err);
}
_bt_get_default_storage(storage);
if (bluetooth_obex_server_init(storage) !=
BLUETOOTH_ERROR_NONE) {
- DBG("Fail to init obex server");
+ ERR("Fail to init obex server");
return BT_SHARE_FAIL;
}
return BT_SHARE_ERROR_NONE;
}
-void _bt_terminate_app(void)
-{
- if (main_loop) {
- g_main_loop_quit(main_loop);
- }
-}
-
void __bt_create_transfer_db(void)
{
struct stat sts;
{
int ret;
struct bt_appdata ad;
- DBG("Starting bluetooth-share daemon");
+ INFO("Starting bluetooth-share daemon");
memset(&ad, 0, sizeof(struct bt_appdata));
app_state = &ad;
__bt_create_transfer_db();
if (__bt_dbus_request_name() == FALSE) {
- DBG("Aleady dbus instance existed\n");
+ INFO("Aleady dbus instance existed");
exit(0);
}
ret = appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, __bt_lang_changed_cb, NULL);
if (ret < 0)
- DBG("Failed to excute the change of language");
+ ERR("Failed to excute the change of language");
/* init internationalization */
if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0)
bluetooth_register_callback(_bt_share_event_handler, NULL);
ret = bluetooth_opc_init();
if (ret != BLUETOOTH_ERROR_NONE) {
- ERR("bluetooth_opc_init failed!!\n");
+ ERR("bluetooth_opc_init failed");
return -1;
}
_bt_init_dbus_signal();
_bt_init_vconf_notification(&ad);
- __bt_update_notification_status_values();
+ __bt_update_transfer_status_values();
_bt_register_notification_cb(&ad);
if (_bt_init_obex_server() == BT_SHARE_ERROR_NONE)
return -1;
}
- notification_h noti;
- noti = __bt_update_notification_adapter_status();
-
main_loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(main_loop);
- _bt_delete_notification(noti);
__bt_release_service(&ad);
bluetooth_unregister_callback();
- _bt_share_cynara_finish();
return 0;
}
if (access(download_path, W_OK) != 0) {
if (mkdir(download_path, 0755) < 0) {
- DBG("mkdir fail![%s]", download_path);
+ ERR("mkdir fail![%s]", download_path);
}
}
mmc_status = vconf_keynode_get_int(node);
if (mmc_status == VCONFKEY_SYSMAN_MMC_REMOVED ||
- mmc_status == VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED) {
+ mmc_status == VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED) {
retm_if(vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
- &default_memory) != 0,
- "vconf_get_int failed");
+ &default_memory) != 0,
+ "vconf_get_int failed");
if (ad->opc_noti) { /* sending case */
DBG("cancel outbound transfer");
if (default_memory == BT_DEFAULT_MEM_MMC) {
_bt_obex_cancel_transfer(data);
retm_if(vconf_set_int(
- VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
- BT_DEFAULT_MEM_PHONE) != 0, "vconf_set_int failed");
- DBG("Default Memory set to Phone");
+ VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
+ BT_DEFAULT_MEM_PHONE) != 0, "vconf_set_int failed");
+ DBG("Default Memory set to Phone");
}
}
}
void _bt_init_vconf_notification(void *data)
{
+ retm_if(!data, "invalid param!");
+
int ret;
ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
__bt_default_memory_changed_cb, NULL);
if (ret < 0) {
- DBG("vconf_notify_key_changed init failed");
+ ERR("vconf_notify_key_changed init failed");
}
ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS,
__bt_mmc_status_changed_cb, data);
if (ret < 0) {
- DBG("vconf_notify_key_changed init failed");
+ ERR("vconf_notify_key_changed init failed");
}
}
ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
(vconf_callback_fn) __bt_default_memory_changed_cb);
if (ret < 0) {
- DBG("vconf_notify_key_changed deinit failed");
+ ERR("vconf_notify_key_changed deinit failed");
}
ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS,
(vconf_callback_fn) __bt_mmc_status_changed_cb);
if (ret < 0) {
- DBG("vconf_notify_key_changed deinit failed");
+ ERR("vconf_notify_key_changed deinit failed");
}
}
CSC_FTM,
} bt_csc_type_t;
-notification_h _bt_create_notification(bt_qp_type_t type)
-{
- DBG("+\n");
- DBG("+Create type : %d\n", type);
- notification_h noti = NULL;
- noti = notification_create(type);
- if (!noti) {
- ERR("Fail to notification_new\n");
- return NULL;
- }
- DBG("noti : %d \n", noti);
- DBG("-\n");
- return noti;
-}
notification_h _bt_insert_notification(struct bt_appdata *ad, bt_notification_type_e type, int index, int total)
{
if (count_str) {
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT,
- NULL, count_str, NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, count_str, NOTIFICATION_VARIABLE_TYPE_NONE);
if (ret != NOTIFICATION_ERROR_NONE)
ERR("Fail to notification_set_text [%d]", ret);
if (title) {
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- NULL, title,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, title,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
if (ret != NOTIFICATION_ERROR_NONE) {
ERR("Fail to notification_set_text [%d]", ret);
}
if (type == BT_SENT_NOTI || type == BT_RECEIVED_NOTI) {
if (success == 1)
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content,
- NOTIFICATION_VARIABLE_TYPE_INT, fail,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content,
+ NOTIFICATION_VARIABLE_TYPE_INT, fail,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
else
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content,
- NOTIFICATION_VARIABLE_TYPE_INT, success,
- NOTIFICATION_VARIABLE_TYPE_INT, fail,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content,
+ NOTIFICATION_VARIABLE_TYPE_INT, success,
+ NOTIFICATION_VARIABLE_TYPE_INT, fail,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
} else {
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE);
}
if (ret != NOTIFICATION_ERROR_NONE) {
else if (type == BT_RECEIVED_NOTI)
ad->receive_noti_id = noti_id;
- INFO("Insert %s type: %d ", (type == BT_SENT_NOTI || type == BT_RECEIVED_NOTI) ?
+ INFO("Insert %s type: %p ", (type == BT_SENT_NOTI || type == BT_RECEIVED_NOTI) ?
"Notification" : "Ongoing", noti);
return noti;
}
int _bt_update_notification(struct bt_appdata *ad, notification_h noti,
- char *title, char *content, char *icon_path)
+ char *title, char *content, char *icon_path)
{
- retvm_if(!noti, BT_SHARE_FAIL, "noti is NULL");
+ retvm_if (!noti, BT_SHARE_FAIL, "noti is NULL");
- INFO("Update noti : %d", noti);
+ INFO("Update noti : %p", noti);
notification_error_e ret = NOTIFICATION_ERROR_NONE;
int success = 0;
int fail = 0;
if (title) {
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- NULL, title,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, title,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
if (ret != NOTIFICATION_ERROR_NONE) {
ERR("Fail to notification_set_text [%d]", ret);
}
if (noti == ad->send_noti || noti == ad->receive_noti) {
if (success == 1)
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content,
- NOTIFICATION_VARIABLE_TYPE_INT, fail,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content,
+ NOTIFICATION_VARIABLE_TYPE_INT, fail,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
else
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content,
- NOTIFICATION_VARIABLE_TYPE_INT, success,
- NOTIFICATION_VARIABLE_TYPE_INT, fail,
- NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content,
+ NOTIFICATION_VARIABLE_TYPE_INT, success,
+ NOTIFICATION_VARIABLE_TYPE_INT, fail,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
} else {
ret = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE);
+ NULL, content, NOTIFICATION_VARIABLE_TYPE_NONE);
}
if (ret != NOTIFICATION_ERROR_NONE) {
}
int _bt_update_notification_progress(notification_h not,
- int id, int val)
+ int id, int val)
{
notification_error_e ret = NOTIFICATION_ERROR_NONE;
ret = notification_update_progress(not, id, (double)val / 100);
return ret;
}
-gboolean _bt_get_notification_text(int priv_id, char *str)
-{
- notification_error_e ret = NOTIFICATION_ERROR_NONE;
- notification_list_h list = NULL;
- notification_h noti = NULL;
-
- /* Get notification information from notification detail list */
- ret = notification_get_detail_list(BT_SHARE_BIN_PATH,
- -1,
- priv_id,
- -1,
- &list);
- if (ret != NOTIFICATION_ERROR_NONE) {
- ERR("Fail to notification_get_text\n");
- return FALSE;
- }
-
- if (list) {
- noti = notification_list_get_data(list);
- char *text = NULL;
- notification_get_text(noti,
- NOTIFICATION_TEXT_TYPE_TITLE,
- &text);
- g_strlcpy(str, text, NOTIFICATION_TEXT_LEN_MAX);
- } else {
- return FALSE;
- }
- return TRUE;
-}
-
int _bt_get_notification_priv_id(notification_h noti)
{
int group_id = 0;
int _bt_delete_notification(notification_h noti)
{
- DBG("+\n");
-
+ retv_if(!noti, BT_SHARE_FAIL);
notification_error_e ret = NOTIFICATION_ERROR_NONE;
- if (!noti)
- return BT_SHARE_FAIL;
+ INFO("Delete noti : %d", noti);
/* In case daemon, give full path */
ret = notification_delete(noti);
if (ret != NOTIFICATION_ERROR_NONE) {
- ERR("Fail to notification_delete_by_priv_id\n");
+ ERR("Fail to notification_delete [%d]", ret);
}
- DBG("-\n");
+
return ret;
}
int _bt_set_notification_app_launch(notification_h noti,
- bt_notification_launch_type_e launch_type,
- const char *transfer_type,
- const char *filename,
- const char *progress_cnt,
- int transfer_id)
+ bt_notification_launch_type_e launch_type,
+ const char *transfer_type,
+ const char *filename,
+ const char *progress_cnt,
+ int transfer_id)
{
DBG("+\n");
if (!noti)
}
ret = notification_set_execute_option(noti,
- NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
- NULL, NULL, b);
+ NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+ NULL, NULL, b);
if (ret != NOTIFICATION_ERROR_NONE) {
ERR("Fail to notification_set_execute_option [%d]\n", ret);
}
return ret;
}
-int _bt_set_notification_property(notification_h noti, int flag)
-{
- DBG("+\n");
- if (!noti)
- return -1;
-
- notification_error_e ret = NOTIFICATION_ERROR_NONE;
-
- ret = notification_set_property(noti, flag);
- if (ret != NOTIFICATION_ERROR_NONE) {
- ERR("Fail to notification_set_property\n");
- }
-
- ret = notification_set_display_applist(noti,
- NOTIFICATION_DISPLAY_APP_ALL ^
- NOTIFICATION_DISPLAY_APP_TICKER);
- if (ret != NOTIFICATION_ERROR_NONE) {
- ERR("Fail to notification_set_display_applist\n");
- }
-
- DBG("-\n");
- return ret;
-}
-
gboolean _bt_update_notification_status(struct bt_appdata *ad)
{
notification_h noti = NULL;
int priv_id = 0;
int ret;
- retv_if(ad == NULL, FALSE);
+ retv_if (ad == NULL, FALSE);
/* When bt-share is launched, need to update notification status */
{
DBG("__bt_notification_changed_cb");
- retm_if(data == NULL, "Invalid data");
+ retm_if (data == NULL, "Invalid data");
struct bt_appdata *ad = (struct bt_appdata *)data;
gboolean is_sent_noti_exist = FALSE;
gboolean is_received_noti_exist = FALSE;
int priv_id;
sqlite3 *db = NULL;
- retm_if(op_list == NULL, "Invalid op_list");
+ retm_if (op_list == NULL, "Invalid op_list");
if (type != NOTIFICATION_TYPE_NOTI ||
- (op_list->type != NOTIFICATION_OP_DELETE &&
- op_list->type != NOTIFICATION_OP_DELETE_ALL))
+ (op_list->type != NOTIFICATION_OP_DELETE &&
+ op_list->type != NOTIFICATION_OP_DELETE_ALL))
return;
if (ad->send_noti == NULL && ad->receive_noti == NULL)
return;
noti_err = notification_get_list(type, -1, ¬i_list);
- ret_if(noti_err != NOTIFICATION_ERROR_NONE);
+ ret_if (noti_err != NOTIFICATION_ERROR_NONE);
noti_list = notification_list_get_head(noti_list);
while (noti_list) {
ad->send_noti = NULL;
ad->send_noti_id = 0;
if (bt_share_remove_tr_data_by_notification(db,
- BT_DB_OUTBOUND) == BT_SHARE_ERR_NONE) {
+ BT_DB_OUTBOUND) == BT_SHARE_ERR_NONE) {
ad->send_data.tr_fail = 0;
ad->send_data.tr_success = 0;
}
ad->receive_noti = NULL;
ad->receive_noti_id = 0;
if (bt_share_remove_tr_data_by_notification(db,
- BT_DB_INBOUND) == BT_SHARE_ERR_NONE) {
+ BT_DB_INBOUND) == BT_SHARE_ERR_NONE) {
ad->recv_data.tr_fail = 0;
ad->recv_data.tr_success = 0;
}
#include <string.h>
#include <syspopup_caller.h>
#include <bundle_internal.h>
+
#include "applog.h"
#include "bluetooth-api.h"
#include "bt-share-syspopup.h"
}
int _bt_launch_system_popup(bt_app_event_type_t event_type,
- bt_app_sys_popup_params_t *popup_params,
- void *cb,
- void *data)
+ bt_app_sys_popup_params_t *popup_params,
+ void *cb,
+ void *data)
{
int ret = 0;
bundle *b = NULL;
bundle_add(b, "device_name", popup_params->device_name);
switch (event_type) {
- case BT_APP_EVENT_CONFIRM_MODE_REQUEST:
- strncpy(event_str, "app-confirm-request", sizeof(event_str));
- break;
- case BT_APP_EVENT_FILE_RECEIVED:
- strncpy(event_str, "file-received", sizeof(event_str));
- break;
- case BT_APP_EVENT_INFORMATION:
- strncpy(event_str, "bt-information", sizeof(event_str));
- break;
- case BT_APP_EVENT_OVERWRITE_REQUEST:
- strncpy(event_str, "confirm-overwrite-request", sizeof(event_str));
- break;
- default:
- break;
+ case BT_APP_EVENT_CONFIRM_MODE_REQUEST:
+ strncpy(event_str, "app-confirm-request", sizeof(event_str));
+ break;
+ case BT_APP_EVENT_FILE_RECEIVED:
+ strncpy(event_str, "file-received", sizeof(event_str));
+ break;
+ case BT_APP_EVENT_INFORMATION:
+ strncpy(event_str, "bt-information", sizeof(event_str));
+ break;
+ case BT_APP_EVENT_OVERWRITE_REQUEST:
+ strncpy(event_str, "confirm-overwrite-request", sizeof(event_str));
+ break;
+ default:
+ break;
}
bundle_add(b, "event-type", event_str);
/*The system popup launch function is not able to launch second popup
- * if first popup is being processed still, this due to the check
- * in AUL module to restrict multiple launching of syspopup,
- * to solve this problem after discussion it is decided that if
- * the popup launch fails then it will be retried
- * after small timeout. */
+ * if first popup is being processed still, this due to the check
+ * in AUL module to restrict multiple launching of syspopup,
+ * to solve this problem after discussion it is decided that if
+ * the popup launch fails then it will be retried
+ * after small timeout. */
ret = syspopup_launch("bt-syspopup", b);
if (0 > ret) {
ERR("Popup launch failed...retry = %d\n", ret);
g_timeout_add(BT_POPUP_SYSPOPUP_TIMEOUT_FOR_MULTIPLE_POPUPS,
- (GSourceFunc) __bt_system_popup_timer_cb, b);
+ (GSourceFunc) __bt_system_popup_timer_cb, b);
} else {
bundle_free(b);
}
return 0;
}
+
gboolean _bt_app_popup_memoryfull(gpointer user_data)
{
bt_app_sys_popup_params_t popup_params = { NULL };
#include "bt-share-common.h"
#include "bt-share-noti-handler.h"
-
-extern struct bt_appdata *app_state;
-
typedef struct {
void *noti_handle;
int transfer_id;
bt_file_type_t file_type;
} bt_file_info_t;
-bt_obex_server_authorize_into_t server_auth_info;
+extern struct bt_appdata *app_state;
extern GSList *bt_transfer_list;
GSList *bt_receive_noti_list;
+
static gboolean isFirstReceivedPacket = FALSE;
static gboolean isTransferConnectedReceived = FALSE;
*/
if (g_str_has_prefix(path, BT_FTP_FOLDER_PHONE)) {
snprintf(file_path, sizeof(file_path), "%s/%s",
- BT_DOWNLOAD_PHONE_ROOT,
- path + strlen(BT_FTP_FOLDER_PHONE));
+ BT_DOWNLOAD_PHONE_ROOT,
+ path + strlen(BT_FTP_FOLDER_PHONE));
} else if (g_str_has_prefix(path, BT_FTP_FOLDER_MMC)) {
snprintf(file_path, sizeof(file_path), "%s/%s",
- BT_DOWNLOAD_MMC_ROOT,
- path + strlen(BT_FTP_FOLDER_MMC));
+ BT_DOWNLOAD_MMC_ROOT,
+ path + strlen(BT_FTP_FOLDER_MMC));
} else {
snprintf(file_path, sizeof(file_path), "%s", path);
}
}
void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
- void *user_data)
+ void *user_data)
{
int ret;
static int send_index = 0;
node = bt_transfer_list->data;
switch (event) {
- case BLUETOOTH_EVENT_ENABLED:
- if (ad->obex_server_init == FALSE) {
- if (_bt_init_obex_server() == BT_SHARE_ERROR_NONE)
- ad->obex_server_init = TRUE;
- }
- break;
+ case BLUETOOTH_EVENT_ENABLED:
+ if (ad->obex_server_init == FALSE) {
+ if (_bt_init_obex_server() == BT_SHARE_ERROR_NONE)
+ ad->obex_server_init = TRUE;
+ }
+ break;
- case BLUETOOTH_EVENT_OPC_CONNECTED:
- INFO("BLUETOOTH_EVENT_OPC_CONNECTED, result [%d] \n", param->result);
- send_index = 0;
- if (param->result != BLUETOOTH_ERROR_NONE) {
- _bt_create_warning_popup(param->result,
- BT_STR_UNABLE_TO_SEND);
- if (NULL != node && node->file_cnt > send_index) {
- if (ad->tr_next_data == NULL) {
- ERR("ad->tr_next_data is NULL");
- return;
- }
- info = (bt_tr_data_t *)(ad->tr_next_data)->data;
- if (info == NULL) {
- ERR("info is NULL");
- return;
- }
+ case BLUETOOTH_EVENT_OPC_CONNECTED:
+ INFO("BLUETOOTH_EVENT_OPC_CONNECTED, result [%d] \n", param->result);
+ send_index = 0;
+ if (param->result != BLUETOOTH_ERROR_NONE) {
+ _bt_create_warning_popup(param->result,
+ BT_STR_UNABLE_TO_SEND);
+ if (NULL != node && node->file_cnt > send_index) {
+ if (ad->tr_next_data == NULL) {
+ ERR("ad->tr_next_data is NULL");
+ return;
+ }
+ info = (bt_tr_data_t *)(ad->tr_next_data)->data;
+ if (info == NULL) {
+ ERR("info is NULL");
+ return;
+ }
- s_id = info->sid;
+ s_id = info->sid;
+ INFO("info->sid = %d info->id = %d", info->sid, info->id);
+ while (NULL != ad->tr_next_data) {
+ info = (bt_tr_data_t *)(ad->tr_next_data)->data;
+ if (info == NULL)
+ break;
INFO("info->sid = %d info->id = %d", info->sid, info->id);
- while (NULL != ad->tr_next_data) {
- info = (bt_tr_data_t *)(ad->tr_next_data)->data;
- if (info == NULL)
- break;
- INFO("info->sid = %d info->id = %d", info->sid, info->id);
- if (info->sid != s_id) {
- DBG("SID did not match so break done.");
- break;
- }
-
- _bt_update_sent_data_status(info->id, BT_TR_FAIL);
- ad->send_data.tr_fail++;
- ad->tr_next_data = g_slist_next(ad->tr_next_data);
+ if (info->sid != s_id) {
+ DBG("SID did not match so break done.");
+ break;
}
- _bt_update_transfer_list_view("outbound");
- if (ad->send_noti == NULL) {
- ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
- } else {
- _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
- }
+ _bt_update_sent_data_status(info->id, BT_TR_FAIL);
+ ad->send_data.tr_fail++;
+ ad->tr_next_data = g_slist_next(ad->tr_next_data);
}
+ _bt_update_transfer_list_view("outbound");
- _remove_transfer_info(node);
-
- if (!ad->tr_next_data) {
- bt_share_release_tr_data_list(ad->tr_send_list);
- ad->tr_send_list = NULL;
+ if (ad->send_noti == NULL) {
+ ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
+ } else {
+ _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
}
+ }
- } else {
- ret = notification_status_message_post(BT_STR_SENDING);
- if (ret != NOTIFICATION_ERROR_NONE)
- ERR("notification_status_message_post() is failed : %d", ret);
+ _remove_transfer_info(node);
- _bt_share_block_sleep(TRUE);
- _bt_set_transfer_indicator(TRUE);
+ if (!ad->tr_next_data) {
+ bt_share_release_tr_data_list(ad->tr_send_list);
+ ad->tr_send_list = NULL;
}
- break;
+ } else {
+ ret = notification_status_message_post(BT_STR_SENDING);
+ if (ret != NOTIFICATION_ERROR_NONE)
+ ERR("notification_status_message_post() is failed : %d", ret);
- case BLUETOOTH_EVENT_OPC_TRANSFER_STARTED:
- INFO("BLUETOOTH_EVENT_OPC_TRANSFER_STARTED");
- ret_if(node == NULL);
+ _bt_share_block_sleep(TRUE);
+ _bt_set_transfer_indicator(TRUE);
+ }
+ break;
- if (ad->opc_noti) {
- _bt_delete_notification(ad->opc_noti);
- ad->opc_noti = NULL;
- ad->opc_noti_id = 0;
- }
+ case BLUETOOTH_EVENT_OPC_TRANSFER_STARTED:
+ INFO("BLUETOOTH_EVENT_OPC_TRANSFER_STARTED");
+ ret_if(node == NULL);
+
+ if (ad->opc_noti) {
+ _bt_delete_notification(ad->opc_noti);
+ ad->opc_noti = NULL;
+ ad->opc_noti_id = 0;
+ }
- name = __get_file_name(send_index++, node->file_path);
- snprintf(opc_cnt, sizeof(opc_cnt), "%d/%d",
- send_index, node->file_cnt);
+ name = __get_file_name(send_index++, node->file_path);
+ snprintf(opc_cnt, sizeof(opc_cnt), "%d/%d",
+ send_index, node->file_cnt);
- noti = _bt_insert_notification(ad, BT_SENDING_NOTI, send_index, node->file_cnt);
- ad->opc_noti_id = _bt_get_notification_priv_id(noti);
- _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
+ noti = _bt_insert_notification(ad, BT_SENDING_NOTI, send_index, node->file_cnt);
+ ad->opc_noti_id = _bt_get_notification_priv_id(noti);
+ _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
NOTI_TR_TYPE_OUT, name, opc_cnt, 0);
- ad->opc_noti = noti;
+ ad->opc_noti = noti;
- INFO("file count %d", node->file_cnt);
- _bt_update_notification(ad, ad->opc_noti, name, NULL, NULL);
- _bt_update_transfer_list_view("outbound");
+ INFO("file count %d", node->file_cnt);
+ _bt_update_notification(ad, ad->opc_noti, name, NULL, NULL);
+ _bt_update_transfer_list_view("outbound");
- if (ad->tr_next_data == NULL) {
- ERR("ad->tr_next_data is NULL");
- return;
- }
-
- info = (bt_tr_data_t *)(ad->tr_next_data)->data;
- ret_if(info == NULL);
- ad->current_tr_uid = info->id;
- INFO("ad->current_tr_uid = [%d]", ad->current_tr_uid);
- break;
+ if (ad->tr_next_data == NULL) {
+ ERR("ad->tr_next_data is NULL");
+ return;
+ }
+ info = (bt_tr_data_t *)(ad->tr_next_data)->data;
+ ret_if(info == NULL);
+ ad->current_tr_uid = info->id;
+ INFO("ad->current_tr_uid = [%d]", ad->current_tr_uid);
+ break;
- case BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS:
- client_info = (bt_opc_transfer_info_t *)param->param_data;
- ret_if(client_info == NULL);
+ case BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS:
+ client_info = (bt_opc_transfer_info_t *)param->param_data;
+ ret_if(client_info == NULL);
- name = strrchr(client_info->filename, '/');
- if (name)
- name++;
- else
- name = client_info->filename;
+ name = strrchr(client_info->filename, '/');
+ if (name)
+ name++;
+ else
+ name = client_info->filename;
- percentage = client_info->percentage;
+ percentage = client_info->percentage;
- _bt_update_notification_progress(NULL,
- ad->opc_noti_id, percentage);
- break;
+ _bt_update_notification_progress(NULL,
+ ad->opc_noti_id, percentage);
+ break;
- case BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE:
- INFO("BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE");
+ case BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE:
+ INFO("BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE");
- client_info = (bt_opc_transfer_info_t *)param->param_data;
- ret_if(client_info == NULL);
+ client_info = (bt_opc_transfer_info_t *)param->param_data;
+ ret_if(client_info == NULL);
- DBG("client_info->filename = [%s]", client_info->filename);
- INFO("ad->current_tr_uid = [%d]", ad->current_tr_uid);
+ DBG("client_info->filename = [%s]", client_info->filename);
+ INFO("ad->current_tr_uid = [%d]", ad->current_tr_uid);
- name = strrchr(client_info->filename, '/');
- if (name)
- name++;
- else
- name = client_info->filename;
+ name = strrchr(client_info->filename, '/');
+ if (name)
+ name++;
+ else
+ name = client_info->filename;
- DBG("name address = [%x]", name);
+ DBG("name address = [%x]", name);
- if (ad->opc_noti) {
- _bt_delete_notification(ad->opc_noti);
- ad->opc_noti = NULL;
- ad->opc_noti_id = 0;
- }
- INFO("ad->send_data.tr_fail = %d, ad->send_data.tr_success= %d",
- ad->send_data.tr_fail, ad->send_data.tr_success);
+ if (ad->opc_noti) {
+ _bt_delete_notification(ad->opc_noti);
+ ad->opc_noti = NULL;
+ ad->opc_noti_id = 0;
+ }
+ INFO("ad->send_data.tr_fail = %d, ad->send_data.tr_success= %d",
+ ad->send_data.tr_fail, ad->send_data.tr_success);
+
+ if (param->result != BLUETOOTH_ERROR_NONE)
+ ad->send_data.tr_fail++;
+ else {
+ ad->send_data.tr_success++;
+ _bt_remove_tmp_file(client_info->filename);
+ _bt_remove_vcf_file(client_info->filename);
+ }
- if (param->result != BLUETOOTH_ERROR_NONE)
- ad->send_data.tr_fail++;
- else {
- ad->send_data.tr_success++;
- _bt_remove_tmp_file(client_info->filename);
- _bt_remove_vcf_file(client_info->filename);
- }
+ if (ad->send_noti == NULL) {
+ ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
+ } else {
+ _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
+ }
- if (ad->send_noti == NULL) {
- ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
- } else {
- _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
- }
+ if (param->result != BLUETOOTH_ERROR_NONE) {
+ _bt_update_sent_data_status(ad->current_tr_uid,
+ BT_TR_FAIL);
+ DBG("opp_transfer_abort by user %d ", ad->opp_transfer_abort);
+ if (!ad->opp_transfer_abort)
+ _bt_create_warning_popup(param->result,
+ BT_STR_UNABLE_TO_SEND);
+ ad->opp_transfer_abort = FALSE;
+ } else {
+ _bt_update_sent_data_status(ad->current_tr_uid,
+ BT_TR_SUCCESS);
+ }
- if (param->result != BLUETOOTH_ERROR_NONE) {
- _bt_update_sent_data_status(ad->current_tr_uid,
- BT_TR_FAIL);
- DBG("opp_transfer_abort by user %d ", ad->opp_transfer_abort);
- if (!ad->opp_transfer_abort)
- _bt_create_warning_popup(param->result,
- BT_STR_UNABLE_TO_SEND);
- ad->opp_transfer_abort = FALSE;
- } else {
- _bt_update_sent_data_status(ad->current_tr_uid,
- BT_TR_SUCCESS);
- }
+ _bt_update_transfer_list_view("outbound");
- _bt_update_transfer_list_view("outbound");
+ ad->tr_next_data = g_slist_next(ad->tr_next_data);
+ break;
- ad->tr_next_data = g_slist_next(ad->tr_next_data);
- break;
+ case BLUETOOTH_EVENT_OPC_DISCONNECTED:
+ INFO("BLUETOOTH_EVENT_OPC_DISCONNECTED");
+ ret_if(node == NULL);
- case BLUETOOTH_EVENT_OPC_DISCONNECTED:
- INFO("BLUETOOTH_EVENT_OPC_DISCONNECTED");
- ret_if(node == NULL);
+ if (node->file_cnt > send_index) {
+ send_index = 0;
+ if (!ad) {
+ ERR("ad is NULL");
+ break;
+ }
+ if (!ad->tr_next_data) {
+ ERR("ad>tr_next_data is NULL");
+ break;
+ }
- if (node->file_cnt > send_index) {
- send_index = 0;
- if (!ad) {
- ERR("ad is NULL");
- break;
- }
- if (!ad->tr_next_data) {
- ERR("ad>tr_next_data is NULL");
- break;
- }
+ info = (bt_tr_data_t *)(ad->tr_next_data)->data;
+ if (info == NULL)
+ break;
+ s_id = info->sid;
+ INFO("info->sid = %d info->id = %d", info->sid, info->id);
+ while (NULL != ad->tr_next_data) {
info = (bt_tr_data_t *)(ad->tr_next_data)->data;
if (info == NULL)
break;
- s_id = info->sid;
INFO("info->sid = %d info->id = %d", info->sid, info->id);
- while (NULL != ad->tr_next_data) {
- info = (bt_tr_data_t *)(ad->tr_next_data)->data;
- if (info == NULL)
- break;
- INFO("info->sid = %d info->id = %d", info->sid, info->id);
-
- if (s_id != info->sid) {
- DBG("SID did not match so break done.");
- break;
- }
-
- _bt_update_sent_data_status(info->id, BT_TR_FAIL);
- ad->send_data.tr_fail++;
- ad->tr_next_data = g_slist_next(ad->tr_next_data);
- }
- _bt_update_transfer_list_view("outbound");
-
- if (ad->send_noti == NULL) {
- ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
- } else {
- _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
+ if (s_id != info->sid) {
+ DBG("SID did not match so break done.");
+ break;
}
- }
-
- send_index = 0;
- _bt_share_block_sleep(FALSE);
- _bt_set_transfer_indicator(FALSE);
- _remove_transfer_info(node);
- if (!ad->tr_next_data) {
- bt_share_release_tr_data_list(ad->tr_send_list);
- ad->tr_send_list = NULL;
+ _bt_update_sent_data_status(info->id, BT_TR_FAIL);
+ ad->send_data.tr_fail++;
+ ad->tr_next_data = g_slist_next(ad->tr_next_data);
}
- break;
-
+ _bt_update_transfer_list_view("outbound");
- case BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE:
- INFO("BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE");
- break;
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE:
- INFO("BT_EVENT_OBEX_TRANSFER_AUTHORIZE");
- if (param->result == BLUETOOTH_ERROR_NONE) {
- g_free(server_auth_info.filename);
- server_auth_info.filename = NULL;
-
- auth_info = param->param_data;
- server_auth_info.filename = g_strdup(auth_info->filename);
- server_auth_info.length = auth_info->length;
- if (server_auth_info.filename)
- __bt_obex_file_push_auth(&server_auth_info);
+ if (ad->send_noti == NULL) {
+ ad->send_noti = _bt_insert_notification(ad, BT_SENT_NOTI, 0, 0);
+ } else {
+ _bt_update_notification(ad, ad->send_noti, NULL, NULL, NULL);
}
- break;
+ }
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED:
- INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED");
- if (param->result == BLUETOOTH_ERROR_NONE) {
- isTransferConnectedReceived = TRUE;
- }
- break;
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED:
- INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED");
- isFirstReceivedPacket = TRUE;
- transfer_info = param->param_data;
- if (transfer_info->file_size > (100 * 1024)) {
- if (0 == g_strcmp0(transfer_info->type, TRANSFER_GET)) {
- /*GET request */
- noti = _bt_insert_notification(ad, BT_SENDING_NOTI, 0, 0);
-
- _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
- NOTI_TR_TYPE_OUT, transfer_info->filename, NULL,
- transfer_info->transfer_id);
- } else {
- /*PUT Request */
- noti = _bt_insert_notification(ad, BT_RECEIVING_NOTI, 0, 0);
- _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
- NOTI_TR_TYPE_IN, transfer_info->filename, NULL,
- transfer_info->transfer_id);
- }
+ send_index = 0;
+ _bt_share_block_sleep(FALSE);
+ _bt_set_transfer_indicator(FALSE);
+ _remove_transfer_info(node);
+ if (!ad->tr_next_data) {
+ bt_share_release_tr_data_list(ad->tr_send_list);
+ ad->tr_send_list = NULL;
+ }
+ break;
- data = g_new0(bt_noti_data_t, 1);
- data->noti_handle = noti;
- data->noti_id = _bt_get_notification_priv_id(noti);
+ case BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE:
+ INFO("BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE");
+ break;
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE:
+ INFO("BT_EVENT_OBEX_TRANSFER_AUTHORIZE");
+ if (param->result == BLUETOOTH_ERROR_NONE) {
+ g_free(server_auth_info.filename);
+ server_auth_info.filename = NULL;
+
+ auth_info = param->param_data;
+ server_auth_info.filename = g_strdup(auth_info->filename);
+ server_auth_info.length = auth_info->length;
+ if (server_auth_info.filename)
+ __bt_obex_file_push_auth(&server_auth_info);
+ }
+ break;
- data->transfer_id = transfer_info->transfer_id;
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED:
+ INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED");
+ if (param->result == BLUETOOTH_ERROR_NONE) {
- bt_receive_noti_list = g_slist_append(bt_receive_noti_list, data);
+ isTransferConnectedReceived = TRUE;
+ }
+ break;
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED:
+ INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED");
+ isFirstReceivedPacket = TRUE;
+ transfer_info = param->param_data;
+ if (transfer_info->file_size > (100 * 1024)) {
+ if (0 == g_strcmp0(transfer_info->type, TRANSFER_GET)) {
+ /*GET request */
+ noti = _bt_insert_notification(ad, BT_SENDING_NOTI, 0, 0);
+
+ _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
+ NOTI_TR_TYPE_OUT, transfer_info->filename, NULL,
+ transfer_info->transfer_id);
+ } else {
+ /*PUT Request */
+ noti = _bt_insert_notification(ad, BT_RECEIVING_NOTI, 0, 0);
+ _bt_set_notification_app_launch(noti, CREATE_PROGRESS,
+ NOTI_TR_TYPE_IN, transfer_info->filename, NULL,
+ transfer_info->transfer_id);
}
- _bt_set_transfer_indicator(TRUE);
- _bt_share_block_sleep(TRUE);
- break;
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS:
- if (param->result == BLUETOOTH_ERROR_NONE) {
- transfer_info = param->param_data;
+ data = g_new0(bt_noti_data_t, 1);
+ data->noti_handle = noti;
+ data->noti_id = _bt_get_notification_priv_id(noti);
- data = __bt_get_noti_data_by_transfer_id(
- transfer_info->transfer_id);
- if (data == NULL) {
- DBG("Data is NULL, returning");
- return;
- }
+ data->transfer_id = transfer_info->transfer_id;
- if (isFirstReceivedPacket)
- _bt_update_notification(ad, data->noti_handle, transfer_info->filename, "", NULL);
- if (data && data->noti_id)
- _bt_update_notification_progress(
- data->noti_handle,
- data->noti_id,
- transfer_info->percentage);
- else
- DBG("noti_id is not exist!");
- }
- isFirstReceivedPacket = FALSE;
- break;
+ bt_receive_noti_list = g_slist_append(bt_receive_noti_list, data);
+ }
+ _bt_set_transfer_indicator(TRUE);
+ _bt_share_block_sleep(TRUE);
+ break;
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED:
- INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED");
- char mime_type[BT_MIME_TYPE_MAX_LEN] = { 0 };
- unsigned int file_size = 0;
- struct stat file_attr;
- char *file_path = NULL;
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS:
+ if (param->result == BLUETOOTH_ERROR_NONE) {
transfer_info = param->param_data;
- _bt_set_transfer_indicator(FALSE);
- _bt_share_block_sleep(FALSE);
- isFirstReceivedPacket = FALSE;
-
- data = __bt_get_noti_data_by_transfer_id(transfer_info->transfer_id);
- if (data) {
- _bt_delete_notification(data->noti_handle);
- bt_receive_noti_list = g_slist_remove(bt_receive_noti_list, data);
- g_free(data);
+ data = __bt_get_noti_data_by_transfer_id(
+ transfer_info->transfer_id);
+ if (data == NULL) {
+ DBG("Data is NULL, returning");
+ return;
}
- if (0 == g_strcmp0(transfer_info->type, TRANSFER_PUT)) {
- INFO("TRANSFER_PUT");
+ if (isFirstReceivedPacket)
+ _bt_update_notification(ad, data->noti_handle, transfer_info->filename, "", NULL);
+ if (data && data->noti_id)
+ _bt_update_notification_progress(
+ data->noti_handle,
+ data->noti_id,
+ transfer_info->percentage);
+ else
+ DBG("noti_id is not exist!");
+ }
+ isFirstReceivedPacket = FALSE;
+ break;
+
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED:
+ INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED");
+ char mime_type[BT_MIME_TYPE_MAX_LEN] = { 0 };
+ unsigned int file_size = 0;
+ struct stat file_attr;
+ char *file_path = NULL;
+ transfer_info = param->param_data;
+ _bt_set_transfer_indicator(FALSE);
+ _bt_share_block_sleep(FALSE);
+ isFirstReceivedPacket = FALSE;
+
+ data = __bt_get_noti_data_by_transfer_id(transfer_info->transfer_id);
+
+ if (data) {
+ _bt_delete_notification(data->noti_handle);
+ bt_receive_noti_list = g_slist_remove(bt_receive_noti_list, data);
+ g_free(data);
+ }
- file_path = __get_dest_file_path(transfer_info->file_path);
- DBG("Filename : %s", transfer_info->filename);
- DBG("File Path : %s", transfer_info->file_path);
+ if (0 == g_strcmp0(transfer_info->type, TRANSFER_PUT)) {
+ INFO("TRANSFER_PUT");
- if (aul_get_mime_from_file(file_path, mime_type,
- BT_MIME_TYPE_MAX_LEN) == AUL_R_OK)
- DBG("mime type : %s", mime_type);
+ file_path = __get_dest_file_path(transfer_info->file_path);
+ DBG("Filename : %s", transfer_info->filename);
+ DBG("File Path : %s", transfer_info->file_path);
- if (g_utf8_validate(file_path, -1, NULL)) {
- if (stat(file_path, &file_attr) == 0)
- file_size = file_attr.st_size;
- else
- file_size = 0;
- }
+ if (aul_get_mime_from_file(file_path, mime_type,
+ BT_MIME_TYPE_MAX_LEN) == AUL_R_OK)
+ DBG("mime type : %s", mime_type);
+ if (g_utf8_validate(file_path, -1, NULL)) {
+ if (stat(file_path, &file_attr) == 0)
+ file_size = file_attr.st_size;
+ else
+ file_size = 0;
+ }
- if (param->result != BLUETOOTH_ERROR_NONE) {
- ad->recv_data.tr_fail++;
- _bt_add_recv_transfer_status_data(
+ if (param->result != BLUETOOTH_ERROR_NONE) {
+ ad->recv_data.tr_fail++;
+ _bt_add_recv_transfer_status_data(
transfer_info->device_name,
transfer_info->filename,
mime_type, file_size,
BT_TR_FAIL);
- } else {
- ad->recv_data.tr_success++;
- _bt_add_recv_transfer_status_data(
+ } else {
+ ad->recv_data.tr_success++;
+ _bt_add_recv_transfer_status_data(
transfer_info->device_name,
file_path,
mime_type, file_size,
BT_TR_SUCCESS);
- }
+ }
- _bt_update_transfer_list_view("inbound");
+ _bt_update_transfer_list_view("inbound");
- if (ad->receive_noti == NULL) {
- ad->receive_noti = _bt_insert_notification(ad, BT_RECEIVED_NOTI, 0, 0);
- } else {
- _bt_update_notification(ad, ad->receive_noti, NULL, NULL, NULL);
- }
- } else if (0 == g_strcmp0(transfer_info->type, TRANSFER_GET)) {
- INFO("TRANSFER_GET");
+ if (ad->receive_noti == NULL) {
+ ad->receive_noti = _bt_insert_notification(ad, BT_RECEIVED_NOTI, 0, 0);
+ } else {
+ _bt_update_notification(ad, ad->receive_noti, NULL, NULL, NULL);
}
+ } else if (0 == g_strcmp0(transfer_info->type, TRANSFER_GET)) {
+ INFO("TRANSFER_GET");
+ }
- if (param->result == BLUETOOTH_ERROR_NONE) {
- bt_file_type_t file_type;
- char *extn;
- bt_file_info_t *info;
+ if (param->result == BLUETOOTH_ERROR_NONE) {
+ bt_file_type_t file_type;
+ char *extn;
+ bt_file_info_t *info;
- transfer_info = param->param_data;
- if (transfer_info->file_path == NULL) {
- ERR("File path is NULL");
- break;
- }
+ transfer_info = param->param_data;
+ if (transfer_info->file_path == NULL) {
+ ERR("File path is NULL");
+ break;
+ }
- if (!g_strcmp0(transfer_info->type, TRANSFER_GET)) {
- DBG("Transfer is GET, so no need to handle");
- break;
- }
+ if (!g_strcmp0(transfer_info->type, TRANSFER_GET)) {
+ DBG("Transfer is GET, so no need to handle");
+ break;
+ }
- name = __get_dest_file_path(transfer_info->file_path);
+ name = __get_dest_file_path(transfer_info->file_path);
- extn = strrchr(name, '.');
- if (NULL != extn)
- extn++;
- file_type = __get_file_type(extn);
+ extn = strrchr(name, '.');
+ if (NULL != extn)
+ extn++;
+ file_type = __get_file_type(extn);
- INFO("file type %d", file_type);
+ INFO("file type %d", file_type);
- if (transfer_info->server_type == FTP_SERVER ||
- file_type != BT_FILE_VCARD) {
- if (file_type != BT_FILE_VCAL)
- __bt_scan_media_file(name);
- g_free(name);
- break;
- }
+ if (transfer_info->server_type == FTP_SERVER ||
+ file_type != BT_FILE_VCARD) {
+ if (file_type != BT_FILE_VCAL)
+ __bt_scan_media_file(name);
+ g_free(name);
+ break;
+ }
- info = g_new0(bt_file_info_t, 1);
- info->file_path = name;
- info->file_type = file_type;
+ info = g_new0(bt_file_info_t, 1);
+ info->file_path = name;
+ info->file_type = file_type;
- if (pthread_create(&thread_id, NULL, (void *)&_bt_obex_writeclose,
+ if (pthread_create(&thread_id, NULL, (void *)&_bt_obex_writeclose,
info) < 0) {
- ERR("pthread_create() is failed");
- __free_file_info(info);
- break;
- }
- if (pthread_detach(thread_id) < 0) {
- ERR("pthread_detach() is failed");
- }
- } else {
- DBG("param->result = %d", param->result);
- DBG("opp_transfer_abort by user %d ", ad->opp_transfer_abort);
- if (!ad->opp_transfer_abort)
- _bt_create_warning_popup(param->result,
- BT_STR_UNABLE_TO_RECEIVE);
- ad->opp_transfer_abort = FALSE;
+ ERR("pthread_create() is failed");
+ __free_file_info(info);
+ break;
}
- break;
+ if (pthread_detach(thread_id) < 0) {
+ ERR("pthread_detach() is failed");
+ }
+ } else {
+ DBG("param->result = %d", param->result);
+ DBG("opp_transfer_abort by user %d ", ad->opp_transfer_abort);
+ if (!ad->opp_transfer_abort)
+ _bt_create_warning_popup(param->result,
+ BT_STR_UNABLE_TO_RECEIVE);
+ ad->opp_transfer_abort = FALSE;
+ }
+ break;
- case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED:
- INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED");
- if (param->result == BLUETOOTH_ERROR_NONE)
- isTransferConnectedReceived = FALSE;
- break;
+ case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED:
+ INFO("BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED");
+ if (param->result == BLUETOOTH_ERROR_NONE)
+ isTransferConnectedReceived = FALSE;
+ break;
- default:
- break;
+ default:
+ break;
}
}
void _bt_get_default_storage(char *storage)
{
int val = BT_DEFAULT_MEM_PHONE;
- int ret;
+ int ret = 0;
char *path = NULL;
if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
(void *)&val)) {
- DBG("vconf error\n");
+ ERR("vconf error");
val = BT_DEFAULT_MEM_PHONE;
}
ret = storage_get_directory(STORAGE_TYPE_EXTERNAL,
STORAGE_DIRECTORY_DOWNLOADS, &path);
- if (ret != STORAGE_ERROR_NONE)
- DBG("Fail to get the download path: %d", ret);
+ if (ret != STORAGE_ERROR_NONE)
+ DBG("Fail to get the download path: %d", ret);
- if (path == NULL)
- path = g_strdup(BT_DOWNLOAD_DEFAULT_MMC_FOLDER);
+ if (path == NULL)
+ path = g_strdup(BT_DOWNLOAD_DEFAULT_MMC_FOLDER);
} else {
path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
}
ERR("ret : %d", r);
else {
INFO("total : %lf, avail : %lf",
- (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
+ (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
*dAvail = (double)s.f_bsize*s.f_bavail;
}
filename, seq);
snprintf(temp_filepath, sizeof(temp_filepath), "%s/%s",
- storage_path, temp_filename);
+ storage_path, temp_filename);
/* In below code check is done for unique file name or
Max value of integer reached, in this case overwrite
}
static void __bt_app_obex_openwrite_requested(bt_obex_server_authorize_into_t
- *server_auth_info)
+ *server_auth_info)
{
ret_if(server_auth_info == NULL);
ret_if(server_auth_info->filename == NULL);
_bt_get_default_storage(storage);
/* For vcf file type, some device send weird filename like "telecom/pb.vcf"
- This filename should be renamed.
- */
+ This filename should be renamed.
+ */
regex = g_regex_new("[*\"<>;?|\\^:/]", 0, 0, NULL);
name = g_regex_replace(regex, server_auth_info->filename, -1, 0, "_", 0, NULL);
}
snprintf(temp_filename, BT_FILE_PATH_LEN_MAX, "%s/%s",
- storage, server_auth_info->filename);
+ storage, server_auth_info->filename);
INFO("temp_filename : %s", temp_filename);
if (access(temp_filename, F_OK) == 0) {
name = server_auth_info->filename;
server_auth_info->filename = __bt_get_unique_file_name(storage,
- name);
+ name);
g_free(name);
}
INFO("available_ext_mem_size =%llu", available_ext_mem_size);
if (available_ext_mem_size < server_auth_info->length) {
g_timeout_add(BT_APP_POPUP_LAUNCH_TIMEOUT,
- (GSourceFunc)_bt_app_popup_memoryfull,
- NULL);
+ (GSourceFunc)_bt_app_popup_memoryfull,
+ NULL);
goto reject;
}
} else {
INFO("available_int_mem_size =%lf", available_ext_mem_size);
if (available_int_mem_size < server_auth_info->length) {
g_timeout_add(BT_APP_POPUP_LAUNCH_TIMEOUT,
- (GSourceFunc)_bt_app_popup_memoryfull,
- NULL);
+ (GSourceFunc)_bt_app_popup_memoryfull,
+ NULL);
goto reject;
}
}
if (isTransferConnectedReceived) {
if (notification_status_message_post(BT_STR_RECEIVING) != NOTIFICATION_ERROR_NONE)
ERR("notification_status_message_post() is failed");
- isTransferConnectedReceived = FALSE;
+ isTransferConnectedReceived = FALSE;
}
__bt_app_obex_openwrite_requested(server_auth_info);