Skip to content

Commit a18d49c

Browse files
peitschiedpgeorge
authored andcommitted
aioble: Make l2cap chunk size configurable to allow optimization by app.
1 parent c4fada7 commit a18d49c

File tree

1 file changed

+2
-2
lines changed
  • micropython/bluetooth/aioble/aioble

1 file changed

+2
-2
lines changed

Diff for: micropython/bluetooth/aioble/aioble/l2cap.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ def available(self):
132132

133133
# Waits until the channel is free and then sends buf.
134134
# If the buffer is larger than the MTU it will be sent in chunks.
135-
async def send(self, buf, timeout_ms=None):
135+
async def send(self, buf, timeout_ms=None, chunk_size=None):
136136
self._assert_connected()
137137
offset = 0
138-
chunk_size = min(self.our_mtu * 2, self.peer_mtu)
138+
chunk_size = min(self.our_mtu * 2, self.peer_mtu, chunk_size or self.peer_mtu)
139139
mv = memoryview(buf)
140140
while offset < len(buf):
141141
if self._stalled:

0 commit comments

Comments
 (0)