DPM: Modify/Remove the DPM APIs and Expose DPM BT-APIs
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-adapter.c
index 6eb7fe7..2391393 100644 (file)
@@ -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.
@@ -94,6 +88,11 @@ BT_EXPORT_API int bluetooth_enable_adapter(void)
        retv_if(bluetooth_check_adapter() == BLUETOOTH_ADAPTER_ENABLED,
                                BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED);
 
+#ifdef TIZEN_DPM_VCONF_ENABLE
+       retv_if(bluetooth_dpm_is_bluetooth_mode_allowed() == BLUETOOTH_DPM_RESULT_ACCESS_DENIED,
+                               BLUETOOTH_ERROR_PERMISSION_DEINED);
+#endif
+
        user_info = _bt_get_user_data(BT_COMMON);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -295,7 +294,7 @@ BT_EXPORT_API int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t
        if (bluetooth_check_adapter() == BLUETOOTH_ADAPTER_DISABLED) {
                if (vconf_get_int(BT_FILE_VISIBLE_TIME, &timeout) != 0) {
                        BT_ERR("Fail to get the timeout value");
-                       return BLUETOOTH_ERROR_INTERNAL;
+                       return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
                }
 
                if (timeout == -1) {
@@ -306,6 +305,8 @@ BT_EXPORT_API int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t
 
                return BLUETOOTH_ERROR_NONE;
        }
+#else
+       BT_CHECK_ENABLED(return);
 #endif
 
        BT_INIT_PARAMS();