背景:项目使用flutter_ble_lib搜索蓝牙设备,根据后台给定的蓝牙前缀过滤需要展示的设备,本来使用一切正常,但是后面发现一直搜索不到设备,使用iOS的LightBlue搜索发现设备已经搜索出来了,但是名字不是想要的,连接设备后,发现设备的AdvertisementData里面的localName才是自己想要的名字.
![]() |
![]() |
---|
查看源码后,发现设备名字除了Peripheral里面的name,在ScanResult的AdvertisementData下面也有一个localName
属性,可以获取到这个设备的名字,使用localName
解决了这个问题
![]() |
![]() |
---|
框架地址:https://github.com/dotintent/FlutterBleLib
相关文章地址:https://blog.csdn.net/qq_33463449/article/details/91489726?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2-91489726-blog-50434476.235%5Ev43%5Epc_blog_bottom_relevance_base3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-2-91489726-blog-50434476.235%5Ev43%5Epc_blog_bottom_relevance_base3&utm_relevant_index=5
网友评论