BLE 传感器节点的访问

我们通过gatttool 工具对 ble 节点访问

连接ble节点。

gatttool -b BC:6A:29:C0:DE:29 -I
[ ][BC:6A:29:C0:DE:29][LE]> connect
[CON][BC:6A:29:C0:DE:29][LE]> primary
[CON][BC:6A:29:C0:DE:29][LE]>
attr handle: 0x0001, end grp handle: 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0022 uuid: 0000180a-0000-1000-8000-00805f9b34fb
attr handle: 0x0023, end grp handle: 0x0027 uuid: 0000aa20-0000-1000-8000-00805f9b34fb
attr handle: 0x0028, end grp handle: 0x003d uuid: 0000fa20-0000-1000-8000-00805f9b34fb
attr handle: 0x003e, end grp handle: 0x0041 uuid: 0000fa10-0000-1000-8000-00805f9b34fb
attr handle: 0x0042, end grp handle: 0xffff uuid: 0000180f-0000-1000-8000-00805f9b34fb

查询特性

[CON][BC:6A:29:C0:DE:29][LE]> characteristics
[CON][BC:6A:29:C0:DE:29][LE]>
handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x0a, char value handle: 0x0007, uuid: 00002a02-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x0a, char value handle: 0x0009, uuid: 00002a03-0000-1000-8000-00805f9b34fb
handle: 0x000a, char properties: 0x02, char value handle: 0x000b, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x20, char value handle: 0x000e, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0011, char properties: 0x02, char value handle: 0x0012, uuid: 00002a23-0000-1000-8000-00805f9b34fb
handle: 0x0013, char properties: 0x02, char value handle: 0x0014, uuid: 00002a24-0000-1000-8000-00805f9b34fb
handle: 0x0015, char properties: 0x02, char value handle: 0x0016, uuid: 00002a25-0000-1000-8000-00805f9b34fb
handle: 0x0017, char properties: 0x02, char value handle: 0x0018, uuid: 00002a26-0000-1000-8000-00805f9b34fb
handle: 0x0019, char properties: 0x02, char value handle: 0x001a, uuid: 00002a27-0000-1000-8000-00805f9b34fb
handle: 0x001b, char properties: 0x02, char value handle: 0x001c, uuid: 00002a28-0000-1000-8000-00805f9b34fb
handle: 0x001d, char properties: 0x02, char value handle: 0x001e, uuid: 00002a29-0000-1000-8000-00805f9b34fb
handle: 0x001f, char properties: 0x02, char value handle: 0x0020, uuid: 00002a2a-0000-1000-8000-00805f9b34fb
handle: 0x0021, char properties: 0x02, char value handle: 0x0022, uuid: 00002a50-0000-1000-8000-00805f9b34fb
handle: 0x0024, char properties: 0x10, char value handle: 0x0025, uuid: 0000aa21-0000-1000-8000-00805f9b34fb
handle: 0x0029, char properties: 0x0a, char value handle: 0x002a, uuid: 0000fa21-0000-1000-8000-00805f9b34fb
handle: 0x002c, char properties: 0x0a, char value handle: 0x002d, uuid: 0000fa22-0000-1000-8000-00805f9b34fb
handle: 0x002f, char properties: 0x02, char value handle: 0x0030, uuid: 0000fa23-0000-1000-8000-00805f9b34fb
handle: 0x0032, char properties: 0x0a, char value handle: 0x0033, uuid: 0000fa24-0000-1000-8000-00805f9b34fb
handle: 0x0035, char properties: 0x0a, char value handle: 0x0036, uuid: 0000fa25-0000-1000-8000-00805f9b34fb
handle: 0x0038, char properties: 0x02, char value handle: 0x0039, uuid: 0000fa26-0000-1000-8000-00805f9b34fb
handle: 0x003b, char properties: 0x0a, char value handle: 0x003c, uuid: 0000fa27-0000-1000-8000-00805f9b34fb
handle: 0x003f, char properties: 0x0a, char value handle: 0x0040, uuid: 0000fa11-0000-1000-8000-00805f9b34fb
handle: 0x0043, char properties: 0x12, char value handle: 0x0044, uuid: 00002a19-0000-1000-8000-00805f9b34fb

获得notify handle

[CON][BC:6A:29:C0:DE:29][LE]> char-read-uuid 0000aa21-0000-1000-8000-00805f9b34fb
[CON][BC:6A:29:C0:DE:29][LE]>
handle: 0x0025 value: 30 0b 2a 07

使能notify

[CON][BC:6A:29:C0:DE:29][LE]> char-write-req 0x0026 0100
[CON][BC:6A:29:C0:DE:29][LE]> Characteristic value was written successfully

Notification handle = 0x0025 value: 38 0b 74 06
[CON][BC:6A:29:C0:DE:29][LE]>
Notification handle = 0x0025 value: 38 0b 74 06

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

redparrot2008

打赏+收藏,私信获得部分资源。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值