casambi-bt-revamped 0.3.12.dev15__py3-none-any.whl → 0.3.12.dev16__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 +39 -0
- CasambiBt/_version.py +1 -1
- {casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/METADATA +1 -1
- {casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/RECORD +7 -7
- {casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/WHEEL +0 -0
- {casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/licenses/LICENSE +0 -0
- {casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/top_level.txt +0 -0
CasambiBt/_client.py
CHANGED
|
@@ -1624,6 +1624,39 @@ class CasambiClient:
|
|
|
1624
1624
|
visitor_key = self._network.classicVisitorKey()
|
|
1625
1625
|
manager_key = self._network.classicManagerKey()
|
|
1626
1626
|
|
|
1627
|
+
def _walk_classic_records(data: bytes) -> bool:
|
|
1628
|
+
"""Check if data is a plausible Classic unit state record stream.
|
|
1629
|
+
|
|
1630
|
+
Walks the same record structure as _parseClassicUnitStates:
|
|
1631
|
+
- unit_id(1) + flags(1) + optional extras + state(state_len)
|
|
1632
|
+
- unit_id 0xF0 is a command response (no extras, state_len bytes consumed)
|
|
1633
|
+
Accepts if >=1 record parsed AND pos ends exactly at len(data).
|
|
1634
|
+
"""
|
|
1635
|
+
pos = 0
|
|
1636
|
+
count = 0
|
|
1637
|
+
while pos + 3 <= len(data): # Match Android available()>=3
|
|
1638
|
+
unit_id = data[pos]
|
|
1639
|
+
flags = data[pos + 1]
|
|
1640
|
+
state_len = flags & 0x0F
|
|
1641
|
+
# 0 and 255 are Classic control bytes, not valid unit records
|
|
1642
|
+
# inside a record stream (handled at dispatch level).
|
|
1643
|
+
if unit_id == 0 or unit_id == 255:
|
|
1644
|
+
return False
|
|
1645
|
+
pos += 2
|
|
1646
|
+
if unit_id == 0xF0:
|
|
1647
|
+
# Command response: cmd_id(1) + seq(1) + payload(state_len-2).
|
|
1648
|
+
if state_len < 2:
|
|
1649
|
+
return False
|
|
1650
|
+
pos += state_len
|
|
1651
|
+
else:
|
|
1652
|
+
has_extra1 = (flags & 0x20) != 0
|
|
1653
|
+
has_extra2 = (flags & 0x40) != 0
|
|
1654
|
+
pos += int(has_extra1) + int(has_extra2) + state_len
|
|
1655
|
+
if pos > len(data):
|
|
1656
|
+
return False
|
|
1657
|
+
count += 1
|
|
1658
|
+
return count >= 1 and pos == len(data)
|
|
1659
|
+
|
|
1627
1660
|
def _plausible_payload(payload: bytes) -> bool:
|
|
1628
1661
|
if not payload:
|
|
1629
1662
|
return False
|
|
@@ -1638,6 +1671,12 @@ class CasambiClient:
|
|
|
1638
1671
|
rec_len = (payload[0] - 239) & 0xFF
|
|
1639
1672
|
if 2 <= rec_len <= len(payload):
|
|
1640
1673
|
return True
|
|
1674
|
+
# Classic unit state record stream or control byte.
|
|
1675
|
+
if self._protocolMode == ProtocolMode.CLASSIC:
|
|
1676
|
+
if payload[0] in (0, 255):
|
|
1677
|
+
return True
|
|
1678
|
+
if _walk_classic_records(payload):
|
|
1679
|
+
return True
|
|
1641
1680
|
return False
|
|
1642
1681
|
|
|
1643
1682
|
def _score(verified: bool | None, payload: bytes) -> int:
|
CasambiBt/_version.py
CHANGED
{casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: casambi-bt-revamped
|
|
3
|
-
Version: 0.3.12.
|
|
3
|
+
Version: 0.3.12.dev16
|
|
4
4
|
Summary: Forked Casambi Bluetooth client library with switch event support, use original if no special need. https://github.com/lkempf/casambi-bt
|
|
5
5
|
Home-page: https://github.com/rankjie/casambi-bt
|
|
6
6
|
Author: rankjie
|
{casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/RECORD
RENAMED
|
@@ -2,7 +2,7 @@ CasambiBt/__init__.py,sha256=iJdTF4oeXfj5d5gfGxQkacqUjtnQo0IW-zFPJvFjWWk,336
|
|
|
2
2
|
CasambiBt/_cache.py,sha256=3bQil8vhSy4f4sf9JusMfEdQC7d3cJuva9qHhyKro-0,3808
|
|
3
3
|
CasambiBt/_casambi.py,sha256=dAZZ0S2-t2ShLbW78AE9lOLBzOmhBOTTXJky-6khdkE,41981
|
|
4
4
|
CasambiBt/_classic_crypto.py,sha256=XIp3JBaeY8hIUv5kB0ygVG_eRx9AgHHF4ts2--CFm78,4973
|
|
5
|
-
CasambiBt/_client.py,sha256=
|
|
5
|
+
CasambiBt/_client.py,sha256=uieXtm5hRRMCUyxhsY1ZwSFs1mVvBJbe3JMkWQsayGk,105829
|
|
6
6
|
CasambiBt/_constants.py,sha256=86heoDdb5iPaRrPmK2DIIl-4uSxbFFcnCo9zlCvTLww,1290
|
|
7
7
|
CasambiBt/_discover.py,sha256=jLc6H69JddrCURgtANZEjws6_UbSzXJtvJkbKTaIUHY,1849
|
|
8
8
|
CasambiBt/_encryption.py,sha256=CLcoOOrggQqhJbnr_emBnEnkizpWDvb_0yFnitq4_FM,3831
|
|
@@ -12,11 +12,11 @@ CasambiBt/_network.py,sha256=3ZUedQlHzzuHHiG5KxDLnK0AIz0TjzG1_vwg0UGsO9U,22132
|
|
|
12
12
|
CasambiBt/_operation.py,sha256=Q5UccsrtNp_B_wWqwH_3eLFW_yF6A55FMmfUKDk2WrI,1059
|
|
13
13
|
CasambiBt/_switch_events.py,sha256=S8OD0dBcw5T4J2C7qfmOQMnTJ7omIXRUYv4PqDOB87E,13137
|
|
14
14
|
CasambiBt/_unit.py,sha256=nxbg_8UCCVB9WI8dUS21g2JrGyPKcefqKMSusMOhLOo,18721
|
|
15
|
-
CasambiBt/_version.py,sha256=
|
|
15
|
+
CasambiBt/_version.py,sha256=gV1qUyxx1Ng85vM0VQRn42juijLHgX2A69jBFD8mmfQ,338
|
|
16
16
|
CasambiBt/errors.py,sha256=1L_Q8og_N_BRYEKizghAQXr6tihlHykFgtcCHUDcBas,1961
|
|
17
17
|
CasambiBt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
casambi_bt_revamped-0.3.12.
|
|
19
|
-
casambi_bt_revamped-0.3.12.
|
|
20
|
-
casambi_bt_revamped-0.3.12.
|
|
21
|
-
casambi_bt_revamped-0.3.12.
|
|
22
|
-
casambi_bt_revamped-0.3.12.
|
|
18
|
+
casambi_bt_revamped-0.3.12.dev16.dist-info/licenses/LICENSE,sha256=TAIIitFxpxEDi6Iju7foW4TDQmWvC-IhLVLhl67jKmQ,11341
|
|
19
|
+
casambi_bt_revamped-0.3.12.dev16.dist-info/METADATA,sha256=p35CV0zqdNSbxrs0JzqVKlbOnS0F5aU2Flcty5SEw1k,5878
|
|
20
|
+
casambi_bt_revamped-0.3.12.dev16.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
21
|
+
casambi_bt_revamped-0.3.12.dev16.dist-info/top_level.txt,sha256=uNbqLjtecFosoFzpGAC89-5icikWODKI8rOjbi8v_sA,10
|
|
22
|
+
casambi_bt_revamped-0.3.12.dev16.dist-info/RECORD,,
|
{casambi_bt_revamped-0.3.12.dev15.dist-info → casambi_bt_revamped-0.3.12.dev16.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|