mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
deal with bad established ble cx
This commit is contained in:
@@ -113,7 +113,12 @@ class BLEConnection:
|
||||
except TimeoutError:
|
||||
return None
|
||||
|
||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||
try:
|
||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||
except AttributeError :
|
||||
logger.info("Connection is not established, need to restart it")
|
||||
logger.debug("in ble_cx.connect()")
|
||||
return None
|
||||
|
||||
nus = self.client.services.get_service(UART_SERVICE_UUID)
|
||||
if nus is None:
|
||||
|
||||
@@ -165,6 +165,7 @@ class MeshCore:
|
||||
await self.dispatcher.start()
|
||||
result = await self.connection_manager.connect()
|
||||
if result is None:
|
||||
await self.dispatcher.stop()
|
||||
raise ConnectionError("Failed to connect to device")
|
||||
return await self.commands.send_appstart()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user