Tizen Native API
5.5
|
Bluetooth Audio API provides functions for connecting to Bluetooth audio devices such as headset, hand-free and headphone.
#include <bluetooth.h>
This API supports the HFP(Hands-Free Profile), HSP(Headset Profile) and A2DP(Advanced Audio Distribution Profile).
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | bt_audio_initialize (void) |
Initializes the Bluetooth profiles related with audio. | |
int | bt_audio_deinitialize (void) |
Deinitializes the Bluetooth profiles related with audio. | |
int | bt_audio_connect (const char *remote_address, bt_audio_profile_type_e type) |
Connects the remote device with the given audio profile, asynchronously. | |
int | bt_audio_disconnect (const char *remote_address, bt_audio_profile_type_e type) |
Disconnects the remote device with the given audio profile, asynchronously. | |
int | bt_audio_set_connection_state_changed_cb (bt_audio_connection_state_changed_cb callback, void *user_data) |
Registers a callback function that will be invoked when the connection state is changed. | |
int | bt_audio_unset_connection_state_changed_cb (void) |
Unregisters a callback function that will be invoked when the connection state is changed. | |
Typedefs | |
typedef void(* | bt_audio_connection_state_changed_cb )(int result, bool connected, const char *remote_address, bt_audio_profile_type_e type, void *user_data) |
Called when the connection state is changed. |
typedef void(* bt_audio_connection_state_changed_cb)(int result, bool connected, const char *remote_address, bt_audio_profile_type_e type, void *user_data) |
Called when the connection state is changed.
This callback is called when the connection state is changed.
[in] | result | The result of changing the connection state |
[in] | connected | The state to be changed. true means connected state, Otherwise, false. |
[in] | remote_address | The remote address |
[in] | type | The type of audio profile except BT_AUDIO_PROFILE_TYPE_ALL |
[in] | user_data | The user data passed from the callback registration function |
Enumerations for the types of profiles related with audio.
int bt_audio_connect | ( | const char * | remote_address, |
bt_audio_profile_type_e | type | ||
) |
Connects the remote device with the given audio profile, asynchronously.
If you input type as BT_AUDIO_PROFILE_TYPE_ALL and connection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
when BT_AUDIO_PROFILE_TYPE_HSP_HFP is connected and BT_AUDIO_PROFILE_TYPE_A2DP is connected.
[in] | remote_address | The remote address |
[in] | type | The type of audio profile |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_audio_deinitialize | ( | void | ) |
Deinitializes the Bluetooth profiles related with audio.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_audio_disconnect | ( | const char * | remote_address, |
bt_audio_profile_type_e | type | ||
) |
Disconnects the remote device with the given audio profile, asynchronously.
If you input type as BT_AUDIO_PROFILE_TYPE_ALL and disconnection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
when BT_AUDIO_PROFILE_TYPE_HSP_HFP is disconnected and BT_AUDIO_PROFILE_TYPE_A2DP is disconnected.
[in] | remote_address | The remote address |
[in] | type | The type of audio profile |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_audio_initialize | ( | void | ) |
Initializes the Bluetooth profiles related with audio.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_audio_set_connection_state_changed_cb | ( | bt_audio_connection_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function that will be invoked when the connection state is changed.
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_audio_unset_connection_state_changed_cb | ( | void | ) |
Unregisters a callback function that will be invoked when the connection state is changed.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_SUPPORTED | Not supported |