From 240b11fc6e0f33b24876184d9b6b456af1fcae25 Mon Sep 17 00:00:00 2001 From: Vitaly Gridin Date: Thu, 7 Nov 2019 20:24:22 +0300 Subject: [PATCH] BGAPIBackend: add timeout parameter in discover_characteristics method --- pygatt/backends/bgapi/bgapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygatt/backends/bgapi/bgapi.py b/pygatt/backends/bgapi/bgapi.py index 29da0b91..8604b67d 100755 --- a/pygatt/backends/bgapi/bgapi.py +++ b/pygatt/backends/bgapi/bgapi.py @@ -455,7 +455,7 @@ def connect(self, address, timeout=5, exc.__cause__ = None raise exc - def discover_characteristics(self, connection_handle): + def discover_characteristics(self, connection_handle, timeout=30): att_handle_start = 0x0001 # first valid handle att_handle_end = 0xFFFF # last valid handle log.info("Fetching characteristics for connection %d", @@ -467,7 +467,7 @@ def discover_characteristics(self, connection_handle): self.expect(ResponsePacketType.attclient_find_information) try: self.expect(EventPacketType.attclient_procedure_completed, - timeout=30) + timeout=timeout) except ExpectedResponseTimeout: log.warn("Continuing even though discovery hasn't finished")