前面几篇分别简单涉及了
- raspberryPi上bluez
- BLE sniffer
- TI SensorTag
https://blog.csdn.net/feiwatson/article/details/81590397
https://blog.csdn.net/feiwatson/article/details/82942416
https://blog.csdn.net/feiwatson/article/details/82945485
那么接下来,可以仔细分析蓝牙的packets
raspberryPi scan
在raspberryPi上执行sudo hcitool lescan
pi@raspberrypi:~ $ sudo hcitool lescan
LE Scan ...
3F:27:A7:F4:76:A1 (unknown)
2B:52:CB:55:00:90 (unknown)
37:92:63:B7:9C:54 (unknown)
54:6C:0E:80:B4:86 CC2650 SensorTag
如log中54:6C:0E:80:B4:86 CC2650 SensorTag
, Sensor Tag被扫描到。
Siniffer log
wireshark中Log的packet截图如下
ADV_IND
下图为sensorTag的广播报文
Advertising_Type:
- 0x00 Connectable and scannable undirected advertising (ADV_IND)(default)
- 0x01 Connectable high duty cycle directed advertising (ADV_DIRECT_IND, high duty cycle)
- 0x02 Scannable undirected advertising (ADV_SCAN_IND)
- 0x03 Non connectable undirected advertising (ADV_NONCONN_IND)
- 0x04 Connectable low duty cycle directed advertising (ADV_DIRECT_IND, low duty cycle)
在spec 5.0中2.3.1.1 ADV_IND定义了ADV_IND PDU payload.
SCAN_REQ
下图为Scan Request packet
https://www.bluetooth.com/zh-cn/specifications/bluetooth-core-specification
Advertising devices may receive scan requests from listening devices in order to get additional user data from the advertising device. Scan responses are sent by the advertising device to the device making the scan request.
在spec 5.0 中, 4.2.2.3 Scanning Procedure
- A scanning device uses the scanning procedure to listen for unidirectional broadcasts of user data from advertising devices using the advertising channel.
- A scanning device can request additional user data from an advertising device by making a scan request.
- The advertising device responds to these requests with additional user data sent to the scanning device over the advertising
channel.
关于广播报文,Scan Request, Scan Response, 以及connect Request在下面的链接中有进一步的解释,
http://www.wowotech.net/bluetooth/ble_broadcast.html
这里就直接引用一下: