【发布时间】:2015-12-08 10:37:31
【问题描述】:
我有一个 iOS 应用程序通过以下方式宣传两个 BLE 服务(两个主要):
peripheralManager.addService(containingService)
peripheralManager.addService(preciseService)
peripheralManager.startAdvertising([CBAdvertisementDataServiceUUIDsKey: [containingService.UUID, preciseService.UUID]])
我通过 LightBlue 应用验证了这两种服务都已宣传。
我想要在 Android 端做的是为广告“preciseService”的设备获取 ScanResult。过滤它,但从未找到该设备。根本不过滤,找到了设备,但在 ScanRecord 中,方法 getServiceUUIDs 只返回“包含服务”的 UUID。
我知道我可以通过连接找到所有其他服务 UUID。在我的应用程序中,我不想连接到设备。所以我的问题是,是否有人知道为什么在 ScanRecord 中只能找到两个广告的主要服务之一?
非常感谢
【问题讨论】:
-
你应该通过ScanRecord.getBytes()查看原始字节,这样你就可以确认它们是否都遇到了,或者Android是否只是错误地解析了原始扫描记录。
标签: android ios bluetooth bluetooth-lowenergy