remove tre from scanner.py, add test routine
This commit is contained in:
1 parent
0bfcde0f64
commit
3c1c3ed432
3 files changed
+12
-17
No files matched your search
+8
-9
@@ -32,11 +32,10 @@ from bleak import BleakClient, BleakScanner
|
||||
MI_SERVICE_UUID = "ebe0ccb0-7a0a-4b0c-8a1a-6ff2997da3a6"
|
||||
TEMP_CHAR_UUID = "ebe0ccc1-7a0a-4b0c-8a1a-6ff2997da3a6"
|
||||
|
||||
SCAN_TIMEOUT = 5.0 # seconds to scan for each MAC
|
||||
CONNECT_TIMEOUT = 10.0
|
||||
READ_TIMEOUT = 2.0
|
||||
SERVICE_DISCOVERY_TIMEOUT = 5.0
|
||||
_lock = asyncio.Lock()
|
||||
SCAN_TIMEOUT = 10.0 # seconds to scan for each MAC
|
||||
CONNECT_TIMEOUT = 20.0
|
||||
READ_TIMEOUT = 5.0
|
||||
SERVICE_DISCOVERY_TIMEOUT = 10.0
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Logging
|
||||
@@ -192,10 +191,9 @@ def read_data_sync(mac: str) -> Optional[SensorReading]:
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# Original helper functions - unchanged
|
||||
# Original helper functions
|
||||
# --------------------------------------------------------------------------- #
|
||||
def sensor_data_query(mac_list: List[str]) -> List[dict]:
|
||||
"""Legacy function; returns a list of dicts like the original code."""
|
||||
result = []
|
||||
for mac in mac_list:
|
||||
try:
|
||||
@@ -212,7 +210,6 @@ def sensor_data_query(mac_list: List[str]) -> List[dict]:
|
||||
|
||||
|
||||
def test(test_count = 0) -> None:
|
||||
"""Legacy test harness - identical to your original script."""
|
||||
# first test scanner
|
||||
test_loop_count = 0
|
||||
found_macs = scan_macs()
|
||||
@@ -226,7 +223,9 @@ def test(test_count = 0) -> None:
|
||||
"A4:C1:38:24:15:B0",
|
||||
"A4:C1:38:D7:8D:26",
|
||||
]
|
||||
|
||||
print("Testing concurrent scan...")
|
||||
multi_test_results = read_multiple(mac_list)
|
||||
print(json.dumps(multi_test_results, indent=2))
|
||||
print("Starting BLE test...")
|
||||
print(" Scanning MACs:")
|
||||
for mac in mac_list:
|
||||
|
||||
Reference in new issue
Block a user