如果要改某个状态下的音频链路,那就需要先找出默认的链路是怎么样的,这个可以从log和qact看得到,例如在usb dongle中找到通话的链路。我们在qact看是这样的
static void dfu_MessageHandler(Task task, MessageId id, Message message)
{
UNUSED(task);
UNUSED(message);
DEBUG_LOG("dfu_MessageHandler. MESSAGE:dfu_internal_messages_t:0x%X", id);
switch (id)
{
#ifdef INCLUDE_DFU_PEER
case PEER_SIG_MARSHALLED_MSG_CHANNEL_RX_IND:
dfu_HandlePeerSigMarshalledMsgChannelRxInd((PEER_SIG_MARSHALLED_MSG_CHANNEL_RX_IND_T *)message);
break;
case PEER_SIG_MARSHALLED_MSG_CHANNEL_TX_CFM:
dfu_HandlePeerSigMarshalledMsgChannelTxCfm((PEER_SIG_MARSHALLED_MSG_CHANNEL_TX_CFM_T *)message);
break;
case CON_MANAGER_CONNECTION_IND:
dfu_HandleConManagerConnectionInd((CON_MANAGER_CONNECTION_IND_T*)message);
break;
case PEER_SIG_CONNECTION_IND:
dfu_HandlePeerSigConnectInd((const PEER_SIG_CONNECTION_IND_T *)message);
break;
/* MIRROR PROFILE MESSAGES */
case MIRROR_PROFILE_CONNECT_IND:
{
dfu_task_data_t *the_dfu = Dfu_GetTaskData();
bool is_primary = BtDevice_IsMyAddressPrimary();
if (is_primary)
{
the_dfu->peerProfilesToConnect &= ~DEVICE_PROFILE_MIRROR;
DEBUG_LOG("dfu_MessageHandler (profiles:x%x) pending to connect", the_dfu->peerProfilesToConnect);
}
}
break;
case HANDOVER_PROFILE_CONNECTION_IND:
{
dfu_task_data_t *the_dfu = Dfu_GetTaskData();
bool is_primary = BtDevice_IsMyAddressPrimary();
if (is_primary)
{
the_dfu->peerProfilesToConnect &= ~DEVICE_PROFILE_HANDOVER;
DEBUG_LOG("dfu_MessageHandler (profiles:x%x) pending to connect", the_dfu->peerProfilesToConnect);
}
}
break;
#endif
case CON_MANAGER_CLOSE_ALL_CFM:
{
if(Dfu_GetTaskData()->dfu_reboot_pending_on_acl_close)
{
DEBUG_LOG_INFO("dfu_MessageHandler. CON_MANAGER_CLOSE_ALL_CFM Call UpgradeImageSwap()");
Dfu_GetTaskData()->dfu_reboot_pending_on_acl_close = FALSE;
UpgradeImageSwap();
}
}
break;
/* Message sent in response to UpgradeInit().
* In this case we need to forward to the app to unblock initialisation.
*/
case UPGRADE_INIT_CFM:
{
const UPGRADE_INIT_CFM_T *init_cfm = (const UPGRADE_INIT_CFM_T *)message;
DEBUG_LOG("dfu_MessageHandler. UPGRADE_INIT_CFM %d (sts)",init_cfm->status);
dfu_ForwardInitCfm(init_cfm);
}
break;
/* Message sent during initialisation of the upgrade library
to let the VM application know that a restart has occurred
and reconnection to a host may be required. */
case UPGRADE_RESTARTED_IND:
dfu_HandleRestartedInd((UPGRADE_RESTARTED_IND_T*)message);
break;
/* Message sent to application to request applying a downloaded upgrade.
Note this may include a warm reboot of the device.
Application must respond with UpgradeApplyResponse() */
case UPGRADE_APPLY_IND:
{
#ifdef INCLUDE_DFU_PEER
bool isPrimary = BtDevice_IsMyAddressPrimary();
dfu_task_data_t *the_dfu = Dfu_GetTaskData();
DEBUG_LOG("dfu_MessageHandler UPGRADE_APPLY_IND, isPrimary:%d", isPrimary);
#ifndef HOSTED_TEST_ENVIRONMENT
if (isPrimary)
{
/*
* As per the legacy scheme, Primary reboots post Secondary
* having rebooted. And as part of Secondary reboot, the
* peer links (including DFU L2CAP channel) are
* re-established. Wait for the connections of these other
* peer profiles to complete before Primary reboot, in order
* to avoid und