DPM: Sync API return value with other bt-service modules. 68/100968/2
authorh.sandeep <h.sandeep@samsung.com>
Tue, 29 Nov 2016 11:41:15 +0000 (17:11 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Wed, 30 Nov 2016 04:45:49 +0000 (20:45 -0800)
1. All the API return values synchronozed as per bt-service
modules.
2. Moved the getter API return values to API out parameter.
3. Fix the Svace 2.2 issue.

Change-Id: Ie76f2cbc913bfbdb567606635e0e817b2f237056
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
bt-api/bt-dpm.c
bt-service/bt-request-handler.c
bt-service/bt-service-adapter.c
bt-service/bt-service-agent.c
bt-service/bt-service-dpm.c
bt-service/bt-service-event-receiver.c
bt-service/bt-service-obex-server.c
bt-service/include/bt-service-dpm.h

index d0b6a91..bbf4d6c 100644 (file)
@@ -33,12 +33,12 @@ BT_EXPORT_API int bluetooth_dpm_is_mode_allowed(void)
        /* check VCONFKEY_BT_STATUS */
        if (vconf_get_int(VCONFKEY_BT_DPM_STATUS, &value) != 0) {
                BT_ERR("fail to get vconf key!");
-               return BLUETOOTH_DPM_RESULT_FAIL;
+               return BLUETOOTH_ERROR_INTERNAL;
        }
        if (value != VCONFKEY_BT_DPM_STATUS_RESTRICTED)
-               return BLUETOOTH_DPM_RESULT_SUCCESS;
+               return BLUETOOTH_ERROR_NONE;
        else
-               return BLUETOOTH_DPM_RESULT_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 }
 #endif
 
@@ -246,7 +246,7 @@ static bt_dpm_status_e _bt_check_dpm_spp_restriction(void)
 int _bt_check_dpm(int service, void *param)
 {
        bt_dpm_status_e status = BT_DPM_ALLOWED;
-
+       int ret = BLUETOOTH_ERROR_NONE;
        BT_CHECK_ENABLED_ANY(return);
 
        switch (service) {
@@ -291,17 +291,20 @@ int _bt_check_dpm(int service, void *param)
                return status;
        }
 
-       if (status == BT_DPM_RESTRICTED)
+       if (status == BT_DPM_RESTRICTED) {
                BT_INFO("Service [%d], DPM permission denied", service);
-       else if (status == BT_DPM_NO_SERVICE)
+               ret = BLUETOOTH_ERROR_PERMISSION_DEINED;
+       } else if (status == BT_DPM_NO_SERVICE) {
                BT_DBG("DPM no service [%d]", status);
+               ret = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+       }
 
-       return status;
+       return ret;
 }
 
 BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
 {
-       int result =  BLUETOOTH_DPM_RESULT_SUCCESS;
+       int result =  BLUETOOTH_ERROR_NONE;
 #ifdef TIZEN_FEATURE_BT_DPM
        int bt_status;
 #endif
@@ -313,10 +316,10 @@ BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
        if (bt_status == VCONFKEY_BT_STATUS_ON) {
                if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
                        BT_ERR("Set VCONFKEY_BT_DPM_STATUS failed\n");
-                       result = BLUETOOTH_DPM_RESULT_FAIL;
+                       result = BLUETOOTH_ERROR_INTERNAL;
                } else {
                        BT_ERR("Set VCONFKEY_BT_DPM_STATUS success\n");
-                       result = BLUETOOTH_DPM_RESULT_SUCCESS;
+                       result = BLUETOOTH_ERROR_NONE;
                }
 
                BT_INIT_PARAMS();
@@ -329,7 +332,7 @@ BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
 
                BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
-               if (result == BLUETOOTH_DPM_RESULT_SUCCESS &&
+               if (result == BLUETOOTH_ERROR_NONE &&
                        value == BLUETOOTH_DPM_BT_RESTRICTED) {
                        result = bluetooth_disable_adapter();
                }
@@ -338,11 +341,11 @@ BT_EXPORT_API int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value)
                        value <= BLUETOOTH_DPM_BT_RESTRICTED) {
                        if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0) {
                                BT_ERR("Set VCONFKEY_BT_DPM_STATUS failed\n");
-                               result = BLUETOOTH_DPM_RESULT_FAIL;
+                               result = BLUETOOTH_ERROR_INTERNAL;
                        } else
-                               result = BLUETOOTH_DPM_RESULT_SUCCESS;
+                               result = BLUETOOTH_ERROR_NONE;
                } else
-                       result = BLUETOOTH_DPM_RESULT_INVALID_PARAM;
+                       result = BLUETOOTH_ERROR_INVALID_PARAM;
        }
 #else
        BT_INIT_PARAMS();
@@ -366,7 +369,7 @@ BT_EXPORT_API int bluetooth_dpm_get_allow_mode(bt_dpm_allow_t *value)
 
 #ifdef TIZEN_FEATURE_BT_DPM
        *value = bluetooth_dpm_is_mode_allowed();
-       return BLUETOOTH_DPM_RESULT_SUCCESS;
+       result = BLUETOOTH_ERROR_NONE;
 #else
        BT_CHECK_ENABLED_ANY(return);
 
@@ -376,7 +379,7 @@ BT_EXPORT_API int bluetooth_dpm_get_allow_mode(bt_dpm_allow_t *value)
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -424,7 +427,7 @@ BT_EXPORT_API int bluetooth_dpm_is_device_restriction_active(bt_dpm_status_t *va
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICE_RESTRITION,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -471,7 +474,7 @@ BT_EXPORT_API int bluetooth_dpm_is_uuid_restriction_active(bt_dpm_status_t *valu
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUID_RESTRITION,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -698,13 +701,13 @@ BT_EXPORT_API int bluetooth_dpm_get_devices_from_blacklist(bt_dpm_device_list_t
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_BLACKLIST,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
                BT_DBG("device_list->count : %d", devices->count);
 
                if (devices->count == 0) {
                        BT_ERR("device_list->count is zero !");
-                       return BLUETOOTH_DPM_RESULT_FAIL;
+                       result = BLUETOOTH_ERROR_NOT_FOUND;
                }
 
                device_list->count = devices->count;
@@ -733,13 +736,13 @@ BT_EXPORT_API int bluetooth_dpm_get_devices_from_whitelist(bt_dpm_device_list_t
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DEVICES_WHITELIST,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                devices = &g_array_index(out_param, bt_dpm_device_list_t, 0);
                BT_DBG("device_list->count : %d", devices->count);
 
                if (devices->count == 0) {
                        BT_ERR("device_list->count is zero !");
-                       return BLUETOOTH_DPM_RESULT_FAIL;
+                       result = BLUETOOTH_ERROR_NOT_FOUND;
                }
 
                device_list->count = devices->count;
@@ -768,13 +771,13 @@ BT_EXPORT_API int bluetooth_dpm_get_uuids_from_blacklist(bt_dpm_uuids_list_t *uu
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_BLACKLIST,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
                BT_DBG("uuids->count : %d", uuids->count);
 
                if (uuids->count == 0) {
                        BT_ERR("uuids->count is zero !");
-                       return BLUETOOTH_DPM_RESULT_FAIL;
+                       result = BLUETOOTH_ERROR_NOT_FOUND;
                }
 
                uuid_list->count = uuids->count;
@@ -802,13 +805,13 @@ BT_EXPORT_API int bluetooth_dpm_get_uuids_from_whitelist(bt_dpm_uuids_list_t *uu
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_UUIDS_WHITELIST,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                uuids = &g_array_index(out_param, bt_dpm_uuids_list_t, 0);
                BT_DBG("uuids->count : %d", uuids->count);
 
                if (uuids->count == 0) {
                        BT_ERR("uuids->count is zero !");
-                       return BLUETOOTH_DPM_RESULT_FAIL;
+                       result = BLUETOOTH_ERROR_NOT_FOUND;
                }
 
                uuid_list->count = uuids->count;
@@ -940,7 +943,7 @@ BT_EXPORT_API int bluetooth_dpm_get_allow_outgoing_call(bt_dpm_status_t *value)
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_OUTGOING_CALL,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -985,7 +988,7 @@ BT_EXPORT_API int bluetooth_dpm_get_pairing_state(bt_dpm_status_t *value)
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_ALLOW_BT_MODE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -1033,7 +1036,7 @@ BT_EXPORT_API int bluetooth_dpm_get_profile_state(bt_dpm_profile_t profile, bt_d
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_PROFILE_STATE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -1078,7 +1081,7 @@ BT_EXPORT_API int bluetooth_dpm_get_desktop_connectivity_state(bt_dpm_status_t *
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DESKROP_CONNECTIVITY_STATE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -1123,7 +1126,7 @@ BT_EXPORT_API int bluetooth_dpm_get_discoverable_state(bt_dpm_status_t *value)
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DISCOVERABLE_STATE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -1170,7 +1173,7 @@ BT_EXPORT_API int bluetooth_dpm_get_limited_discoverable_state(bt_dpm_status_t *
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_LIMITED_DISCOVERABLE_STATE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
@@ -1215,7 +1218,7 @@ BT_EXPORT_API int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value)
        result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_GET_DATA_TRANSFER_STATE,
                in_param1, in_param2, in_param3, in_param4, &out_param);
 
-       if (result == BLUETOOTH_DPM_RESULT_SUCCESS) {
+       if (result == BLUETOOTH_ERROR_NONE) {
                if (out_param->len > 0) {
                        *value = g_array_index(out_param,
                                        int, 0);
index 9f9122f..90d706b 100644 (file)
@@ -1823,16 +1823,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_ALLOW_BT_MODE: {
-               dpm_bt_allow_t value = DPM_BT_ERROR;
+               int value = DPM_BT_ERROR;
 
-               value = _bt_dpm_get_allow_bluetooth_mode();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_allow_bluetooth_mode(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_DEVICE_RESTRITION: {
-               dpm_status_t value = DPM_BT_ERROR;
+               dpm_status_t value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -1841,16 +1839,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_DEVICE_RESTRITION: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_is_bluetooth_device_restriction_active();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_is_bluetooth_device_restriction_active(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_UUID_RESTRITION: {
-               dpm_status_t value = DPM_BT_ERROR;
+               dpm_status_t value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -1859,12 +1855,10 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_UUID_RESTRITION: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_is_bluetooth_uuid_restriction_active();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_is_bluetooth_uuid_restriction_active(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_ADD_DEVICES_BLACKLIST: {
@@ -1969,7 +1963,7 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
-               dpm_status_t value = DPM_BT_ERROR;
+               dpm_status_t value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -1979,16 +1973,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_ALLOW_OUTGOING_CALL: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_allow_bluetooth_outgoing_call();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_allow_bluetooth_outgoing_call(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_PAIRING_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               dpm_status_t value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -1998,17 +1990,15 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_PAIRING_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_bluetooth_pairing_state();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_bluetooth_pairing_state(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_PROFILE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
-               dpm_profile_t profile = DPM_PROFILE_NONE;
+               int value = DPM_STATUS_ERROR;
+               int profile = DPM_PROFILE_NONE;
 
                __bt_service_get_parameters(in_param1, &profile,
                                sizeof(int));
@@ -2020,20 +2010,18 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_PROFILE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
-               dpm_profile_t profile = DPM_PROFILE_NONE;
+               int value = DPM_STATUS_ERROR;
+               int profile = DPM_PROFILE_NONE;
 
-               __bt_service_get_parameters(in_param2, &profile,
+               __bt_service_get_parameters(in_param1, &profile,
                                sizeof(int));
 
-               value = _bt_dpm_get_bluetooth_profile_state(profile);
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_bluetooth_profile_state(profile, &value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_DESKROP_CONNECTIVITY_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_BT_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -2043,16 +2031,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_bluetooth_desktop_connectivity_state();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_bluetooth_desktop_connectivity_state(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_DISCOVERABLE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -2062,16 +2048,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_DISCOVERABLE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_bluetooth_discoverable_state();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_bluetooth_discoverable_state(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_LIMITED_DISCOVERABLE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -2081,16 +2065,14 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_bluetooth_limited_discoverable_state();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_bluetooth_limited_discoverable_state(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_DPM_SET_DATA_TRANSFER_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
                __bt_service_get_parameters(in_param1, &value,
                                sizeof(int));
@@ -2100,12 +2082,10 @@ int __bt_bluez_request(int function_name,
                break;
        }
        case BT_DPM_GET_DATA_TRANSFER_STATE: {
-               dpm_status_t value = DPM_BT_ERROR;
+               int value = DPM_STATUS_ERROR;
 
-               value = _bt_dpm_get_allow_bluetooth_data_transfer_state();
-               result = DPM_RESULT_SUCCESS;
+               result = _bt_dpm_get_allow_bluetooth_data_transfer_state(&value);
                g_array_append_vals(*out_param1, &value, sizeof(int));
-
                break;
        }
        case BT_PXP_MONITOR_SET_PROPERTY: {
index f9a15b6..25b86e6 100644 (file)
@@ -212,6 +212,11 @@ int __bt_set_visible_time(int timeout)
 {
        int result;
        alarm_id_t alarm_id;
+#ifndef TIZEN_PROFILE_WEARABLE
+#ifdef TIZEN_FEATURE_BT_DPM
+       int discoverable_state = DPM_BT_ERROR;
+#endif
+#endif
 
        __bt_visibility_alarm_remove();
 
@@ -219,7 +224,8 @@ int __bt_set_visible_time(int timeout)
 
 #ifndef TIZEN_PROFILE_WEARABLE
 #ifdef TIZEN_FEATURE_BT_DPM
-       if (_bt_dpm_get_bluetooth_limited_discoverable_state() != DPM_RESTRICTED) {
+       _bt_dpm_get_bluetooth_limited_discoverable_state(&discoverable_state);
+       if(discoverable_state != DPM_RESTRICTED) {
 #endif
        if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
                BT_ERR("Set vconf failed");
@@ -1923,19 +1929,23 @@ int _bt_set_discoverable_mode(int discoverable_mode, int timeout)
        GError *error = NULL;
        GDBusProxy *proxy;
        GVariant *result;
+#ifdef TIZEN_FEATURE_BT_DPM
+       int discoverable_state = DPM_BT_ERROR;
+#endif
 
        proxy = _bt_get_adapter_properties_proxy();
 
        retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
 
 #ifdef TIZEN_FEATURE_BT_DPM
+       _bt_dpm_get_bluetooth_limited_discoverable_state(&discoverable_state);
        if (discoverable_mode != BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE &&
-               _bt_dpm_get_bluetooth_limited_discoverable_state() == DPM_RESTRICTED) {
+                discoverable_state == DPM_RESTRICTED) {
                _bt_launch_dpm_popup("DPM_POLICY_DISABLE_BT_HANDSFREE");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
        }
        if (discoverable_mode != BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE &&
-                _bt_dpm_get_bluetooth_limited_discoverable_state() == DPM_RESTRICTED) {
+               discoverable_state == DPM_RESTRICTED) {
                _bt_launch_dpm_popup("DPM_POLICY_DISABLE_BT");
                return BLUETOOTH_ERROR_ACCESS_DENIED;
        }
index 1eb20a5..c7f181b 100644 (file)
@@ -261,11 +261,15 @@ static gboolean __pincode_request(GapAgentPrivate *agent, GDBusProxy *device)
        GVariant *reply_temp = NULL;
        GVariant *tmp_value;
        char pin_code[BLUETOOTH_PIN_CODE_MAX_LENGTH + 1];
+#ifdef TIZEN_FEATURE_BT_DPM
+       int pairing_state = DPM_STATUS_ERROR;
+#endif
 
        BT_DBG("+");
 
 #ifdef TIZEN_FEATURE_BT_DPM
-       if (_bt_dpm_get_bluetooth_pairing_state() == DPM_RESTRICTED) {
+       _bt_dpm_get_bluetooth_pairing_state(&pairing_state);
+       if (pairing_state == DPM_RESTRICTED) {
                BT_ERR("Not allow to pair the device");
                gap_agent_reply_confirmation(agent, GAP_AGENT_REJECT, NULL);
                __bt_agent_release_memory();
@@ -367,10 +371,15 @@ static gboolean __passkey_request(GapAgentPrivate *agent, GDBusProxy *device)
        GVariant *reply = NULL;
        GVariant *reply_temp = NULL;
        GVariant *tmp_value;
+#ifdef TIZEN_FEATURE_BT_DPM
+       int pairing_state = DPM_STATUS_ERROR;
+#endif
+
        BT_DBG("+");
 
 #ifdef TIZEN_FEATURE_BT_DPM
-       if (_bt_dpm_get_bluetooth_pairing_state() == DPM_RESTRICTED) {
+       _bt_dpm_get_bluetooth_pairing_state(&pairing_state);
+       if (pairing_state == DPM_RESTRICTED) {
                BT_ERR("Not allow to pair the device");
                gap_agent_reply_confirmation(agent, GAP_AGENT_REJECT, NULL);
                __bt_agent_release_memory();
@@ -496,10 +505,14 @@ static gboolean __confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
        GVariant *reply_temp = NULL;
        GVariant *reply = NULL;
        GVariant *tmp_value;
+#ifdef TIZEN_FEATURE_BT_DPM
+               int pairing_state = DPM_STATUS_ERROR;
+#endif
        BT_DBG("+ passkey[%.6d]", passkey);
 
 #ifdef TIZEN_FEATURE_BT_DPM
-       if (_bt_dpm_get_bluetooth_pairing_state() == DPM_RESTRICTED) {
+       _bt_dpm_get_bluetooth_pairing_state(&pairing_state);
+       if (pairing_state == DPM_RESTRICTED) {
                BT_ERR("Not allow to pair the device");
                gap_agent_reply_confirmation(agent, GAP_AGENT_REJECT, NULL);
                __bt_agent_release_memory();
index f288b68..27cb1f2 100644 (file)
@@ -85,7 +85,7 @@ int _bt_launch_dpm_popup(char *mode)
        return ret;
 }
 
-dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
+int _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
 {
        BT_INFO("_bt_dpm_set_allow_bluetooth_mode");
 
@@ -104,67 +104,88 @@ dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
 #endif
        policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value  = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_bt_allow_t _bt_dpm_get_allow_bluetooth_mode(void)
+int _bt_dpm_get_allow_bluetooth_mode(int *value)
 {
        BT_INFO("_bt_dpm_get_allow_bluetooth_mode");
 
-       return policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
+       *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
+int _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
        BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value  = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_is_bluetooth_device_restriction_active(void)
+int _bt_dpm_is_bluetooth_device_restriction_active(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_is_bluetooth_device_restriction_active");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DEVICE_RESTRICTION].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
 dpm_result_t _bt_dpm_activate_bluetoooth_uuid_restriction(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value  = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void)
+dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_is_bluetooth_uuid_restriction_active");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
+       *value = policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
 dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address_t *bd_addr)
 {
        char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
        char *dev_addr = NULL;
+       int allow_bt = DPM_BT_ERROR;
 
        BT_INFO("_bt_dpm_add_bluetooth_devices_to_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        BT_CHECK_PARAMETER(bd_addr, return);
 
@@ -173,26 +194,29 @@ dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address
 
        dev_addr = g_strdup(device_address);
        if (!dev_addr)
-               return DPM_RESULT_FAIL;
+               return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
        policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list  = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list, dev_addr);
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
 {
-       dpm_result_t ret = DPM_RESULT_FAIL;
+       int ret = BLUETOOTH_ERROR_INTERNAL;
+       int allow_bt = DPM_BT_ERROR;
        bt_dpm_device_list_t device_list;
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list;
        int i = 0;
 
        BT_INFO("_bt_dpm_get_bluetooth_devices_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return ret;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (list) {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                for (; list; list = list->next, i++) {
                        memset(device_list.addresses[i].addr, 0, BLUETOOTH_ADDRESS_LENGTH);
                        _bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
@@ -200,22 +224,24 @@ dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
                device_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list);
                g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
        } else {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                device_list.count = 0;
                g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
        }
        return ret;
 }
 
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
+int _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
 {
        char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
        char *dev_addr = NULL;
+       int allow_bt = DPM_BT_ERROR;
 
        BT_INFO("_bt_dpm_add_bluetooth_devices_to_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        BT_CHECK_PARAMETER(bd_addr, return);
 
@@ -224,25 +250,27 @@ dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address
 
        dev_addr = g_strdup(device_address);
        if (!dev_addr)
-               return DPM_RESULT_FAIL;
+               return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
        policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list  = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, dev_addr);
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
 {
-       dpm_result_t ret = DPM_RESULT_FAIL;
+       dpm_result_t ret = BLUETOOTH_ERROR_INTERNAL;
+       int allow_bt = DPM_BT_ERROR;
        bt_dpm_device_list_t device_list;
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list;
        int i = 0;
 
        BT_INFO("_bt_dpm_get_bluetooth_devices_from_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return ret;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (list) {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                for (; list; list = list->next, i++) {
                        memset(device_list.addresses[i].addr, 0, BLUETOOTH_ADDRESS_LENGTH);
                        _bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
@@ -251,42 +279,48 @@ dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
                device_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list);
                g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
        } else {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                device_list.count = 0;
                g_array_append_vals(*out_param1, &device_list, sizeof(bt_dpm_device_list_t));
        }
        return ret;
 }
 
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
+int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
 {
        char *l_uuid;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_add_bluetooth_uuids_to_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        l_uuid = g_strdup(uuid);
        if (!l_uuid)
-               return DPM_RESULT_FAIL;
+               return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list  = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
 {
-       dpm_result_t ret = DPM_RESULT_FAIL;
+       int ret = BLUETOOTH_ERROR_INTERNAL;
+       int allow_bt = DPM_BT_ERROR;
        bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list;
        int i = 0;
 
        BT_INFO("_bt_dpm_get_bluetooth_uuids_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return ret;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (list) {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                uuids_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
                for (; list; list = list->next, i++) {
                        memset(uuids_list.uuids[i], 0, BLUETOOTH_UUID_STRING_MAX);
@@ -295,7 +329,7 @@ dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
                }
                g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
        } else {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                uuids_list.count = 0;
                g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
        }
@@ -303,36 +337,42 @@ dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
        return ret;
 }
 
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
+int _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
 {
        char *l_uuid;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_add_bluetooth_uuids_to_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        l_uuid = g_strdup(uuid);
        if (!l_uuid)
-               return DPM_RESULT_FAIL;
+               return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list  = g_slist_append(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list, l_uuid);
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
 
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
+int _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
 {
-       dpm_result_t ret = DPM_RESULT_FAIL;
+       int ret = BLUETOOTH_ERROR_INTERNAL;
+       int allow_bt = DPM_BT_ERROR;
        bt_dpm_uuids_list_t uuids_list = {0, { {0}, } };
        GSList *list = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list;
        int i = 0;
 
        BT_INFO("_bt_dpm_get_bluetooth_uuids_from_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return ret;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (list) {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                uuids_list.count = g_slist_length(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
                for (; list; list = list->next, i++) {
                        memset(uuids_list.uuids[i], 0, BLUETOOTH_UUID_STRING_MAX);
@@ -341,7 +381,7 @@ dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
                }
                g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
        } else {
-               ret = DPM_RESULT_SUCCESS;
+               ret = BLUETOOTH_ERROR_NONE;
                uuids_list.count = 0;
                g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
        }
@@ -350,34 +390,46 @@ dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
 
 }
 
-dpm_result_t _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
+int _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_activate_bluetooth_device_restriction");
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value  = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_allow_bluetooth_outgoing_call(void)
+int _bt_dpm_get_allow_bluetooth_outgoing_call(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_allow_bluetooth_outgoing_call");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
 
-       return policy_table[DPM_POLICY_ALLOW_BLUETOOTH_OUTGOING_CALL].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
+int _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list; l; l = g_slist_next(l)) {
                char *address = l->data;
@@ -388,16 +440,20 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
        }
        g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list);
        policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = NULL;
-       return DPM_RESULT_SUCCESS;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
+int _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list; l; l = g_slist_next(l)) {
                char *address = l->data;
@@ -408,16 +464,20 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
        }
        g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list);
        policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = NULL;
-       return DPM_RESULT_SUCCESS;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
+int _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_clear_bluetooth_devices_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
                char *l_uuid = l->data;
@@ -427,16 +487,20 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
        }
        g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = NULL;
-       return DPM_RESULT_SUCCESS;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
+int _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_clear_bluetooth_uuids_from_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list; l; l = g_slist_next(l)) {
                char *l_uuid = l->data;
@@ -447,81 +511,115 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
        }
        g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = NULL;
-       return DPM_RESULT_SUCCESS;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_pairing_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_bluetooth_pairing_state(void)
+int _bt_dpm_get_bluetooth_pairing_state(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_bluetooth_pairing_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_PAIRING_STATE].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value)
+int _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_profile_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       if (profile >= DPM_PROFILE_NONE)
+               return BLUETOOTH_ERROR_INTERNAL;
+
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        dpm_profile_state[profile].value = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile)
+int _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile, int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_bluetooth_profile_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       if (profile >= DPM_PROFILE_NONE)
+               return BLUETOOTH_ERROR_INTERNAL;
+
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = dpm_profile_state[profile].value;
 
-       return dpm_profile_state[profile].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_desktop_connectivity_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_bluetooth_desktop_connectivity_state(void)
+int _bt_dpm_get_bluetooth_desktop_connectivity_state(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_bluetooth_desktop_connectivity_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DESKTOP_CONNECTIVITY_STATE].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_discoverable_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (value == DPM_RESTRICTED) {
                /* Since Discoverable mode is restricted, stop the ongoing discoverable mode */
@@ -530,25 +628,33 @@ dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value)
 
        policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_bluetooth_discoverable_state(void)
+int _bt_dpm_get_bluetooth_discoverable_state(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_bluetooth_discoverable_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DISCOVERABLE_STATE].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_limited_discoverable_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        if (value == DPM_RESTRICTED) {
                /* Since Discoverable mode is restricted, stop the ongoing discoverable mode */
@@ -557,54 +663,68 @@ dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value
 
        policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value = value;
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_bluetooth_limited_discoverable_state(void)
+int _bt_dpm_get_bluetooth_limited_discoverable_state(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_bluetooth_limited_discoverable_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
+       *value = policy_table[DPM_POLICY_BLUETOOTH_LIMITED_DISCOVERABLE_STATE].value;
+
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
+int _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_set_bluetooth_data_transfer_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
+       policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(void)
+int _bt_dpm_get_allow_bluetooth_data_transfer_state(int *value)
 {
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_get_allow_bluetooth_data_transfer_state");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESTRICTED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
+       *value = policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
+int _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
 {
        GSList *l = NULL;
        char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_remove_bluetooth_devices_from_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        _bt_convert_addr_type_to_string(bd_addr,
                        (unsigned char *)device_address->addr);
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
-
        for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list; l; l = g_slist_next(l)) {
                char *l_device = l->data;
                if (l_device && g_strcmp0(l_device, bd_addr)) {
@@ -612,18 +732,20 @@ dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_ad
                        g_free(l_device);
                }
        }
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
+int _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
 {
        GSList *l = NULL;
        char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
+       int allow_bt = DPM_BT_ERROR;
 
        BT_INFO("_bt_dpm_remove_bluetooth_devices_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        _bt_convert_addr_type_to_string(bd_addr,
                        (unsigned char *)device_address->addr);
@@ -636,16 +758,20 @@ dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_ad
                }
        }
 
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
+int _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_whitelist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
+
        for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list; l; l = g_slist_next(l)) {
                char *l_uuid = l->data;
                if (l_uuid && g_strcmp0(l_uuid, uuids)) {
@@ -653,16 +779,19 @@ dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
                        g_free(l_uuid);
                }
        }
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
+int _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
 {
        GSList *l = NULL;
+       int allow_bt = DPM_BT_ERROR;
+
        BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_blacklist");
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
                char *l_uuid = l->data;
@@ -671,16 +800,19 @@ dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
                        g_free(l_uuid);
                }
        }
-       return DPM_RESULT_SUCCESS;
+       return BLUETOOTH_ERROR_NONE;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void)
+int _bt_dpm_clear_bluetooth_uuids_from_list(void)
 {
+       int allow_bt = DPM_BT_ERROR;
+       int err = BLUETOOTH_ERROR_INTERNAL;
+
        BT_INFO("_bt_dpm_clear_bluetooth_uuids_from_list");
-       dpm_result_t err = DPM_RESULT_FAIL;
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        err = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
        if (!err)
@@ -689,13 +821,16 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void)
        return err;
 }
 
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void)
+int _bt_dpm_clear_bluetooth_devices_from_list(void)
 {
+       int allow_bt = DPM_BT_ERROR;
+       int err = BLUETOOTH_ERROR_INTERNAL;
+
        BT_INFO("_bt_dpm_clear_bluetooth_devices_from_list");
-       dpm_result_t err = DPM_RESULT_FAIL;
 
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
-               return DPM_RESULT_ACCESS_DENIED;
+       _bt_dpm_get_allow_bluetooth_mode(&allow_bt);
+       if (allow_bt == DPM_BT_RESTRICTED)
+               return BLUETOOTH_ERROR_PERMISSION_DEINED;
 
        err = _bt_dpm_clear_bluetooth_devices_from_blacklist();
        if (!err)
index 89754be..4dcd32f 100644 (file)
@@ -913,6 +913,9 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
        GVariant *param = NULL;
        bt_remote_dev_info_t *remote_dev_info;
        g_variant_iter_init(&value_iter, msg);
+#ifdef TIZEN_FEATURE_BT_DPM
+       int desktop_state = DPM_BT_ERROR;
+#endif
        while ((g_variant_iter_loop(&value_iter, "{sv}", &property, &val))) {
                BT_DBG("Property %s", property);
                if (strcasecmp(property, "Connected") == 0) {
@@ -968,8 +971,8 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                                BT_DBG("Name %s", remote_dev_info->name);
 
 #ifdef TIZEN_FEATURE_BT_DPM
-                               if (_bt_dpm_get_bluetooth_desktop_connectivity_state() ==
-                                                       DPM_RESTRICTED) {
+                               _bt_dpm_get_bluetooth_desktop_connectivity_state(&desktop_state);
+                               if (desktop_state == DPM_RESTRICTED) {
                                        bluetooth_device_class_t device_class;
                                        _bt_divide_device_class(&device_class, remote_dev_info->class);
 
@@ -2667,7 +2670,9 @@ static  void __bt_manager_event_filter(GDBusConnection *connection,
                        if (bt_event == BT_DEVICE_EVENT) {
                                bt_cache_info_t *cache_info;
                                bt_remote_dev_info_t *dev_info;
-
+#ifdef TIZEN_FEATURE_BT_DPM
+                               int desktop_state = DPM_BT_ERROR;
+#endif
                                ret_if(_bt_is_discovering() == FALSE &&
                                                _bt_is_le_scanning() == FALSE);
 
@@ -2700,8 +2705,8 @@ static  void __bt_manager_event_filter(GDBusConnection *connection,
                                        dev_info->name = g_strdup(dev_info->address);
 
 #ifdef TIZEN_FEATURE_BT_DPM
-                               if (_bt_dpm_get_bluetooth_desktop_connectivity_state() ==
-                                                       DPM_RESTRICTED) {
+                               _bt_dpm_get_bluetooth_desktop_connectivity_state(&desktop_state);
+                               if (desktop_state == DPM_RESTRICTED) {
                                        bluetooth_device_class_t device_class;
                                        _bt_divide_device_class(&device_class, dev_info->class);
                                        BT_DBG("[%s]device_class.major_class : %d", dev_info->name, device_class.major_class);
index 3cd6ea0..8ac19bd 100644 (file)
@@ -535,6 +535,9 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
        GVariant *param = NULL;
        GError *err = NULL;
        bt_session_info_t *session_info = NULL;
+#ifdef TIZEN_FEATURE_BT_DPM
+       int value = DPM_BT_ERROR;
+#endif
 
        BT_DBG(" path [%s] \n", path);
 
@@ -574,7 +577,8 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
        agent_info.auth_info->transfer_path = g_strdup(path);
 
 #ifdef TIZEN_FEATURE_BT_DPM
-       if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_HANDSFREE_ONLY) {
+       _bt_dpm_get_allow_bluetooth_mode(&value);
+       if (value == DPM_BT_HANDSFREE_ONLY) {
                /* Free auth info in next function */
                _bt_obex_server_reject_authorize();
                return FALSE;
index 7628052..f08953c 100644 (file)
@@ -117,46 +117,46 @@ struct dpm_profile_val {
 typedef struct dpm_profile_val dpm_profile_state_t;
 
 int _bt_launch_dpm_popup(char *mode);
-dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value);
-dpm_bt_allow_t _bt_dpm_get_allow_bluetooth_mode(void);
-dpm_result_t _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value);
-dpm_status_t _bt_dpm_is_bluetooth_device_restriction_active(void);
-dpm_result_t _bt_dpm_activate_bluetoooth_uuid_restriction(dpm_status_t value);
-dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void);
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address_t *bd_addr);
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr);
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid);
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid);
-dpm_result_t _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value);
-dpm_status_t _bt_dpm_get_allow_bluetooth_outgoing_call(void);
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void);
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void);
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void);
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void);
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1);
-dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1);
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1);
-dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1);
-dpm_status_t _bt_dpm_is_bluetooth_device_restriction_active(void);
-dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void);
-dpm_status_t _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value);
-dpm_status_t _bt_dpm_get_bluetooth_pairing_state(void);
-dpm_status_t _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value);
-dpm_status_t _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile);
-dpm_status_t _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value);
-dpm_status_t _bt_dpm_get_bluetooth_desktop_connectivity_state(void);
-dpm_status_t _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value);
-dpm_status_t _bt_dpm_get_bluetooth_discoverable_state(void);
-dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void);
-dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_list(void);
-dpm_status_t _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value);
-dpm_status_t _bt_dpm_get_bluetooth_limited_discoverable_state(void);
-dpm_status_t _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value);
-dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(void);
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *bd_addr);
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *bd_addr);
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids);
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids);
+int _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value);
+int _bt_dpm_get_allow_bluetooth_mode(int *value);
+int _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value);
+int _bt_dpm_is_bluetooth_device_restriction_active(int *value);
+int _bt_dpm_activate_bluetoooth_uuid_restriction(dpm_status_t value);
+int _bt_dpm_is_bluetooth_uuid_restriction_active(int *value);
+int _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address_t *bd_addr);
+int _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr);
+int _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid);
+int _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid);
+int _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value);
+int _bt_dpm_get_allow_bluetooth_outgoing_call(int *value);
+int _bt_dpm_clear_bluetooth_devices_from_blacklist(void);
+int _bt_dpm_clear_bluetooth_devices_from_whitelist(void);
+int _bt_dpm_clear_bluetooth_uuids_from_blacklist(void);
+int _bt_dpm_clear_bluetooth_uuids_from_whitelist(void);
+int _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1);
+int _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1);
+int _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1);
+int _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1);
+int _bt_dpm_is_bluetooth_device_restriction_active(int *value);
+int _bt_dpm_is_bluetooth_uuid_restriction_active(int *value);
+int _bt_dpm_set_bluetooth_pairing_state(dpm_status_t value);
+int _bt_dpm_get_bluetooth_pairing_state(int *value);
+int _bt_dpm_set_bluetooth_profile_state(dpm_profile_t profile, dpm_status_t value);
+int _bt_dpm_get_bluetooth_profile_state(dpm_profile_t profile, int *value);
+int _bt_dpm_set_bluetooth_desktop_connectivity_state(dpm_status_t value);
+int _bt_dpm_get_bluetooth_desktop_connectivity_state(int *value);
+int _bt_dpm_set_bluetooth_discoverable_state(dpm_status_t value);
+int _bt_dpm_get_bluetooth_discoverable_state(int *value);
+int _bt_dpm_clear_bluetooth_devices_from_list(void);
+int _bt_dpm_clear_bluetooth_uuids_from_list(void);
+int _bt_dpm_set_bluetooth_limited_discoverable_state(dpm_status_t value);
+int _bt_dpm_get_bluetooth_limited_discoverable_state(int *value);
+int _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value);
+int _bt_dpm_get_allow_bluetooth_data_transfer_state(int *value);
+int _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *bd_addr);
+int _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *bd_addr);
+int _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids);
+int _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids);
 
 #ifdef __cplusplus
 }