startPairing

abstract suspend fun startPairing(deviceAddress: BluetoothDeviceAddress): Boolean

Initiates pairing with a specific Bluetooth device which is registered to deviceAddress. Once the bond state has changed BluetoothConnectivityStatus.bondState will be update for the device entry in deviceInformation.

When a pairing has been requested successfully, the BluetoothPairingRequestListener.onPairingRequestReceived is called to notify the client that a pairing request has been initiated. The callback will provide a personal identification number which can be shown by the client so the user can decide to accept or reject the pairing request.

BluetoothConnectivityStatus.lastBondStateChangeReason should be observed by the client to trigger any UI transition when the pairing is finished. In case of an unsuccessful pairing, BluetoothConnectivityStatus.lastBondStateChangeReason contains a reason why it was unsuccessful.

When a discovery process is active, it will be automatically stopped before the pairing request is sent.

Return

true when a pairing has been requested, 'false' otherwise, for example when another pairing is already in progress.