mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
disconnect client before returning None
This commit is contained in:
parent
3c34c6b34e
commit
9bcb9c5877
1 changed files with 2 additions and 1 deletions
|
|
@ -18,7 +18,6 @@ UART_SERVICE_UUID = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
|
|||
UART_RX_CHAR_UUID = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
|
||||
UART_TX_CHAR_UUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
|
||||
|
||||
|
||||
class BLEConnection:
|
||||
def __init__(self, address=None, device=None, client=None, pin=None):
|
||||
"""
|
||||
|
|
@ -116,6 +115,8 @@ class BLEConnection:
|
|||
try:
|
||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||
except AttributeError :
|
||||
if self.client :
|
||||
await self.client.disconnect()
|
||||
logger.info("Connection is not established, need to restart it")
|
||||
logger.debug("in ble_cx.connect()")
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue