⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 headset_auth.c

📁 CSR蓝牙芯片 无线蓝牙耳机的语音网关程序 蓝牙耳机程序已经上传
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    headset_auth.c        

DESCRIPTION
    This file contains the Authentication functionality for the AV Headset 
    Application

NOTES

*/


/****************************************************************************
    Header files
*/
#include "headset_private.h"
#include "headset_auth.h"
#include "av_headset_kalimba.h"

#include <ps.h>

/*************************************************************************
NAME    
     headsetHandlePinCodeInd
    
DESCRIPTION
     This function is called on receipt on an CL_PIN_CODE_IND message
     being recieved.  The AV Headset default pin code is sent back.

RETURNS
     
*/
void headsetHandlePinCodeInd(const CL_SM_PIN_CODE_IND_T* ind)
{
    uint16 pin_length = 0;
    uint8 pin[16];
    
    /* Do we have a fixed pin in PS, if not reject pairing */
    if ((pin_length = PsFullRetrieve(PSKEY_FIXED_PIN, pin, 16)) == 0 || pin_length > 16)
        /* Set length to 0 indicating we're rejecting the PIN request */
        pin_length = 0; 
    
    /* Respond to the PIN code request */
    ConnectionSmPinCodeResponse(&ind->bd_addr, pin_length, pin); 
}


/****************************************************************************
NAME    
    headsetHandleAuthoriseInd
    
DESCRIPTION
    Request to authorise access to a particular service.

RETURNS
    void
*/
void headsetHandleAuthoriseInd(const CL_SM_AUTHORISE_IND_T *ind)
{
    ConnectionSmAuthoriseResponse(&ind->bd_addr, ind->protocol_id, ind->channel, ind->incoming, 1);
}

/****************************************************************************
NAME    
    headsetHandleAuthenticateCfm
    
DESCRIPTION
    Indicates whether the authentication succeeded or not.

RETURNS
    void
*/
void headsetHandleAuthenticateCfm(const CL_SM_AUTHENTICATE_CFM_T *cfm)
{
    if (cfm->status == auth_status_success)
    {
        /* Pairing complete so send a pair mode end message immediately */
        (void) MessageCancelAll(getAppTask(), APP_PAIR_MODE_END_IND);
        MessageSend(getAppTask(), APP_PAIR_MODE_END_IND, 0);
    }
}

⌨️ 快捷键说明

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