static bt_status_t adapter_state = BT_DEACTIVATED;
static bt_adapter_discovery_state_t adapter_discovery_state = ADAPTER_DISCOVERY_STOPPED;
+/* Below masking value will be delivered from bluez */
typedef enum {
- BT_ADAPTER_A2DP_ROLE_SOURCE = 0,
- BT_ADAPTER_A2DP_ROLE_SINK,
+ BT_ADAPTER_A2DP_ROLE_SOURCE = 0x01,
+ BT_ADAPTER_A2DP_ROLE_SINK = 0x02,
} bt_adapter_a2dp_role_e;
static bt_adapter_a2dp_role_e a2dp_role_state = BT_ADAPTER_A2DP_ROLE_SOURCE;
BT_DBG("+");
a2dp_init_pending = FALSE;
- if (a2dp_role == BT_A2DP_SINK_ROLE) {
+ if (a2dp_role & BT_ADAPTER_A2DP_ROLE_SINK) {
BT_INFO("Enable A2DP Sink role");
/* Initialize A2DP Sink */
ret = _bt_audio_initialize(BT_A2DP_SINK_MODULE);
BT_ERR("_bt_audio_initialize(BT_AVRCP_CTRL_MODULE) Failed");
_bt_audio_set_current_role(BLUETOOTH_A2DP_SINK);
- return;
}
- BT_INFO("Enable A2DP Source role");
- /* Initialize A2DP Source */
- ret = _bt_audio_initialize(BT_A2DP_SOURCE_MODULE);
- if (ret != BLUETOOTH_ERROR_NONE)
- BT_ERR("_bt_audio_initialize(BT_A2DP_SOURCE_MODULE) Failed");
+ if (a2dp_role & BT_ADAPTER_A2DP_ROLE_SOURCE) {
+ BT_INFO("Enable A2DP Source role");
+ /* Initialize A2DP Source */
+ ret = _bt_audio_initialize(BT_A2DP_SOURCE_MODULE);
+ if (ret != BLUETOOTH_ERROR_NONE)
+ BT_ERR("_bt_audio_initialize(BT_A2DP_SOURCE_MODULE) Failed");
- /* Initialize AVRCP Target */
- ret = _bt_audio_initialize(BT_AVRCP_MODULE);
- if (ret != BLUETOOTH_ERROR_NONE)
- BT_ERR("_bt_audio_initialize(BT_AVRCP_MODULE) Failed");
+ /* Initialize AVRCP Target */
+ ret = _bt_audio_initialize(BT_AVRCP_MODULE);
+ if (ret != BLUETOOTH_ERROR_NONE)
+ BT_ERR("_bt_audio_initialize(BT_AVRCP_MODULE) Failed");
+
+ _bt_audio_set_current_role(BLUETOOTH_A2DP_SOURCE);
+ }
- _bt_audio_set_current_role(BLUETOOTH_A2DP_SOURCE);
BT_DBG("-");
}
BT_INFO("a2dp role: [%u]", *a2dp_role);
+ /* In Fhub case, both role(Source|Sink, 0x03) can be delivered */
__bt_handle_pending_a2dp_init(*a2dp_role);
if (TIZEN_FEATURE_FHUB_REFERENCE) {
if (TIZEN_FEATURE_DA_REFERENCE) {
/* If non-Fhub, visible off even if headless device.
* If Fhub, visible on when a2dp role sink(speaker). otherwise, visible off */
- if (TIZEN_FEATURE_FHUB_REFERENCE && a2dp_role_state == BT_ADAPTER_A2DP_ROLE_SINK) {
+ if (TIZEN_FEATURE_FHUB_REFERENCE && a2dp_role_state & BT_ADAPTER_A2DP_ROLE_SINK) {
BT_DBG("It is initial state.. Set General Discoverable Mode");
if (BLUETOOTH_ERROR_NONE != _bt_set_discoverable_mode(
BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0))
if (TIZEN_FEATURE_FHUB_REFERENCE) {
BT_DBG("timeout : %d, a2dp_role : %d", timeout, a2dp_role_state);
- if (timeout == 0 && a2dp_role_state == BT_ADAPTER_A2DP_ROLE_SINK) {
+ if (timeout == 0 && a2dp_role_state & BT_ADAPTER_A2DP_ROLE_SINK) {
BT_DBG("It is initial state.. Set General Discoverable Mode");
if (_bt_set_discoverable_mode(
BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,