// NOTE: Unconditionally dispatch the event to make sure a callback with
// the most recent codec info is generated.
- btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, NULL, 0);
+ btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, &p_peer->addr,
+ sizeof(RawAddress));
return p_sink;
}
}
done:
- // NOTE: We uncoditionally send the upcall even if there is no change
+ // NOTE: We unconditionally send the upcall even if there is no change
// or the user config failed. Thus, the caller would always know whether the
// request succeeded or failed.
// NOTE: Currently, the input is restarted by sending an upcall
// and informing the Media Framework about the change.
- btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, NULL, 0);
+ RawAddress empty_raw_address = RawAddress::kEmpty;
+ RawAddress* p_addr;
+ if (p_peer != nullptr) {
+ p_addr = &p_peer->addr;
+ } else {
+ p_addr = &empty_raw_address;
+ }
+ btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, p_addr,
+ sizeof(RawAddress));
return success;
}
if (restart_input || config_updated) {
// NOTE: Currently, the input is restarted by sending an upcall
// and informing the Media Framework about the change.
- btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, NULL, 0);
+ btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, &p_peer->addr,
+ sizeof(RawAddress));
}
return true;
if (config_updated) {
// NOTE: Currently, the input is restarted by sending an upcall
// and informing the Media Framework about the change.
- btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, NULL, 0);
+ btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, &p_peer->addr,
+ sizeof(RawAddress));
}
return true;
// NOTE: Unconditionally dispatch the event to make sure a callback with
// the most recent codec info is generated.
- btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, NULL, 0);
+ RawAddress empty_raw_address = RawAddress::kEmpty;
+ btif_dispatch_sm_event(BTIF_AV_SOURCE_CONFIG_UPDATED_EVT, &empty_raw_address,
+ sizeof(RawAddress));
}
* Returns None
*
******************************************************************************/
-static void btif_report_connection_state(btav_connection_state_t state,
- RawAddress* bd_addr) {
+static void btif_report_connection_state(RawAddress* bd_addr,
+ btav_connection_state_t state) {
if (bt_av_sink_callbacks != NULL) {
- HAL_CBACK(bt_av_sink_callbacks, connection_state_cb, state, bd_addr);
+ HAL_CBACK(bt_av_sink_callbacks, connection_state_cb, bd_addr, state);
} else if (bt_av_src_callbacks != NULL) {
- HAL_CBACK(bt_av_src_callbacks, connection_state_cb, state, bd_addr);
+ HAL_CBACK(bt_av_src_callbacks, connection_state_cb, bd_addr, state);
}
}
* Returns None
*
******************************************************************************/
-static void btif_report_audio_state(btav_audio_state_t state,
- RawAddress* bd_addr) {
+static void btif_report_audio_state(RawAddress* bd_addr,
+ btav_audio_state_t state) {
if (bt_av_sink_callbacks != NULL) {
- HAL_CBACK(bt_av_sink_callbacks, audio_state_cb, state, bd_addr);
+ HAL_CBACK(bt_av_sink_callbacks, audio_state_cb, bd_addr, state);
} else if (bt_av_src_callbacks != NULL) {
- HAL_CBACK(bt_av_src_callbacks, audio_state_cb, state, bd_addr);
+ HAL_CBACK(bt_av_src_callbacks, audio_state_cb, bd_addr, state);
}
}
btif_a2dp_source_encoder_user_config_update_req(req);
}
-static void btif_report_source_codec_state(UNUSED_ATTR void* p_data) {
+static void btif_report_source_codec_state(void* p_data) {
+ RawAddress* bd_addr = (RawAddress*)p_data;
btav_a2dp_codec_config_t codec_config;
std::vector<btav_a2dp_codec_config_t> codecs_local_capabilities;
std::vector<btav_a2dp_codec_config_t> codecs_selectable_capabilities;
return;
}
if (bt_av_src_callbacks != NULL) {
- HAL_CBACK(bt_av_src_callbacks, audio_config_cb, codec_config,
+ HAL_CBACK(bt_av_src_callbacks, audio_config_cb, bd_addr, codec_config,
codecs_local_capabilities, codecs_selectable_capabilities);
}
}
}
/* inform the application of the event */
- btif_report_connection_state(state, &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda), state);
/* change state to open/idle based on the status */
btif_sm_change_state(btif_av_cb.sm_handle, av_state);
if (btif_av_cb.peer_sep == AVDT_TSEP_SNK) {
switch (event) {
case BTIF_SM_ENTER_EVT:
/* inform the application that we are entering connecting state */
- btif_report_connection_state(BTAV_CONNECTION_STATE_CONNECTING,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_CONNECTING);
break;
case BTIF_SM_EXIT_EVT:
case BTA_AV_REJECT_EVT:
BTIF_TRACE_WARNING("%s: Received BTA_AV_REJECT_EVT", __func__);
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
if (btif_av_cb.self_initiated_connection) {
btif_queue_advance();
}
/* inform the application of the event */
- btif_report_connection_state(state, &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda), state);
/* change state to open/idle based on the status */
btif_sm_change_state(btif_av_cb.sm_handle, av_state);
if (btif_av_cb.peer_sep == AVDT_TSEP_SNK) {
"%s: device %s is already connecting, reject Connect request to %s",
__func__, btif_av_cb.peer_bda.ToString().c_str(),
target_bda.ToString().c_str());
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &target_bda);
+ btif_report_connection_state(&target_bda,
+ BTAV_CONNECTION_STATE_DISCONNECTED);
}
// Ignore all connection request if we are already opening
btif_queue_advance();
case BTA_AV_CLOSE_EVT:
btif_a2dp_on_stopped(NULL);
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
if (btif_av_cb.self_initiated_connection) {
btif_queue_advance();
break;
case BTIF_AV_DISCONNECT_REQ_EVT:
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
BTA_AvClose(btif_av_cb.bta_handle);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
if (btif_av_cb.self_initiated_connection) {
case BTA_AV_CLOSE_EVT:
/* inform the application that we are disconnecting */
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
break;
}
/* inform the application that we are disconnecting */
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTING,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTING);
break;
case BTA_AV_CLOSE_EVT:
btif_a2dp_on_stopped(NULL);
/* inform the application that we are disconnected */
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
/* change state to idle, send acknowledgement if start is pending */
if (btif_av_cb.flags & BTIF_AV_FLAG_PENDING_START) {
"%s: Moved to opened by Other incoming Connect request: "
"target_bda=%s",
__func__, target_bda.ToString().c_str());
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &target_bda);
+ btif_report_connection_state(&target_bda,
+ BTAV_CONNECTION_STATE_DISCONNECTED);
}
btif_queue_advance();
} break;
* stage, this should usually be followed by focus grant.
* see update_audio_focus_state()
*/
- btif_report_audio_state(BTAV_AUDIO_STATE_STARTED, &(btif_av_cb.peer_bda));
+ btif_report_audio_state(&(btif_av_cb.peer_bda), BTAV_AUDIO_STATE_STARTED);
break;
case BTIF_SM_EXIT_EVT:
}
/* inform the application that we are disconnecting */
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTING,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTING);
/* wait in closing state until fully closed */
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_CLOSING);
if ((btif_av_cb.flags & BTIF_AV_FLAG_LOCAL_SUSPEND_PENDING) == 0)
btif_av_cb.flags |= BTIF_AV_FLAG_REMOTE_SUSPEND;
- btif_report_audio_state(BTAV_AUDIO_STATE_REMOTE_SUSPEND,
- &(btif_av_cb.peer_bda));
+ btif_report_audio_state(&(btif_av_cb.peer_bda),
+ BTAV_AUDIO_STATE_REMOTE_SUSPEND);
} else {
- btif_report_audio_state(BTAV_AUDIO_STATE_STOPPED,
- &(btif_av_cb.peer_bda));
+ btif_report_audio_state(&(btif_av_cb.peer_bda),
+ BTAV_AUDIO_STATE_STOPPED);
}
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_OPENED);
btif_av_cb.flags |= BTIF_AV_FLAG_PENDING_STOP;
btif_a2dp_on_stopped(&p_av->suspend);
- btif_report_audio_state(BTAV_AUDIO_STATE_STOPPED, &(btif_av_cb.peer_bda));
+ btif_report_audio_state(&(btif_av_cb.peer_bda), BTAV_AUDIO_STATE_STOPPED);
/* if stop was successful, change state to open */
if (p_av->suspend.status == BTA_AV_SUCCESS)
btif_a2dp_on_stopped(NULL);
/* inform the application that we are disconnected */
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
break;
BTIF_TRACE_DEBUG(
"%s: Moving State from Opening to Idle due to ACL disconnect",
__func__);
- btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED,
- &(btif_av_cb.peer_bda));
+ btif_report_connection_state(&(btif_av_cb.peer_bda),
+ BTAV_CONNECTION_STATE_DISCONNECTED);
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
}
}