casambi-bt-revamped 0.3.7.dev14__py3-none-any.whl → 0.3.8.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- CasambiBt/_client.py +27 -13
- {casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/METADATA +1 -1
- {casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/RECORD +6 -6
- {casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/WHEEL +0 -0
- {casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/licenses/LICENSE +0 -0
- {casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/top_level.txt +0 -0
CasambiBt/_client.py
CHANGED
|
@@ -233,18 +233,23 @@ class CasambiClient:
|
|
|
233
233
|
self._callbackQueue.put_nowait((handle, data))
|
|
234
234
|
|
|
235
235
|
async def _processCallbacks(self) -> None:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
try:
|
|
237
|
+
while True:
|
|
238
|
+
handle, data = await self._callbackQueue.get()
|
|
239
|
+
|
|
240
|
+
# Try to loose any races here.
|
|
241
|
+
# Otherwise a state change caused by the last packet might not have been handled yet
|
|
242
|
+
await asyncio.sleep(0.001)
|
|
243
|
+
await self._activityLock.acquire()
|
|
244
|
+
try:
|
|
245
|
+
self._callbackMulitplexer(handle, data)
|
|
246
|
+
finally:
|
|
247
|
+
self._callbackQueue.task_done()
|
|
248
|
+
self._activityLock.release()
|
|
249
|
+
except asyncio.CancelledError:
|
|
250
|
+
# Task cancelled during shutdown; log at debug and exit cleanly.
|
|
251
|
+
self._logger.debug("Callback processing task cancelled during shutdown.")
|
|
252
|
+
raise
|
|
248
253
|
|
|
249
254
|
def _callbackMulitplexer(
|
|
250
255
|
self, handle: BleakGATTCharacteristic, data: bytes
|
|
@@ -759,8 +764,17 @@ class CasambiClient:
|
|
|
759
764
|
self._logger.info("Disconnecting...")
|
|
760
765
|
|
|
761
766
|
if self._callbackTask is not None:
|
|
767
|
+
# Cancel and await the background callback task to avoid
|
|
768
|
+
# 'Task was destroyed but it is pending' warnings.
|
|
762
769
|
self._callbackTask.cancel()
|
|
763
|
-
|
|
770
|
+
try:
|
|
771
|
+
await self._callbackTask
|
|
772
|
+
except asyncio.CancelledError:
|
|
773
|
+
pass
|
|
774
|
+
except Exception:
|
|
775
|
+
self._logger.debug("Callback task finished with exception during disconnect.", exc_info=True)
|
|
776
|
+
finally:
|
|
777
|
+
self._callbackTask = None
|
|
764
778
|
|
|
765
779
|
if self._gattClient is not None and self._gattClient.is_connected:
|
|
766
780
|
try:
|
{casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/RECORD
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
CasambiBt/__init__.py,sha256=TW445xSu5PV3TyMjJfwaA1JoWvQQ8LXhZgGdDTfWf3s,302
|
|
2
2
|
CasambiBt/_cache.py,sha256=KZ2xbiHAHXUPa8Gw_75Nw9NL4QSY_sTWHbyYXYUDaB0,3865
|
|
3
3
|
CasambiBt/_casambi.py,sha256=AfyuzEU2ylJOGLmZ87Qft-aNXI_JK8Ng9Tfk4fWYOwo,34345
|
|
4
|
-
CasambiBt/_client.py,sha256=
|
|
4
|
+
CasambiBt/_client.py,sha256=6uFawDzPJuLEhD5oVaFlxDSm3herw_eBUPFkUIHLgYw,31832
|
|
5
5
|
CasambiBt/_constants.py,sha256=_AxkG7Btxl4VeS6mO7GJW5Kc9dFs3s9sDmtJ83ZEKNw,359
|
|
6
6
|
CasambiBt/_discover.py,sha256=H7HpiFYIy9ELvmPXXd_ck-5O5invJf15dDIRk-vO5IE,1696
|
|
7
7
|
CasambiBt/_encryption.py,sha256=CLcoOOrggQqhJbnr_emBnEnkizpWDvb_0yFnitq4_FM,3831
|
|
@@ -11,8 +11,8 @@ CasambiBt/_operation.py,sha256=Q5UccsrtNp_B_wWqwH_3eLFW_yF6A55FMmfUKDk2WrI,1059
|
|
|
11
11
|
CasambiBt/_unit.py,sha256=M-Q8-Xd3qjJSUEvsFtic8E4xDc_gtWYakbTGyoIA-P8,16377
|
|
12
12
|
CasambiBt/errors.py,sha256=0JgDjaKlAKDes0poWzA8nrTUYQ8qdNfBb8dfaqqzCRA,1664
|
|
13
13
|
CasambiBt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
casambi_bt_revamped-0.3.
|
|
15
|
-
casambi_bt_revamped-0.3.
|
|
16
|
-
casambi_bt_revamped-0.3.
|
|
17
|
-
casambi_bt_revamped-0.3.
|
|
18
|
-
casambi_bt_revamped-0.3.
|
|
14
|
+
casambi_bt_revamped-0.3.8.dev2.dist-info/licenses/LICENSE,sha256=TAIIitFxpxEDi6Iju7foW4TDQmWvC-IhLVLhl67jKmQ,11341
|
|
15
|
+
casambi_bt_revamped-0.3.8.dev2.dist-info/METADATA,sha256=i70KB_Zi7ZedRaKQ4A33A2CdRy1pTcZ2X5oED4ivN1g,3048
|
|
16
|
+
casambi_bt_revamped-0.3.8.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
casambi_bt_revamped-0.3.8.dev2.dist-info/top_level.txt,sha256=uNbqLjtecFosoFzpGAC89-5icikWODKI8rOjbi8v_sA,10
|
|
18
|
+
casambi_bt_revamped-0.3.8.dev2.dist-info/RECORD,,
|
{casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
{casambi_bt_revamped-0.3.7.dev14.dist-info → casambi_bt_revamped-0.3.8.dev2.dist-info}/top_level.txt
RENAMED
|
File without changes
|