我正在寻找使用 BLE5 与使用 BLE4 有何不同。 BLE5 向后兼容。但是,如何在 Android 或 IOS 上启用 2xSpeed、4xRange 或 LE Advertising Extensions 等功能?您可以建议从什么教程或代码示例开始吗?
最佳答案
据我所知,iOS 尚不以编程方式支持蓝牙 5 功能。但是,如果两个设备都支持此功能,蓝牙 5 设备可以自动启动到 2MPHY 的切换。您可以找到有关此的更多详细信息 here 。默认情况下,在支持蓝牙 5 的 Android 设备上也可以使用此功能,但我找不到任何对此的引用。
至于 Android API,蓝牙 5 功能是在 Android 8 中引入的。可在此处找到此 API:-
- getPhy()
- PH_LE_ALL_SUPPORTED
- enableAdvertising
- setPeriodicAdvertisingData
- setPeriodicAdvertisingDataEnabled
- isLe2MPhySupported
- isLeCodedPhySupported
- isLeExtendedAdvertisingSupported
- isLePeriodicAdvertisingSupported
- readPhy
- setPreferredPhy
还有更多用于蓝牙 5 控制的 API,但这应该可以帮助您入门。
您可以在以下位置找到更多信息:-
- CoreBluetooth Programming Guide
- Android Bluetooth API
- Android API Reference for Bluetooth
- Android API Reference for Bluetooth LE
我希望这会有所帮助。
关于bluetooth-lowenergy - 您知道如何在移动设备上编写 BLE5 功能代码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53190824/