您好!
我使用 multi_role (simplelink_cc13xx_cc26xx_sdk_5_30_01_01)、并且遇到问题。
我使用 multi_role_getBondInfo 函数来查找 irk 值。
bool multi_role_getBondInfo(uint8_t index)
{
(void) index;
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, "");
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, "===================================================================");
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, "Get Bonding Information");
// Parameters needed for storing bonding information.
static gapBondRec_t pSavedBondRec;
static gapBondLTK_t pLocalLtk;
static gapBondLTK_t pPeerLtk;
static uint8_t pPeerIRK[KEYLEN];
static uint8_t pPeerSRK[KEYLEN];
static uint32_t pPeerSignCount;
static gapBondCharCfg_t charCfg;
uint8_t i;
uint8_t readStatus = FAILURE;
readStatus = gapBondMgrReadBondRec(pPeerAddrType,
peerDeviceAddr,
&pSavedBondRec,
&pLocalLtk,
&pPeerLtk,
pPeerIRK,
pPeerSRK,
pPeerSignCount,
&charCfg);
if (readStatus == SUCCESS)
{
Display_printf(dispHandle, DisplayUart_SCROLLING, 0,
" Peer Device Addr = [0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x];",
pSavedBondRec.addr[0],
pSavedBondRec.addr[1],
pSavedBondRec.addr[2],
pSavedBondRec.addr[3],
pSavedBondRec.addr[4],
pSavedBondRec.addr[5]);
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, " Peer Device AddrType = 0x%02x; stateFlag = 0x%02x;", pSavedBondRec.addrType, pSavedBondRec.stateFlags);
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, " Local Device eDiv = 0x%02x; keySize = 0x%02x", pLocalLtk.div, pLocalLtk.keySize);
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, " peer Device SignCount = 0x%08x;", pPeerSignCount);
for (i = 0; i < KEYLEN; i++)
{
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, " Peer Device IRK[%d]= 0x%02x;", i, pPeerIRK[i]);
}
}
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, "===================================================================");
Display_printf(dispHandle, DisplayUart_SCROLLING, 0, "");
return (true);
}
之后、如果我使用 GATT_WriteCharValue() API、则响应 将为 "ATT_ERROR_RSP"。
attWriteReq_t conPoWriteValueReq;
uint8_t conPoWriteValueConnIndex;
bool multi_role_doGattConPoWriteValue(uint8 NotiUid1, uint8 NotiUid2, uint8 NotiUid3, uint8 NotiUid4)
{
conPoWriteValueReq.pValue = GATT_bm_alloc(g_connHandle, ATT_WRITE_REQ, 10, NULL);
if (conPoWriteValueReq.pValue != NULL)
{
conPoWriteValueConnIndex = multi_role_getConnIndex(g_connHandle);
// connIndex cannot be equal to or greater than MAX_NUM_BLE_CONNS
MULTIROLE_ASSERT(conPoWriteValueConnIndex < MAX_NUM_BLE_CONNS);
conPoWriteValueReq.handle = ancsConPoHdl;
conPoWriteValueReq.len = 10;
conPoWriteValueReq.pValue[0] = 0;
conPoWriteValueReq.pValue[1] = NotiUid1;
conPoWriteValueReq.pValue[2] = NotiUid2;
conPoWriteValueReq.pValue[3] = NotiUid3;
conPoWriteValueReq.pValue[4] = NotiUid4;
conPoWriteValueReq.pValue[5] = 0;
conPoWriteValueReq.pValue[6] = 1;
conPoWriteValueReq.pValue[7] = 0xFF;
conPoWriteValueReq.pValue[8] = 0xFF;
conPoWriteValueReq.pValue[9] = 4;
conPoWriteValueReq.sig = 0;
conPoWriteValueReq.cmd = 0;
response = GATT_WriteCharValue(g_connHandle, &conPoWriteValueReq, selfEntity);
if ( response != SUCCESS )
{
GATT_bm_free((gattMsg_t *)&conPoWriteValueReq, ATT_WRITE_REQ);
}
}
return (true);
}
Display_printf (dispHandle、DisplayUart_scrolling、0、"写入错误%d"、pMsg->msg.errorRsp.errCode);
=>写入错误160
(如果我没有使用 multi_role_getBondInfo 函数、则没有任何问题)
可以提供一些建议吗?
是否存在超时问题?
此致、
Kim。