Connection – A BLE connection

A BLE connection to another device. Used to discover and interact with services on the other device.


import _bleio

my_entry = None
for entry in _bleio.adapter.scan(2.5):
    if is not None and == 'InterestingPeripheral':
        my_entry = entry

if not my_entry:
    raise Exception("'InterestingPeripheral' not found")

connection = _bleio.adapter.connect(my_entry.address, timeout=10)
class _bleio.Connection

Connections cannot be made directly. Instead, to initiate a connection use Adapter.connect. Connections may also be made when another device initiates a connection. To use a Connection created by a peer, read the Adapter.connections property.


Disconnects from the remote peripheral. Does nothing if already disconnected.

pair(*, bond=True)

Pair to the peer to improve security.

Do BLE discovery for all services or for the given service UUIDS, to find their handles and characteristics, and return the discovered services. Connection.connected must be True.
Parameters:service_uuids_whitelist (iterable) –

an iterable of :py:class:~`UUID` objects for the services provided by the peripheral that you want to use.

The peripheral may provide more services, but services not listed are ignored and will not be returned.

If service_uuids_whitelist is None, then all services will undergo discovery, which can be slow.

If the service UUID is 128-bit, or its characteristic UUID’s are 128-bit, you you must have already created a :py:class:~`UUID` object for that UUID in order for the service or characteristic to be discovered. Creating the UUID causes the UUID to be registered for use. (This restriction may be lifted in the future.)

Returns:A tuple of _bleio.Service objects provided by the remote peripheral.

True if connected to the remote peer.


True if paired to the remote peer.


Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers increase speed and decrease latency but increase power consumption.

When setting connection_interval, the peer may reject the new interval and connection_interval will then remain the same.

Apple has additional guidelines that dictate should be a multiple of 15ms except if HID is available. When HID is available Apple devices may accept 11.25ms intervals.