www.pudn.com > headset.rar > sco.c


#include "demohs.h" 
#include "hal.h" 
 
#include  
#include  
 
#ifdef DEV_BOARD_HS 
#include  
#endif 
 
 
/* 
    scoStatusInd 
 
    Called by the headset framework to indicate that a SCO (voice) 
    connection has been either created or destroyed by the Audio 
    Gateway. 
*/ 
void scoStatusInd(const HS_SCO_STATUS_IND_T * ind) 
{ 
    /* Stop any ring tone that might be playing */ 
    (void) AudioStop(hsState.AudioRingHandle); 
 
    /* On setting up or tearing down a sco unmute the microphone */ 
    if (hsState.isMuted) 
        muteRequest(); 
 
    if (ind->status == CmConnectComplete) 
    { 
#ifdef DEV_BOARD_HS 
        /* enable the codec */ 
        PioSet(PIO_CODEC, CODEC_ON);         
#endif 
 
        /* set the sco connected flag */ 
        hsState.scoConnected = 1; 
 
        /* 
            Volume cmds are *only* allowed when there is a SCO  so send  
            initial volume here and not on RFCOMM connection establishment 
        */ 
        sendInitialVolume(); 
        /* sendInitialMicGain(); */ 
    } 
    else 
    { 
#ifdef DEV_BOARD_HS 
        /* disable the codec */ 
        PioSet(PIO_CODEC, CODEC_OFF); 
#endif 
        /* reset the sco connected flag */ 
        hsState.scoConnected = 0; 
    } 
}