summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorh.sandeep <h.sandeep@samsung.com>2016-04-20 15:11:21 +0530
committerh.sandeep <h.sandeep@samsung.com>2016-04-28 16:45:48 +0530
commit5893b1836a33a514d3c29c5fb8624d23b0ff3f1c (patch)
tree818bce3513233147a6ad20f20d0cbe7f76e4d847
parent1321249c9f8ace138077fab1dc9f5014a3d744e7 (diff)
downloadbluetooth-5893b1836a33a514d3c29c5fb8624d23b0ff3f1c.tar.gz
bluetooth-5893b1836a33a514d3c29c5fb8624d23b0ff3f1c.tar.bz2
bluetooth-5893b1836a33a514d3c29c5fb8624d23b0ff3f1c.zip
DPM: Add dpm APIs and bt_unit_test test cases
Change-Id: I77e1bdd1eab6a131903602ead2d6a6dab1062c13 Signed-off-by: h.sandeep <h.sandeep@samsung.com>
-rw-r--r--[-rwxr-xr-x]CMakeLists.txt1
-rw-r--r--include/mobile/bluetooth_internal.h751
-rw-r--r--include/mobile/bluetooth_type_internal.h66
-rw-r--r--src/bluetooth-dpm.c658
-rw-r--r--test/bt_unit_test.c846
-rw-r--r--test/bt_unit_test.h38
6 files changed, 2360 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11715f4..659a36b 100755..100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,6 +75,7 @@ src/bluetooth-audio.c
src/bluetooth-avrcp.c
src/bluetooth-gatt.c
src/bluetooth-ipsp.c
+src/bluetooth-dpm.c
)
IF (TIZEN_WEARABLE)
LIST(APPEND SOURCES src/bluetooth-pbap.c)
diff --git a/include/mobile/bluetooth_internal.h b/include/mobile/bluetooth_internal.h
index b8040ea..34abbcd 100644
--- a/include/mobile/bluetooth_internal.h
+++ b/include/mobile/bluetooth_internal.h
@@ -3183,6 +3183,757 @@ int bt_hid_device_reply_to_report(const char *remote_address,
const char *data, unsigned int data_len);
/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets Restriction for BT mode(BT allowed or not).
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - BT Allow value.
+ * BT_DPM_ERROR = -1, < bluetooth allowance error
+ * BT_DPM_BT_ALLOWED, < bluetooth allowance allowed
+ * BT_DPM_HANDSFREE_ONLY, < bluetooth allowance handsfree only
+ * BT_DPM_BT_RESTRICTED, < bluetooth allowance restricted
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre none.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_allow_bluetooth_mode(bt_dpm_allow_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads Restriction for BT mode(BT allowed or not).
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] none
+ * @param[out] value - BT Allow value.
+ * BT_DPM_ERROR = -1, < bluetooth allowance error
+ * BT_DPM_BT_ALLOWED, < bluetooth allowance allowed
+ * BT_DPM_HANDSFREE_ONLY, < bluetooth allowance handsfree only
+ * BT_DPM_BT_RESTRICTED, < bluetooth allowance restricted
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre none.
+ * @see bt_dpm_set_allow_bluetooth_mode()
+ */
+int bt_dpm_get_allow_bluetooth_mode(bt_dpm_allow_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for device.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_activate_bluetooth_device_restriction(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for device.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_is_bluetooth_device_restriction_active(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for uuid.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for uuid.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_is_bluetooth_uuid_restriction_active(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Adds the device to blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] device_address - Device address
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_add_bluetooth_devices_to_blacklist(const char *device_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Adds the device to whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] device_address - Device address
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_add_bluetooth_devices_to_whitelist(const char *device_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Adds the uuids to blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] service_uuids - profile or custom service uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_add_bluetooth_uuids_to_blacklist(const char *service_uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Adds the uuid to whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] service_uuids - profile or custom service uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_add_bluetooth_uuids_to_whitelist(const char *service_uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Clears the device from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] none
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_clear_bluetooth_devices_from_blacklist(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Clears the device from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] none
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_clear_bluetooth_devices_from_whitelist(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Clears the uuids from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] none
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_clear_bluetooth_uuids_from_blacklist(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Clears the uuids from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] none
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_clear_bluetooth_uuids_from_whitelist(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the devices from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] device_list - list of devices
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_devices_from_blacklist(bt_dpm_device_list_s **device_list);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the devices from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] device_list - list of devices
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_devices_from_whitelist(bt_dpm_device_list_s **device_list);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the uuids from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] uuid_list - list of uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_uuids_from_blacklist(bt_dpm_uuids_list_s **uuid_list);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the uuids from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] uuid_list - list of uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_uuids_from_whitelist(bt_dpm_uuids_list_s **uuid_list);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Removes the devices from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] device_address - Device address
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_remove_bluetooth_device_from_whitelist(const char *device_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Removes the devices from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] device_address - Device address
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_remove_bluetooth_device_from_blacklist(const char *device_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Removes the uuids from whitelist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] service_uuids - profile or custom service uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_remove_bluetooth_uuid_from_whitelist(const char *service_uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Removes the uuids from blacklist.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] service_uuids - profile or custom service uuids
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_remove_bluetooth_uuid_from_blacklist(const char *service_uuid);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for outgoing call.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_allow_bluetooth_outgoing_call(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for outgoing call.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_allow_bluetooth_outgoing_call(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for pairing.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_bluetooth_pairing_state(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for pairing.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_pairing_state(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for profiles.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in]profile - Profile.
+ * BT_DPM_POLICY_A2DP_PROFILE_STATE,
+ * BT_DPM_POLICY_AVRCP_PROFILE_STATE,
+ * BT_DPM_POLICY_BPP_PROFILE_STATE,
+ * BT_DPM_POLICY_DUN_PROFILE_STATE,
+ * BT_DPM_POLICY_FTP_PROFILE_STATE,
+ * BT_DPM_POLICY_HFP_PROFILE_STATE,
+ * BT_DPM_POLICY_HSP_PROFILE_STATE,
+ * BT_DPM_POLICY_PBAP_PROFILE_STATE,
+ * BT_DPM_POLICY_SAP_PROFILE_STATE,
+ * BT_DPM_POLICY_SPP_PROFILE_STATE,
+ * BT_DPM_PROFILE_NONE
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_bluetooth_profile_state(bt_dpm_profile_e profile, bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for profiles.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in]profile - Profile.
+ * BT_DPM_POLICY_A2DP_PROFILE_STATE,
+ * BT_DPM_POLICY_AVRCP_PROFILE_STATE,
+ * BT_DPM_POLICY_BPP_PROFILE_STATE,
+ * BT_DPM_POLICY_DUN_PROFILE_STATE,
+ * BT_DPM_POLICY_FTP_PROFILE_STATE,
+ * BT_DPM_POLICY_HFP_PROFILE_STATE,
+ * BT_DPM_POLICY_HSP_PROFILE_STATE,
+ * BT_DPM_POLICY_PBAP_PROFILE_STATE,
+ * BT_DPM_POLICY_SAP_PROFILE_STATE,
+ * BT_DPM_POLICY_SPP_PROFILE_STATE,
+ * BT_DPM_PROFILE_NONE
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_profile_state(bt_dpm_profile_e profile, bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for desktop connectivity.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_bluetooth_desktop_connectivity_state(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for desktop connectivity.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_desktop_connectivity_state(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for discoverable mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_bluetooth_discoverable_state(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for discoverable mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_discoverable_state(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for limited discoverable mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+
+int bt_dpm_set_bluetooth_limited_discoverable_state(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for limited discoverable mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_limited_discoverable_state(bt_dpm_status_e *value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Sets the Restriction for Data transfer.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_set_bluetooth_data_transfer_state(bt_dpm_status_e value);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+ * @brief Reads the Restriction for Data transfer.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[out] value - State value.
+ * BT_DPM_ALLOWED = 0, < DPM Policy status allowed.
+ * BT_DPM_RESTRICTED = 1, < DPM Policy status restricted.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER invalid paramter
+ * @retval #BT_ERROR_NOT_SUPPORTED Not suported
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED operation failed
+ *
+ * @pre bt_dpm_set_allow_bluetooth_mode must be allowed.
+ * @see bt_dpm_get_allow_bluetooth_mode()
+ */
+int bt_dpm_get_bluetooth_data_transfer_state(bt_dpm_status_e *value);
+
+/**
* @}
*/
diff --git a/include/mobile/bluetooth_type_internal.h b/include/mobile/bluetooth_type_internal.h
index 5613f08..1a99bea 100644
--- a/include/mobile/bluetooth_type_internal.h
+++ b/include/mobile/bluetooth_type_internal.h
@@ -169,6 +169,55 @@ typedef enum {
} bt_gatt_permission_e;
/**
+* @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+* @brief DPM BT allowance state
+* @since_tizen 3.0
+*/
+typedef enum {
+ BT_DPM_ERROR = -1, /**< bluetooth allowance error */
+ BT_DPM_BT_ALLOWED, /**< bluetooth allowance allowed */
+ BT_DPM_HANDSFREE_ONLY, /**< bluetooth allowance handsfree only */
+ BT_DPM_BT_RESTRICTED, /**< bluetooth allowance restricted */
+} bt_dpm_allow_e;
+
+/**
+* @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+* @brief DPM Policy status
+* @since_tizen 3.0
+*/
+typedef enum {
+ BT_DPM_STATUS_ERROR = -1,
+
+ BT_DPM_ALLOWED = 0, /**< DPM Policy status allowed. */
+ BT_DPM_RESTRICTED = 1, /**< DPM Policy status restricted. */
+
+ BT_DPM_ENABLE = 1, /**< DPM Policy status enabled. */
+ BT_DPM_DISABLE = 0, /**< DPM Policy status disabled. */
+
+ BT_DPM_FALSE = 0, /**< DPM Policy status false. */
+ BT_DPM_TRUE = 1, /**< DPM Policy status true. */
+} bt_dpm_status_e;
+
+/**
+* @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
+* @brief DPM Profile states
+* @since_tizen 3.0
+*/
+typedef enum {
+ BT_DPM_POLICY_A2DP_PROFILE_STATE,
+ BT_DPM_POLICY_AVRCP_PROFILE_STATE,
+ BT_DPM_POLICY_BPP_PROFILE_STATE,
+ BT_DPM_POLICY_DUN_PROFILE_STATE,
+ BT_DPM_POLICY_FTP_PROFILE_STATE,
+ BT_DPM_POLICY_HFP_PROFILE_STATE,
+ BT_DPM_POLICY_HSP_PROFILE_STATE,
+ BT_DPM_POLICY_PBAP_PROFILE_STATE,
+ BT_DPM_POLICY_SAP_PROFILE_STATE,
+ BT_DPM_POLICY_SPP_PROFILE_STATE,
+ BT_DPM_PROFILE_NONE,
+} bt_dpm_profile_e;
+
+/**
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
* @brief The handle to control Bluetooth LE scan filter
* @since_tizen 2.4
@@ -352,6 +401,23 @@ typedef struct {
unsigned int time_out; /**< Supervision timeout (msec) */
} bt_le_conn_update_s;
+
+/**
+ * Structure to DPM device list
+ */
+typedef struct {
+ int count;
+ char **devices;
+} bt_dpm_device_list_s;
+
+/**
+ * Structure to DPM uuid list
+ */
+typedef struct {
+ int count;
+ char **uuids;
+} bt_dpm_uuids_list_s;
+
/**
* @}
*/
diff --git a/src/bluetooth-dpm.c b/src/bluetooth-dpm.c
new file mode 100644
index 0000000..5cc906a
--- /dev/null
+++ b/src/bluetooth-dpm.c
@@ -0,0 +1,658 @@
+/*
+ * 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.
+ */
+
+#include <glib.h>
+#include <dlog.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <bluetooth-api.h>
+
+#include "bluetooth.h"
+#include "bluetooth_internal.h"
+#include "bluetooth_private.h"
+
+static int _bt_dpm_get_error_code(int origin_error)
+{
+ switch (origin_error) {
+ case BLUETOOTH_DPM_RESULT_SUCCESS:
+ return BT_ERROR_NONE;
+ case BLUETOOTH_DPM_RESULT_INVALID_PARAM:
+ return BT_ERROR_INVALID_PARAMETER;
+ case BLUETOOTH_DPM_RESULT_NOT_SUPPORTED:
+ return BT_ERROR_NOT_SUPPORTED;
+ case BLUETOOTH_DPM_RESULT_SERVICE_NOT_ENABLED:
+ return BT_ERROR_NOT_ENABLED;
+ case BLUETOOTH_DPM_RESULT_FAIL:
+ case BLUETOOTH_DPM_RESULT_ACCESS_DENIED:
+ default:
+ return BT_ERROR_OPERATION_FAILED;
+ }
+
+}
+
+int bt_dpm_set_allow_bluetooth_mode(bt_dpm_allow_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_allow_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_allow_bluetooth_mode(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_allow_bluetooth_mode(bt_dpm_allow_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_allow_t dpm_value = BLUETOOTH_DPM_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_allow_bluetooth_mode(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_activate_bluetooth_device_restriction(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_activate_bluetooth_device_restriction(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_is_bluetooth_device_restriction_active(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_is_bluetooth_device_restriction_active(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_activate_bluetoooth_uuid_restriction(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_is_bluetooth_uuid_restriction_active(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_is_bluetooth_uuid_restriction_active(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_add_bluetooth_devices_to_blacklist(const char *device_address)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(device_address);
+
+ _bt_convert_address_to_hex(&addr_hex, device_address);
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_add_bluetooth_devices_to_blacklist(&addr_hex));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_add_bluetooth_devices_to_whitelist(const char *device_address)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(device_address);
+
+ _bt_convert_address_to_hex(&addr_hex, device_address);
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_add_bluetooth_devices_to_whitelist(&addr_hex));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_add_bluetooth_uuids_to_blacklist(const char *service_uuid)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_add_bluetooth_uuids_to_blacklist(service_uuid));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_add_bluetooth_uuids_to_whitelist(const char *service_uuid)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_add_bluetooth_uuids_to_whitelist(service_uuid));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_clear_bluetooth_devices_from_blacklist(void)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_clear_bluetooth_devices_from_blacklist());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_clear_bluetooth_devices_from_whitelist(void)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_clear_bluetooth_devices_from_whitelist());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_clear_bluetooth_uuids_from_blacklist(void)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_clear_bluetooth_uuids_from_blacklist());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_clear_bluetooth_uuids_from_whitelist(void)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_clear_bluetooth_uuids_from_whitelist());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+static int __bt_get_bt_dpm_device_list_info_s(bt_dpm_device_list_s **device_info, bt_dpm_device_list_t *source_info)
+{
+ int i;
+
+ BT_CHECK_INPUT_PARAMETER(source_info);
+
+ *device_info = (bt_dpm_device_list_s *)malloc(sizeof(device_info));
+ if (*device_info == NULL)
+ return BT_ERROR_OUT_OF_MEMORY;
+
+ (*device_info)->count = source_info->count;
+ if (source_info->count > 0) {
+ (*device_info)->devices = (char **)malloc(sizeof(char *) *source_info->count);
+ if ((*device_info)->devices)
+ for (i = 0; i < (*device_info)->count; i++) {
+ _bt_convert_address_to_string(&((*device_info)->devices[i]), &(source_info->addresses[i]));
+ BT_INFO("Devices: %s", (*device_info)->devices[i]);
+ }
+ } else {
+ (*device_info)->count = 0;
+ (*device_info)->devices = NULL;
+ }
+ return BT_ERROR_NONE;
+}
+
+int bt_dpm_get_bluetooth_devices_from_blacklist(bt_dpm_device_list_s **device_list)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_device_list_t dev_list;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_devices_from_blacklist(&dev_list));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ error_code = __bt_get_bt_dpm_device_list_info_s(device_list, &dev_list);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_devices_from_whitelist(bt_dpm_device_list_s **device_list)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_device_list_t dev_list;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_devices_from_whitelist(&dev_list));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ error_code = __bt_get_bt_dpm_device_list_info_s(device_list, &dev_list);
+
+ return error_code;
+}
+
+static int __bt_get_bt_dpm_uuid_list_info_s(bt_dpm_uuids_list_s **uuid_list, bt_dpm_uuids_list_t *source_info)
+{
+ int i;
+
+ BT_CHECK_INPUT_PARAMETER(source_info);
+
+ *uuid_list = (bt_dpm_uuids_list_s *)malloc(sizeof(uuid_list));
+ if (*uuid_list == NULL)
+ return BT_ERROR_OUT_OF_MEMORY;
+
+ (*uuid_list)->count = source_info->count;
+
+ if (source_info->count > 0) {
+ (*uuid_list)->uuids = (char **)malloc(sizeof(char *) *source_info->count);
+ if ((*uuid_list)->uuids != NULL) {
+ for (i = 0; i < (*uuid_list)->count; i++) {
+ (*uuid_list)->uuids[i] = strdup(source_info->uuids[i]);
+ if ((*uuid_list)->uuids[i] != NULL)
+ BT_INFO("UUID: %s", (*uuid_list)->uuids[i]);
+ }
+ }
+ } else {
+ (*uuid_list)->count = 0;
+ (*uuid_list)->uuids = NULL;
+ }
+
+ return BT_ERROR_NONE;
+}
+
+int bt_dpm_get_bluetooth_uuids_from_blacklist(bt_dpm_uuids_list_s **uuid_list)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_uuids_list_t uuids;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_uuids_from_blacklist(&uuids));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ error_code = __bt_get_bt_dpm_uuid_list_info_s(uuid_list, &uuids);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_uuids_from_whitelist(bt_dpm_uuids_list_s **uuid_list)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_uuids_list_t uuids;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_uuids_from_whitelist(&uuids));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ error_code = __bt_get_bt_dpm_uuid_list_info_s(uuid_list, &uuids);
+
+ return error_code;
+}
+
+int bt_dpm_remove_bluetooth_device_from_whitelist(const char *device_address)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(device_address);
+
+ _bt_convert_address_to_hex(&addr_hex, device_address);
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_remove_bluetooth_device_from_whitelist(&addr_hex));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_remove_bluetooth_device_from_blacklist(const char *device_address)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(device_address);
+
+ _bt_convert_address_to_hex(&addr_hex, device_address);
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_remove_bluetooth_device_from_blacklist(&addr_hex));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_remove_bluetooth_uuid_from_whitelist(const char *service_uuid)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_remove_bluetooth_uuid_from_whitelist(service_uuid));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_remove_bluetooth_uuid_from_blacklist(const char *service_uuid)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_remove_bluetooth_uuid_from_blacklist(service_uuid));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_set_allow_bluetooth_outgoing_call(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_allow_bluetooth_outgoing_call(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_allow_bluetooth_outgoing_call(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_allow_bluetooth_outgoing_call(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_pairing_state(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_pairing_state(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_pairing_state(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_pairing_state(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_profile_state(bt_dpm_profile_e profile, bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+ bt_dpm_profile_t dpm_profile = profile;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_profile_state(dpm_profile, dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_profile_state(bt_dpm_profile_e profile, bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_profile_state(profile, &dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_desktop_connectivity_state(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_desktop_connectivity_state(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_desktop_connectivity_state(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_desktop_connectivity_state(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_discoverable_state(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_discoverable_state(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_discoverable_state(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_discoverable_state(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_limited_discoverable_state(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_limited_discoverable_state(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_limited_discoverable_state(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_limited_discoverable_state(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
+
+int bt_dpm_set_bluetooth_data_transfer_state(bt_dpm_status_e value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = value;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_set_bluetooth_data_transfer_state(dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_dpm_get_bluetooth_data_transfer_state(bt_dpm_status_e *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bt_dpm_status_t dpm_value = BLUETOOTH_DPM_STATUS_ERROR;
+
+ BT_CHECK_BT_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+
+ error_code = _bt_dpm_get_error_code(bluetooth_dpm_get_bluetooth_data_transfer_state(&dpm_value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ *value = dpm_value;
+
+ return error_code;
+}
diff --git a/test/bt_unit_test.c b/test/bt_unit_test.c
index 81b8874..4e76e68 100644
--- a/test/bt_unit_test.c
+++ b/test/bt_unit_test.c
@@ -157,6 +157,8 @@ tc_table_t tc_main[] = {
, BT_UNIT_TEST_TABLE_IPSP},
{"HDP"
, BT_UNIT_TEST_TABLE_HDP},
+ {"DPM"
+ , BT_UNIT_TEST_TABLE_DPM},
#ifdef TIZEN_WEARABLE
{"HF Role"
, BT_UNIT_TEST_TABLE_HF},
@@ -824,6 +826,89 @@ tc_table_t tc_HDP[] = {
{NULL , 0x0000},
};
+tc_table_t tc_DPM[] = {
+ /* DPM functions */
+ {"BACK"
+ , BT_UNIT_TEST_FUNCTION_BACK},
+ {"bt_dpm_Set_default_policies"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_DEFAULT_POLICIES},
+ {"bt_dpm_set_allow_bluetooth_mode"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE},
+ {"bt_dpm_get_allow_bluetooth_mode"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_BLUETOOTH_MODE},
+ {"bt_dpm_activate_bluetooth_device_restriction"
+ , BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION},
+ {"bt_dpm_is_bluetooth_device_restriction_active"
+ , BT_UNIT_TEST_FUNCTION_DPM_IS_DEVICE_RESTRICTIO_ACTIVATE},
+ {"bt_dpm_activate_bluetoooth_uuid_restriction"
+ , BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION},
+ {"bt_dpm_is_bluetooth_uuid_restriction_active"
+ , BT_UNIT_TEST_FUNCTION_DPM_IS_UUID_RESTRICTIO_ACTIVATE},
+ {"bt_dpm_add_bluetooth_devices_to_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST},
+ {"bt_dpm_add_bluetooth_devices_to_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST},
+ {"bt_dpm_add_bluetooth_uuids_to_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST},
+ {"bt_dpm_add_bluetooth_uuids_to_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST},
+ {"bt_dpm_get_bluetooth_devices_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_BLACKLIST},
+ {"bt_dpm_get_bluetooth_devices_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_WHITELIST},
+ {"bt_dpm_get_bluetooth_uuids_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_BLACKLIST},
+ {"bt_dpm_get_bluetooth_uuids_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_WHITELIST},
+ {"bt_dpm_clear_bluetooth_devices_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_BLACKLIST},
+ {"bt_dpm_clear_bluetooth_devices_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_WHITELIST},
+ {"bt_dpm_clear_bluetooth_uuids_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_BLACKLIST},
+ {"bt_dpm_clear_bluetooth_uuids_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_WHITELIST},
+ {"bt_dpm_remove_bluetooth_device_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST},
+ {"bt_dpm_remove_bluetooth_device_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST},
+ {"bt_dpm_remove_bluetooth_uuid_from_blacklist"
+ , BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST},
+ {"bt_dpm_remove_bluetooth_uuid_from_whitelist"
+ , BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST},
+ {"bt_dpm_set_allow_bluetooth_outgoing_call"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL},
+ {"bt_dpm_get_allow_bluetooth_outgoing_call"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_OUTGOING_CALL},
+ {"bt_dpm_set_bluetooth_pairing_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE},
+ {"bt_dpm_get_bluetooth_pairing_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_PAIRING_STATE},
+ {"bt_dpm_set_bluetooth_profile_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE},
+ {"bt_dpm_get_bluetooth_profile_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE},
+ {"bt_dpm_set_bluetooth_desktop_connectivity_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE},
+ {"bt_dpm_get_bluetooth_desktop_connectivity_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_DESKTOP_CONNECTIVITY_STATE},
+ {"bt_dpm_set_bluetooth_discoverable_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE},
+ {"bt_dpm_get_bluetooth_discoverable_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_DISCOVERABLE_STATE},
+ {"bt_dpm_set_bluetooth_limited_discoverable_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE},
+ {"bt_dpm_get_bluetooth_limited_discoverable_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_LIMITED_DISCOVERABLE_STATE},
+ {"bt_dpm_set_bluetooth_data_transfer_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE},
+ {"bt_dpm_get_bluetooth_data_transfer_state"
+ , BT_UNIT_TEST_FUNCTION_DPM_GET_DATA_TRANSFER_STATE},
+ {"Select this menu to set parameters and then select the function again."
+ , BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
+ {NULL , 0x0000},
+};
+
#ifdef TIZEN_WEARABLE
tc_table_t tc_hf[] = {
/* Handsfree role functions */
@@ -970,6 +1055,9 @@ void tc_usage_print(void)
case BT_UNIT_TEST_TABLE_HDP:
tc_table = tc_HDP;
break;
+ case BT_UNIT_TEST_TABLE_DPM:
+ tc_table = tc_DPM;
+ break;
#ifdef TIZEN_WEARABLE
case BT_UNIT_TEST_TABLE_HF:
tc_table = tc_hf;
@@ -3554,6 +3642,253 @@ int test_set_params(int test_id, char *param)
break;
}
+ case BT_UNIT_TEST_TABLE_DPM: {
+ switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_HANDSFREE_ONLY, \n2.BT_DPM_BT_RESTRICTED");
+ break;
+ }
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION:
+ case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE:
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
+ break;
+ }
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ }
+
+ if (param_index > 0) {
+ int len = strlen(param);
+ g_test_param.params[param_index - 1] = g_malloc0(len + 1);
+ /* Remove new line character */
+ param[len - 1] = '\0';
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input device Address");
+ break;
+ }
+ param_index++;
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST:
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ }
+
+ if (param_index > 0) {
+ int len = strlen(param);
+ g_test_param.params[param_index - 1] = g_malloc0(len + 1);
+ /* Remove new line character */
+ param[len - 1] = '\0';
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input UUID");
+ break;
+ }
+ param_index++;
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE: {
+ if (param_index == 0) {
+ g_test_param.param_count = 2;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
+ \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
+ \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
+ \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
+ \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
+ \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
+ \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
+ \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
+ \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
+ \n9.BT_DPM_POLICY_SPP_PROFILE_STATE, \
+ \n10.BT_DPM_PROFILE_NONE");
+ break;
+ case 1:
+ TC_PRT("Input Value Type (avail. : \n0.BT_DPM_BT_ALLOWED, \n1.BT_DPM_RESTRICTED");
+ break;
+ }
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Profile Type (avail. : \n0.BT_DPM_POLICY_A2DP_PROFILE_STATE, \
+ \n1.BT_DPM_POLICY_AVRCP_PROFILE_STATE, \
+ \n2.BT_DPM_POLICY_BPP_PROFILE_STATE, \
+ \n3.BT_DPM_POLICY_DUN_PROFILE_STATE, \
+ \n4.BT_DPM_POLICY_FTP_PROFILE_STATE, \
+ \n5.BT_DPM_POLICY_HFP_PROFILE_STATE, \
+ \n6.BT_DPM_POLICY_HSP_PROFILE_STATE, \
+ \n7.BT_DPM_POLICY_PBAP_PROFILE_STATE, \
+ \n8.BT_DPM_POLICY_SAP_PROFILE_STATE, \
+ \n9.BT_DPM_POLICY_SPP_PROFILE_STATE, \
+ \n10.BT_DPM_PROFILE_NONE");
+ break;
+ }
+
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+
+ default:
+ TC_PRT("There is no param to set\n");
+ need_to_set_params = false;
+ break;
+ break;
+ }
+ break;
+ }
+
case BT_UNIT_TEST_TABLE_AVRCP: {
switch (test_id) {
default:
@@ -3595,6 +3930,7 @@ int test_set_params(int test_id, char *param)
break;
}
+
#ifdef TIZEN_WEARABLE
case BT_UNIT_TEST_TABLE_HF: {
switch (test_id) {
@@ -7184,6 +7520,516 @@ int test_input_callback(void *data)
}
break;
}
+ case BT_UNIT_TEST_TABLE_DPM: {
+ switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DEFAULT_POLICIES: {
+ const char *hfp_uuid = "0000111f-0000-1000-8000-00805f9b34fb";
+ const char *hsp_uuid = "00001112-0000-1000-8000-00805f9b34fb";
+ const char *a2dp_uuid = "0000110D-0000-1000-8000-00805F9B34FB";
+ const char *avrcp_target_uuid = "0000110c-0000-1000-8000-00805f9b34fb";
+
+ ret = bt_dpm_set_allow_bluetooth_mode(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_allow_bluetooth_mode : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_activate_bluetooth_device_restriction(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_activate_bluetooth_device_restriction : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_activate_bluetoooth_uuid_restriction(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_activate_bluetoooth_uuid_restriction : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_allow_bluetooth_outgoing_call(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_allow_bluetooth_outgoing_call : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_pairing_state(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_pairing_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_profile_state(BT_DPM_POLICY_HFP_PROFILE_STATE,
+ BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_profile_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_desktop_connectivity_state(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_desktop_connectivity_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_discoverable_state(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_discoverable_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_limited_discoverable_state(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_limited_discoverable_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_set_bluetooth_data_transfer_state(BT_DPM_BT_ALLOWED);
+
+ TC_PRT("bt_dpm_set_bluetooth_data_transfer_state : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(spp_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(opp_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(hid_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(hfp_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(hsp_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(a2dp_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(avrcp_target_uuid);
+
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+ ret = bt_dpm_set_allow_bluetooth_mode(value);
+
+ TC_PRT("bt_dpm_set_allow_bluetooth_mode : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_BLUETOOTH_MODE: {
+ bt_dpm_allow_e value = BT_DPM_ERROR;
+ ret = bt_dpm_get_allow_bluetooth_mode(&value);
+ TC_PRT("bt_dpm_get_allow_bluetooth_mode : allow: %d, returns %s\n",
+ value , __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_activate_bluetooth_device_restriction(value);
+ TC_PRT("bt_dpm_activate_bluetooth_device_restriction : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_IS_DEVICE_RESTRICTIO_ACTIVATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_is_bluetooth_device_restriction_active(&value);
+ TC_PRT("bt_dpm_is_bluetooth_device_restriction_active : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_activate_bluetoooth_uuid_restriction(value);
+ TC_PRT("bt_dpm_activate_bluetoooth_uuid_restriction : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_IS_UUID_RESTRICTIO_ACTIVATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_is_bluetooth_uuid_restriction_active(&value);
+ TC_PRT("bt_dpm_is_bluetooth_uuid_restriction_active : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_add_bluetooth_devices_to_blacklist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_add_bluetooth_devices_to_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_add_bluetooth_devices_to_whitelist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_add_bluetooth_devices_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_add_bluetooth_uuids_to_blacklist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_add_bluetooth_uuids_to_whitelist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_add_bluetooth_uuids_to_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_BLACKLIST: {
+ bt_dpm_device_list_s *device_list = NULL;
+ int i = 0;
+ char *str = NULL;
+ ret = bt_dpm_get_bluetooth_devices_from_blacklist(&device_list);
+ TC_PRT("bt_dpm_get_bluetooth_devices_from_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ if (device_list) {
+ TC_PRT("list len %d", device_list->count);
+ for (i = 0; i<device_list->count; i++) {
+ str = g_strdup((const gchar*)device_list->devices[i]);
+ TC_PRT("%d: %s\n", i, str);
+ g_free(str);
+ free(device_list->devices[i]);
+ }
+ free(device_list);
+ }
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_WHITELIST: {
+ bt_dpm_device_list_s *device_list = NULL;
+ int i = 0;
+ char *str = NULL;
+ ret = bt_dpm_get_bluetooth_devices_from_whitelist(&device_list);
+ TC_PRT("bt_dpm_get_bluetooth_devices_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ if (device_list) {
+ TC_PRT("list len %d", device_list->count);
+ for (i = 0; i<device_list->count; i++) {
+ str = g_strdup((const gchar*)device_list->devices[i]);
+ TC_PRT("%d: %s\n", i, str);
+ g_free(str);
+ free(device_list->devices[i]);
+ }
+ free(device_list);
+ }
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_BLACKLIST: {
+ bt_dpm_uuids_list_s *uuids_list = NULL;
+ int i = 0;
+ char *str = NULL;
+ ret = bt_dpm_get_bluetooth_uuids_from_blacklist(&uuids_list);
+ TC_PRT("bt_dpm_get_bluetooth_uuids_from_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ if (uuids_list) {
+ TC_PRT("list len %d", uuids_list->count);
+ for (i = 0; i<uuids_list->count; i++) {
+ str = g_strdup(uuids_list->uuids[i]);
+ TC_PRT("%d: %s\n", i, str);
+ g_free(str);
+ free(uuids_list->uuids[i]);
+ }
+ free(uuids_list);
+ }
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_WHITELIST: {
+ bt_dpm_uuids_list_s *uuids_list = NULL;
+ int i = 0;
+ char *str = NULL;
+ ret = bt_dpm_get_bluetooth_uuids_from_whitelist(&uuids_list);
+ TC_PRT("bt_dpm_get_bluetooth_uuids_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+
+ if (uuids_list) {
+ TC_PRT("list len %d", uuids_list->count);
+ for (i = 0; i<uuids_list->count; i++) {
+ str = g_strdup(uuids_list->uuids[i]);
+ TC_PRT("%d: %s\n", i, str);
+ g_free(str);
+ free(uuids_list->uuids[i]);
+ }
+ free(uuids_list);
+ }
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_BLACKLIST:
+ ret = bt_dpm_clear_bluetooth_devices_from_blacklist();
+ TC_PRT("bt_dpm_clear_bluetooth_devices_from_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_WHITELIST:
+ ret = bt_dpm_clear_bluetooth_devices_from_whitelist();
+ TC_PRT("bt_dpm_clear_bluetooth_devices_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_BLACKLIST:
+ ret = bt_dpm_clear_bluetooth_uuids_from_blacklist();
+ TC_PRT("bt_dpm_clear_bluetooth_uuids_from_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_WHITELIST:
+ ret = bt_dpm_clear_bluetooth_uuids_from_whitelist();
+ TC_PRT("bt_dpm_clear_bluetooth_uuids_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_remove_bluetooth_device_from_blacklist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_add_bluetooth_devices_to_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_remove_bluetooth_device_from_whitelist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_remove_bluetooth_device_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_remove_bluetooth_uuid_from_blacklist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_remove_bluetooth_device_from_blacklist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST:
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+
+ ret = bt_dpm_remove_bluetooth_uuid_from_whitelist(g_test_param.params[0]);
+ TC_PRT("bt_dpm_remove_bluetooth_uuid_from_whitelist : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_set_allow_bluetooth_outgoing_call(value);
+ TC_PRT("bt_dpm_set_allow_bluetooth_outgoing_call : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_OUTGOING_CALL: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_allow_bluetooth_outgoing_call(&value);
+ TC_PRT("bt_dpm_get_allow_bluetooth_outgoing_call : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_set_bluetooth_pairing_state(value);
+ TC_PRT("bt_dpm_set_bluetooth_pairing_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_PAIRING_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_bluetooth_pairing_state(&value);
+ TC_PRT("bt_dpm_get_bluetooth_pairing_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE: {
+ int profile, value;
+ if (g_test_param.param_count < 2) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ profile = atoi(g_test_param.params[0]);
+ value = atoi(g_test_param.params[1]);
+
+ ret = bt_dpm_set_bluetooth_profile_state(profile, value);
+ TC_PRT("bt_dpm_set_bluetooth_profile_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ int profile;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ profile = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_get_bluetooth_profile_state(profile, &value);
+ TC_PRT("bt_dpm_get_bluetooth_profile_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_set_bluetooth_desktop_connectivity_state(value);
+ TC_PRT("bt_dpm_set_bluetooth_desktop_connectivity_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_DESKTOP_CONNECTIVITY_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_bluetooth_desktop_connectivity_state(&value);
+ TC_PRT("bt_dpm_get_bluetooth_desktop_connectivity_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+ ret = bt_dpm_set_bluetooth_discoverable_state(value);
+ TC_PRT("bt_dpm_set_bluetooth_discoverable_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_DISCOVERABLE_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_bluetooth_discoverable_state(&value);
+ TC_PRT("bt_dpm_get_bluetooth_discoverable_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_set_bluetooth_limited_discoverable_state(value);
+ TC_PRT("bt_dpm_set_bluetooth_limited_discoverable_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_bluetooth_limited_discoverable_state(&value);
+ TC_PRT("bt_dpm_get_bluetooth_limited_discoverable_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE: {
+ int value;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ value = atoi(g_test_param.params[0]);
+
+ ret = bt_dpm_set_bluetooth_data_transfer_state(value);
+ TC_PRT("bt_dpm_set_bluetooth_data_transfer_state : returns %s\n",
+ __bt_get_error_message(ret));
+ __bt_free_test_param(&g_test_param);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_DPM_GET_DATA_TRANSFER_STATE: {
+ bt_dpm_status_e value = BT_DPM_STATUS_ERROR;
+ ret = bt_dpm_get_bluetooth_data_transfer_state(&value);
+ TC_PRT("bt_dpm_get_bluetooth_data_transfer_state : allow: %d, returns %s\n",
+ value, __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
+ need_to_set_params = true;
+ TC_PRT("Select the function again");
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
#ifdef TIZEN_WEARABLE
case BT_UNIT_TEST_TABLE_HF: {
switch (test_id) {
diff --git a/test/bt_unit_test.h b/test/bt_unit_test.h
index 9f33e98..123eb3d 100644
--- a/test/bt_unit_test.h
+++ b/test/bt_unit_test.h
@@ -45,6 +45,7 @@ typedef enum {
BT_UNIT_TEST_TABLE_HID,
BT_UNIT_TEST_TABLE_IPSP,
BT_UNIT_TEST_TABLE_HDP,
+ BT_UNIT_TEST_TABLE_DPM,
#ifdef TIZEN_WEARABLE
BT_UNIT_TEST_TABLE_HF,
BT_UNIT_TEST_TABLE_PBAP_CLIENT,
@@ -340,6 +341,43 @@ typedef enum {
BT_UNIT_TEST_FUNCTION_HDP_UNSET_CONNECTION_CB,
BT_UNIT_TEST_FUNCTION_HDP_SET_DATA_RECEIVED_CB,
BT_UNIT_TEST_FUNCTION_HDP_UNSET_DATA_RECEIVED_CB,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_DEFAULT_POLICIES = 1,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_BLUETOOTH_MODE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_BLUETOOTH_MODE,
+ BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_DEVICE_RESTRICTION,
+ BT_UNIT_TEST_FUNCTION_DPM_IS_DEVICE_RESTRICTIO_ACTIVATE,
+ BT_UNIT_TEST_FUNCTION_DPM_ACTIVATE_UUID_RESTRICTION,
+ BT_UNIT_TEST_FUNCTION_DPM_IS_UUID_RESTRICTIO_ACTIVATE,
+ BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_ADD_DEVICES_TO_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_ADD_UUIDS_TO_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_DEVICES_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_UUIDS_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_CLEAR_DEVICES_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_CLEAR_UUIDS_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_REMOVE_DEVICE_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_BLACKLIST,
+ BT_UNIT_TEST_FUNCTION_DPM_REMOVE_UUIDS_FROM_WHITELIST,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_ALLOW_OUTGOING_CALL,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_ALLOW_OUTGOING_CALL,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_PAIRING_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_PAIRING_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_PROFILE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_PROFILE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_DESKTOP_CONNECTIVITY_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_DESKTOP_CONNECTIVITY_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_DISCOVERABLE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_DISCOVERABLE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_LIMITED_DISCOVERABLE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_LIMITED_DISCOVERABLE_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_SET_DATA_TRANSFER_STATE,
+ BT_UNIT_TEST_FUNCTION_DPM_GET_DATA_TRANSFER_STATE,
#ifdef TIZEN_WEARABLE
BT_UNIT_TEST_FUNCTION_HF_INITIALIZE = 1,
BT_UNIT_TEST_FUNCTION_HF_DEINITIALIZE,