aioble/README.md: Add l2cap example.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/426/head
Jim Mussared 2021-10-29 14:02:14 +11:00 zatwierdzone przez Damien George
rodzic 3ea74867f3
commit a61bfc1460
1 zmienionych plików z 19 dodań i 0 usunięć

Wyświetl plik

@ -123,6 +123,25 @@ while True:
data = await temp_char.notified()
```
Open L2CAP channels: (Listener)
```py
channel = await connection.l2cap_accept(_L2CAP_PSN, _L2CAP_MTU)
buf = bytearray(64)
n = channel.recvinto(buf)
channel.send(b'response')
```
Open L2CAP channels: (Initiator)
```py
channel = await connection.l2cap_connect(_L2CAP_PSN, _L2CAP_MTU)
channel.send(b'request')
buf = bytearray(64)
n = channel.recvinto(buf)
```
Examples
--------