void hfpHandlerConnectInd( const HFP_SLC_CONNECT_IND_T *ind ) { /* Cancel inquiry and throw away results if one is in progress */ inquiryStop(); /* We support more than one HFP so check which one this request is for */ if ((theHeadset.profile_connected == hfp_no_profile) && (stateManagerGetHfpState() != headsetPoweringOn)) { HfpSlcConnectResponse(ind->hfp, 1, &ind->addr, 0); /* See whether we are connecting as HSP or HFP */ if (ind->hfp == theHeadset.hfp) { theHeadset.profile_connected = hfp_handsfree_profile; } else if (ind->hfp == theHeadset.hsp) { theHeadset.profile_connected = hfp_headset_profile; } else /* Something is wrong we should be either hfp or hsp */ Panic(); } else { /* Reject the connect attempt we're already connected */ HfpSlcConnectResponse(ind->hfp, 0, &ind->addr, 0); } theHeadset.LinkLossAttemptHfp = 0; }
/**************************************************************************** NAME sinkHandleSlcConnectInd DESCRIPTION Handle a request to establish an SLC from the AG. RETURNS void */ void sinkHandleSlcConnectInd( const HFP_SLC_CONNECT_IND_T *ind ) { if(ind->accepted) { /* Cancel inquiry and throw away results if one is in progress, allow subwoofer inquiry to continue*/ if(theSink.inquiry.action != rssi_subwoofer) inquiryStop(); /* set flag indicating a connection is in progress */ gSlcData.gSlcConnectRemote = TRUE; } }
void handleUEMessage( Task task, MessageId id, Message message ) { headsetHfpState lState = stateManagerGetHfpState() ; /* If we do not want the event received to be indicated then set this to FALSE. */ bool lIndicateEvent = TRUE ; if (theHeadset.ProfileLibrariesInitialising) { if (!eventAllowedWhileProfilesInitialising(id)) { EVENTS_DEBUG(("Event 0x%x while profiles initialising - queue\n",id)); MessageSendConditionally(&theHeadset.task, id, 0, &theHeadset.ProfileLibrariesInitialising); return; } } /* Deal with user generated Event specific actions*/ switch ( id ) { /*these are the events that are not user generated and can occur at any time*/ case EventOkBattery: case EventChargerDisconnected: case EventLEDEventComplete: case EventTrickleCharge: case EventFastCharge: case EventLowBattery: case EventPowerOff: case EventLinkLoss: case EventSLCConnected: case EventA2dpConnected: case EventError: case EventChargeError: case EventCancelLedIndication: case EventAutoSwitchOff: case EventHfpReconnectFailed: case EventA2dpReconnectFailed: /*do nothing for these events*/ break ; default: break; } switch (id) { case EventPowerOn: EVENTS_DEBUG(("EventPowerOn\n")); if (!theHeadset.headsetPoweredOn) { theHeadset.headsetPoweredOn = TRUE; theHeadset.a2dp_list_index = 0xf; theHeadset.hfp_list_index = 0xf; theHeadset.switch_a2dp_source = FALSE; stateManagerPowerOn(); if(theHeadset.Timeouts.EncryptionRefreshTimeout_m != 0) MessageSendLater(&theHeadset.task, APP_EVENT_REFRESH_ENCRYPTION, 0, D_MIN(theHeadset.Timeouts.EncryptionRefreshTimeout_m)); theHeadset.PowerOffIsEnabled = TRUE ; } else { lIndicateEvent = FALSE ; } break; case EventPowerOff: EVENTS_DEBUG(("EventPowerOff\n")); if (!theHeadset.PowerOffIsEnabled) { EVENTS_DEBUG(("Power off disabled - ignore event\n")); lIndicateEvent = FALSE ; break; } theHeadset.headsetPoweredOn = FALSE; theHeadset.a2dp_list_index = 0xf; theHeadset.hfp_list_index = 0xf; theHeadset.switch_a2dp_source = FALSE; stateManagerEnterPoweringOffState(); AuthResetConfirmationFlags(); if (theHeadset.gMuted) VolumeMuteOff() ; hfpCallClearQueuedEvent() ; if(theHeadset.Timeouts.EncryptionRefreshTimeout_m != 0) MessageCancelAll ( &theHeadset.task, APP_EVENT_REFRESH_ENCRYPTION) ; MessageCancelAll ( &theHeadset.task , EventPairingFail) ; break; case EventEnterPairing: EVENTS_DEBUG(("EventEnterPairing\n")); stateManagerEnterConnDiscoverableState( ) ; break ; case EventPairingFail: EVENTS_DEBUG(("EventPairingFail\n")); if (lState != headsetTestMode) { stateManagerEnterHfpConnectableState( TRUE) ; } break ; case EventPairingSuccessful: EVENTS_DEBUG(("EventPairingSuccessful\n")); if (lState == headsetConnDiscoverable) { stateManagerEnterHfpConnectableState( FALSE) ; } break ; case EventConfirmationAccept: EVENTS_DEBUG(("EventConfirmationAccept\n")); headsetPairingAcceptRes(); break; case EventConfirmationReject: EVENTS_DEBUG(("EventConfirmationReject\n")); headsetPairingRejectRes(); break; case EventToggleDebugKeys: EVENTS_DEBUG(("EventToggleDebugKeys\n")); /* if debug keys functionality enabled toggle current state */ if (theHeadset.features.debugKeysEnabled) { ConnectionSmSecModeConfig(&theHeadset.task, cl_sm_wae_acl_owner_none, !theHeadset.debugKeysInUse, TRUE); } break; case EventSLCConnected: EVENTS_DEBUG(("EventSLCConnected\n")); hfpCallRecallQueuedEvent() ; break; case EventLinkLoss: EVENTS_DEBUG(("EventLinkLoss\n")); break; case EventSLCDisconnected: EVENTS_DEBUG(("EventSLCDisconnected\n")); if (lState == headsetPoweringOn ) lIndicateEvent = FALSE ; theHeadset.voice_recognition_enabled = FALSE; break; case EventEstablishSLC: EVENTS_DEBUG(("EventEstablishSLC\n")); /* Cancel inquiry and throw away results if one is in progress */ inquiryStop(); if (theHeadset.slcConnectFromPowerOn) { /* This is from power on so carry out the power on connect sequence */ lIndicateEvent = FALSE ; } else { bdaddr bd_addr; /* Try a connection attempt to Last AG. */ if (!hfpSlcConnectBdaddrRequest( hfp_handsfree_profile, &bd_addr ) ) lIndicateEvent = FALSE ; } break; case EventHfpReconnectFailed: EVENTS_DEBUG(("EventHfpReconnectFailed\n")); break; case EventA2dpReconnectFailed: EVENTS_DEBUG(("EventA2dpReconnectFailed\n")); break; case EventInitateVoiceDial: EVENTS_DEBUG(("EventInitateVoiceDial [%d]\n", theHeadset.voice_recognition_enabled )) ; /* Toggle the voice dial behaviour depending on whether we are currently active */ if (theHeadset.voice_recognition_enabled) { hfpCallCancelVoiceDial() ; lIndicateEvent = FALSE ; } else { if (!hfpCallInitiateVoiceDial()) lIndicateEvent = FALSE ; } break ; case EventLastNumberRedial: if (theHeadset.features.LNRCancelsVoiceDialIfActive) { if (theHeadset.voice_recognition_enabled) { MessageSend(&theHeadset.task, EventInitateVoiceDial, 0); lIndicateEvent = FALSE ; break; } } EVENTS_DEBUG(("EventLastNumberRedial\n" )) ; if (!hfpCallInitiateLNR()) lIndicateEvent = FALSE ; break ; case EventAnswer: EVENTS_DEBUG(("EventAnswer\n" )) ; /* Call the HFP lib function, this will determine the AT cmd to send depending on whether the profile instance is HSP or HFP compliant. */ hfpCallAnswer(); break ; case EventReject: EVENTS_DEBUG(("EventReject\n" )) ; /* Reject incoming call - only valid for instances of HFP. */ hfpCallReject(); break ; case EventCancelEnd: if (theHeadset.features.EndCallWithNoSCOtransfersAudio && !HfpGetAudioSink(theHeadset.hfp_hsp)) { lIndicateEvent = FALSE; MessageSend(&theHeadset.task, EventTransferToggle, 0); } else { EVENTS_DEBUG(("EventCancelEnd\n" )) ; /* Terminate the current ongoing call process */ hfpCallHangUp(); } break ; case EventTransferToggle : EVENTS_DEBUG(("EventTransferToggle\n")) ; hfpCallTransferToggle() ; break ; case EventSCOLinkOpen : EVENTS_DEBUG(("EventScoLinkOpen\n")) ; break ; case EventSCOLinkClose: EVENTS_DEBUG(("EventScoLinkClose\n")) ; break ; case EventResetPairedDeviceList: EVENTS_DEBUG(("EventResetPairedDeviceList\n")) ; if ( stateManagerIsHfpConnected () ) { /* Then we have an SLC active */ hfpSlcDisconnect(); } if ( stateManagerIsA2dpConnected() ) { a2dpDisconnectRequest(); } configManagerReset() ; break ; case EventToggleMute: EVENTS_DEBUG(("EventToggleMute\n")) ; VolumeToggleMute() ; break ; case EventMuteOn : EVENTS_DEBUG(("EventMuteOn\n")) ; VolumeMuteOn() ; break ; case EventMuteOff: EVENTS_DEBUG(("EventMuteOff\n")) ; VolumeMuteOff() ; break ; case EventMuteReminder : EVENTS_DEBUG(("EventMuteReminder\n")) ; MessageSendLater( &theHeadset.task , EventMuteReminder , 0 ,D_SEC(theHeadset.Timeouts.MuteRemindTime_s ) ) ; break; case EventEnterDutState : EVENTS_DEBUG(("EventEnterDutState\n")) ; stateManagerEnterTestModeState() ; break; case EventEnterDutMode : EVENTS_DEBUG(("EventEnterDutMode\n")) ; if (lState != headsetTestMode) { MessageSend( task , EventEnterDutState, 0 ) ; } ConnectionEnterDutMode(); break; case EventEnterTXContTestMode: EVENTS_DEBUG(("EventEnterTXContTestMode\n")); if (lState != headsetTestMode) { MessageSend( task , EventEnterDutState, 0 ) ; } MessageSendLater( task , APP_TX_TEST_MODE, 0, 1000 ) ; break; case EventResetComplete: EVENTS_DEBUG(("EventResetComplete\n")); break; case EventError: EVENTS_DEBUG(("EventError\n")) ; break; case EventEndOfCall : EVENTS_DEBUG(("EventEndOfCall\n")) ; break; case EventA2dpConnected: EVENTS_DEBUG(("EventA2dpConnected\n")) ; break; case EventA2dpDisconnected: EVENTS_DEBUG(("EventA2dpDisconnected\n")) ; if (lState == headsetPoweringOn ) lIndicateEvent = FALSE ; break; case EventVolumeMax: EVENTS_DEBUG(("EventVolumeMax\n")); break; case EventVolumeMin: EVENTS_DEBUG(("EventVolumeMin\n")); break; case EventPlay: EVENTS_DEBUG(("EventPlay\n")); /* Always indicate play event as will try to connect A2DP if not already connected */ avrcpEventPlay(); break; case EventPause: EVENTS_DEBUG(("EventPause\n")); avrcpEventPause(); break; case EventStop: EVENTS_DEBUG(("EventStop\n")); avrcpEventStop(); break; case EventSkipForward: /* Only indicate event if AVRCP connected */ if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventSkipForward\n")); avrcpEventSkipForward(); } else { lIndicateEvent = FALSE ; } break; case EventSkipBackward: /* Only indicate event if AVRCP connected */ if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventSkipBackward\n")); avrcpEventSkipBackward(); } else { lIndicateEvent = FALSE ; } break; case EventFFWDPress: if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventFFWDPress\n")); avrcpEventFastForwardPress(); } else { lIndicateEvent = FALSE ; } break; case EventFFWDRelease: if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventFFWDRelease\n")); avrcpEventFastForwardRelease(); } else { lIndicateEvent = FALSE ; } break; case EventRWDPress: if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventRWDPress\n")); avrcpEventFastRewindPress(); } else { lIndicateEvent = FALSE ; } break; case EventRWDRelease: if ( stateManagerIsAvrcpConnected() ) { EVENTS_DEBUG(("EventRWDRelease\n")); avrcpEventFastRewindRelease(); } else { lIndicateEvent = FALSE ; } break; case EventEnterDFUMode: EVENTS_DEBUG(("EventEnterDFUMode\n")); BootSetMode(0); break; case EventSwitchA2dpSource: EVENTS_DEBUG(("EventSwitchA2dpSource\n")); a2dpSwitchSource(); break; case EventSwitchAudioMode: EVENTS_DEBUG(("EventSwitchAudioMode\n")); if (theHeadset.eqMode >= eq_mode_passthrough) { theHeadset.eqMode = eq_mode_level1; } else { theHeadset.eqMode++; } if ((theHeadset.dsp_process == dsp_process_a2dp)) { /* Set audio mode for A2DP only (not used for Faststream) */ AudioSetMode(theHeadset.eqMode, 0); } break; case EventToggleLEDS: EVENTS_DEBUG(("EventToggleLEDS\n")); #ifdef ROM_LEDS LedManagerToggleLEDS(); #endif break; /* threeway calling events */ case EventThreeWayReleaseAllHeld: EVENTS_DEBUG(("EventThreeWayReleaseAllHeld\n")); HfpMultipleCallsReleaseHeldOrRejectWaiting(theHeadset.hfp); break; case EventThreeWayAcceptWaitingReleaseActive: EVENTS_DEBUG(("EventThreeWayAcceptWaitingReleaseActive\n")); HfpMultipleCallsReleaseActiveAcceptOther(theHeadset.hfp); break; case EventThreeWayAcceptWaitingHoldActive: EVENTS_DEBUG(("EventThreeWayAcceptWaitingHoldActive\n")); HfpMultipleCallsHoldActiveAcceptOther(theHeadset.hfp); break; case EventThreeWayAddHeldTo3Way: EVENTS_DEBUG(("EventThreeWayAddHeldTo3Way\n")); HfpMultipleCallsAddHeldCall(theHeadset.hfp); break; case EventThreeWayConnect2Disconnect: EVENTS_DEBUG(("EventThreeWayConnect2Disconnect\n")); HfpMultipleCallsExplicitCallTransfer(theHeadset.hfp); break; /* end threeway calling events */ case EventRssiPair: EVENTS_DEBUG(("EventRssiPair\n")); /* start inquiry on this event */ inquiryStart(); break; case EventRssiPairReminder: EVENTS_DEBUG(("EventRssiPairReminder\n")); inquiryReminder(); break; case EventRssiPairTimeout: EVENTS_DEBUG(("EventRssiPairTimeout\n")); /* Stop any pending inquiry now as this pairing mode has timed out */ inquiryStop(); break; default: EVENTS_DEBUG(("UNHANDLED EVENT: 0x%x\n",id)); lIndicateEvent = FALSE ; break; } if ( lIndicateEvent ) { LEDManagerIndicateEvent ( id ) ; } }
void slcContinueEstablishSLCRequest( void ) { SLC_DEBUG(("SLC: ContSLCReq, listId = %d\n",gSlcData.gListID)) ; /* is multipoint enabled ?, if so see if necessary to connect further devices, also check for non multipoint and no devices, otherwise exit */ if((!gSlcData.gSlcConnectRemote) && (deviceManagerCanConnect()) && #ifdef ENABLE_PARTYMODE (!((theSink.PartyModeEnabled)&&(theSink.features.PartyMode)))&& #endif (stateManagerGetState() != deviceLimbo)) { if(slcDetermineConnectAction() & AR_Rssi) { /* Connect next result*/ inquiryConnectNext(); } else { /* if there are more devices to connect to then continue */ if(slcGetNextListID()) { SLC_DEBUG(("SLC: PDL entry available for connection , listId = %d\n",gSlcData.gListID)) ; /* attempt to connect to next item in list */ slcAttemptConnection(); } /* otherwise check whether any connection attempt was successful, if not check feature to automatically enter pairing mode */ else if(theSink.features.EnterPairingModeOnFailureToConnect && !stateManagerIsConnected()) { SLC_DEBUG(("SLC: Failed to Connect to anything, enter pairing mode\n")) ; /* enter pairing mode */ MessageSend(&theSink.task, EventUsrEnterPairing, 0); /* now allow role switches */ theSink.rundata->connection_in_progress = FALSE; } /* all connection attempts now complete, allow role switching */ else { /* now allow role switches */ theSink.rundata->connection_in_progress = FALSE; } } } /* Need to handle this case to stop RSSI when all devs connected */ else if(slcDetermineConnectAction() & AR_Rssi) { /* All done, stop inquiring */ if(theSink.inquiry.action != rssi_subwoofer) inquiryStop(); /* set flag to block role switch requests until all connections are complete to avoid unneccesary switching */ theSink.rundata->connection_in_progress = FALSE; } /* connections complete, allow role switches to commence if necessary */ else { /* set flag to block role switch requests until all connections are complete to avoid unneccesary switching */ theSink.rundata->connection_in_progress = FALSE; } /* reset connection via remote ag instead of device flag */ gSlcData.gSlcConnectRemote = FALSE; SLC_DEBUG(("SLC: StopReq\n")) ; }
void slcEstablishSLCRequest ( void ) { bool listId_available = FALSE; /* only attempt a connection is the device is able to do so, 1 connection without multipoint only */ if(deviceManagerCanConnect()) { ARAction_t reconnect_action; reconnect_action = slcDetermineConnectAction(); /* set flag to block role switch requests until all connections are complete to avoid unneccesary switching */ theSink.rundata->connection_in_progress = TRUE; if(reconnect_action & AR_Rssi) { theSink.inquiry.action = rssi_connecting; inquiryStart( TRUE ); } else { SLC_DEBUG(("SLC: slcEstablishSLCRequest - MP = [%c] \n",theSink.MultipointEnable ? 'T':'F' )); /* Cancel inquiry and throw away results if one is in progress, allow subwoofer inquiry to continue*/ if(theSink.inquiry.action != rssi_subwoofer) inquiryStop(); if(reconnect_action == AR_LastConnected) theSink.NoOfReconnectionAttempts = theSink.features.ReconnectLastAttempts; else theSink.NoOfReconnectionAttempts = theSink.conf1->timeouts.ReconnectionAttempts ; /* reset connection via remote ag instead of device flag */ gSlcData.gSlcConnectRemote = FALSE; /*Paging attempts as per PSKEY's complete*/ SLC_DEBUG(("SLC: List Id [%d]\n" , gSlcData.gListID)) ; /* reset list to start at beginning */ gSlcData.gListID = 0; /* get the number of devices in the PDL */ gSlcData.gPdlSize = ConnectionTrustedDeviceListSize(); listId_available = slcIsListIdAvailable(gSlcData.gListID); /* ensure device is available to connect to and not already connected */ if(!listId_available) { /* move to next ID as that must be free */ gSlcData.gListID++; /* check whether next id is available for connection */ listId_available = slcIsListIdAvailable(gSlcData.gListID); } /* ensure device is available */ if(listId_available) { /* attempt to connect to first item in list */ slcAttemptConnection(); } /* not able to find a device to connect to, abandon attempt */ else { SLC_DEBUG(("SLC: EstablishSLC - no devices found\n")) ; /* nothing to connect to, reset flag */ theSink.rundata->connection_in_progress = FALSE; } } } }
/**************************************************************************** NAME sinkHandleSlcConnectCfm DESCRIPTION Confirmation that the SLC has been established (or not). RETURNS void */ bool sinkHandleSlcConnectCfm( const HFP_SLC_CONNECT_CFM_T *cfm ) { sink_attributes attributes; bool lResult = FALSE; #ifdef ENABLE_PEER inquiry_result_t* connecting_device = inquiryGetConnectingDevice(); #endif deviceManagerGetDefaultAttributes(&attributes, FALSE); (void)deviceManagerGetAttributes(&attributes, &cfm->bd_addr); /* cancel any link loss reminders */ MessageCancelAll(&theSink.task , EventSysLinkLoss ); /* Check the status of the SLC attempt */ if (cfm->status == hfp_connect_success) { SLC_DEBUG(("SLC: ConnCfm - Success\n")) ; lResult = TRUE ; /* update the profile volume level */ theSink.profile_data[PROFILE_INDEX(cfm->priority)].audio.gSMVolumeLevel = attributes.hfp.volume; /* Handle new connection setup */ slcConnectionComplete(cfm->priority, cfm->sink, (bdaddr *)&cfm->bd_addr); /* Handle common setup for new SLC/link loss */ slcConnectionSetup(cfm->priority, cfm->sink, (bdaddr *)&cfm->bd_addr); /* Record the position of the device in the PDL - prevents reconnection later */ theSink.profile_data[PROFILE_INDEX(cfm->priority)].status.list_id = deviceManagerSetPriority((bdaddr *)&cfm->bd_addr); #ifdef ENABLE_PEER /* If RSSI pairing, check inquiry results for A2DP support */ if (theSink.inquiry.action == rssi_pairing) { if ((connecting_device != NULL) && BdaddrIsSame(&connecting_device->bd_addr, &cfm->bd_addr) && (connecting_device->remote_profiles & profile_a2dp)) { attributes.profiles |= sink_a2dp; } } #endif /* Make sure we store this device */ attributes.profiles |= sink_hfp; deviceManagerStoreAttributes(&attributes, &cfm->bd_addr); /* if rssi pairing check to see if need to cancel rssi pairing or not */ if(theSink.inquiry.action == rssi_pairing) { /* if rssi pairing has completed and the device being connected currently doesn't support A2DP, then stop it progressing further */ if(!((theSink.features.PairIfPDLLessThan) && ( ConnectionTrustedDeviceListSize() < theSink.features.PairIfPDLLessThan ))) { #ifdef ENABLE_PEER if(!((connecting_device != NULL) && BdaddrIsSame(&connecting_device->bd_addr, &cfm->bd_addr) && (connecting_device->remote_profiles & profile_a2dp))) #endif { inquiryStop(); } } } /* Disable A2dp link loss management if connected on remote device */ if( theSink.a2dp_link_data && (theSink.a2dp_link_data->connected[a2dp_primary]) && BdaddrIsSame(&cfm->bd_addr, &theSink.a2dp_link_data->bd_addr[a2dp_primary]) ) { A2dpDeviceManageLinkloss(theSink.a2dp_link_data->device_id[a2dp_primary], FALSE); } else if( theSink.a2dp_link_data && (theSink.a2dp_link_data->connected[a2dp_secondary]) && BdaddrIsSame(&cfm->bd_addr, &theSink.a2dp_link_data->bd_addr[a2dp_secondary]) ) { A2dpDeviceManageLinkloss(theSink.a2dp_link_data->device_id[a2dp_secondary], FALSE); } /* Auto answer call if ringing - only answer the incoming call if its on the connecting AG */ if ( (theSink.features.AutoAnswerOnConnect) && (HfpLinkPriorityFromCallState(hfp_call_state_incoming) == cfm->priority) && (stateManagerGetState() < deviceActiveCallSCO) ) { MessageSend (&theSink.task , EventUsrAnswer , 0 ) ; SLC_DEBUG(("SLC: AutoAnswer triggered\n")) ; } } else { SLC_DEBUG(("SLC: ConnCfm - Fail\n")) ; /* a connection timeout will arrive here, need to report fail for multipoint connections also such that a link loss retry will be performed */ if(!stateManagerIsConnected() || theSink.MultipointEnable) { /* Update local state to reflect this */ slcConnectFail(); } } /* if using multipoint and both devices are connected disable connectable */ if((theSink.MultipointEnable) && (deviceManagerNumConnectedDevs() == MAX_MULTIPOINT_CONNECTIONS)) { SLC_DEBUG(("SLC: disable Conn \n" )); MessageCancelAll(&theSink.task, EventSysConnectableTimeout); #ifdef ENABLE_SUBWOOFER if(SwatGetSignallingSink(theSink.rundata->subwoofer.dev_id)) { sinkDisableConnectable(); } #else sinkDisableConnectable(); #endif } SLC_DEBUG(("SLC: Connect A2DP? En=%d att=%d\n",theSink.features.EnableA2dpStreaming,attributes.profiles)) ; /* if the AG supports A2DP profile attempt to connect to it if auto reconnect is enabled */ if ((theSink.features.EnableA2dpStreaming) && ((!cfm->priority)||(cfm->status == hfp_connect_success) || (cfm->status == hfp_connect_sdp_fail) || (cfm->status == hfp_connect_rejected)) && ((slcDetermineConnectAction() & AR_Rssi)||(attributes.profiles & sink_a2dp)) && ((slcDetermineConnectAction() & AR_Rssi)||(stateManagerGetState()!=deviceConnDiscoverable))) { SLC_DEBUG(("SLC: Connecting A2DP Remote %x\n",gSlcData.gSlcConnectRemote)) ; /* attempt connection to device supporting A2DP */ theSink.a2dp_link_data->remote_connection = gSlcData.gSlcConnectRemote; A2dpSignallingConnectRequest((bdaddr *)&cfm->bd_addr); MessageCancelFirst(&theSink.task, EventSysContinueSlcConnectRequest); /* if rssi pairing check to see if need to cancel rssi pairing or not */ if(theSink.inquiry.action == rssi_pairing) { /* if rssi pairing has completed then stop it progressing further */ if(!((theSink.features.PairIfPDLLessThan)&&( ConnectionTrustedDeviceListSize() < theSink.features.PairIfPDLLessThan ))) { #ifdef ENABLE_PEER if(!((connecting_device != NULL) && BdaddrIsSame(&connecting_device->bd_addr, &cfm->bd_addr) && (connecting_device->remote_profiles & profile_a2dp))) #endif { inquiryStop(); } } } } else { /* reset connection via remote ag instead of device flag */ gSlcData.gSlcConnectRemote = FALSE; } #ifdef ENABLE_MAPC mapcMasConnectRequest((bdaddr *)&cfm->bd_addr); #endif return lResult ; }