/****************************************************************************
NAME
    handleAghfpAudioConnectCfm

DESCRIPTION
    Handles the AGHFP library call create confirmation message.

*/
static void handleAghfpAudioConnectCfm(const AGHFP_AUDIO_CONNECT_CFM_T *ind)
{
    devInstanceTaskData *inst = devInstanceFindFromAG(ind->aghfp);
    
    if (inst == NULL)
        return;
 
    switch (getAghfpState(inst))
    {
        case AghfpStateAudioOpening:
        {
            if (ind->status == aghfp_success)
            {
                setAghfpState(inst, AghfpStateAudioStreaming);
            }
            else
            {
                setAghfpState(inst, AghfpStateConnected);
            }
            /* Fall through to AghfpStateCallActive case */
        }
        case AghfpStateCallActive:
        {
            if (ind->status == aghfp_success)
            {
                switch (ind->link_type)
                {
                    case sync_link_unknown:  /* Assume SCO if we don't know */
                    case sync_link_sco:
                        the_app->sink_type = AUDIO_SINK_SCO;
                    break;
                    case sync_link_esco:
                        the_app->sink_type = AUDIO_SINK_ESCO;
                        break;
                    default:
                        the_app->sink_type = AUDIO_SINK_INVALID;
                        break;
                }
                
                if (inst->audio_sink == 0)
                {
                    inst->audio_sink = ind->audio_sink;
                                          
                    connectAudio(inst->audio_sink);
                }
                streamManagerOpenComplete(TRUE);
            }
            else
            {
                streamManagerOpenComplete(FALSE);
            }
            break;
        }
        default:
        {
            aghfpUnhandledMessage(inst, AGHFP_AUDIO_CONNECT_CFM);
            break;
        }
    }
}
示例#2
0
GLvoid Qubet::initQubet()
{
    loadDone = true;
    setFocusPolicy(Qt::StrongFocus);
    audioManager = new AudioManager(this);
    connectAudio(this);

    if (!load())
        errorLoading();
    else
        loadingCompleted();

    drawTimer = new QTimer(this);
    connect(drawTimer, SIGNAL(timeout()), this, SLOT(draw()));
    drawTimer->start(30);
}
/****************************************************************************
NAME
    handleAghfpCallMgrCreateCfm

DESCRIPTION
    Handles the AGHFP library call create confirmation message.

*/
static void handleAghfpCallMgrCreateCfm(const AGHFP_CALL_MGR_CREATE_CFM_T *cfm)
{
    devInstanceTaskData *inst = devInstanceFindFromAG(cfm->aghfp);
    
    if (inst == NULL)
        return;
        
    switch (getAghfpState(inst))
    {
        case AghfpStateCallSetup:
        case AghfpStateCallShutdown:
        {
            if (cfm->status == aghfp_success)
            {    /* Call create attempt succeeded */
                setAghfpState(inst, AghfpStateCallActive);

                if (inst->audio_sink == 0)
                {
                    inst->audio_sink = cfm->audio_sink;
                    connectAudio(inst->audio_sink);
                }
                
                /* Continue with current comm action */
                aghfpCallOpenComplete(TRUE);
            }
            else
            {    /* Call create attempt failed */
                setAghfpState(inst, AghfpStateConnected);
                disconnectAudio(inst);
                aghfpCallOpenComplete(FALSE);
            }
            break;
        }    
        default:
        {
            aghfpUnhandledMessage(inst, AGHFP_CALL_MGR_CREATE_CFM);
            break;
        }
    }
}        
/*!
    Asks the Audio Gateway to establish an SCO data connection with the currently
    connected peer.  All audio data should now be routed to the associated audio
    device.

    \sa releaseAudio()
*/
void QBluetoothAudioGateway::connectAudio()
{
    invoke( SLOT(connectAudio()) );
}