前言:
针对HID设备配对绑定获取信息常用代码做汇总。
一、获取主机MAC地址
需先绑定以获取固定MAC地址
{
gapBondRec_t bond_info;
uint8_t adv_event_type = GAP_ADTYPE_ADV_HDC_DIRECT_IND;
uint8_t Adv_Direct_Addr[B_ADDR_LEN];
uint8_t Adv_Direct_Type = adv_direct.advtype;
tmos_snv_read(mainRecordNvID(0), sizeof(gapBondRec_t), &bond_info);
tmos_memcpy(Adv_Direct_Addr, bond_info.publicAddr, 6);
PRINT("Adv Direct type:%#x (", Adv_Direct_Type);
for (int i = 0; i < 6; i++) {
PRINT("%#x ", Adv_Direct_Addr[i]);
} PRINT(")\n");
}
二、获取当前绑定数目
uint16_t bonding = 0;
if(events & BONDNUM_EVT)
{
GAPBondMgr_GetParameter(GAPBOND_BOND_COUNT, &bonding); //2022/7/21
printf("BondNum = %x\n", bonding);
tmos_start_task(hidEmuTaskId, BONDNUM_EVT, 6400);
return (events ^ BONDNUM_EVT);
}
标签:Adv,tmos,Addr,绑定,Direct,PRINT,BLE,配对 From: https://www.cnblogs.com/gscw/p/17310246.html