I'm not totally sure if this is a ble_lib issue or a blemulator issue. I have two simulated peripherals, one with a service SERVICE_STATUS and one without. When I try to use bleManager.startPeripheralScan(uuids: [SERVICE_STATUS]) it returns both peripherals rather than just one. However, if I manually check each scan result's advertisementData then I get the desired results. I'm not super familiar with Dart/Flutter so there could just be some other dumb mistake in the relevant code:
Stream<ScanResult> timeoutScan( {int sec = 5}) {
Future.delayed(Duration(seconds:sec), () {
print("++++++ delayed scan stopping");
bleManager.stopPeripheralScan();
} );
return bleManager.startPeripheralScan(uuids: [SERVICE_STATUS]); //this parameter makes no difference to the results
}
...
Future<void> updateScan({timeout = 5}) async {
Peripheral p;
foundDevices.clear();
if (!scanInProgress)
{
scanInProgress = true;
await timeoutScan(sec: timeout).listen((scanResult) async {
p = scanResult.peripheral;
if (!foundDevices.contains(p) && !connectedDevices.contains(p) && scanResult.advertisementData.serviceUuids.contains(SERVICE_STATUS)) {
foundDevices.addPeripheral(p);
}
...
}).asFuture();
scanInProgress = false;
}
}
Hi,
I'm not totally sure if this is a ble_lib issue or a blemulator issue. I have two simulated peripherals, one with a service SERVICE_STATUS and one without. When I try to use bleManager.startPeripheralScan(uuids: [SERVICE_STATUS]) it returns both peripherals rather than just one. However, if I manually check each scan result's advertisementData then I get the desired results. I'm not super familiar with Dart/Flutter so there could just be some other dumb mistake in the relevant code: