mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Analyze MeshCore BLE scan logs
This commit is contained in:
@@ -486,6 +486,14 @@ class ConnectionProvider with ChangeNotifier {
|
||||
/// Start scanning for MeshCore devices
|
||||
Future<void> startScan() async {
|
||||
debugPrint('🔍 [Provider] startScan() called');
|
||||
if (_deviceInfo.connectionState == ConnectionState.connecting ||
|
||||
_deviceInfo.connectionState == ConnectionState.connected) {
|
||||
debugPrint(
|
||||
'⏭️ [Provider] Ignoring scan request while connection is active: ${_deviceInfo.connectionState}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
_isScanning = true;
|
||||
_scannedDevices.clear();
|
||||
_error = null;
|
||||
@@ -559,6 +567,11 @@ class ConnectionProvider with ChangeNotifier {
|
||||
'🔵 [Provider] connect() called for device: ${device.platformName}',
|
||||
);
|
||||
|
||||
if (_isScanning) {
|
||||
debugPrint('🔵 [Provider] Stopping active scan before connect()');
|
||||
await stopScan();
|
||||
}
|
||||
|
||||
_deviceInfo = _deviceInfo.copyWith(
|
||||
deviceId: device.remoteId.toString(),
|
||||
deviceName: device.platformName.isNotEmpty
|
||||
|
||||
Reference in New Issue
Block a user