Beispiel #1
0
void VolumeSendAndSetHeadsetVolume( uint16 pNewVolume , bool pPlayTone, hfp_link_priority priority ) 
{
    bool lOverideMute = theHeadset.features.OverideMute ;
    
    /* ensure profile is connected before changing volume */
    if(priority)
    {
        /*if there is a hfp attached - then send the vol change, but only if not
          muted and mute overide is not in effect*/
        if ( (stateManagerIsConnected() && (!theHeadset.gMuted ))||
             ( lOverideMute ))
        {     
            HfpVolumeSyncSpeakerGainRequest ( priority , (uint8*)&pNewVolume ) ;
        }
        VOL_DEBUG(("VOL: SEND and %x",(unsigned int) priority)) ;

		#if 1
		VolumeSetHeadsetVolume( pNewVolume , pPlayTone, priority, TRUE, dir );
		#else
        VolumeSetHeadsetVolume( pNewVolume , pPlayTone, priority, TRUE );
		#endif
    }
}
void hfpHandlerSpeakerVolumeInd( const HFP_SPEAKER_VOLUME_IND_T *ind )
{
	HFP_DEBUG(("HFP: hfpHandlerSpeakerVolumeInd [%d]\n", ind->volume_gain)) ;
	theHeadset.gHfpVolumeLevel = ind->volume_gain;
	
	if (theHeadset.gHfpVolumeLevel == 0)
		MessageSend(&theHeadset.task, EventVolumeMin, 0);
	
	if (theHeadset.gHfpVolumeLevel == VOL_MAX_VOLUME_LEVEL)
		MessageSend(&theHeadset.task, EventVolumeMax, 0);
			
	if (stateManagerIsA2dpStreaming())
	    return;    
	
	VolumeSetHeadsetVolume(theHeadset.gHfpVolumeLevel, FALSE, FALSE);
	
}