X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-api%2Fbt-obex-server.c;h=c679d0e316fc77f57e6216fe09763db91dcce09c;hb=39ba85ec55b2de81bb872bacb035f6731e56086e;hp=b4b651327c098896129a3c606778213a0e8f5f0b;hpb=f8cd843634b70ab96c83bd552606c197fcf5decc;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-api/bt-obex-server.c b/bt-api/bt-obex-server.c index b4b6513..c679d0e 100755 --- a/bt-api/bt-obex-server.c +++ b/bt-api/bt-obex-server.c @@ -1,11 +1,5 @@ /* - * Bluetooth-frwk - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hocheol Seo - * Girishashok Joshi - * Chanyeol Park + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +31,7 @@ BT_EXPORT_API int bluetooth_obex_server_init(const char *dst_path) bt_user_info_t *user_info; gboolean native_service = TRUE; char path[BT_FILE_PATH_MAX]; + int res; BT_CHECK_ENABLED(return); @@ -61,8 +56,10 @@ BT_EXPORT_API int bluetooth_obex_server_init(const char *dst_path) if (result == BLUETOOTH_ERROR_NONE) { _bt_set_obex_server_id(BT_NATIVE_SERVER); - _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb, - user_info->user_data); + res = _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb, + user_info->user_data); + if (res != BLUETOOTH_ERROR_NONE) + BT_ERR("Fail to _bt_register_event(%d)", res); } else { BT_ERR("Fail to send request"); } @@ -109,6 +106,7 @@ BT_EXPORT_API int bluetooth_obex_server_init_without_agent(const char *dst_path) bt_user_info_t *user_info; gboolean native_service = FALSE; char path[BT_FILE_PATH_MAX]; + int res; BT_CHECK_ENABLED(return); @@ -133,8 +131,11 @@ BT_EXPORT_API int bluetooth_obex_server_init_without_agent(const char *dst_path) if (result == BLUETOOTH_ERROR_NONE) { _bt_set_obex_server_id(BT_CUSTOM_SERVER); - _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb, - user_info->user_data); + res = _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb, + user_info->user_data); + if (res != BLUETOOTH_ERROR_NONE) + BT_ERR("Fail to _bt_register_event(%d)", res); + } else { BT_ERR("Fail to send request"); } @@ -187,11 +188,10 @@ BT_EXPORT_API gboolean bluetooth_obex_server_is_activated(void) result = _bt_send_request(BT_OBEX_SERVICE, BT_OBEX_SERVER_IS_ACTIVATED, in_param1, in_param2, in_param3, in_param4, &out_param); - if (result == BLUETOOTH_ERROR_NONE) { + if (result == BLUETOOTH_ERROR_NONE) is_activated = g_array_index(out_param, gboolean, 0); - } else { + else BT_ERR("Fail to send request"); - } BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); @@ -348,7 +348,6 @@ BT_EXPORT_API int bluetooth_obex_server_cancel_transfer(int transfer_id) { int result; int server_type; - int service_function = BT_OBEX_SERVER_CANCEL_TRANSFER; BT_CHECK_ENABLED(return); @@ -356,16 +355,18 @@ BT_EXPORT_API int bluetooth_obex_server_cancel_transfer(int transfer_id) if (server_type == BT_NO_SERVER) return BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST; - else if (server_type == BT_CUSTOM_SERVER) - service_function = BT_OBEX_SERVER_CANCEL_ALL_TRANSFERS; BT_INIT_PARAMS(); BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); g_array_append_vals(in_param1, &transfer_id, sizeof(int)); - result = _bt_send_request(BT_OBEX_SERVICE, service_function, - in_param1, in_param2, in_param3, in_param4, &out_param); + if (server_type == BT_CUSTOM_SERVER) + result = _bt_send_request(BT_OBEX_SERVICE, BT_OBEX_SERVER_CANCEL_ALL_TRANSFERS, + in_param1, in_param2, in_param3, in_param4, &out_param); + else + result = _bt_send_request(BT_OBEX_SERVICE, BT_OBEX_SERVER_CANCEL_TRANSFER, + in_param1, in_param2, in_param3, in_param4, &out_param); BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); @@ -406,11 +407,10 @@ BT_EXPORT_API int bluetooth_obex_server_is_receiving(gboolean *is_receiving) result = _bt_send_request(BT_OBEX_SERVICE, BT_OBEX_SERVER_IS_RECEIVING, in_param1, in_param2, in_param3, in_param4, &out_param); - if (result == BLUETOOTH_ERROR_NONE) { + if (result == BLUETOOTH_ERROR_NONE) *is_receiving = g_array_index(out_param, gboolean, 0); - } else { + else BT_ERR("Fail to send request"); - } BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);