discovery method
Starts scan for Bluetooth LE devices Note: This is a continuous behavior, don't forget to call stopDiscovery. Throw BTException if failed.
Implementation
@override
Stream<BluetoothDevice> discovery() async* {
try {
// Clear result
_scanResults.add([]);
await methodChannel.invokeMethod("startDiscovery");
yield* _scanResultMethodStream.takeUntil(_stopScanPill)
.doOnDone(stopDiscovery)
.map((event) => event.arguments)
.transform(StreamTransformer(_addDeviceTransform));
} on BTException catch (_) {
rethrow;
} on PlatformException catch (e) {
throw BTException.fromPlatform(e);
}
}