kopia lustrzana https://github.com/micropython/micropython-lib
aioble: Make l2cap chunk size configurable to allow optimization by app.
rodzic
c4fada7f6f
commit
a18d49cda7
|
@ -132,10 +132,10 @@ class L2CAPChannel:
|
||||||
|
|
||||||
# Waits until the channel is free and then sends buf.
|
# Waits until the channel is free and then sends buf.
|
||||||
# If the buffer is larger than the MTU it will be sent in chunks.
|
# 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()
|
self._assert_connected()
|
||||||
offset = 0
|
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)
|
mv = memoryview(buf)
|
||||||
while offset < len(buf):
|
while offset < len(buf):
|
||||||
if self._stalled:
|
if self._stalled:
|
||||||
|
|
Ładowanie…
Reference in New Issue