首页 > 其他分享 >BLE配对与绑定三

BLE配对与绑定三

时间:2023-04-12 16:34:53浏览次数:29  
标签:Adv tmos Addr 绑定 Direct PRINT BLE 配对

前言:

针对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

相关文章

  • QTableWidget获取列(行)索引方法
    //获取指定的列索引集合QList<int>QcViewBaseForm::getSelectedColumns(QTableWidget*tableWidget){QList<int>selectedColumns;QList<QTableWidgetSelectionRange>selectedRanges=tableWidget->selectedRanges();for(autorange:selec......
  • Look-up table使用
    今天做光伏系统仿真的时候想使用looktable模块导入辐射数据,于是有以下随笔。使用命令Ir=xlsread('gaoyuhour.xlsx');创建LookupTable变量mylookuptable=Simulink.LookupTable;   可以看到LookupTable变量有很多属性,这里我们主要用到Breakpoints和Table属性,Breakpo......
  • Android动态设置drawableRight
    DrawablerightDrawable=getResources().getDrawable(R.drawable.icon);//调用setCompoundDrawables时,必须调用Drawable.setBounds()方法,否则图片不显示rightDrawable.setBounds(0,0,rightDrawable.getMinimumWidth(),rightDrawable.getMinimumHeight());//left,top,r......
  • Vivado BRAM Byte Write Enable
    1,ByteWriteEnable怎么用2,vivadobram中的width与depth设置注意事项3,Vivado使用心得(四)IP核BRAM的实用功能......
  • UVa 113 / POJ 2109 Power of Cryptography (使用double处理大整数&泰勒公式与误差分
    113-PowerofCryptographyTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=49http://poj.org/problem?id=2109题意:给出n和p,求出 ,但是p可以很大()如何存储p?不用大数可不可以?先看看double......
  • UVa 524 Prime Ring Problem (数论&DFS)
    524-PrimeRingProblemTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=465Aringiscomposedofn(evennumber)circlesasshownindiagram.Putnaturalnumbers  intoea......
  • UVa 11507 Bender B. Rodríguez Problem (模拟&异或)
    11507-BenderB.RodríguezProblemTimelimit:4.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2502Benderisarobotbuiltby Mom'sFriendlyRobotCompany atits......
  • UVa 443 / POJ 2247 Humble Numbers (4因子-丑数&STL灵活运用)
    443-HumbleNumbersTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=384http://poj.org/problem?id=2247Anumberwhoseonlyprimefactorsare2,3,5or7isc......
  • springcloud gateway根据服务名称进行路由失败There was an unexpected error (type=S
    出现错误,如下图:解决办法:检查自己的yaml文件:server:port:88spring:application:name:applicationNamecloud:nacos:discovery:server-addr:127.0.0.1:8848gateway:#开启服务发现路由(不开启跨域问题可能无法解决)disco......
  • Autosar系列之Runnable可运行实体
    文章目录一、RUnnableEntity一、RUnnableEntity可运行实体,其实就是.C文件内的函数而已。一个SWC可以包含多个RunnableEntity,就是一个.C文件中可以包含多个函数,每个函数可以执行一个特定的操作并且RunnableEntity必须要挂子Task上,就像函数如果只是放在那里没有被调用的化,也不起......