简体   繁体   English

具有多种服务的Android / iOS蓝牙低功耗(BLE)通信

[英]Android / iOS Bluetooth Low Energy (BLE) communication with multiple Services

I have an iOS App advertising two BLE services (both primary ) the following way: 我有一个iOS应用程序,它通过以下方式宣传两个BLE服务(均为primary ):

peripheralManager.addService(containingService)
peripheralManager.addService(preciseService)
peripheralManager.startAdvertising([CBAdvertisementDataServiceUUIDsKey: [containingService.UUID, preciseService.UUID]])

I verified with the LightBlue app that both services are advertised. 我使用LightBlue应用程序验证了这两个服务都已发布。

What I want to do on the Android side is to get a ScanResult for devices advertising the " preciseService ". 我要在Android方面执行的操作是为宣传“ precisionService ”的设备获取ScanResult Filtering for it, the device is never found though. 对其进行过滤,但始终找不到该设备。 Not filtering at all, the device is found, but in the ScanRecord the method getServiceUUIDs only returns the UUID of " containingService ". 在所有未滤波,该装置被发现,但在ScanRecord方法getServiceUUIDs只返回“containingService”的UUID。

I know that I can find all other Service UUIDs by connecting to it. 我知道可以通过连接找到所有其他服务UUID。 In my app I do not want to connect to the device though. 在我的应用程序中,我不想连接到设备。 So my question is if someone knows why only one of the two advertised primary services is found in the ScanRecord? 所以我的问题是,是否有人知道为什么在ScanRecord中仅找到两个广告的主要服务之一?

Thanks a lot 非常感谢

I realized that it was all about the length of two or more 128bit UUIDs being added. 我意识到,这完全是要添加两个或多个128位UUID的长度。 Adding one 128bit and one 32bit UUID worked fine. 添加一个128位和一个32位UUID可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM