Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion smpclient/transport/ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from uuid import UUID

from bleak import BleakClient, BleakGATTCharacteristic, BleakScanner
from bleak.args.winrt import WinRTClientArgs
from bleak.backends.client import BaseBleakClient
from bleak.backends.device import BLEDevice
from smp import header as smphdr
Expand Down Expand Up @@ -66,11 +67,12 @@ class SMPBLETransportNotSMPServer(SMPBLETransportException):
class SMPBLETransport(SMPTransport):
"""A Bluetooth Low Energy (BLE) SMPTransport."""

def __init__(self) -> None:
def __init__(self, winrt: WinRTClientArgs = {}) -> None:
self._buffer = bytearray()
self._notify_condition = asyncio.Condition()
self._disconnected_event = asyncio.Event()
self._disconnected_event.set()
self._winrt = winrt

self._max_write_without_response_size = 20
"""Initially set to BLE minimum; may be mutated by the `connect()` method."""
Expand All @@ -90,6 +92,7 @@ async def connect(self, address: str, timeout_s: float) -> None:
self._client = BleakClient(
device,
services=(str(SMP_SERVICE_UUID),),
winrt=self._winrt,
disconnected_callback=self._set_disconnected_event,
)
else:
Expand Down