From 49530d8d6deb890c99e5bb764a2fab54358389e9 Mon Sep 17 00:00:00 2001 From: Dennis Heinze Date: Sat, 24 Jan 2026 00:20:55 +0100 Subject: [PATCH] Update apps and examples to await .terminated --- apps/gg_bridge.py | 2 +- apps/l2cap_bridge.py | 2 +- apps/rfcomm_bridge.py | 2 +- apps/scan.py | 2 +- apps/speaker/speaker.py | 2 +- examples/device_information_server.py | 2 +- examples/run_a2dp_sink.py | 2 +- examples/run_a2dp_source.py | 2 +- examples/run_advertiser.py | 2 +- examples/run_classic_discoverable.py | 2 +- examples/run_classic_discovery.py | 2 +- examples/run_connect_and_encrypt.py | 2 +- examples/run_controller.py | 2 +- examples/run_device_with_snooper.py | 2 +- examples/run_gatt_server.py | 2 +- examples/run_gatt_server_with_pairing_delegate.py | 2 +- examples/run_gatt_with_adapters.py | 2 +- examples/run_hfp_handsfree.py | 2 +- examples/run_hid_device.py | 2 +- examples/run_hid_host.py | 2 +- examples/run_rfcomm_client.py | 2 +- examples/run_rfcomm_server.py | 2 +- examples/run_scanner.py | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/gg_bridge.py b/apps/gg_bridge.py index 5e5574b..402b8ef 100644 --- a/apps/gg_bridge.py +++ b/apps/gg_bridge.py @@ -352,7 +352,7 @@ async def run( await bridge.start() # Wait until the source terminates - await hci_source.wait_for_termination() + await hci_source.terminated @click.command() diff --git a/apps/l2cap_bridge.py b/apps/l2cap_bridge.py index aaccc12..bef07c6 100644 --- a/apps/l2cap_bridge.py +++ b/apps/l2cap_bridge.py @@ -268,7 +268,7 @@ async def run(device_config, hci_transport, bridge): await bridge.start(device) # Wait until the transport terminates - await hci_source.wait_for_termination() + await hci_source.terminated # ----------------------------------------------------------------------------- diff --git a/apps/rfcomm_bridge.py b/apps/rfcomm_bridge.py index b0b27ca..6b5f3ef 100644 --- a/apps/rfcomm_bridge.py +++ b/apps/rfcomm_bridge.py @@ -421,7 +421,7 @@ async def run(device_config, hci_transport, bridge): await bridge.start(device) # Wait until the transport terminates - await hci_source.wait_for_termination() + await hci_source.terminated except core.ConnectionError as error: print(color(f"!!! Bluetooth connection failed: {error}", "red")) except Exception as error: diff --git a/apps/scan.py b/apps/scan.py index 7de628e..5761190 100644 --- a/apps/scan.py +++ b/apps/scan.py @@ -190,7 +190,7 @@ async def scan( scanning_phys=scanning_phys, ) - await hci_source.wait_for_termination() + await hci_source.terminated # ----------------------------------------------------------------------------- diff --git a/apps/speaker/speaker.py b/apps/speaker/speaker.py index 777025b..4ca9731 100644 --- a/apps/speaker/speaker.py +++ b/apps/speaker/speaker.py @@ -726,7 +726,7 @@ class Speaker: print("Waiting for connection...") await self.advertise() - await hci_source.wait_for_termination() + await hci_source.terminated for output in self.outputs: await output.stop() diff --git a/examples/device_information_server.py b/examples/device_information_server.py index 9d3bc6d..bce0c7d 100644 --- a/examples/device_information_server.py +++ b/examples/device_information_server.py @@ -65,7 +65,7 @@ async def main() -> None: # Go! await device.power_on() await device.start_advertising(auto_restart=True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_a2dp_sink.py b/examples/run_a2dp_sink.py index 1d4f2a2..fab4ff2 100644 --- a/examples/run_a2dp_sink.py +++ b/examples/run_a2dp_sink.py @@ -161,7 +161,7 @@ async def main() -> None: await device.set_discoverable(True) await device.set_connectable(True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_a2dp_source.py b/examples/run_a2dp_source.py index 4766cdf..8ed185e 100644 --- a/examples/run_a2dp_source.py +++ b/examples/run_a2dp_source.py @@ -181,7 +181,7 @@ async def main() -> None: await device.set_discoverable(True) await device.set_connectable(True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_advertiser.py b/examples/run_advertiser.py index 2049075..a52e82b 100644 --- a/examples/run_advertiser.py +++ b/examples/run_advertiser.py @@ -70,7 +70,7 @@ async def main() -> None: await device.power_on() await device.start_advertising(advertising_type=advertising_type, target=target) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_classic_discoverable.py b/examples/run_classic_discoverable.py index bad08f6..a8c10f8 100644 --- a/examples/run_classic_discoverable.py +++ b/examples/run_classic_discoverable.py @@ -112,7 +112,7 @@ async def main() -> None: await device.set_discoverable(True) await device.set_connectable(True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_classic_discovery.py b/examples/run_classic_discovery.py index 77d036e..153a23c 100644 --- a/examples/run_classic_discovery.py +++ b/examples/run_classic_discovery.py @@ -73,7 +73,7 @@ async def main() -> None: await device.power_on() await device.start_discovery() - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_connect_and_encrypt.py b/examples/run_connect_and_encrypt.py index 5515ade..02d25f5 100644 --- a/examples/run_connect_and_encrypt.py +++ b/examples/run_connect_and_encrypt.py @@ -57,7 +57,7 @@ async def main() -> None: print(f'!!! Encryption failed: {error}') return - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_controller.py b/examples/run_controller.py index d25d32f..c634e18 100644 --- a/examples/run_controller.py +++ b/examples/run_controller.py @@ -101,7 +101,7 @@ async def main() -> None: await device.start_advertising() await device.start_scanning() - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_device_with_snooper.py b/examples/run_device_with_snooper.py index c7752d8..c8ae647 100644 --- a/examples/run_device_with_snooper.py +++ b/examples/run_device_with_snooper.py @@ -48,7 +48,7 @@ async def main() -> None: await device.power_on() await device.start_scanning() - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_gatt_server.py b/examples/run_gatt_server.py index afc6c05..a4430f5 100644 --- a/examples/run_gatt_server.py +++ b/examples/run_gatt_server.py @@ -147,7 +147,7 @@ async def main() -> None: else: await device.start_advertising(auto_restart=True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_gatt_server_with_pairing_delegate.py b/examples/run_gatt_server_with_pairing_delegate.py index 151baec..e4b36b6 100644 --- a/examples/run_gatt_server_with_pairing_delegate.py +++ b/examples/run_gatt_server_with_pairing_delegate.py @@ -99,7 +99,7 @@ async def main() -> None: else: await device.start_advertising(auto_restart=True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_gatt_with_adapters.py b/examples/run_gatt_with_adapters.py index 81e2ca9..82be051 100644 --- a/examples/run_gatt_with_adapters.py +++ b/examples/run_gatt_with_adapters.py @@ -422,7 +422,7 @@ async def main() -> None: # Setup a server await server(device) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_hfp_handsfree.py b/examples/run_hfp_handsfree.py index 33bd213..2caf67b 100644 --- a/examples/run_hfp_handsfree.py +++ b/examples/run_hfp_handsfree.py @@ -167,7 +167,7 @@ async def main() -> None: await websockets.asyncio.server.serve(serve, 'localhost', 8989) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_hid_device.py b/examples/run_hid_device.py index 0c7fb36..696e734 100644 --- a/examples/run_hid_device.py +++ b/examples/run_hid_device.py @@ -735,7 +735,7 @@ async def main() -> None: print("Executing in Web mode") await keyboard_device(hid_device) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_hid_host.py b/examples/run_hid_host.py index f6153f1..a3d4fef 100644 --- a/examples/run_hid_host.py +++ b/examples/run_hid_host.py @@ -556,7 +556,7 @@ async def main() -> None: # Interrupt Channel await hid_host.connect_interrupt_channel() - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_rfcomm_client.py b/examples/run_rfcomm_client.py index d801797..b91792e 100644 --- a/examples/run_rfcomm_client.py +++ b/examples/run_rfcomm_client.py @@ -227,7 +227,7 @@ async def main() -> None: tcp_port = int(sys.argv[5]) asyncio.create_task(tcp_server(tcp_port, session)) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_rfcomm_server.py b/examples/run_rfcomm_server.py index 94a5a2f..4e2d020 100644 --- a/examples/run_rfcomm_server.py +++ b/examples/run_rfcomm_server.py @@ -153,7 +153,7 @@ async def main() -> None: await device.set_discoverable(True) await device.set_connectable(True) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # ----------------------------------------------------------------------------- diff --git a/examples/run_scanner.py b/examples/run_scanner.py index 6bb7e78..8c56cb1 100644 --- a/examples/run_scanner.py +++ b/examples/run_scanner.py @@ -75,7 +75,7 @@ async def main() -> None: await device.power_on() await device.start_scanning(filter_duplicates=filter_duplicates) - await hci_transport.source.wait_for_termination() + await hci_transport.source.terminated # -----------------------------------------------------------------------------