We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3f4779 commit 09f0e47Copy full SHA for 09f0e47
micropython/bluetooth/aioble/aioble/device.py
@@ -262,7 +262,7 @@ def is_connected(self):
262
def timeout(self, timeout_ms):
263
return DeviceTimeout(self, timeout_ms)
264
265
- async def exchange_mtu(self, mtu=None):
+ async def exchange_mtu(self, mtu=None, timeout_ms=1000):
266
if not self.is_connected():
267
raise ValueError("Not connected")
268
@@ -271,7 +271,8 @@ async def exchange_mtu(self, mtu=None):
271
272
self._mtu_event = self._mtu_event or asyncio.ThreadSafeFlag()
273
ble.gattc_exchange_mtu(self._conn_handle)
274
- await self._mtu_event.wait()
+ with self.timeout(timeout_ms):
275
+ await self._mtu_event.wait()
276
return self.mtu
277
278
# Wait for a connection on an L2CAP connection-oriented-channel.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments