蓝牙学习 (8)配对raspberryPi和SensorTag CC2650
在上一篇中,用raspberryPi能够扫描到Ti SensorTag. 但是没有获得更多的数据,并且发现sensor Tag并没有回复scan request。
https://blog.csdn.net/feiwatson/article/details/82946621
这里我们利用gatttool来配对。
pi@raspberrypi:~ $ gatttool --help
Usage:
gatttool [OPTION...]
Application Options:
-i, --adapter=hciX Specify local adapter interface
-b, --device=MAC Specify remote Bluetooth address
-t, --addr-type=[public | random] Set LE address type. Default: public
-m, --mtu=MTU Specify the MTU size
-p, --psm=PSM Specify the PSM for GATT/ATT over BR/EDR
-l, --sec-level=[low | medium | high] Set security level. Default: low
-I, --interactive Use interactive mode
pi@raspberrypi:~ $ sudo gatttool -b 54:6C:0E:80:B4:86 --interactive
[54:6C:0E:80:B4:86][LE]> help
help Show this help
exit Exit interactive mode
quit Exit interactive mode
connect [address [address type]] Connect to a remote device
disconnect Disconnect from a remote device
primary [UUID] Primary Service Discovery
included [start hnd [end hnd]] Find Included Services
characteristics [start hnd [end hnd [UUID]]] Characteristics Discovery
char-desc [start hnd] [end hnd] Characteristics Descriptor Discovery
char-read-hnd <handle> Characteristics Value/Descriptor Read by handle
char-read-uuid <UUID> [start hnd] [end hnd] Characteristics Value/Descriptor Read by UUID
char-write-req <handle> <new value> Characteristic Value Write (Write Request)
char-write-cmd <handle> <new value> Characteristic Value Write (No response)
sec-level [low | medium | high] Set security level. Default: low
mtu <value> Exchange MTU for GATT/ATT
[54:6C:0E:80:B4:86][LE]>
建立Interactive Session, 读取温度值
[54:6C:0E:80:B4:86][LE]> connect
Attempting to connect to 54:6C:0E:80:B4:86
Connection successful
[54:6C:0E:80:B4:86][LE]> char-read-hnd 0x21
Characteristic value/descriptor: 04 00 ad 27 01 11 31
[54:6C:0E:80:B4:86][LE]> disconnect