connect

open suspend override fun connect(peripheral: Peripheral)

Connects to the given peripheral using default connection options.

Parameters

peripheral

The peripheral to connect to.

See also

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If BLUETOOTH_CONNECT permission is denied.

If the Peripheral wasn't acquired from this manager by scanning, ranging, or using methods getPeripheralsById or getBondedPeripherals.


abstract suspend fun connect(peripheral: Peripheral, options: CentralManager.ConnectionOptions)

Connects to the given peripheral.

Parameters

peripheral

The peripheral to connect to.

options

Connection options.

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If BLUETOOTH_CONNECT permission is denied.

If the Peripheral wasn't acquired from this manager by scanning, ranging, or using methods getPeripheralsById or getBondedPeripherals.