X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-api%2Fbt-opp-client.c;h=b69d2bd935b194ba83cefbe3661b2c97354c3fab;hb=e791089370a0d9f172547ac849f8f4970658e3d0;hp=014806f07ea780da428bb45bedd494409c3cf12f;hpb=a32ca17365d4acf1332a8960fc74316b075237f1;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-api/bt-opp-client.c b/bt-api/bt-opp-client.c index 014806f..b69d2bd 100644 --- a/bt-api/bt-opp-client.c +++ b/bt-api/bt-opp-client.c @@ -24,7 +24,7 @@ #include "bt-request-sender.h" #include "bt-event-handler.h" -#ifdef TIZEN_DPM_ENABLE +#ifdef TIZEN_FEATURE_BT_DPM #include "bt-dpm.h" #endif @@ -58,7 +58,7 @@ BT_EXPORT_API int bluetooth_opc_deinit(void) } BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address, - char **file_name_array) + char **file_name_array) { int result; int i; @@ -77,7 +77,7 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad return BLUETOOTH_ERROR_PERMISSION_DEINED; } -#ifdef TIZEN_DPM_ENABLE +#ifdef TIZEN_FEATURE_BT_DPM if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; @@ -191,14 +191,45 @@ BT_EXPORT_API int bluetooth_opc_is_sending(gboolean *is_sending) result = _bt_send_request(BT_OBEX_SERVICE, BT_OPP_IS_PUSHING_FILES, in_param1, in_param2, in_param3, in_param4, &out_param); - if (result == BLUETOOTH_ERROR_NONE) { + if (result == BLUETOOTH_ERROR_NONE) *is_sending = g_array_index(out_param, gboolean, 0); + else + BT_ERR("Fail to send request"); + + + BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); + + return result; +} + +BT_EXPORT_API int bluetooth_opp_get_transfer_progress(bluetooth_opp_transfer_type_t transfer_type, + int transfer_id, unsigned char *progress) +{ + int result; + int direction = transfer_type; + int percentage = 0; + BT_CHECK_ENABLED(return); + + BT_INIT_PARAMS(); + BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); + + g_array_append_vals(in_param1, &direction, sizeof(int)); + g_array_append_vals(in_param2, &transfer_id, sizeof(int)); + + result = _bt_send_request(BT_OBEX_SERVICE, BT_OPP_GET_TRANSFER_PROGRESS, + in_param1, in_param2, in_param3, in_param4, &out_param); + + if (result == BLUETOOTH_ERROR_NONE) { + percentage = g_array_index(out_param, guint8, 0); + BT_DBG("Percentage: %d", percentage); } else { BT_ERR("Fail to send request"); } + if (progress) + *progress = percentage; + BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); return result; } -