DPM: Modify/Remove the DPM APIs and Expose DPM BT-APIs 90/66690/11 accepted/tizen/ivi/20160504.012033 accepted/tizen/mobile/20160504.011937 accepted/tizen/tv/20160504.011958 accepted/tizen/wearable/20160504.012023 submit/tizen/20160503.014314 submit/tizen/20160503.100744
authorh.sandeep <h.sandeep@samsung.com>
Wed, 20 Apr 2016 09:31:24 +0000 (15:01 +0530)
committerSandeep Hattiholi <h.sandeep@samsung.com>
Thu, 28 Apr 2016 10:42:13 +0000 (03:42 -0700)
1. Add BT-APIs
2. Add dpm policies to individual profiles as per mdm policies

Change-Id: Ie60dc0e4cdd3666631e2707e8cfebfc7a8333838
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
23 files changed:
bt-api/CMakeLists.txt
bt-api/bt-adapter.c [changed mode: 0755->0644]
bt-api/bt-audio.c [changed mode: 0755->0644]
bt-api/bt-avrcp.c [changed mode: 0755->0644]
bt-api/bt-common.c [changed mode: 0755->0644]
bt-api/bt-device.c [changed mode: 0755->0644]
bt-api/bt-dpm.c [new file with mode: 0644]
bt-api/bt-hid.c [changed mode: 0755->0644]
bt-api/bt-network.c [changed mode: 0755->0644]
bt-api/bt-opp-client.c [changed mode: 0755->0644]
bt-api/bt-rfcomm-client.c [changed mode: 0755->0644]
bt-api/bt-rfcomm-server.c [changed mode: 0755->0644]
bt-api/include/bt-dpm.h [new file with mode: 0644]
bt-service/CMakeLists.txt
bt-service/bt-request-handler.c [changed mode: 0755->0644]
bt-service/bt-service-adapter.c [changed mode: 0755->0644]
bt-service/bt-service-agent.c [changed mode: 0755->0644]
bt-service/bt-service-dpm.c [changed mode: 0755->0644]
bt-service/bt-service-event-receiver.c [changed mode: 0755->0644]
bt-service/bt-service-obex-server.c [changed mode: 0755->0644]
bt-service/include/bt-service-dpm.h [changed mode: 0755->0644]
include/bluetooth-api.h
include/bt-internal-types.h [changed mode: 0755->0644]

index 695b747..0aa3b80 100644 (file)
@@ -24,7 +24,8 @@ bt-gatt-service.c
 bt-pbap.c
 bt-hid-device.c
 bt-gatt-client.c
-bt-ipsp.c)
+bt-ipsp.c
+bt-dpm.c)
 
 SET(HEADERS
 bluetooth-api.h
@@ -81,6 +82,8 @@ IF("${ARCH}" STREQUAL "arm")
 ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DHPS_FEATURE")
+ADD_DEFINITIONS("-DTIZEN_DPM_ENABLE")
+ADD_DEFINITIONS("-DTIZEN_DPM_VCONF_ENABLE")
 
 FIND_PROGRAM(MARSHALTOOL NAMES glib-genmarshal)
 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${CMAKE_CURRENT_SOURCE_DIR}/marshal.list --header > ${CMAKE_CURRENT_SOURCE_DIR}/include/marshal.h")
old mode 100755 (executable)
new mode 100644 (file)
index 2874725..2391393
@@ -88,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);
 
old mode 100755 (executable)
new mode 100644 (file)
index 037066a..054c7c5
 #include "bt-common.h"
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 
 BT_EXPORT_API int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data)
 {
@@ -85,6 +89,38 @@ BT_EXPORT_API int bluetooth_audio_connect(bluetooth_device_address_t *remote_add
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED &&
+                _bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use HSP / A2DP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       } else if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use HSP profile");
+               service_function = BT_AV_CONNECT;
+       } else if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use A2DP profile");
+               service_function = BT_AG_CONNECT;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, remote_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_AUDIO);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -147,6 +183,31 @@ BT_EXPORT_API int bluetooth_ag_connect(bluetooth_device_address_t *remote_addres
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use HSP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, remote_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_AUDIO);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -209,6 +270,31 @@ BT_EXPORT_API int bluetooth_av_connect(bluetooth_device_address_t *remote_addres
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use A2DP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, remote_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_AUDIO);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -240,6 +326,18 @@ BT_EXPORT_API int bluetooth_av_source_connect(bluetooth_device_address_t *remote
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use A2DP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_AUDIO);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -348,6 +446,13 @@ BT_EXPORT_API int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain)
 
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use HSP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
old mode 100755 (executable)
new mode 100644 (file)
index f18b485..2ec6536
 #include "bt-common.h"
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 
 BT_EXPORT_API int bluetooth_media_player_init(media_cb_func_ptr callback_ptr,
                                                void *user_data)
@@ -68,6 +72,13 @@ BT_EXPORT_API int bluetooth_media_player_change_property(
 
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
@@ -90,6 +101,13 @@ BT_EXPORT_API int bluetooth_media_player_set_properties(
        BT_CHECK_PARAMETER(setting, return);
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
@@ -112,6 +130,13 @@ BT_EXPORT_API int bluetooth_media_player_change_track(
        BT_CHECK_PARAMETER(metadata, return);
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
@@ -203,6 +228,18 @@ BT_EXPORT_API int bluetooth_media_control_connect(
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_AVRCP);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
@@ -263,6 +300,13 @@ BT_EXPORT_API int bluetooth_media_control_command(
 
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
@@ -284,6 +328,13 @@ BT_EXPORT_API int bluetooth_media_control_set_property(
 
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
@@ -309,6 +360,13 @@ BT_EXPORT_API int bluetooth_media_control_get_property(
        BT_CHECK_PARAMETER(value, return);
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
        g_array_append_vals(in_param1, &type, sizeof(int));
@@ -335,6 +393,13 @@ BT_EXPORT_API int bluetooth_media_control_get_track_info(
        BT_CHECK_PARAMETER(metadata, return);
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use AVRCP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INIT_PARAMS();
        BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
old mode 100755 (executable)
new mode 100644 (file)
index c624824..2306185
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
+
 static bt_user_info_t user_info[BT_MAX_USER_INFO];
 static GDBusConnection *system_gdbus_conn = NULL;
 
old mode 100755 (executable)
new mode 100644 (file)
index 3f72f6e..85701aa
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 BT_EXPORT_API int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
 {
        int result;
@@ -36,6 +40,18 @@ BT_EXPORT_API int bluetooth_bond_device(const bluetooth_device_address_t *device
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_PAIRING, NULL) == BT_DPM_RESTRICTED) {
+                       BT_ERR("Not allow to pair the device");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        user_info = _bt_get_user_data(BT_COMMON);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
diff --git a/bt-api/bt-dpm.c b/bt-api/bt-dpm.c
new file mode 100644 (file)
index 0000000..17dc922
--- /dev/null
@@ -0,0 +1,1235 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifdef TIZEN_DPM_ENABLE
+#include <vconf.h>
+
+#include "bluetooth-api.h"
+#include "bt-internal-types.h"
+#include "bt-common.h"
+#include "bt-request-sender.h"
+#include "bt-event-handler.h"
+#include "bt-event-handler.h"
+#include "bt-dpm.h"
+
+#ifdef TIZEN_DPM_VCONF_ENABLE
+BT_EXPORT_API int bluetooth_dpm_is_bluetooth_mode_allowed(void)
+{
+       int value;
+       /* 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;
+       }
+       if (value != VCONFKEY_BT_DPM_STATUS_RESTRICTED)
+               return BLUETOOTH_DPM_RESULT_SUCCESS;
+       else
+               return BLUETOOTH_DPM_RESULT_ACCESS_DENIED;
+}
+#endif
+
+#if 0
+static bt_dpm_status_e _bt_check_dpm_allow_restriction(void)
+{
+       bt_dpm_allow_t mode;
+
+       bluetooth_dpm_get_allow_bluetooth_mode(&mode);
+
+       return (mode == BLUETOOTH_DPM_BT_RESTRICTED) ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED;
+}
+#endif
+
+static bt_dpm_status_e _bt_check_dpm_handsfree_only(void)
+{
+       bt_dpm_allow_t mode;
+
+       bluetooth_dpm_get_allow_bluetooth_mode(&mode);
+
+       return (mode == BLUETOOTH_DPM_HANDSFREE_ONLY ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+
+static bt_dpm_status_e _bt_check_dpm_pairing_restriction(void)
+{
+       bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+
+       bluetooth_dpm_get_bluetooth_pairing_state(&dpm_status);
+
+       return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+
+static bt_dpm_status_e _bt_check_dpm_desktop_connectivity_restriction(void)
+{
+       bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+
+       bluetooth_dpm_get_bluetooth_desktop_connectivity_state(&dpm_status);
+
+       return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+
+#if 0
+static bt_dpm_status_e _bt_check_dpm_visible_restriction(void)
+{
+       bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+
+       bluetooth_dpm_get_bluetooth_desktop_connectivity_state(&dpm_status);
+
+       return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+
+static bt_dpm_status_e _bt_check_dpm_limited_discoverable_mode(void)
+{
+       bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+
+       bluetooth_dpm_get_bluetooth_limited_discoverable_state(&dpm_status);
+
+       return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+#endif
+
+static bt_dpm_status_e _bt_check_dpm_blacklist_device(bluetooth_device_address_t *address)
+{
+       int ret = BLUETOOTH_DPM_RESULT_SUCCESS;
+       bt_dpm_device_list_t dev_list;
+       char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+       _bt_convert_addr_type_to_string(device_address,
+                       (unsigned char *)address->addr);
+
+       ret = bluetooth_dpm_get_bluetooth_devices_from_blacklist(&dev_list);
+       if (ret == BLUETOOTH_DPM_RESULT_SUCCESS) {
+               int i = 0;
+               for (i = 0; i < dev_list.count; i++) {
+                       char temp_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+                       _bt_convert_addr_type_to_string(temp_address,
+                       (unsigned char *)dev_list.addresses[i].addr);
+                       if (g_strcmp0(device_address, temp_address) == 0)
+                               return BT_DPM_RESTRICTED;
+                       else
+                               return BT_DPM_ALLOWED;
+               }
+       } else {
+               return BT_DPM_NO_SERVICE;
+       }
+       return BT_DPM_ALLOWED;
+}
+
+static bt_dpm_status_e _bt_check_dpm_blacklist_uuid(char *uuid)
+{
+       bt_dpm_status_e bt_dpm_status = BT_DPM_ALLOWED;
+       bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+       bt_dpm_profile_t dpm_profile = BLUETOOTH_DPM_PROFILE_NONE;
+       bt_dpm_uuids_list_t uuid_list;
+       int ret = BLUETOOTH_DPM_RESULT_SUCCESS;
+       retv_if(!uuid, bt_dpm_status);
+
+       ret = bluetooth_dpm_get_bluetooth_uuids_from_blacklist(&uuid_list);
+       if (ret == BLUETOOTH_DPM_RESULT_SUCCESS) {
+               int i = 0;
+               for (i = 0; i < uuid_list.count; i++) {
+                       if (g_strcmp0(uuid, uuid_list.uuids[i]) == 0)
+                               return BT_DPM_RESTRICTED;
+                       else
+                               return BT_DPM_ALLOWED;
+               }
+       } else {
+               return BT_DPM_NO_SERVICE;
+       }
+
+       if (g_strcmp0(BT_OPP_UUID, uuid) == 0) {
+               bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+               bluetooth_dpm_get_bluetooth_data_transfer_state(&dpm_status);
+               return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+       }
+
+       /* ++ check MDM profile restriction ++ */
+       if (g_strcmp0(BT_A2DP_UUID, uuid) == 0)
+               dpm_profile = BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE;
+       else if (g_strcmp0(BT_AVRCP_TARGET_UUID, uuid) == 0)
+               dpm_profile = BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE;
+       else if (g_strcmp0(BT_HFP_AUDIO_GATEWAY_UUID, uuid) == 0)
+               dpm_profile = BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE;
+       else if (g_strcmp0(BT_HSP_AUDIO_GATEWAY_UUID, uuid) == 0)
+               dpm_profile = BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE;
+       else if (g_strcmp0(BT_OBEX_PSE_UUID, uuid) == 0)
+               dpm_profile = BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE;
+
+       if (dpm_profile != BLUETOOTH_DPM_PROFILE_NONE) {
+               ret = bluetooth_dpm_get_bluetooth_profile_state(dpm_profile, &dpm_status);
+               return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+       }
+       /* -- check DPM profile restriction -- */
+
+       return bt_dpm_status;
+}
+
+static bt_dpm_status_e _bt_check_dpm_transfer_restriction(void)
+{
+       bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
+       bt_dpm_status_t dpm_value = BLUETOOTH_DPM_ALLOWED;
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_OPP_UUID);
+
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+
+       bluetooth_dpm_get_bluetooth_data_transfer_state(&dpm_value);
+
+       return (dpm_value == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
+}
+
+static bt_dpm_status_e _bt_check_dpm_hsp_restriction(void)
+{
+       bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_HFP_AUDIO_GATEWAY_UUID);
+
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_HSP_AUDIO_GATEWAY_UUID);
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+       return dpm_status;
+}
+
+static bt_dpm_status_e _bt_check_dpm_a2dp_restriction(void)
+{
+       bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_A2DP_UUID);
+
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+
+       return dpm_status;
+}
+
+static bt_dpm_status_e _bt_check_dpm_avrcp_restriction(void)
+{
+       bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_AVRCP_TARGET_UUID);
+
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+
+       return dpm_status;
+}
+
+static bt_dpm_status_e _bt_check_dpm_spp_restriction(void)
+{
+       bt_dpm_status_e dpm_status = BT_DPM_ALLOWED;
+
+       dpm_status = _bt_check_dpm_blacklist_uuid(BT_SPP_UUID);
+
+       if (dpm_status == BT_DPM_NO_SERVICE || dpm_status == BT_DPM_RESTRICTED) {
+               return dpm_status;
+       }
+
+       return dpm_status;
+}
+
+int _bt_check_dpm(int service, void *param)
+{
+       bt_dpm_status_e status = BT_DPM_ALLOWED;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       switch (service) {
+       case BT_DPM_HF_ONLY:
+               status= _bt_check_dpm_handsfree_only();
+               break;
+
+       case BT_DPM_PAIRING:
+               status = _bt_check_dpm_pairing_restriction();
+               break;
+       case BT_DPM_DESKTOP:
+               status = _bt_check_dpm_desktop_connectivity_restriction();
+               break;
+       case BT_DPM_ADDRESS: {
+               status = _bt_check_dpm_blacklist_device((bluetooth_device_address_t *)param);
+               }
+               break;
+       case BT_DPM_UUID: {
+               char *uuid;
+               uuid = (char *)param;
+               status = _bt_check_dpm_blacklist_uuid(uuid);
+               }
+               break;
+       case BT_DPM_OPP:
+               status = _bt_check_dpm_transfer_restriction();
+               break;
+       case BT_DPM_HSP:
+               status = _bt_check_dpm_hsp_restriction();
+               break;
+       case BT_DPM_A2DP:
+               status = _bt_check_dpm_a2dp_restriction();
+               break;
+       case BT_DPM_AVRCP:
+               status = _bt_check_dpm_avrcp_restriction();
+               break;
+       case BT_DPM_SPP:
+               status = _bt_check_dpm_spp_restriction();
+               break;
+
+       default:
+               BT_ERR("Unknown service");
+               return status;
+       }
+
+       if (status == BT_DPM_RESTRICTED)
+               BT_INFO("Service [%d], DPM permission denied", service);
+       else if (status == BT_DPM_NO_SERVICE)
+               BT_DBG("DPM no service [%d]",status);
+
+       return status;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_allow_bluetooth_mode(bt_dpm_allow_t value)
+{
+       int result =  BLUETOOTH_DPM_RESULT_SUCCESS;
+#ifdef TIZEN_DPM_VCONF_ENABLE
+       int bt_status;
+#endif
+
+#ifdef TIZEN_DPM_VCONF_ENABLE
+       if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status) < 0) {
+               BT_ERR("Error in reading VCONFKEY_BT_STATUS");
+       }
+
+       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;
+               } else
+                       result = BLUETOOTH_DPM_RESULT_SUCCESS;
+
+               BT_INIT_PARAMS();
+               BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+               g_array_append_vals(in_param1, &value, sizeof(int));
+
+               result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_BT_MODE,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+               BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+               if (result == BLUETOOTH_DPM_RESULT_SUCCESS &&
+                       value == BLUETOOTH_DPM_BT_RESTRICTED) {
+                       result = bluetooth_disable_adapter();
+               }
+       } else {
+               if (value >= BLUETOOTH_DPM_BT_ALLOWED &&
+                       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;
+                       } else
+                               result = BLUETOOTH_DPM_RESULT_SUCCESS;
+               } else
+                       result = BLUETOOTH_DPM_RESULT_INVALID_PARAM;
+       }
+#else
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_BT_MODE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+#endif
+
+       return result;
+
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_allow_bluetooth_mode(bt_dpm_allow_t *value)
+{
+       int result;
+
+#ifdef TIZEN_DPM_VCONF_ENABLE
+       *value = bluetooth_dpm_is_bluetooth_mode_allowed();
+       return BLUETOOTH_DPM_RESULT_SUCCESS;
+#else
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+#endif
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_activate_bluetooth_device_restriction(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DEVICE_RESTRITION,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_is_bluetooth_device_restriction_active(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_UUID_RESTRITION,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_is_bluetooth_uuid_restriction_active(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_add_bluetooth_devices_to_blacklist(const bluetooth_device_address_t *device_address)
+{
+       int result;
+
+       BT_CHECK_PARAMETER(device_address, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_DEVICES_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_add_bluetooth_devices_to_whitelist(const bluetooth_device_address_t *device_address)
+{
+       int result;
+
+       BT_CHECK_PARAMETER(device_address, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_DEVICES_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_add_bluetooth_uuids_to_blacklist(const char *service_uuid)
+{
+       int result;
+       char uuid[BLUETOOTH_UUID_STRING_MAX];
+
+       BT_CHECK_PARAMETER(service_uuid, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_strlcpy(uuid, service_uuid, sizeof(uuid));
+       g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_UUIDS_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_add_bluetooth_uuids_to_whitelist(const char *service_uuid)
+{
+       int result;
+       char uuid[BLUETOOTH_UUID_STRING_MAX];
+
+       BT_CHECK_PARAMETER(service_uuid, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_strlcpy(uuid, service_uuid, sizeof(uuid));
+       g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_ADD_UUIDS_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_clear_bluetooth_devices_from_blacklist(void)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_DEVICES_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_clear_bluetooth_devices_from_whitelist(void)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_DEVICES_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_clear_bluetooth_uuids_from_blacklist(void)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_UUIDS_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+BT_EXPORT_API int bluetooth_dpm_clear_bluetooth_uuids_from_whitelist(void)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_CLEAR_UUIDS_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+
+static void _bluetooth_extract_dpm_device_info(int count,
+                                                       bt_dpm_device_list_t *dst_info,
+                                                       bt_dpm_device_list_t *src_info)
+{
+       int i;
+
+       for (i = 0; i < count; i++) {
+               memset(dst_info->addresses[i].addr, 0,
+                       BT_ADDRESS_STRING_SIZE);
+
+               g_strlcpy((gchar *)dst_info->addresses[i].addr, (gchar *)src_info->addresses[i].addr,
+                       BT_ADDRESS_STRING_SIZE);
+
+//             BT_DBG("address[%d] : %s", i, dst_info->addresses[i].addr);
+       }
+}
+
+static void _bluetooth_extract_dpm_uuid_info(int count,
+                                                       bt_dpm_uuids_list_t *dst_info,
+                                                       bt_dpm_uuids_list_t *src_info)
+{
+       int i;
+
+       for (i = 0; i < count; i++) {
+               memset(dst_info->uuids[i], 0,
+                       BLUETOOTH_UUID_STRING_MAX);
+
+               g_strlcpy(dst_info->uuids[i], src_info->uuids[i],
+                       BLUETOOTH_UUID_STRING_MAX);
+
+               BT_DBG("uuids[%d] : %s", i, dst_info->uuids[i]);
+       }
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_devices_from_blacklist(bt_dpm_device_list_t *device_list)
+{
+       int result;
+       bt_dpm_device_list_t *devices = NULL;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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) {
+               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;
+               }
+
+               device_list->count = devices->count;
+
+               _bluetooth_extract_dpm_device_info(devices->count,
+                               device_list, devices);
+       } else {
+               BT_ERR("Get Devices list Failed");
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_devices_from_whitelist(bt_dpm_device_list_t *device_list)
+{
+       int result;
+       bt_dpm_device_list_t *devices = NULL;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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) {
+               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;
+               }
+
+               device_list->count = devices->count;
+
+               _bluetooth_extract_dpm_device_info(devices->count,
+                               device_list, devices);
+
+       } else {
+               BT_ERR("Get Devices list Failed");
+       }
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_uuids_from_blacklist(bt_dpm_uuids_list_t *uuid_list)
+{
+       int result;
+       bt_dpm_uuids_list_t *uuids;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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) {
+               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;
+               }
+
+               uuid_list->count = uuids->count;
+               _bluetooth_extract_dpm_uuid_info(uuids->count,
+                               uuid_list, uuids);
+       } else {
+               BT_ERR("Get UUIDS list Failed");
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_uuids_from_whitelist(bt_dpm_uuids_list_t *uuid_list)
+{
+       int result;
+       bt_dpm_uuids_list_t *uuids;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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) {
+               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;
+               }
+
+               uuid_list->count = uuids->count;
+
+               _bluetooth_extract_dpm_uuid_info(uuids->count,
+                               uuid_list, uuids);
+       } else {
+               BT_ERR("Get UUIDS list Failed");
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_remove_bluetooth_device_from_whitelist(const bluetooth_device_address_t *device_address)
+{
+       int result;
+
+       BT_CHECK_PARAMETER(device_address, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_DEVICE_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_remove_bluetooth_device_from_blacklist(const bluetooth_device_address_t *device_address)
+{
+       int result;
+
+       BT_CHECK_PARAMETER(device_address, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_DEVICE_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_remove_bluetooth_uuid_from_whitelist(const char *service_uuid)
+{
+       int result;
+       char uuid[BLUETOOTH_UUID_STRING_MAX];
+
+       BT_CHECK_PARAMETER(service_uuid, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_strlcpy(uuid, service_uuid, sizeof(uuid));
+       g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_UUID_WHITELIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_remove_bluetooth_uuid_from_blacklist(const char *service_uuid)
+{
+       int result;
+       char uuid[BLUETOOTH_UUID_STRING_MAX];
+
+       BT_CHECK_PARAMETER(service_uuid, return);
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_strlcpy(uuid, service_uuid, sizeof(uuid));
+       g_array_append_vals(in_param1, uuid, BLUETOOTH_UUID_STRING_MAX);
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_REMOVE_UUID_BLACKLIST,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_allow_bluetooth_outgoing_call(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_ALLOW_OUTGOING_CALL,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_allow_bluetooth_outgoing_call(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_pairing_state(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_PAIRING_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_pairing_state(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &profile, sizeof(int));
+       g_array_append_vals(in_param2, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_PROFILE_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &profile, sizeof(int));
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_desktop_connectivity_state(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DESKROP_CONNECTIVITY_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_desktop_connectivity_state(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_discoverable_state(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DISCOVERABLE_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_discoverable_state(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_limited_discoverable_state(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_LIMITED_DISCOVERABLE_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_limited_discoverable_state(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_set_bluetooth_data_transfer_state(bt_dpm_status_t value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       g_array_append_vals(in_param1, &value, sizeof(int));
+
+       result = _bt_send_request(BT_BLUEZ_SERVICE, BT_DPM_SET_DATA_TRANSFER_STATE,
+               in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+
+BT_EXPORT_API int bluetooth_dpm_get_bluetooth_data_transfer_state(bt_dpm_status_t *value)
+{
+       int result;
+
+       BT_CHECK_ENABLED_ANY(return);
+
+       BT_INIT_PARAMS();
+       BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       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 (out_param->len > 0) {
+                       *value = g_array_index(out_param,
+                                       int, 0);
+               } else {
+                       BT_ERR("out_param length is 0!!");
+               }
+       }
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       return result;
+}
+#endif /* #ifdef TIZEN_DPM_ENABLE */
old mode 100755 (executable)
new mode 100644 (file)
index 557a2bd..e0693f7
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 BT_EXPORT_API int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data)
 {
        int ret;
@@ -70,6 +74,17 @@ BT_EXPORT_API int bluetooth_hid_connect(hid_device_address_t *device_address)
                BT_ERR("Don't have a privilege to use this API");
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, device_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_UUID, BT_HID_UUID) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist uuid");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
 
        user_info = _bt_get_user_data(BT_HID);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
old mode 100755 (executable)
new mode 100644 (file)
index 94dd467..4b79358
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 BT_EXPORT_API int bluetooth_network_activate_server()
 {
        int result;
@@ -72,6 +76,48 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       char *uuid = NULL;
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       switch (role) {
+       case BLUETOOTH_NETWORK_PANU_ROLE:
+               uuid = g_strdup(BT_PAN_PANU_UUID);
+               break;
+       case BLUETOOTH_NETWORK_NAP_ROLE:
+               uuid = g_strdup(BT_PAN_NAP_UUID);
+               break;
+       case BLUETOOTH_NETWORK_GN_ROLE:
+               uuid = g_strdup(BT_PAN_GN_UUID);
+               break;
+       default:
+               break;
+       }
+
+       if (_bt_check_dpm(BT_DPM_UUID, uuid) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist uuid");
+               g_free(uuid);
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) ==      BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, (unsigned char *)device_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+       g_free(uuid);
+#endif
+
        user_info = _bt_get_user_data(BT_COMMON);
        retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
 
old mode 100755 (executable)
new mode 100644 (file)
index a476ab1..e5b5ac5
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 static void __bt_get_file_size(char **files, unsigned long *file_size, int *count)
 {
        int file_count = 0;
@@ -73,6 +77,31 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_OPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to send files");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, remote_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+#endif
+
        __bt_get_file_size(file_name_array, &size, &file_count);
        retv_if(file_count == 0, BLUETOOTH_ERROR_INVALID_PARAM);
 
old mode 100755 (executable)
new mode 100644 (file)
index a641fb3..d6d7c34
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 #ifdef RFCOMM_DIRECT
 
 #define BT_TIMEOUT_MESSAGE "Did not receive a reply. Possible causes include: " \
@@ -567,6 +571,32 @@ BT_EXPORT_API int bluetooth_rfcomm_connect(
        BT_CHECK_PARAMETER(remote_uuid, return);
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_bt_address) == BT_DPM_RESTRICTED) {
+               BT_ERR("Blacklist device");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
+               _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to connect the RFCOMM service");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
+               char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+               bluetooth_device_class_t dev_class;
+
+               _bt_convert_addr_type_to_string(address, (unsigned char *)remote_bt_address->addr);
+               _bt_get_cod_by_address(address, &dev_class);
+
+               if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                       BT_ERR("Reject a authorization due to MDM Policy");
+                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+               }
+       }
+#endif
+
 #ifdef RFCOMM_DIRECT
        BT_INFO_C("<<<<<<<<< RFCOMM Connect request from app >>>>>>>>>>>");
        int ret;
@@ -817,6 +847,14 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length)
 #endif
        retv_if(length <= 0, BLUETOOTH_ERROR_INVALID_PARAM);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
+               _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to write RFCOMM data");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
 #ifdef RFCOMM_DIRECT
        switch (privilege_token) {
        case 0:
old mode 100755 (executable)
new mode 100644 (file)
index 550a255..4d7ffea
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
 #ifdef RFCOMM_DIRECT
 
 static GSList *rfcomm_nodes;
@@ -385,6 +389,13 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid)
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
 #ifdef RFCOMM_DIRECT
        BT_INFO("<<<<<<<<< RFCOMM Create socket from app >>>>>>>>>");
        info = __register_method();
@@ -434,6 +445,13 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INFO("<<<<<<<<< RFCOMM Create socket from app >>>>>>>>>");
        info = __register_method_2(path, bus_name);
        if (info == NULL)
@@ -661,6 +679,14 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pend
 #endif
 
        BT_CHECK_ENABLED(return);
+
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        if (socket_fd < 0) {
                BT_ERR("Invalid FD");
                return BLUETOOTH_ERROR_INVALID_PARAM;
@@ -713,6 +739,13 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int ma
 
        BT_CHECK_ENABLED(return);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        BT_INFO("<<<<<<<<< RFCOMM Listen & accept from app >>>>>>>>>>>");
 
        info = __find_rfcomm_info_with_uuid(uuid);
@@ -748,6 +781,14 @@ BT_EXPORT_API int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connect
 #endif
 
        BT_CHECK_ENABLED(return);
+
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        if (socket_fd < 0) {
                BT_ERR("Invalid FD");
                return BLUETOOTH_ERROR_INVALID_PARAM;
@@ -806,6 +847,14 @@ BT_EXPORT_API int bluetooth_rfcomm_accept_connection(int server_fd)
        int result;
 
        BT_CHECK_ENABLED(return);
+
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) {
+               BT_ERR("Not allow to use SPP profile");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        if (server_fd < 0) {
                BT_ERR("Invalid FD");
                return BLUETOOTH_ERROR_INVALID_PARAM;
diff --git a/bt-api/include/bt-dpm.h b/bt-api/include/bt-dpm.h
new file mode 100644 (file)
index 0000000..553c920
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifdef TIZEN_DPM_ENABLE
+
+#ifndef _BT_DPM_H_
+#define _BT_DPM_H_
+
+#include <sys/types.h>
+#include <glib.h>
+#include "bluetooth-api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+       BT_DPM_NO_SERVICE,
+       BT_DPM_ALLOWED,
+       BT_DPM_RESTRICTED
+} bt_dpm_status_e;
+
+typedef enum {
+       BT_DPM_PAIRING,
+       BT_DPM_HF_ONLY,
+       BT_DPM_DESKTOP,
+       BT_DPM_ADDRESS,
+       BT_DPM_UUID,
+       BT_DPM_OPP,
+       BT_DPM_HSP,
+       BT_DPM_A2DP,
+       BT_DPM_AVRCP,
+       BT_DPM_SPP,
+} bt_dpm_service_e;
+
+int _bt_check_dpm(int service, void *param);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /*_BT_SERVICE_DPM_H_*/
+#endif /* #ifdef TIZEN_DPM_ENABLE */
index 45262f7..00a3acd 100644 (file)
@@ -111,6 +111,7 @@ ADD_DEFINITIONS("-DAPP_DIR=\"${APP_DIR}\"")
 ADD_DEFINITIONS("-DAPP_LOCALEDIR=\"${APP_LOCALEDIR}\"")
 ADD_DEFINITIONS("-DAPP_SYSCONFDIR=\"${APP_SYSCONFDIR}\"")
 ADD_DEFINITIONS("-DHPS_FEATURE")
+ADD_DEFINITIONS("-DTIZEN_DPM_ENABLE")
 
 IF(LIBNOTIFY_SUPPORT OR LIBNOTIFICATION_SUPPORT)
        ADD_DEFINITIONS("-DDATA_DIR_ICON=\"${SHARE_INSTALL_PREFIX}\"")
old mode 100755 (executable)
new mode 100644 (file)
index f22b794..fab320e
@@ -41,6 +41,7 @@
 #include "bt-service-rfcomm-server.h"
 #include "bt-request-handler.h"
 #include "bt-service-pbap.h"
+#include "bt-service-dpm.h"
 
 static GDBusConnection *bt_service_conn;
 static guint owner_id = 0;
@@ -1603,6 +1604,301 @@ int __bt_bluez_request(int function_name,
                result = _bt_le_set_data_length(&address, max_tx_Octets, max_tx_Time);
                break;
        }
+       case BT_DPM_SET_ALLOW_BT_MODE: {
+               dpm_bt_allow_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_allow_bluetooth_mode(value);
+               break;
+       }
+       case BT_DPM_GET_ALLOW_BT_MODE: {
+               dpm_bt_allow_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_allow_bluetooth_mode();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_DEVICE_RESTRITION: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_activate_bluetooth_device_restriction(value);
+               break;
+       }
+       case BT_DPM_GET_DEVICE_RESTRITION: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_is_bluetooth_device_restriction_active();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_UUID_RESTRITION: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_activate_bluetoooth_uuid_restriction(value);
+               break;
+       }
+       case BT_DPM_GET_UUID_RESTRITION: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_is_bluetooth_uuid_restriction_active();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_ADD_DEVICES_BLACKLIST: {
+               bluetooth_device_address_t address = { {0} };
+
+               __bt_service_get_parameters(in_param1, &address,
+                       sizeof(bluetooth_device_address_t));
+
+               result = _bt_dpm_add_bluetooth_devices_to_blacklist(&address);
+               break;
+       }
+       case BT_DPM_ADD_DEVICES_WHITELIST: {
+               bluetooth_device_address_t address = { {0} };
+
+               __bt_service_get_parameters(in_param1, &address,
+                       sizeof(bluetooth_device_address_t));
+
+               result = _bt_dpm_add_bluetooth_devices_to_whitelist(&address);
+               break;
+       }
+       case BT_DPM_ADD_UUIDS_BLACKLIST: {
+               const char *uuid = NULL;
+
+               uuid = g_variant_get_data(in_param1);
+
+               result = _bt_dpm_add_bluetooth_uuids_to_blacklist(uuid);
+               break;
+       }
+       case BT_DPM_ADD_UUIDS_WHITELIST: {
+               const char *uuid = NULL;
+
+               uuid = g_variant_get_data(in_param1);
+
+               result = _bt_dpm_add_bluetooth_uuids_to_whitelist(uuid);
+               break;
+       }
+       case BT_DPM_CLEAR_DEVICES_BLACKLIST: {
+               result = _bt_dpm_clear_bluetooth_devices_from_blacklist();
+               break;
+       }
+       case BT_DPM_CLEAR_DEVICES_WHITELIST: {
+               result = _bt_dpm_clear_bluetooth_devices_from_whitelist();
+               break;
+       }
+       case BT_DPM_CLEAR_UUIDS_BLACKLIST: {
+               result = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
+               break;
+       }
+       case BT_DPM_CLEAR_UUIDS_WHITELIST: {
+               result = _bt_dpm_clear_bluetooth_uuids_from_whitelist();
+               break;
+       }
+       case BT_DPM_REMOVE_DEVICE_BLACKLIST: {
+               bluetooth_device_address_t address = { {0} };
+
+               __bt_service_get_parameters(in_param1, &address,
+                       sizeof(bluetooth_device_address_t));
+
+               result = _bt_dpm_remove_bluetooth_devices_from_blacklist(&address);
+               break;
+       }
+       case BT_DPM_REMOVE_DEVICE_WHITELIST: {
+               bluetooth_device_address_t address = { {0} };
+
+               __bt_service_get_parameters(in_param1, &address,
+                       sizeof(bluetooth_device_address_t));
+
+               result = _bt_dpm_remove_bluetooth_devices_from_whitelist(&address);
+               break;
+       }
+       case BT_DPM_REMOVE_UUID_BLACKLIST: {
+               const char *uuid = NULL;
+
+               uuid = g_variant_get_data(in_param1);
+
+               result = _bt_dpm_remove_bluetooth_uuids_from_blacklist(uuid);
+               break;
+       }
+       case BT_DPM_REMOVE_UUID_WHITELIST: {
+               const char *uuid = NULL;
+
+               uuid = g_variant_get_data(in_param1);
+
+               result = _bt_dpm_remove_bluetooth_uuids_from_whitelist(uuid);
+
+               break;
+       }
+       case BT_DPM_GET_DEVICES_BLACKLIST: {
+               result = _bt_dpm_get_bluetooth_devices_from_blacklist(out_param1);
+               break;
+       }
+       case BT_DPM_GET_DEVICES_WHITELIST: {
+               result = _bt_dpm_get_bluetooth_devices_from_whitelist(out_param1);
+               break;
+       }
+       case BT_DPM_GET_UUIDS_BLACKLIST: {
+               result = _bt_dpm_get_bluetooth_uuids_from_blacklist(out_param1);
+               break;
+       }
+       case BT_DPM_GET_UUIDS_WHITELIST: {
+               result = _bt_dpm_get_bluetooth_uuids_from_whitelist(out_param1);
+               break;
+       }
+       case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_allow_bluetooth_outgoing_call(value);
+
+               break;
+       }
+       case BT_DPM_GET_ALLOW_OUTGOING_CALL: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_allow_bluetooth_outgoing_call();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_PAIRING_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_pairing_state(value);
+
+               break;
+       }
+       case BT_DPM_GET_PAIRING_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_bluetooth_pairing_state();
+               result = DPM_RESULT_SUCCESS;
+               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;
+
+               __bt_service_get_parameters(in_param1, &profile,
+                               sizeof(int));
+               __bt_service_get_parameters(in_param2, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_profile_state(profile, value);
+
+               break;
+       }
+       case BT_DPM_GET_PROFILE_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+               dpm_profile_t profile = DPM_PROFILE_NONE;
+
+               __bt_service_get_parameters(in_param2, &profile,
+                               sizeof(int));
+
+               value = _bt_dpm_get_bluetooth_profile_state(profile);
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_DESKROP_CONNECTIVITY_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_desktop_connectivity_state(value);
+
+               break;
+       }
+       case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_bluetooth_desktop_connectivity_state();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_DISCOVERABLE_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_discoverable_state(value);
+
+               break;
+       }
+       case BT_DPM_GET_DISCOVERABLE_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_bluetooth_discoverable_state();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_LIMITED_DISCOVERABLE_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_limited_discoverable_state(value);
+
+               break;
+       }
+       case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_bluetooth_limited_discoverable_state();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
+       case BT_DPM_SET_DATA_TRANSFER_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               __bt_service_get_parameters(in_param1, &value,
+                               sizeof(int));
+
+               result = _bt_dpm_set_bluetooth_data_transfer_state(value);
+
+               break;
+       }
+       case BT_DPM_GET_DATA_TRANSFER_STATE: {
+               dpm_status_t value = DPM_BT_ERROR;
+
+               value = _bt_dpm_get_allow_bluetooth_data_transfer_state();
+               result = DPM_RESULT_SUCCESS;
+               g_array_append_vals(*out_param1, &value, sizeof(int));
+
+               break;
+       }
        default:
                result = BLUETOOTH_ERROR_INTERNAL;
                break;
@@ -2220,6 +2516,43 @@ gboolean __bt_service_check_privilege(int function_name,
         case BT_HDP_DISCONNECT:
         case BT_HDP_SEND_DATA:
 
+        case BT_DPM_SET_ALLOW_BT_MODE:
+        case BT_DPM_GET_ALLOW_BT_MODE:
+        case BT_DPM_SET_DEVICE_RESTRITION:
+        case BT_DPM_GET_DEVICE_RESTRITION:
+        case BT_DPM_SET_UUID_RESTRITION:
+        case BT_DPM_GET_UUID_RESTRITION:
+        case BT_DPM_ADD_DEVICES_BLACKLIST:
+        case BT_DPM_ADD_DEVICES_WHITELIST:
+        case BT_DPM_ADD_UUIDS_BLACKLIST:
+        case BT_DPM_ADD_UUIDS_WHITELIST:
+        case BT_DPM_CLEAR_DEVICES_BLACKLIST:
+        case BT_DPM_CLEAR_DEVICES_WHITELIST:
+        case BT_DPM_CLEAR_UUIDS_BLACKLIST:
+        case BT_DPM_CLEAR_UUIDS_WHITELIST:
+        case BT_DPM_REMOVE_DEVICE_BLACKLIST:
+        case BT_DPM_REMOVE_DEVICE_WHITELIST:
+        case BT_DPM_REMOVE_UUID_BLACKLIST:
+        case BT_DPM_REMOVE_UUID_WHITELIST:
+        case BT_DPM_GET_DEVICES_BLACKLIST:
+        case BT_DPM_GET_DEVICES_WHITELIST:
+        case BT_DPM_GET_UUIDS_BLACKLIST:
+        case BT_DPM_GET_UUIDS_WHITELIST:
+        case BT_DPM_SET_ALLOW_OUTGOING_CALL:
+        case BT_DPM_GET_ALLOW_OUTGOING_CALL:
+        case BT_DPM_SET_PAIRING_STATE:
+        case BT_DPM_GET_PAIRING_STATE:
+        case BT_DPM_SET_PROFILE_STATE:
+        case BT_DPM_GET_PROFILE_STATE:
+        case BT_DPM_SET_DESKROP_CONNECTIVITY_STATE:
+        case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE:
+        case BT_DPM_SET_DISCOVERABLE_STATE:
+        case BT_DPM_GET_DISCOVERABLE_STATE:
+        case BT_DPM_SET_LIMITED_DISCOVERABLE_STATE:
+        case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE:
+        case BT_DPM_SET_DATA_TRANSFER_STATE:
+        case BT_DPM_GET_DATA_TRANSFER_STATE:
+
         case BT_NETWORK_ACTIVATE:
         case BT_NETWORK_DEACTIVATE:
         case BT_NETWORK_CONNECT:
old mode 100755 (executable)
new mode 100644 (file)
index e3dbbef..13ed14a
@@ -44,6 +44,9 @@
 #include "bt-service-main.h"
 #include "bt-service-avrcp.h"
 #include "bt-service-device.h"
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-service-dpm.h"
+#endif
 
 typedef struct {
        guint event_id;
@@ -216,8 +219,14 @@ int __bt_set_visible_time(int timeout)
        visible_timer.timeout = timeout;
 
 #ifndef TIZEN_WEARABLE
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_dpm_get_bluetooth_limited_discoverable_state() != DPM_RESTRICTED) {
+#endif
        if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
                BT_ERR("Set vconf failed");
+#ifdef TIZEN_DPM_ENABLE
+       }
+#endif
 #endif
 
        if (timeout <= 0)
@@ -464,6 +473,23 @@ static void __bt_set_visible_mode(void)
        if (vconf_get_int(BT_FILE_VISIBLE_TIME, &timeout) != 0)
                 BT_ERR("Fail to get the timeout value");
 
+#ifdef TIZEN_DPM_ENABLE
+       if (timeout == -1 ||
+       _bt_dpm_get_bluetooth_limited_discoverable_state() == DPM_RESTRICTED) {
+               if (_bt_set_discoverable_mode(
+                       BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,
+                       timeout) != BLUETOOTH_ERROR_NONE) {
+                       if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+                               BT_ERR("Set vconf failed");
+               }
+       } else {
+               if (_bt_set_discoverable_mode(
+                       BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE,
+                       timeout) != BLUETOOTH_ERROR_NONE) {
+                               BT_ERR("Set connectable mode failed");
+               }
+       }
+#else
        if (timeout == -1) {
                if (_bt_set_discoverable_mode(
                        BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,
@@ -478,6 +504,7 @@ static void __bt_set_visible_mode(void)
                                BT_ERR("Set connectable mode failed");
                }
        }
+#endif
 }
 #endif
 
@@ -1862,6 +1889,19 @@ int _bt_set_discoverable_mode(int discoverable_mode, int timeout)
 
        retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (discoverable_mode != BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE &&
+               _bt_dpm_get_bluetooth_limited_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) {
+               _bt_launch_dpm_popup("DPM_POLICY_DISABLE_BT");
+               return BLUETOOTH_ERROR_ACCESS_DENIED;
+       }
+#endif
+
        switch (discoverable_mode) {
        case BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE:
                pg_scan = TRUE;
old mode 100755 (executable)
new mode 100644 (file)
index d0f442b..bc17e81
 #include "bt-service-device.h"
 #include "bt-service-audio.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-service-dpm.h"
+#endif
+
 #define BT_APP_AUTHENTICATION_TIMEOUT          35
 #define BT_APP_AUTHORIZATION_TIMEOUT           15
 
@@ -389,6 +393,15 @@ static gboolean __pincode_request(GapAgentPrivate *agent, GDBusProxy *device)
 
        BT_DBG("+");
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_dpm_get_bluetooth_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();
+               return TRUE;
+       }
+#endif
+
        reply_temp = __bt_service_getall(device, BT_DEVICE_INTERFACE);
 
        if (reply_temp == NULL) {
@@ -488,6 +501,15 @@ static gboolean __passkey_request(GapAgentPrivate *agent, GDBusProxy *device)
        GVariant *tmp_value;
        BT_DBG("+");
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_dpm_get_bluetooth_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();
+               return TRUE;
+       }
+#endif
+
        reply_temp = __bt_service_getall(device, BT_DEVICE_INTERFACE);
 
        if (reply_temp == NULL) {
@@ -619,6 +641,15 @@ static gboolean __confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
        GVariant *tmp_value;
        BT_DBG("+ passkey[%.6d]", passkey);
 
+#ifdef TIZEN_DPM_ENABLE
+       if (_bt_dpm_get_bluetooth_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();
+               return TRUE;
+       }
+#endif
+
        snprintf(str_passkey, sizeof(str_passkey), "%.6d", passkey);
 
        reply_temp = __bt_service_getall(device, BT_DEVICE_INTERFACE);
old mode 100755 (executable)
new mode 100644 (file)
index 68e3029..e45c128
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+#ifdef TIZEN_DPM_ENABLE
 
 #include <glib.h>
 #include <gio/gio.h>
@@ -21,6 +22,7 @@
 #include <string.h>
 #include <syspopup_caller.h>
 #include <bundle_internal.h>
+#include <vconf.h>
 
 #include "bluetooth-api.h"
 #include "bt-internal-types.h"
@@ -62,10 +64,44 @@ static dpm_profile_state_t dpm_profile_state[DPM_PROFILE_NONE]  = {
        [DPM_POLICY_BLUETOOTH_SPP_PROFILE_STATE] = {DPM_STATUS_ERROR},
 };
 
+int _bt_launch_dpm_popup(char *mode)
+{
+       int ret = 0;
+       bundle *b;
+
+       b = bundle_create();
+       retv_if(b == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       bundle_add(b, "mode", mode);
+
+       ret = syspopup_launch(BT_DPM_SYSPOPUP, b);
+
+       if (ret < 0)
+               BT_ERR("Popup launch failed: %d\n", ret);
+
+       bundle_free(b);
+
+       return ret;
+}
+
 dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value)
 {
        BT_INFO("_bt_dpm_set_allow_bluetooth_mode");
-       policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value  = value;
+
+#if 0
+       if (value == DPM_BT_ALLOWED && value == DPM_BT_HANDSFREE_ONLY) {
+               /* Update Bluetooth DPM Status to notify other modules */
+               if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, value) != 0)
+                       BT_ERR("Set vconf failed\n");
+                       return DPM_RESULT_FAIL;
+       } else {
+               /* Update Bluetooth DPM Status to notify other modules */
+               if (vconf_set_int(VCONFKEY_BT_DPM_STATUS, VCONFKEY_BT_DPM_STATUS_RESTRICTED) != 0)
+                       BT_ERR("Set vconf failed\n");
+                       return DPM_RESULT_FAIL;
+       }
+#endif
+       policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value  = value;
 
        return DPM_RESULT_SUCCESS;
 }
@@ -73,6 +109,7 @@ 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)
 {
        BT_INFO("_bt_dpm_get_allow_bluetooth_mode");
+
        return policy_table[DPM_POLICY_ALLOW_BLUETOOTH].value;
 }
 
@@ -118,39 +155,72 @@ dpm_status_t _bt_dpm_is_bluetooth_uuid_restriction_active(void)
        return policy_table[DPM_POLICY_BLUETOOTH_UUID_RESTRICTION].value;
 }
 
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(char *device_address)
+dpm_result_t _bt_dpm_add_bluetooth_devices_to_blacklist(bluetooth_device_address_t *bd_addr)
 {
-       char *dev_addr;
+       char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+       char *dev_addr = NULL;
+
        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_CHECK_PARAMETER(bd_addr, return);
+
+       _bt_convert_addr_type_to_string(device_address,
+                       (unsigned char *)bd_addr->addr);
+
        dev_addr = g_strdup(device_address);
        if (!dev_addr)
                return DPM_RESULT_FAIL;
        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;
 }
 
-GSList *_bt_dpm_get_bluetooth_devices_from_blacklist(void)
+dpm_result_t _bt_dpm_get_bluetooth_devices_from_blacklist(GArray **out_param1)
 {
+       dpm_result_t ret = DPM_RESULT_FAIL;
+       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 NULL;
+               return ret;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list;
+       if (list) {
+               ret = DPM_RESULT_SUCCESS;
+               for (; list; list = list->next, i++) {
+                       memset(device_list.addresses[i].addr, 0, BT_ADDRESS_STRING_SIZE);
+                       _bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
+               }
+               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;
+               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(char *device_address)
+dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(bluetooth_device_address_t *bd_addr)
 {
-       char *dev_addr;
+       char device_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+       char *dev_addr = NULL;
+
        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_CHECK_PARAMETER(bd_addr, return);
+
+       _bt_convert_addr_type_to_string(device_address,
+                       (unsigned char *)bd_addr->addr);
+
        dev_addr = g_strdup(device_address);
        if (!dev_addr)
                return DPM_RESULT_FAIL;
@@ -158,17 +228,36 @@ dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(char *device_address)
        return DPM_RESULT_SUCCESS;
 }
 
-GSList *_bt_dpm_get_bluetooth_devices_from_whitelist(void)
+dpm_result_t _bt_dpm_get_bluetooth_devices_from_whitelist(GArray **out_param1)
 {
+       dpm_result_t ret = DPM_RESULT_FAIL;
+       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 NULL;
+               return ret;
+
+       if (list) {
+               ret = DPM_RESULT_SUCCESS;
+               for (; list; list = list->next, i++) {
+                       memset(device_list.addresses[i].addr, 0, BT_ADDRESS_STRING_SIZE);
+                       _bt_convert_addr_string_to_type(device_list.addresses[i].addr, list->data);
 
-       return policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list;
+               }
+               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;
+               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(char *uuid)
+dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(const char *uuid)
 {
        char *l_uuid;
        BT_INFO("_bt_dpm_add_bluetooth_uuids_to_blacklist");
@@ -183,20 +272,40 @@ dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(char *uuid)
        return DPM_RESULT_SUCCESS;
 }
 
-GSList *_bt_dpm_get_bluetooth_uuids_from_blacklist(void)
+dpm_result_t _bt_dpm_get_bluetooth_uuids_from_blacklist(GArray **out_param1)
 {
+       dpm_result_t ret = DPM_RESULT_FAIL;
+       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 NULL;
+               return ret;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list;
+       if (list) {
+               ret = DPM_RESULT_SUCCESS;
+               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);
+                       g_strlcpy(uuids_list.uuids[i], list->data,
+                               BLUETOOTH_UUID_STRING_MAX);
+               }
+               g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
+       } else {
+               ret = DPM_RESULT_SUCCESS;
+               uuids_list.count = 0;
+               g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
+       }
+
+       return ret;
 }
 
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(char *uuid)
+dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(const char *uuid)
 {
        char *l_uuid;
-       BT_INFO("_bt_dpm_add_bluetooth_uuids_to_blacklist");
+       BT_INFO("_bt_dpm_add_bluetooth_uuids_to_whitelist");
 
        if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
                return DPM_RESULT_ACCESS_DENIED;
@@ -209,14 +318,35 @@ dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(char *uuid)
 }
 
 
-GSList *_bt_dpm_get_bluetooth_uuids_from_whitelist(void)
+dpm_result_t _bt_dpm_get_bluetooth_uuids_from_whitelist(GArray **out_param1)
 {
+       dpm_result_t ret = DPM_RESULT_FAIL;
+       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 NULL;
+               return ret;
+       
+       if (list) {
+               ret = DPM_RESULT_SUCCESS;
+               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);
+                       g_strlcpy(uuids_list.uuids[i], list->data,
+                               BLUETOOTH_UUID_STRING_MAX);
+               }
+               g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
+       } else {
+               ret = DPM_RESULT_SUCCESS;
+               uuids_list.count = 0;
+               g_array_append_vals(*out_param1, &uuids_list, sizeof(bt_dpm_uuids_list_t));
+       }
+
+       return ret;
 
-       return policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list;
 }
 
 dpm_result_t _bt_dpm_set_allow_bluetooth_outgoing_call(dpm_status_t value)
@@ -255,6 +385,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_blacklist(void)
                        g_free(address);
                }
        }
+       g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list);
+       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = NULL;
        return DPM_RESULT_SUCCESS;
 }
 
@@ -273,6 +405,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_whitelist(void)
                        g_free(address);
                }
        }
+       g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list);
+       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = NULL;
        return DPM_RESULT_SUCCESS;
 }
 
@@ -290,6 +424,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
                        policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
                        g_free(l_uuid);
        }
+       g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list);
+       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = NULL;
        return DPM_RESULT_SUCCESS;
 }
 
@@ -308,6 +444,8 @@ dpm_result_t _bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
                        g_free(l_uuid);
                }
        }
+       g_slist_free(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list);
+       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = NULL;
        return DPM_RESULT_SUCCESS;
 }
 
@@ -431,7 +569,7 @@ dpm_status_t _bt_dpm_set_bluetooth_data_transfer_state(dpm_status_t value)
        return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value = value;
 }
 
-dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(dpm_status_t value)
+dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(void)
 {
        BT_INFO("_bt_dpm_get_allow_bluetooth_data_transfer_state");
 
@@ -441,101 +579,85 @@ dpm_status_t _bt_dpm_get_allow_bluetooth_data_transfer_state(dpm_status_t value)
        return policy_table[DPM_POLICY_BLUETOOTH_DATA_TRANSFER_STATE].value;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(GSList *device_addresses)
+dpm_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(bluetooth_device_address_t *device_address)
 {
        GSList *l = NULL;
-       GSList *device_list = NULL;
+       char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
        BT_INFO("_bt_dpm_remove_bluetooth_devices_from_whitelist");
 
        if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
                return DPM_RESULT_ACCESS_DENIED;
 
-       for (device_list = device_addresses; device_list; device_list = g_slist_next(device_list)) {
-               for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list; l; l = g_slist_next(l)) {
-                       if (l->data == device_list->data) {
-                               char *addr = device_list->data;
-                               if (addr) {
-                                       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list =
-                                               g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, addr);
-                                       g_free(addr);
-                                       break;
-                               }
-                       }
+       _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)) {
+                       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, l_device);
+                       g_free(l_device);
                }
        }
        return DPM_RESULT_SUCCESS;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(GSList *device_addresses)
+dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(bluetooth_device_address_t *device_address)
 {
        GSList *l = NULL;
-       GSList *device_list = NULL;
+       char bd_addr[BT_ADDRESS_STRING_SIZE] = { 0 };
+
        BT_INFO("_bt_dpm_remove_bluetooth_devices_from_blacklist");
 
        if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
                return DPM_RESULT_ACCESS_DENIED;
 
-       for (device_list = device_addresses; device_list; device_list = g_slist_next(device_list)) {
-               for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list; l; l = g_slist_next(l)) {
-                       if (l->data == device_list->data) {
-                               char *addr = device_list->data;
-                               if (addr) {
-                                       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list =
-                                               g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list, addr);
-                                       g_free(addr);
-                                       break;
-                               }
-                       }
+       _bt_convert_addr_type_to_string(bd_addr,
+                       (unsigned char *)device_address->addr);
+
+       for (l = policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list; l; l = g_slist_next(l)) {
+               char *l_device = l->data;
+               if (l_device && g_strcmp0(l_device, bd_addr)) {
+                       policy_table[DPM_POLICY_BLUETOOTH_DEVICES_BLACKLIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_DEVICES_WHITELIST].list, l_device);
+                       g_free(l_device);
                }
        }
+
        return DPM_RESULT_SUCCESS;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(GSList *uuids)
+dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(const char *uuids)
 {
        GSList *l = NULL;
-       GSList *uuids_list = NULL;
        BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_whitelist");
 
        if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
                return DPM_RESULT_ACCESS_DENIED;
-
-       for (uuids_list = uuids; uuids_list; uuids_list = g_slist_next(uuids_list)) {
-               for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list; l; l = g_slist_next(l)) {
-                       if (l->data == uuids_list->data) {
-                               char *uuid = uuids_list->data;
-                               if (uuid) {
-                                       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list =
-                                               g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list, uuid);
-                                       g_free(uuid);
-                                       break;
-                               }
-                       }
+       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)) {
+                       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_WHITELIST].list, l_uuid);
+                       g_free(l_uuid);
                }
        }
        return DPM_RESULT_SUCCESS;
 }
 
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(GSList *uuids)
+dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(const char *uuids)
 {
        GSList *l = NULL;
-       GSList *uuids_list = NULL;
        BT_INFO("_bt_dpm_remove_bluetooth_uuids_from_blacklist");
 
        if (_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_RESTRICTED)
                return DPM_RESULT_ACCESS_DENIED;
 
-       for (uuids_list = uuids; uuids_list; uuids_list = g_slist_next(uuids_list)) {
-               for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
-                       if (l->data == uuids_list->data) {
-                               char *uuid = uuids_list->data;
-                               if (uuid) {
-                                       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list =
-                                               g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, uuid);
-                                       g_free(uuid);
-                                       break;
-                               }
-                       }
+       for (l = policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list; l; l = g_slist_next(l)) {
+               char *l_uuid = l->data;
+               if (l_uuid && g_strcmp0(l_uuid, uuids)) {
+                       policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list = g_slist_remove(policy_table[DPM_POLICY_BLUETOOTH_UUIDS_BLACKLIST].list, l_uuid);
+                       g_free(l_uuid);
                }
        }
        return DPM_RESULT_SUCCESS;
@@ -572,3 +694,4 @@ dpm_result_t _bt_dpm_clear_bluetooth_devices_from_list(void)
 
        return err;
 }
+#endif /* #ifdef TIZEN_DPM_ENABLE */
old mode 100755 (executable)
new mode 100644 (file)
index 66d5754..5fae36f
 
 #include "bt-service-opp-client.h"
 
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-service-dpm.h"
+#endif
+
 #define DBUS_TIMEOUT 20 * 1000 /* 20 Sec */
 static GDBusConnection *manager_conn;
 static GDBusConnection *obexd_conn;
@@ -888,6 +892,23 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                        if (remote_dev_info->addr_type == 0) {
                                BT_DBG("Name %s", remote_dev_info->name);
 
+#ifdef TIZEN_DPM_ENABLE
+                               if (_bt_dpm_get_bluetooth_desktop_connectivity_state() ==
+                                                       DPM_RESTRICTED) {
+                                       bluetooth_device_class_t device_class;
+                                       _bt_divide_device_class(&device_class, remote_dev_info->class);
+
+                                       if (device_class.major_class ==
+                                               BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                                               _bt_free_device_info(remote_dev_info);
+                                               g_free(property);
+                                               g_variant_unref(val);
+                                               g_free(address);
+                                               return;
+                                       }
+                               }
+#endif
+
                                GVariant *uuids = NULL;
                                GVariantBuilder *builder = NULL;
                                int i = 0;
@@ -2407,6 +2428,22 @@ static  void __bt_manager_event_filter(GDBusConnection *connection,
                                         */
                                        dev_info->name = g_strdup(dev_info->address);
 
+#ifdef TIZEN_DPM_ENABLE
+                               if (_bt_dpm_get_bluetooth_desktop_connectivity_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);
+
+                                       if (device_class.major_class ==
+                                               BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
+                                               __bt_free_cache_info(cache_info);
+                                               g_variant_unref(value);
+                                               return;
+                                       }
+                               }
+#endif
+
                                GVariant *uuids = NULL;
                                GVariantBuilder *builder = NULL;
                                int i = 0;
old mode 100755 (executable)
new mode 100644 (file)
index e22aada..c035610
 #include <dlog.h>
 #include <string.h>
 #include <dirent.h>
-#ifdef TIZEN_MDM_ENABLE
-#include <bt-service-mdm.h>
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-service-dpm.h"
 #endif
+
 #include <vconf.h>
 
 #include <gio/gio.h>
@@ -443,10 +444,6 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
                return FALSE;
        }
 
-#ifdef TIZEN_MDM_ENABLE
-       mdm_bt_allow_t mode = MDM_BT_ALLOWED;
-#endif
-
        __bt_free_auth_info(agent_info.auth_info);
 
        agent_info.auth_info = g_malloc(sizeof(bt_auth_info_t));
@@ -457,6 +454,14 @@ static gboolean __bt_authorize_cb(GDBusMethodInvocation *context,
 
        agent_info.auth_info->transfer_path = g_strdup(path);
 
+#ifdef TIZEN_DPM_ENABLE
+       if(_bt_dpm_get_allow_bluetooth_mode() == DPM_BT_HANDSFREE_ONLY) {
+               /* Free auth info in next function */
+               _bt_obex_server_reject_authorize();
+               return FALSE;
+       }
+#endif
+
        if (iter) {
                const gchar *key;
                GVariant *val;
old mode 100755 (executable)
new mode 100644 (file)
index 2d6362a..30e10ee
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+#ifdef TIZEN_DPM_ENABLE
 
 #ifndef _BT_SERVICE_DPM_H_
 #define _BT_SERVICE_DPM_H_
@@ -111,30 +112,31 @@ typedef enum dpm_profile {
 } dpm_profile_t;
 
 struct dpm_profile_val {
-               int value; //tells whether the profile is enabled or disabled
+               int value; /* tells whether the profile is enabled or disabled */
 };
 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(char *device_address);
-dpm_result_t _bt_dpm_add_bluetooth_devices_to_whitelist(char *device_address);
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_blacklist(char *uuid);
-dpm_result_t _bt_dpm_add_bluetooth_uuids_to_whitelist(char *uuid);
+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);
-GSList *_bt_dpm_get_bluetooth_devices_from_blacklist(void);
-GSList *_bt_dpm_get_bluetooth_devices_from_whitelist(void);
-GSList *_bt_dpm_get_bluetooth_uuids_from_blacklist(void);
-GSList *_bt_dpm_get_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);
@@ -150,13 +152,15 @@ 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_result_t _bt_dpm_remove_bluetooth_devices_from_whitelist(GSList *device_addresses);
-dpm_result_t _bt_dpm_remove_bluetooth_devices_from_blacklist(GSList *device_addresses);
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_whitelist(GSList *uuids);
-dpm_result_t _bt_dpm_remove_bluetooth_uuids_from_blacklist(GSList *uuids);
+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);
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif /*_BT_SERVICE_DPM_H_*/
+#endif /* #ifdef TIZEN_DPM_ENABLE */
 
index a1613ca..c91aefc 100644 (file)
@@ -71,6 +71,9 @@ extern "C" {
 #define BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH 100
 
 
+#define BLUETOOTH_MAX_DPM_LIST 20      /**< This specifies maximum number of devices/uuids
+                                                       dpm shall store */
+
 /**
  * This is Bluetooth error code
  */
@@ -1514,6 +1517,110 @@ typedef struct {
        guint16 max_rx_time;
 } bt_le_data_length_params_t;
 
+
+ /**
+ * @brief DPM BT allowance state
+ * @see
+ */
+ typedef enum {
+        BLUETOOTH_DPM_ERROR     = -1,   /**< bluetooth allowance error */
+        BLUETOOTH_DPM_BT_ALLOWED,               /**< bluetooth allowance allowed */
+        BLUETOOTH_DPM_HANDSFREE_ONLY,  /**< bluetooth allowance handsfree only */
+        BLUETOOTH_DPM_BT_RESTRICTED,  /**< bluetooth allowance restricted */
+ } bt_dpm_allow_t;
+
+ /**
+ * @brief DPM API result
+ * @see
+ */
+typedef enum {
+       BLUETOOTH_DPM_RESULT_SERVICE_NOT_ENABLED = -5,  /**< DPM API result service not enabled. */
+       BLUETOOTH_DPM_RESULT_ACCESS_DENIED = -4,                        /**< DPM API result access denied. */
+       BLUETOOTH_DPM_RESULT_INVALID_PARAM = -3,                        /**< DPM API result invalid parameter. */
+       BLUETOOTH_DPM_RESULT_NOT_SUPPORTED = -2,                        /**< DPM API result not supported. */
+       BLUETOOTH_DPM_RESULT_FAIL        = -1,                          /**< DPM API result fail. */
+       BLUETOOTH_DPM_RESULT_SUCCESS     = 0,                           /**< DPM API result success. */
+} bt_dpm_result_t;
+
+/**
+ * @brief DPM Policy status
+ * @see
+ */
+typedef enum {
+       BLUETOOTH_DPM_STATUS_ERROR      = -1,
+
+       BLUETOOTH_DPM_ALLOWED           = 0,    /**< DPM Policy status allowed. */
+       BLUETOOTH_DPM_RESTRICTED                = 1,    /**< DPM Policy status restricted. */
+
+       BLUETOOTH_DPM_ENABLE                    = 1,    /**< DPM Policy status enabled. */
+       BLUETOOTH_DPM_DISABLE   = 0,    /**< DPM Policy status disabled. */
+
+       BLUETOOTH_DPM_FALSE                     = 0,    /**< DPM Policy status false. */
+       BLUETOOTH_DPM_TRUE                      = 1,    /**< DPM Policy status true. */
+} bt_dpm_status_t;
+
+typedef enum {
+       /* policy-group : BLUETOOTH */
+       BLUETOOTH_DPM_POLICY_ALLOW,
+       BLUETOOTH_DPM_POLICY_DEVICE_RESTRICTION,
+       BLUETOOTH_DPM_POLICY_UUID_RESTRICTION,
+       BLUETOOTH_DPM_POLICY_DEVICES_WHITELIST,
+       BLUETOOTH_DPM_POLICY_DEVICES_BLACKLIST,
+       BLUETOOTH_DPM_POLICY_UUIDS_WHITELIST,
+       BLUETOOTH_DPM_POLICY_UUIDS_BLACKLIST,
+       BLUETOOTH_DPM_POLICY_ALLOW_OUTGOING_CALL,
+       BLUETOOTH_DPM_POLICY_PAIRING_STATE,
+       BLUETOOTH_DPM_POLICY_DESKTOP_CONNECTIVITY_STATE,
+       BLUETOOTH_DPM_POLICY_DISCOVERABLE_STATE,
+       BLUETOOTH_DPM_POLICY_LIMITED_DISCOVERABLE_STATE,
+       BLUETOOTH_DPM_POLICY_DATA_TRANSFER_STATE,
+       BLUETOOTH_DPM_POLICY_END,
+} bt_dpm_policy_cmd_t;
+
+
+struct bt_dpm_policy {
+       union {
+               int value;
+               GSList *list;
+       };
+};
+typedef struct bt_dpm_policy bt_dpm_policy_t;
+
+typedef enum {
+       BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
+       BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
+       BLUETOOTH_DPM_PROFILE_NONE,
+} bt_dpm_profile_t;
+
+struct bt_dpm_profile_val {
+               int value; /* tells whether the profile is enabled or disabled */
+};
+typedef struct dpm_profile_val dpm_profile_state_t;
+
+/**
+ * Structure to DPM device list
+ */
+typedef struct {
+       int count;
+       bluetooth_device_address_t addresses[BLUETOOTH_MAX_DPM_LIST];
+} bt_dpm_device_list_t;
+
+/**
+ * Structure to DPM uuid list
+ */
+typedef struct {
+       int count;
+       char uuids[BLUETOOTH_MAX_DPM_LIST][BLUETOOTH_UUID_STRING_MAX];
+} bt_dpm_uuids_list_t;
+
 /**
  * Callback pointer type
  */
@@ -5661,6 +5768,752 @@ int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
  * @remark     None
  */
 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
+
+#ifdef TIZEN_DPM_VCONF_ENABLE
+/**
+ * @fn int bluetooth_dpm_is_bluetooth_mode_allowed(void);
+ *
+ * @brief Checks Restriction for BT mode(BT allowed or not)
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ *  @param[in] None
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_is_bluetooth_mode_allowed(void);
+#endif
+
+/**
+ * @fn int bluetooth_dpm_set_allow_bluetooth_mode(bt_dpm_allow_t value);
+ *
+ * @brief Sets Restriction for BT mode(BT allowed or not)
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - BT Allow value.
+ *             BLUETOOTH_DPM_ERROR  = -1,       < bluetooth allowance error
+ *             BLUETOOTH_DPM_BT_ALLOWED,                < bluetooth allowance allowed
+ *             BLUETOOTH_DPM_HANDSFREE_ONLY,  < bluetooth allowance handsfree only
+ *             BLUETOOTH_DPM_BT_RESTRICTED,  < bluetooth allowance restricted
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_allow_bluetooth_mode(bt_dpm_allow_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_allow_bluetooth_mode(bt_dpm_allow_t value);
+ *
+ * @brief Reads the Restriction for BT mode(BT allowed or not)
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ *  @param[in] None
+ * @param[out] value - BT Allow value.
+ *             BLUETOOTH_DPM_ERROR      = -1,   < bluetooth allowance error
+ *             BLUETOOTH_DPM_BT_ALLOWED,                < bluetooth allowance allowed
+ *             BLUETOOTH_DPM_HANDSFREE_ONLY,  < bluetooth allowance handsfree only
+ *             BLUETOOTH_DPM_BT_RESTRICTED,  < bluetooth allowance restricted
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_allow_bluetooth_mode(bt_dpm_allow_t *value);
+
+/**
+ * @fn int bluetooth_dpm_activate_bluetooth_device_restriction(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for device.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_activate_bluetooth_device_restriction(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_is_bluetooth_device_restriction_active(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for device.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_is_bluetooth_device_restriction_active(bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for uuid.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_is_bluetooth_uuid_restriction_active(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for uuid.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_is_bluetooth_uuid_restriction_active(bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_add_bluetooth_devices_to_blacklist(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Adds the device to blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  device_address - Device address
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_add_bluetooth_devices_to_blacklist(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_dpm_add_bluetooth_devices_to_whitelist(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Adds the device to whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  device_address - Device address
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_add_bluetooth_devices_to_whitelist(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_dpm_add_bluetooth_uuids_to_blacklist(const char *service_uuid);
+ *
+ * @brief Adds the Service UUIDS to blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  service_uuids - profile or custom service uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_add_bluetooth_uuids_to_blacklist(const char *service_uuid);
+
+/**
+ * @fn int bluetooth_dpm_add_bluetooth_uuids_to_whitelist(const char *service_uuid);
+ *
+ * @brief Adds the Service UUIDS to whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  service_uuids - profile or custom service uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_add_bluetooth_uuids_to_whitelist(const char *service_uuid);
+
+/**
+ * @fn int bluetooth_dpm_clear_bluetooth_devices_from_blacklist();
+ *
+ * @brief Clears the devices from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  None
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_clear_bluetooth_devices_from_blacklist(void);
+
+/**
+ * @fn int bluetooth_dpm_clear_bluetooth_devices_from_whitelist();
+ *
+ * @brief Clears the devices from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  None
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_clear_bluetooth_devices_from_whitelist(void);
+
+/**
+ * @fn int bluetooth_dpm_clear_bluetooth_uuids_from_blacklist();
+ *
+ * @brief Clears the uuids from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  None
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_clear_bluetooth_uuids_from_blacklist(void);
+
+/**
+ * @fn int bluetooth_dpm_clear_bluetooth_uuids_from_whitelist();
+ *
+ * @brief Clears the uuids from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  None
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_clear_bluetooth_uuids_from_whitelist(void);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_devices_from_blacklist(bt_dpm_device_list_t *device_list);
+ *
+ * @brief reads the devices from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[out] device_list - list of devices
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_devices_from_blacklist(bt_dpm_device_list_t *device_list);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_devices_from_whitelist(bt_dpm_device_list_t *device_list);
+ *
+ * @brief reads the devices from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[out] device_list - list of devices
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_devices_from_whitelist(bt_dpm_device_list_t *device_list);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_uuids_from_blacklist(bt_dpm_uuids_list_t *uuid_list);
+ *
+ * @brief reads the uuids from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  uuid_list - list of uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_uuids_from_blacklist(bt_dpm_uuids_list_t *uuid_list);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_uuids_from_whitelist(bt_dpm_uuids_list_t *uuid_list);
+ *
+ * @brief reads the uuids from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  uuid_list - list of uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_uuids_from_whitelist(bt_dpm_uuids_list_t *uuid_list);
+
+/**
+ * @fn int bluetooth_dpm_remove_bluetooth_device_from_whitelist(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Removes the device from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  device_address - Device address
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_remove_bluetooth_device_from_whitelist(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_dpm_remove_bluetooth_device_from_blacklist(const bluetooth_device_address_t *device_address);
+ *
+ * @brief Removes the device from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  device_address - Device address
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_remove_bluetooth_device_from_blacklist(const bluetooth_device_address_t *device_address);
+
+/**
+ * @fn int bluetooth_dpm_remove_bluetooth_uuid_from_whitelist(const char *service_uuid);
+ *
+ * @brief Removes the Service UUIDS from whitelist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  service_uuids - profile or custom service uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_remove_bluetooth_uuid_from_whitelist(const char *service_uuid);
+
+/**
+ * @fn int bluetooth_dpm_remove_bluetooth_uuid_from_blacklist(const char *service_uuid);
+ *
+ * @brief Removes the Service UUIDS from blacklist.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  service_uuids - profile or custom service uuids
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_remove_bluetooth_uuid_from_blacklist(const char *service_uuid);
+
+/**
+ * @fn int bluetooth_dpm_set_allow_bluetooth_outgoing_call(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for outgoing call.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_allow_bluetooth_outgoing_call(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_allow_bluetooth_outgoing_call(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for  outgoing call.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_allow_bluetooth_outgoing_call(bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_set_bluetooth_pairing_state(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for Pairing.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_pairing_state(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_pairing_state(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for Pairing
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_pairing_state(bt_dpm_status_t *value);
+
+/**
+ * @fnint bluetooth_dpm_set_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for using Profiles.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]profile - Profile.
+ *             BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_PROFILE_NONE
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for using Profiles.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]profile - Profile.
+ *             BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
+ *             BLUETOOTH_DPM_PROFILE_NONE
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_set_bluetooth_desktop_connectivity_state(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for Desktop Connectivity.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_desktop_connectivity_state(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_desktop_connectivity_state(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for Desktop Connectivity.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_desktop_connectivity_state(bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_set_bluetooth_discoverable_state(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for Discoverable state.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_discoverable_state(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_discoverable_state(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for Discoverable state.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_discoverable_state(bt_dpm_status_t *value);
+
+/**
+ * @fn int bluetooth_dpm_set_bluetooth_limited_discoverable_state(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for linited discoverable state..
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_limited_discoverable_state(bt_dpm_status_t value);
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_limited_discoverable_state(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for limited discoverable state.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_limited_discoverable_state(bt_dpm_status_t *value);
+/**
+ * @fn int bluetooth_dpm_set_bluetooth_data_transfer_state(bt_dpm_status_t value);
+ *
+ * @brief Sets the Restriction for Data trasnfer.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in]  value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_set_bluetooth_data_transfer_state(bt_dpm_status_t value);
+
+
+/**
+ * @fn int bluetooth_dpm_get_bluetooth_data_transfer_state(bt_dpm_status_t *value);
+ *
+ * @brief Reads the Restriction for Data trasnfer.
+ *
+ * This function is a synchronous call.
+ *
+ * @return     BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
+ *             BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
+ *             BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
+ *
+ * @exception  None
+ * @param[in] None
+ * @param[out] value - State value.
+ *             BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
+ *             BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
+ *
+ * @remark     None
+ */
+int bluetooth_dpm_get_bluetooth_data_transfer_state(bt_dpm_status_t *value);
+
 /**
  * @}
  */
old mode 100755 (executable)
new mode 100644 (file)
index fa03123..e288029
@@ -104,6 +104,7 @@ typedef enum {
 #define BT_META_DATA_MAX_LEN 512 + 1
 
 #define BT_HFP_AUDIO_GATEWAY_UUID "0000111f-0000-1000-8000-00805f9b34fb"
+#define BT_HSP_AUDIO_GATEWAY_UUID "00001112-0000-1000-8000-00805f9b34fb"
 #define BT_A2DP_UUID "0000110D-0000-1000-8000-00805F9B34FB"
 #define BT_AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"
 #define BT_OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
@@ -113,6 +114,7 @@ typedef enum {
 #define BT_PAN_PANU_UUID "00001115-0000-1000-8000-00805f9b34fb"
 #define BT_PAN_NAP_UUID "00001116-0000-1000-8000-00805f9b34fb"
 #define BT_PAN_GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
+#define BT_OBEX_PSE_UUID "0000112f-0000-1000-8000-00805f9b34fb"
 
 #define BT_FUNC_BASE ((int)(0x0000))
 #define BT_FUNC_DEVICE_BASE ((int)(BT_FUNC_BASE + 0x0050))
@@ -127,6 +129,7 @@ typedef enum {
 #define BT_FUNC_HDP_BASE ((int)(BT_FUNC_PBAP_BASE + 0x0020))
 #define BT_FUNC_GATT_BASE ((int)(BT_FUNC_HDP_BASE + 0x0020))
 #define BT_FUNC_IPSP_BASE ((int)(BT_FUNC_GATT_BASE + 0x0020))
+#define BT_FUNC_DPM_BASE ((int)(BT_FUNC_IPSP_BASE + 0x0020))
 
 typedef enum {
        BT_CHECK_ADAPTER = BT_FUNC_BASE,
@@ -291,6 +294,42 @@ typedef enum {
        BT_LE_IPSP_DEINIT,
        BT_LE_IPSP_CONNECT,
        BT_LE_IPSP_DISCONNECT,
+       BT_DPM_SET_ALLOW_BT_MODE = BT_FUNC_DPM_BASE,
+       BT_DPM_GET_ALLOW_BT_MODE,
+       BT_DPM_SET_DEVICE_RESTRITION,
+       BT_DPM_GET_DEVICE_RESTRITION,
+       BT_DPM_SET_UUID_RESTRITION,
+       BT_DPM_GET_UUID_RESTRITION,
+       BT_DPM_ADD_DEVICES_BLACKLIST,
+       BT_DPM_ADD_DEVICES_WHITELIST,
+       BT_DPM_ADD_UUIDS_BLACKLIST,
+       BT_DPM_ADD_UUIDS_WHITELIST,
+       BT_DPM_CLEAR_DEVICES_BLACKLIST,
+       BT_DPM_CLEAR_DEVICES_WHITELIST,
+       BT_DPM_CLEAR_UUIDS_BLACKLIST,
+       BT_DPM_CLEAR_UUIDS_WHITELIST,
+       BT_DPM_REMOVE_DEVICE_BLACKLIST,
+       BT_DPM_REMOVE_DEVICE_WHITELIST,
+       BT_DPM_REMOVE_UUID_BLACKLIST,
+       BT_DPM_REMOVE_UUID_WHITELIST,
+       BT_DPM_GET_DEVICES_BLACKLIST,
+       BT_DPM_GET_DEVICES_WHITELIST,
+       BT_DPM_GET_UUIDS_BLACKLIST,
+       BT_DPM_GET_UUIDS_WHITELIST,
+       BT_DPM_SET_ALLOW_OUTGOING_CALL,
+       BT_DPM_GET_ALLOW_OUTGOING_CALL,
+       BT_DPM_SET_PAIRING_STATE,
+       BT_DPM_GET_PAIRING_STATE,
+       BT_DPM_SET_PROFILE_STATE,
+       BT_DPM_GET_PROFILE_STATE,
+       BT_DPM_SET_DESKROP_CONNECTIVITY_STATE,
+       BT_DPM_GET_DESKROP_CONNECTIVITY_STATE,
+       BT_DPM_SET_DISCOVERABLE_STATE,
+       BT_DPM_GET_DISCOVERABLE_STATE,
+       BT_DPM_SET_LIMITED_DISCOVERABLE_STATE,
+       BT_DPM_GET_LIMITED_DISCOVERABLE_STATE,
+       BT_DPM_SET_DATA_TRANSFER_STATE,
+       BT_DPM_GET_DATA_TRANSFER_STATE,
 } bt_function_t;
 
 typedef struct {
@@ -308,6 +347,10 @@ typedef struct {
 /* Need to convert the design ID */
 #define BT_STR_NOT_SUPPORT "Not support"
 
+#ifdef TIZEN_DPM_ENABLE
+#define BT_DPM_SYSPOPUP "dpm-syspopup"
+#endif
+
 #ifndef TIZEN_WEARABLE
 #define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
 #endif