Example #1
0
/****************************************************************************
NAME 
 VolumeDown

DESCRIPTION
 Decrements volume - sends a response to the AG

RETURNS
 void
    
*/
void VolumeDown ( void )
{
    uint16 lOldVol = 0;
    uint16 lNewVol = 0;
  
    /* check for a2dp streaming before checking for hpf profiles */
    if(!CheckVolumeA2dp(decrease_volume) && theHeadset.conf->no_of_profiles_connected)
    {
        /* Get the link to change volume on */
        hfp_link_priority priority = audioGetLinkPriority(TRUE);

        /* get current volume for this profile */
        lOldVol = theHeadset.profile_data[PROFILE_INDEX(priority)].audio.gSMVolumeLevel;
        /* obtain new volume level */
        lNewVol = theHeadset.audioData.gVolMaps[lOldVol].DecVol ;
        /* send, set and store new volume level */

		#if 1
		VolumeSendAndSetHeadsetVolume ( lNewVol ,TRUE ,priority,decrease_volume) ;
		#else
        VolumeSendAndSetHeadsetVolume ( lNewVol ,TRUE ,priority) ;
        #endif
		
       	VOL_DEBUG(("VOL: VolDwn[%d][%d]to AG%d\n",lOldVol, lNewVol, priority))  ;
    }      
}
Example #2
0
/****************************************************************************
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;
}