Bluetooth: Observer
概述
本示例演示了如何使用 BLE 的扫描功能。程序运行后,周期性的扫描周边的 BLE 设备。 扫描到的设备信息,如地址、信号强度、广播类型及广播数据会被输出到控制台。
如果控制器支持扩展扫描,还可以使能配置文件中的 CONFIG_BT_EXT_ADV 用以执行 扩展扫描。
环境要求
支持 BLE 功能的开发板
编译和烧录
示例位置:
examples/bluetooth/observer
编译、烧录等操作,具体参考 快速入门 章节 。
运行结果
I/observer [0.002] Starting Observer Demo
I/bt_hci_core [0.028] Identity: 28:6D:CE:01:02:03 (public)
I/bt_hci_core [0.032] HCI: version 4.2 (0x08) revision 0x0709, manufacturer 0x070c
I/bt_hci_core [0.040] LMP: version 4.2 (0x08) subver 0x0709
I/observer [0.048] Started scanning...
I/observer [0.056] Device found: C0:00:00:10:77:16 (public) (RSSI -99), type 0, AD data len 30
I/observer [0.064] Device found: 4A:C1:07:FB:4E:03 (random) (RSSI -100), type 0, AD data len 18
I/observer [0.074] Device found: 11:06:C7:AA:E9:F1 (random) (RSSI -99), type 3, AD data len 31
I/observer [0.084] Device found: 28:6D:CE:11:22:33 (public) (RSSI -60), type 0, AD data len 15