headset_auth.c

来自「此软件为BlueLab 3.6.2 平台所自带的蓝牙耳机源码」· C语言 代码 · 共 91 行

C
91
字号
/****************************************************************************Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006Part of BlueLab 3.6.2-releaseFILE NAME    headset_auth.c        DESCRIPTION    This file contains the Authentication functionality for the AV Headset     ApplicationNOTES*//****************************************************************************    Header files*/#include "headset_private.h"#include "headset_auth.h"#include "headset_slc.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){	/* TODO B-7407 Validate incoming connection */    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(hsTaskData * pApp , const CL_SM_AUTHENTICATE_CFM_T *cfm){    if (cfm->status == auth_status_success)    {            if (pApp->features.StoreLastUserOnPairing)        {            slcStoreBdaddr ( pApp , &cfm->bd_addr) ;        }            /* Send a user event to the app for indication purposes*/        MessageSend (&pApp->task , EventPairingSuccessful , 0 );    }}

⌨️ 快捷键说明

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