*/
int bt_adapter_recover(void);
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
+ * @brief A2DP source/sink role is switched using this API
+ * @since_tizen 4.0
+ * @param[in] Role for A2DP
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ * @retval #BT_ERROR_OPERATION_FAILED Internal Error
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
+ * @see bt_initialize()
+ * @see bt_audio_initialize()
+ */
+int bt_audio_select_role(bt_audio_role_e role);
/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
BT_TRANSFER_OUTBOUND, /**< Outbound Transfer Type */
} bt_opp_transfer_type_t;
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
+ * @brief Enumerations of the Bluetooth A2DP role.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ BT_A2DP_SOURCE,
+ BT_A2DP_SINK,
+} bt_audio_role_e;
+
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_MAP_CLIENT_MODULE
* @brief
}
/* LCOV_EXCL_STOP */
+int bt_audio_select_role(bt_audio_role_e role)
+{
+ BT_CHECK_AUDIO_SUPPORT();
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_AUDIO_INIT_STATUS();
+ int ret;
+
+ ret = bluetooth_audio_select_role(role);
+ ret = _bt_get_error_code(ret);
+
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
+
+ return ret;
+}
+
int bt_audio_set_connection_state_changed_cb(bt_audio_connection_state_changed_cb callback, void *user_data)
{
BT_CHECK_AUDIO_SUPPORT();
, BT_UNIT_TEST_FUNCTION_AG_IS_NREC_ENABLED},
{"bt_ag_switch_headset"
, BT_UNIT_TEST_FUNCTION_AG_SWITCH_HEADSET},
-
+ {"bt_audio_select_role(source)"
+ , BT_UNIT_TEST_FUNCTION_A2DP_SOURCE_ROLE},
+ {"bt_audio_select_role(sink)"
+ , BT_UNIT_TEST_FUNCTION_A2DP_SINK_ROLE},
/* A2DP SCMS-T functions */
{"Select this menu to set parameters and then select the function again."
, BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
need_to_set_params = true;
TC_PRT("Select the function again");
break;
-
+ case BT_UNIT_TEST_FUNCTION_A2DP_SOURCE_ROLE: {
+ bt_audio_role_e role = BT_A2DP_SOURCE;
+ ret = bt_audio_select_role(role);
+ TC_PRT("Asdp Source set change ret = %d", ret);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_A2DP_SINK_ROLE: {
+ bt_audio_role_e role = BT_A2DP_SINK;
+ ret = bt_audio_select_role(role);
+ TC_PRT("Asdp Sink set change ret = %d", ret);
+ break;
+ }
default:
break;
}
BT_UNIT_TEST_FUNCTION_AG_SET_CALL_HANDLING_EVENT_CB,
BT_UNIT_TEST_FUNCTION_AG_IS_NREC_ENABLED,
BT_UNIT_TEST_FUNCTION_AG_SWITCH_HEADSET,
+ BT_UNIT_TEST_FUNCTION_A2DP_SOURCE_ROLE,
+ BT_UNIT_TEST_FUNCTION_A2DP_SINK_ROLE,
BT_UNIT_TEST_FUNCTION_AG_IS_WBS_MODE,
BT_UNIT_TEST_FUNCTION_AG_SET_VENDOR_CMD_CB,
BT_UNIT_TEST_FUNCTION_AG_UNSET_VENDOR_CMD_CB,