Skip to content

Commit

Permalink
APIS-1081 Added async wait and replaced check for Mac with check for …
Browse files Browse the repository at this point in the history
…Windows
  • Loading branch information
SonjaSt committed Dec 13, 2024
1 parent 9325810 commit 1e7960f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/explorepy/btcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ async def stream(self):
if not self.is_connected:
break
if self.try_disconnect.is_set():
await asyncio.sleep(1.0) # wait a second to give bleak time to disconnect (?)
logger.info("scanning for device")
self.ble_device = await BleakScanner.find_device_by_name(self.device_name, timeout=3)

Expand All @@ -288,8 +289,7 @@ async def stream(self):
loop = asyncio.get_running_loop()
disconnect_task = loop.create_task(self.client.disconnect())
await disconnect_task
self.connection_attempt_counter = 0
if self.ble_device and self.client and sys.platform != 'darwin':
if self.ble_device and self.client and sys.platform == 'win32':
available_services = self.client.services # This freezes on Mac
eeg_service_available = False
for s in available_services:
Expand Down

0 comments on commit 1e7960f

Please sign in to comment.