Filter likely BullTron BLE devices

This commit is contained in:
2026-07-10 20:53:48 +02:00
parent e3ef3dbfc5
commit 5a249ecb86
3 changed files with 64 additions and 4 deletions
+12 -1
View File
@@ -1,6 +1,6 @@
import unittest
from bulltron_gui import DeviceState, decode_response, read_frame, split_frames
from bulltron_gui import DeviceState, bulltron_match_reason, decode_response, read_frame, split_frames
class BullTronParserTest(unittest.TestCase):
@@ -41,6 +41,17 @@ class BullTronParserTest(unittest.TestCase):
self.assertTrue(state.telemetry.discharge_mos)
self.assertEqual(state.telemetry.cell_count, 4)
def test_bulltron_scan_filter_matches_apk_markers(self):
self.assertEqual(bulltron_match_reason("DL-1234", [], []), "name:DL")
self.assertEqual(bulltron_match_reason("B35-1234", [], []), "name:B35")
self.assertEqual(
bulltron_match_reason("unknown", ["0000fff0-0000-1000-8000-00805f9b34fb"], []),
"service:fff0",
)
payload = bytes.fromhex("00" * 14 + "4A4842" + "00")
self.assertEqual(bulltron_match_reason("unknown", [], [payload]), "adv:JHB")
self.assertIsNone(bulltron_match_reason("keyboard", [], [b"\x01\x02\x03"]))
if __name__ == "__main__":
unittest.main()