connect

abstract suspend fun connect(peripheral: P)

Establishes Bluetooth LE connection to the peripheral using default connection options.

Parameters

peripheral

The peripheral to connect to.

Throws

If the central manager has been closed.

If Bluetooth is disabled or not available.

If the permission to connect to a peripheral is denied.

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

If connection failed. See ConnectionFailedException.reason for a reason.

CancellationException

If the coroutine was canceled.

TimeoutCancellationException

If the connection attempt timed out.