5.1 蓝牙 LE 2 M
蓝牙 SIG 针对 LE 引入了 2 Msym/s PHY,从核心规范 5.0 开始作为一项可选功能。目前,这些规范针对 2 M PHY 定义了未编码的方案。Qualcomm WCN3990 支持未编码的 2 M。
该功能的主要变更位于 WCN3990 的 PHY 层。在软件增强方面,从 Android O 开始将 API 引入 Android 框架,以便用户指定 PHY 调制方案。
5.1.1 向其他框架公开的蓝牙 5.0 API
BLE 2 M API 主要分为两类:
■ 仅 GATT 服务器
■ 仅 GATT 客户端
仅 GATT 服务器 API
对于此类 API,服务器会设置期望的连接 PHY,但这种 API 不能保证最终选择该 PHY。
制定决策时还会考虑其他 APP 期望设置和控制器功能。
public void setPreferredPhy(BluetoothDevice device, int txPhy, int rxPhy,
int phyOptions)
服务器设置 PHY 之后,如果 PHY 发生相应更改,则会触发以下函数:
public void onPhyUpdate(String address, int txPhy, int rxPhy, int status)
服务器可主动读取当前 PHY 设置。读取结果由 onPhyRead 返回。
public void readPhy(BluetoothDevice device)
public void onPhyRead(String address, int txPhy, int rxPhy, int status)
仅 GATT 客户端 API