/**************************************************************************** NAME slcConnectionSetup DESCRIPTION Perform link setup for a given SLC RETURNS void */ static void slcConnectionSetup(hfp_link_priority priority, Sink sink, bdaddr* bd_addr) { uint16 priorityIdx = PROFILE_INDEX(priority); /* Set timeout to 5 seconds */ ConnectionSetLinkSupervisionTimeout(sink, SINK_LINK_SUPERVISION_TIMEOUT); /* Send our link policy settings */ linkPolicyUseHfpSettings(priority, sink); /* Send a delayed message to request a role indication and make necessary changes as appropriate */ MessageCancelFirst(&theSink.task , EventSysCheckRole); MessageSendConditionally (&theSink.task , EventSysCheckRole , NULL , &theSink.rundata->connection_in_progress ); #ifdef ENABLE_PBAP /* Connect the PBAP link of this device */ pbapConnect(priority); #endif /* Sync volume level and mute settings with AG */ VolumeSendAndSetHeadsetVolume(theSink.profile_data[priorityIdx].audio.gSMVolumeLevel ,FALSE , priority) ; /* Enable +CLIP from AG if using Audio Prompt numbers/names or display, always request if using display */ #if !defined(ENABLE_DISPLAY) if(theSink.features.VoicePromptNumbers) #endif HfpCallerIdEnableRequest(priority, TRUE); /* HS uses call waiting indications when AG SCO is not routed */ HfpCallWaitingEnableRequest(priority, TRUE); /* Attempt to pull the audio across if not already present, delay by 5 seconds to prevent a race condition occuring with certain phones */ MessageSendLater ( &theSink.task , EventSysCheckForAudioTransfer , 0 , 5000 ) ; /* Send different event if first connection since power on - allows different LED pattern */ if((theSink.features.UseDiffConnectedEventAtPowerOn)&&(theSink.powerup_no_connection)) MessageSend (&theSink.task , EventSysSLCConnectedAfterPowerOn , NULL ); else MessageSend (&theSink.task , EventSysSLCConnected , NULL ); /* Reset the flag - first connection indicated */ theSink.powerup_no_connection = FALSE; }
/* Dial the first entry in the specified phonebook */ static void pbapDial(uint8 phonebook) { /* attempt to dial the first entry in the AG missed call history */ if(theHeadset.pbap_ready) { if(theHeadset.pbap_active_link != pbapc_invalid_link) { /* the Pbap profile of the primary HFP device has been connected */ /* set the phonebook and dial */ PBAP_DEBUG(("Pbap dial, set the phonebook first\n")); PbapcSetPhonebook(theHeadset.pbap_active_link, pbap_local, phonebook); } else { /* Otherwise, try to connect Pbap profile of the primary HFP device before dialling */ bdaddr ag_addr; Sink sink; if( HfpLinkGetSlcSink(hfp_primary_link, &sink) && SinkGetBdAddr(sink, &ag_addr) ) { PBAP_DEBUG(("Pbap dial, connect the Pbap profile first\n")); pbapConnect(ag_addr); } } theHeadset.pbap_active_pb = phonebook; } else { PBAP_DEBUG(("PBAPC profile was not initialised\n")); MessageSend ( &theHeadset.task , EventPbapDialFail , 0 ) ; theHeadset.pbap_dial_state = pbapc_no_dial; } }