setPreferredPhy

suspend fun setPreferredPhy(txPhy: Phy, rxPhy: Phy, phyOptions: PhyOption): PhyInUse

Set the preferred connection PHY.

PHY LE 2M or PHY Coded is supported since Android 8.0 (API level 26) or later. Other devices will continue to use the only PHY they support, that is Phy.PHY_LE_1M.

Please note that this is just a recommendation, whether the PHY change will happen depends on other applications preferences, local and remote controller capabilities. Controller can override these settings.

Return

The PHYs in use after the change.

Parameters

txPhy

The preferred transmitter PHY.

rxPhy

The preferred receiver PHY.

phyOptions

The preferred coding to use when transmitting on the LE Coded PHY.

Throws

If the device is not connected.

If PHY change could not be requested.

If BLUETOOTH_CONNECT permission is denied.