请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: CC2745R10-Q1
你(们)好
v 9.12 文档示例代码中提到的 API gapBondMgrReadBondRec 替换为 GapBondMgr_readBondFromNV 构建块。
请使用正确的示例代码更新文档
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
器件型号: CC2745R10-Q1
你(们)好
v 9.12 文档示例代码中提到的 API gapBondMgrReadBondRec 替换为 GapBondMgr_readBondFromNV 构建块。
请使用正确的示例代码更新文档
您好:
这些文档将在接下来几天内的下一个版本中更新。 同时、我将为更新 GapBondMgr_readBondFromNV 函数提供以下代码片段。
// LOCAL VARIABLES
// Array to save peer device's address
static uint8_t peerDeviceAddr[B_ADDR_LEN];
// enum to store peer device's address type
static GAP_Peer_Addr_Types_t pPeerAddrType;
void Peripheral_GAPConnEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
switch(event)
{
case BLEAPPUTIL_LINK_ESTABLISHED_EVENT:
{
gapEstLinkReqEvent_t *gapEstMsg = (gapEstLinkReqEvent_t *)pMsgData;
if(gapEstMsg->connRole == BLEAPPUTIL_PERIPHERAL_ROLE)
{
//...
//...
if (gapEstMsg->hdr.status == SUCCESS)
{
// Copy Peer's addr
memcpy(peerDeviceAddr, gapEstMsg->devAddr, B_ADDR_LEN);
// Copy Peer's addrType
pPeerAddrType = (GAP_Peer_Addr_Types_t)(gapEstMsg->devAddrType & MASK_ADDRTYPE_ID);
}
//...
//...
}
}
break;
//...
//...
// Parameters needed for storing bonding information.
static gapBondNvRecord_t* pSavedBondRec;
static uint8_t pIdentifier;
static uint8_t readMode;
uint8_t readStatus = FAILURE;
readStatus = GapBondMgr_readBondFromNV(readMode,
pIdentifier,
pPeerAddrType,
pSavedBondRec);
if (readStatus == SUCCESS)
{
// If read success, then export the data
// Here we will print it out for later use.
// For the print, we added the following defines
// Please consider your own example and modify as needed
Display_printf(dispHandle, dispIndex, 0, "#%5d Peer Device Addr = [0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x];", dispIndex,
pSavedBondRec->pBondRec->addr[0],
pSavedBondRec->pBondRec->addr[1],
pSavedBondRec->pBondRec->addr[2],
pSavedBondRec->pBondRec->addr[3],
pSavedBondRec->pBondRec->addr[4],
pSavedBondRec->pBondRec->addr[5]); dispIndex++;
Display_printf(dispHandle, dispIndex, 0, "#%5d Peer Device AddrType = 0x%02x; stateFlag = 0x%02x;", dispIndex, pSavedBondRec->pBondRec->addrType, pSavedBondRec->pBondRec->stateFlags); dispIndex++;
Display_printf(dispHandle, dispIndex, 0, "#%5d Peer Device AddrType = 0x%02x; stateFlag = 0x%02x;", dispIndex, pSavedBondRec->pBondRec->addrType, pSavedBondRec->pBondRec->stateFlags); dispIndex++;
Display_printf(dispHandle, dispIndex, 0, "#%5d Local Device eDiv = 0x%02x; keySize = 0x%02x;", dispIndex, pSavedBondRec->pLocalLtk->div, pSavedBondRec->pLocalLtk->keySize); dispIndex++;
Display_printf(dispHandle, dispIndex, 0, "#%5d Peer Device SignCount = 0x%08x;", dispIndex, pSavedBondRec->pSignCount); dispIndex++;
}
break;
谢谢、
Isaac