mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-13 04:36:53 +00:00
disconnect client before returning None
This commit is contained in:
@@ -18,7 +18,6 @@ UART_SERVICE_UUID = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
|
|||||||
UART_RX_CHAR_UUID = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
|
UART_RX_CHAR_UUID = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
|
||||||
UART_TX_CHAR_UUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
|
UART_TX_CHAR_UUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
|
||||||
|
|
||||||
|
|
||||||
class BLEConnection:
|
class BLEConnection:
|
||||||
def __init__(self, address=None, device=None, client=None, pin=None):
|
def __init__(self, address=None, device=None, client=None, pin=None):
|
||||||
"""
|
"""
|
||||||
@@ -116,6 +115,8 @@ class BLEConnection:
|
|||||||
try:
|
try:
|
||||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||||
except AttributeError :
|
except AttributeError :
|
||||||
|
if self.client :
|
||||||
|
await self.client.disconnect()
|
||||||
logger.info("Connection is not established, need to restart it")
|
logger.info("Connection is not established, need to restart it")
|
||||||
logger.debug("in ble_cx.connect()")
|
logger.debug("in ble_cx.connect()")
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user