open.c

来自「蓝牙HANDFREE软件源代码」· C语言 代码 · 共 57 行

C
57
字号
#include "handsfree_private.h"
#include "handsfree.h"

#include <message.h>


/*
    startReqAction

    This function is called at the beginning of the application and
    sets the ring duration, which defines the duration of a single
    ring.
*/
void startReqAction(uint16 features, uint16 profiles)
{    
    /* Initialise the libs used by this app */
    MAKE_MSG(HS_OPEN_REQ);
    msg->hfSupportedFeatures = features;
    msg->supportedProfiles = profiles;
    putMsg(msg);
}


/*
    hfOpenCfm

    Called to indicate that the headset framework has completed
    initialisation. If we are not already paired, go straight into a
    pairing attempt. Otherwise, just go idle.
*/
void hfOpenCfm(const HS_OPEN_CFM_T *cfm)
{
    /* reset state kept about the SLC */
    hfResetConnectionState();

    /* Init the current state */
    setLocalState(idle);
    
    /*  
        If we're paired so go into connectable mode, otherwise let the 
        interface app decide what to do 
    */

    if (cfm->isPaired)
    {        
        connectReqAction();
    }
    else
    {
        /* If not paired perform a hard reset in case the default PIN has not been set */
        resetReqAction();
    }

    /* Respond to a start_req */
    handleOpenCfm(cfm->isPaired);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?