Merge branch 'tizen' into tizen_5.5
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-obex-server.c
old mode 100644 (file)
new mode 100755 (executable)
index 6a79be3..c679d0e
@@ -1,11 +1,5 @@
 /*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
- *              Girishashok Joshi <girish.joshi@samsung.com>
- *              Chanyeol Park <chanyeol.park@samsung.com>
+ * 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.
@@ -63,7 +57,7 @@ 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);
                res = _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb,
-                                       user_info->user_data);
+                       user_info->user_data);
                if (res != BLUETOOTH_ERROR_NONE)
                        BT_ERR("Fail to _bt_register_event(%d)", res);
        } else {
@@ -138,7 +132,7 @@ 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);
                res = _bt_register_event(BT_OPP_SERVER_EVENT, user_info->cb,
-                                       user_info->user_data);
+                               user_info->user_data);
                if (res != BLUETOOTH_ERROR_NONE)
                        BT_ERR("Fail to _bt_register_event(%d)", res);
 
@@ -194,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);
 
@@ -355,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);
 
@@ -363,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);
 
@@ -413,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);