【问题标题】:Android / iOS Bluetooth Low Energy (BLE) communication with multiple ServicesAndroid / iOS 蓝牙低功耗 (BLE) 与多个服务通信
【发布时间】: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


【解决方案1】:

我意识到这完全取决于添加两个或多个 128 位 UUID 的长度。添加一个 128 位和一个 32 位 UUID 效果很好。

【讨论】:

    猜你喜欢
    • 2016-06-14
    • 2013-01-12
    • 2021-10-27
    • 2015-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-28
    相关资源
    最近更新 更多