📄 spp_dev_auth.c
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.4.2-release
FILE NAME
spp_dev_auth.h
DESCRIPTION
Handles authorisation procedures of spp dev A application
*/
/****************************************************************************
Header files
*/
#include "spp_dev_auth.h"
#include "spp_dev_private.h"
#include <stdio.h>
/****************************************************************************
NAME
sppDevHandlePinCodeRequest
DESCRIPTION
Reply to pin code request
RETURNS
void
*/
void sppDevHandlePinCodeRequest(const CL_SM_PIN_CODE_IND_T* ind)
{
ConnectionSmPinCodeResponse(&ind->bd_addr, 4, (uint8 *) "1234");
}
/****************************************************************************
NAME
sppDevAuthoriseResponse
DESCRIPTION
Give authorisation to device
RETURNS
void
*/
void sppDevAuthoriseResponse(const CL_SM_AUTHORISE_IND_T* ind)
{
ConnectionSmAuthoriseResponse(&ind->bd_addr,
ind->protocol_id,
ind->channel,
ind->incoming,
TRUE);
}
/****************************************************************************
NAME
sppDevAuthoriseConnectInd
DESCRIPTION
Authorise a connect request
RETURNS
void
*/
void sppDevAuthoriseConnectInd(sppTaskData* app, const SPP_CONNECT_IND_T* ind)
{
SppConnectResponse(ind->spp, TRUE, &ind->addr);
}
/****************************************************************************
NAME
sppDevSetTrustLevel
DESCRIPTION
Set the trust level of a device
RETURNS
void
*/
void sppDevSetTrustLevel(const CL_SM_AUTHENTICATE_CFM_T* cfm)
{
if(cfm->status == auth_status_success)
{
/* DEBUG("Pairing success, now set the trust level\n");*/
ConnectionSmSetTrustLevel(&cfm->bd_addr, TRUE);
}
else if(cfm->status == auth_status_fail)
{
/* DEBUG("Pairing failed\n");*/
}
else
{
/* DEBUG("Pairing timeout\n");*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -