WCH579如何使用BondManager?

1,可以做个循环,根据最大的绑定数量,去遍历下当前的绑定表,

2,bondsaved时候 可以根据当前的连接地址去 解析出对应的public device address

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//函数的头文件
/**
 * @brief       Resolve an address from bonding information.
 *
 * @param       addrType - device's address type. Reference GAP_ADDR_TYPE_DEFINES in gap.h
 * @param       pDevAddr - device's address
 * @param       pResolvedAddr - pointer to buffer to put the resolved address
 *
 * @return      bonding index (0 - (GAP_BONDINGS_MAX-1) if found,
 *              GAP_BONDINGS_MAX if not found
 */
extern uint8 GAPBondMgr_ResolveAddr( uint8 addrType, uint8 *pDevAddr, uint8 *pResolvedAddr );
 
 
 
//------------------使用---------------------------------------------------
 
PRINT( "Connected.. %02x-%02x-%02x-%02x-%02x-%02x,type:%02x\n",  event->devAddr[0],event->devAddr[1],event->devAddr[2],\
                                                      event->devAddr[3],event->devAddr[4],event->devAddr[5],event->devAddrType);
//GAP_ResolvePrivateAddr( u8 *pIRK, u8 *pAddr );
uint8_t addr[6]={0};
PRINT("GAPBondMgr_ResolveAddr %02x\r\n",
          
//根据私有可解析地址解析出public device address
GAPBondMgr_ResolveAddr(event->devAddrType,event->devAddr,addr));
for(uint8_t i=0;i<6;i++)
{
         PRINT("%02x ",addr[i]);
}
PRINT("\r\n");



可以


只有登录才能回复,可以选择微信账号登录