/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief Disconnects a remote Bluetooth device.
+ * @since_tizen 4.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @param[in] remote_address The address of the remote Bluetooth device
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see bt_device_set_connection_state_changed_cb()
+ */
+int bt_device_disconnect(const char *remote_address);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
* @brief Gets a connection state
* @since_tizen @if WEARABLE @else 2.4 @endif
*
};
+int bt_device_disconnect(const char *remote_address)
+{
+ bluetooth_device_address_t addr_hex = { {0,} };
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address);
+
+ _bt_convert_address_to_hex(&addr_hex, remote_address); /* LCOV_EXCL_START */
+ error_code = _bt_get_error_code(bluetooth_disconnect_device(&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_device_create_bond(const char *device_address)
{
bluetooth_device_address_t addr_hex = { {0,} };
, BT_UNIT_TEST_FUNCTION_DEVICE_SET_BOND_CREATED_CB},
{"bt_device_set_bond_destroyed_cb"
, BT_UNIT_TEST_FUNCTION_DEVICE_SET_BOND_DESTROYED_CB},
+ {"bt_device_disconnect"
+ , BT_UNIT_TEST_FUNCTION_DEVICE_DISCONNECT},
{"bt_device_create_bond"
, BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND},
{"bt_device_create_bond_by_type"
break;
}
+ case BT_UNIT_TEST_FUNCTION_DEVICE_DISCONNECT: {
+ ret = bt_device_disconnect(remote_addr);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+
case BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND: {
ret = bt_device_create_bond(remote_addr);
TC_PRT("returns %s\n", __bt_get_error_message(ret));
BT_UNIT_TEST_FUNCTION_DEVICE_IS_PROFILE_CONNECTED,
BT_UNIT_TEST_FUNCTION_DEVICE_SET_BOND_CREATED_CB,
BT_UNIT_TEST_FUNCTION_DEVICE_SET_BOND_DESTROYED_CB,
+ BT_UNIT_TEST_FUNCTION_DEVICE_DISCONNECT,
BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND,
BT_UNIT_TEST_FUNCTION_DEVICE_CREATE_BOND_BY_TYPE,
BT_UNIT_TEST_FUNCTION_DEVICE_DESTROY_BOND,