NRF51822

本文详细介绍了NRF51822在蓝牙低功耗(BLE)开发中的各项操作,包括如何触发bonding请求、添加128bit UUID、发现iOS的ANCS服务、清除绑定、使用APP_BUTTON_INIT、保护Flash、设置广播数据和128bit UUID,以及解决蓝牙连接断线问题。内容涵盖关键步骤和注意事项。
摘要由CSDN通过智能技术生成

为了防止个人理解错误,下面的回答大多都会引用了论坛资料或者链接。
1.如何让设备发起bongding请求
先设置权限BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&dis_init.dis_attr_md.read_perm)
在ios上,除非app试图读取的characteristic收到保护,否则是没有bongding请求发生的。(可参考ble_app_gls例程)

原回答如下:
On iOS, no bonding will occur unless an app tries to read a characteristic that is protected. If you use LightBlue, this app will not do any such reads unless you specifically asks it to. To trigger bonding, you should therefore make sure to navigate the services/characteristics in such way that either a protected read or write is triggered, which again should trigger bonding.

authorization doesn’t have anything to do with bonding, it’s just a way for the application to know and authorize each read/write.
The protection I mean is the one set with the BLE_GAP_CONN_SEC_* macros. If you try to read any characteristic that is set as for example BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(), this will trigger bonding.

2.如何添加用户自己的128bit UUID?
使用sd_ble_uuid_vs_add(param1, param2)函数添加自己的128bit的service或者UUID,6.0的softdevice固件支持添加最多10个128bitUUID。param1是16byte用户uuid, param2存放softdevice分配的UUIDtype, 从BLE_UUID_TYPE_VENDOR_BEGIN(0x02)开始算,总共能添加10条,以后每一条只需要这个vender uuid type就行.
注意,param1的第13,14byte 不用写也行,写了也没用,后面还需添加。
/* 范例 */
ble_uuid128_t uuid_128bits = {0xD0, 0x00, 0x2D, 0x12, 0x1E, 0x4B, 0x0F, 0xA4, 0x99, 0x4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值