mirror of
https://github.com/smittix/intercept.git
synced 2026-06-08 14:11:54 -07:00
fix(meshcore): revert wrong scan_ble_sync route call, fix scan without worker
- Revert route to scan_ble() — scan_ble_sync() lives on AsyncWorker, not MeshcoreClient; the 500 was caused by our previous fix - MeshcoreClient.scan_ble() now runs a one-shot asyncio scan when no worker is active, so Scan works before Connect is pressed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+11
-2
@@ -413,10 +413,19 @@ class MeshcoreClient:
|
||||
self._worker.request_traceroute(node_id)
|
||||
|
||||
def scan_ble(self) -> list[dict]:
|
||||
"""Scan for BLE MeshCore devices; returns list of found device dicts."""
|
||||
"""Scan for BLE MeshCore devices; works with or without an active connection."""
|
||||
if self._worker:
|
||||
return self._worker.scan_ble_sync()
|
||||
return []
|
||||
# No worker yet — run a one-shot scan directly
|
||||
import asyncio
|
||||
|
||||
from utils.meshcore_client import _scan_ble
|
||||
|
||||
try:
|
||||
return asyncio.run(_scan_ble())
|
||||
except Exception as exc:
|
||||
logger.warning("BLE scan failed: %s", exc)
|
||||
return []
|
||||
|
||||
|
||||
_client: MeshcoreClient | None = None
|
||||
|
||||
Reference in New Issue
Block a user