From a61bfc14605eb5d1f9fb2976258f4d05f18f2576 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Fri, 29 Oct 2021 14:02:14 +1100 Subject: [PATCH] aioble/README.md: Add l2cap example. Signed-off-by: Jim Mussared --- micropython/bluetooth/aioble/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/micropython/bluetooth/aioble/README.md b/micropython/bluetooth/aioble/README.md index dd2318ee..66bb32d6 100644 --- a/micropython/bluetooth/aioble/README.md +++ b/micropython/bluetooth/aioble/README.md @@ -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 --------