Metadata-Version: 2.4
Name: aio-rfcomm
Version: 1.1.0
Summary: Cross-platform asyncio RFCOMM (Bluetooth Classic serial port) for Linux, macOS and Windows
Keywords: asyncio,bluetooth,bluetooth-classic,rfcomm,serial
Author: David Lechner
Author-email: David Lechner <david@pybricks.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Framework :: AsyncIO
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Typing :: Typed
Requires-Dist: typing-extensions>=4.4
Requires-Dist: dbus-fast>=4 ; sys_platform == 'linux'
Requires-Dist: rubicon-objc>=0.5.3 ; sys_platform == 'darwin'
Requires-Dist: winrt-windows-devices-bluetooth>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-devices-bluetooth-rfcomm>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-devices-enumeration>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-devices-radios>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-foundation>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-foundation-collections>=3.2.1 ; sys_platform == 'win32'
Requires-Dist: winrt-windows-storage-streams>=3.2.1 ; sys_platform == 'win32'
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/dlech/aio-rfcomm
Project-URL: Documentation, https://dlech.github.io/aio-rfcomm/
Project-URL: Repository, https://github.com/dlech/aio-rfcomm
Project-URL: Issues, https://github.com/dlech/aio-rfcomm/issues
Description-Content-Type: text/markdown

# aio-rfcomm

Talk to Bluetooth Classic serial devices from asyncio — the same way on Linux,
macOS and Windows.

```python
async with (
    aio_rfcomm.open_bluetooth() as bluetooth,
    bluetooth.open_service(DEVICE, MY_SERVICE) as channel,
):
    await channel.send(b"hello\n")

    while True:  # until the connection ends, raising ChannelClosedError
        print((await channel.receive()).decode(), end="")
```

That is the whole idea. RFCOMM is how many Bluetooth gadgets that predate BLE
still talk — printers, GPS units, robots, serial adapters, a great many
embedded boards — and reaching one from Python has meant a different library,
a different API and a different set of surprises on every platform.

This is one API for all three, running in your own event loop, with every
connection owned by an `async with` block that cleans up after itself.

## Install

```console
$ uv add aio-rfcomm
```

It needs Python 3.11 or newer. The documentation is at
<https://dlech.github.io/aio-rfcomm/>.

## Serving, too

Publish a service and let devices connect to you:

```python
async with bluetooth.serve(MY_SERVICE, name="my thing") as service:
    async for request in service.connection_requests():
        ...  # accept it, in a task of your own
```
