From 0d76c0d7f66e73e7e5943730ee758885d746f072 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Wed, 9 Nov 2016 17:35:10 +0900 Subject: [PATCH] Fix the sending failed count (TSAM-9574) Change-Id: I30b8a83766067a96997fe037050ae73c642f495e Signed-off-by: Hyuk Lee --- bt-share/src/obex-event-handler.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/bt-share/src/obex-event-handler.c b/bt-share/src/obex-event-handler.c index eedec78..90e1972 100644 --- a/bt-share/src/obex-event-handler.c +++ b/bt-share/src/obex-event-handler.c @@ -226,6 +226,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, { int ret; static int send_index = 0; + static gboolean is_started = FALSE; int percentage = 0; int s_id = 0; char *name = NULL; @@ -254,6 +255,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, case BLUETOOTH_EVENT_OPC_CONNECTED: INFO("BLUETOOTH_EVENT_OPC_CONNECTED, result [%d] \n", param->result); send_index = 0; + is_started = FALSE; if (param->result != BLUETOOTH_ERROR_NONE) { _bt_create_warning_popup(param->result, BT_STR_UNABLE_TO_SEND); @@ -314,6 +316,8 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, INFO("BLUETOOTH_EVENT_OPC_TRANSFER_STARTED"); ret_if(node == NULL); + is_started = TRUE; + if (ad->opc_noti) { _bt_delete_notification(ad->opc_noti); ad->opc_noti = NULL; @@ -366,6 +370,17 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, case BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE: INFO("BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE"); + if (!is_started) { + INFO("TRANSFER operation abnormal. It is completed without TRANSFER START"); + 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); + send_index++; + } + + is_started = FALSE; + client_info = (bt_opc_transfer_info_t *)param->param_data; ret_if(client_info == NULL); @@ -413,6 +428,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, BT_STR_UNABLE_TO_SEND); ad->opp_transfer_abort = FALSE; _bt_update_transfer_list_view("outbound"); + ad->tr_next_data = g_slist_next(ad->tr_next_data); break; } else { _bt_update_sent_data_status(ad->current_tr_uid, @@ -425,18 +441,21 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, break; - case BLUETOOTH_EVENT_OPC_DISCONNECTED: + case BLUETOOTH_EVENT_OPC_DISCONNECTED: INFO("BLUETOOTH_EVENT_OPC_DISCONNECTED"); ret_if(node == NULL); if (node->file_cnt > send_index) { send_index = 0; + is_started = FALSE; + if (!ad) { ERR("ad is NULL"); break; } if (!ad->tr_next_data) { send_index = 0; + is_started = FALSE; _bt_share_block_sleep(FALSE); _bt_set_transfer_indicator(FALSE); _remove_transfer_info(node); @@ -481,6 +500,7 @@ void _bt_share_event_handler(int event, bluetooth_event_param_t *param, send_index = 0; + is_started = FALSE; _bt_share_block_sleep(FALSE); _bt_set_transfer_indicator(FALSE); _remove_transfer_info(node); -- 2.7.4