From a18d49cda7a5d615298e8bb65fb24208036befff Mon Sep 17 00:00:00 2001 From: Philip Peitsch Date: Tue, 23 Aug 2022 18:19:19 +1000 Subject: [PATCH] aioble: Make l2cap chunk size configurable to allow optimization by app. --- micropython/bluetooth/aioble/aioble/l2cap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micropython/bluetooth/aioble/aioble/l2cap.py b/micropython/bluetooth/aioble/aioble/l2cap.py index 4d8fd927..e8e4c026 100644 --- a/micropython/bluetooth/aioble/aioble/l2cap.py +++ b/micropython/bluetooth/aioble/aioble/l2cap.py @@ -132,10 +132,10 @@ class L2CAPChannel: # Waits until the channel is free and then sends buf. # If the buffer is larger than the MTU it will be sent in chunks. - async def send(self, buf, timeout_ms=None): + async def send(self, buf, timeout_ms=None, chunk_size=None): self._assert_connected() offset = 0 - chunk_size = min(self.our_mtu * 2, self.peer_mtu) + chunk_size = min(self.our_mtu * 2, self.peer_mtu, chunk_size or self.peer_mtu) mv = memoryview(buf) while offset < len(buf): if self._stalled: