@@ -349,6 +349,13 @@ class BleakClient:
349349 Callback that will be scheduled in the event loop when the client is
350350 disconnected. The callable must take one argument, which will be
351351 this client object.
352+ pairing_callbacks:
353+ Optional callbacks used in the pairing process (e.g. displaying,
354+ confirming, requesting pin). If provided here instead of to the
355+ :meth:`pair` method as ``callbacks`` parameter, device will be
356+ implicitly paired during connection establishment. This is useful
357+ for devices sending Slave Security Request immediately after
358+ connection, requiring pairing before GATT service discovery.
352359 timeout:
353360 Timeout in seconds passed to the implicit ``discover`` call when
354361 ``address_or_ble_device`` is not a :class:`BLEDevice`. Defaults to 10.0.
@@ -385,6 +392,7 @@ def __init__(
385392 self ,
386393 address_or_ble_device : Union [BLEDevice , str ],
387394 disconnected_callback : Optional [Callable [[BleakClient ], None ]] = None ,
395+ pairing_callbacks : Optional [BaseBleakAgentCallbacks ] = None ,
388396 * ,
389397 timeout : float = 10.0 ,
390398 winrt : WinRTClientArgs = {},
@@ -398,6 +406,7 @@ def __init__(
398406 self ._backend = PlatformBleakClient (
399407 address_or_ble_device ,
400408 disconnected_callback = disconnected_callback ,
409+ pairing_callbacks = pairing_callbacks ,
401410 timeout = timeout ,
402411 winrt = winrt ,
403412 ** kwargs ,
@@ -507,9 +516,10 @@ async def pair(
507516
508517 Args:
509518 callbacks:
510- Optional callbacks for confirming or requesting pin. This is
511- only supported on Linux and Windows. If omitted, the OS will
512- handle the pairing request.
519+ Optional callbacks used in the pairing process (e.g. displaying,
520+ confirming, requesting pin).
521+ This is only supported on Linux and Windows.
522+ If omitted, the OS will handle the pairing request.
513523
514524 Returns:
515525 Always returns ``True`` for backwards compatibility.
0 commit comments