diff --git a/irobot_edu_sdk/backend/bluetooth_desktop.py b/irobot_edu_sdk/backend/bluetooth_desktop.py index 61e27fc..36cb1de 100644 --- a/irobot_edu_sdk/backend/bluetooth_desktop.py +++ b/irobot_edu_sdk/backend/bluetooth_desktop.py @@ -1,5 +1,5 @@ # -# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2022 iRobot Corporation. All rights reserved. +# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2023 iRobot Corporation. All rights reserved. # """ @@ -49,10 +49,11 @@ async def connect(self): self._address = device.address self._device = device break - print(f'Connecting to {device.name} ({device.address})') if self._device: + print(f'Connecting to {device.name} ({device.address})') self._client = BleakClient(self._device) else: + print(f'Connecting to {self._address}') self._client = BleakClient(self._address) if await self._client.connect(): diff --git a/irobot_edu_sdk/robot.py b/irobot_edu_sdk/robot.py index 875c644..363248a 100644 --- a/irobot_edu_sdk/robot.py +++ b/irobot_edu_sdk/robot.py @@ -1,5 +1,5 @@ # -# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2022 iRobot Corporation. All rights reserved. +# Licensed under 3-Clause BSD license available in the License file. Copyright (c) 2020-2023 iRobot Corporation. All rights reserved. # try: @@ -92,7 +92,12 @@ def __init__(self, backend: Backend): self.sound_enabled = True + # Catch all signals and direct to the _exit_handler signal.signal(signal.SIGINT, _exit_handler) + signal.signal(signal.SIGTSTP, _exit_handler) + signal.signal(signal.SIGQUIT, _exit_handler) + signal.signal(signal.SIGHUP, _exit_handler) + signal.signal(signal.SIGTERM, _exit_handler) def __enter__(self): return self