Open fvisticot opened 5 years ago
I don't think the underlying libraries, RxBluetoothKit / RxAndroidBle expose this.
You better file an issue there, since this library is fully dependent on those.
I'm just using the connect method, with the deviceId
stored in shared preferences and a timeout.
(Passing autoConnect: true
does the scanning for you automatically.)
final stream = RxBle.connect(deviceId, autoConnect: true).timeout(
Duration(seconds: 10),
onTimeout: (sink) {
sink.close();
...
},
);
await for (state in stream) {
...
}
I have checked the doc for iOS and it seems the methods are available:
https://github.com/Polidea/RxBluetoothKit/wiki/9.-Other-functionalities#retrieving-peripherals
It would be nice if you could wrap the 2 methods:
manager.retrieveConnectedPeripherals(withServices: services) manager.retrievePeripherals(withIdentifiers: identifiers)
Thanks for the research. How are you planning to make this feature cross-platform?
In addition, how can I re connect a device that i not yet "in range" ? I would like to connect without timeout to connect the device when he will be in range.
I would like to avoid scanning again if my device know the identifier of my BLE Objects. Apple provide this interesting method:
retrievePeripheralsWithIdentifiers : https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1519127-retrieveperipheralswithidentifie?language=objc
Can you please expose this method in the API ?