Closed sleushunou closed 6 months ago
According to the Apple guide, scanning should be active only when it is really needed to save battery power.
business case: Once we have found all of our expected devices, we stop scanning. But, if we want to add another device to the device list, we run the scan again.
Are you actually connected to the devices while running a scan though?
usually not, but a business case is theoretically possible when we are connected to one device and are trying to find a second one
Please read the previous issue. Don't keep a reference to peripheral across scans unless they're connected
Component/Nuget
BluetoothLE Client (Shiny.BluetoothLE)
What operating system(s) are effected?
Version(s) of Operation Systems
Tested on iOS 16 iPhone 12
Hosting Model
Steps To Reproduce
Run .Scan() Receive IPeripheral from result of .Scan() Run .Scan() again Try to connect to received at step 2 IPeripheral and observe IPeripheral::WhenStatusChanged()
Expected Behavior
IPeripheral::WhenStatusChanged() - status changed when peripheral is connected
Actual Behavior
IPeripheral::WhenStatusChanged() - status not changed when peripheral is connected, subscription handler is not called when BUT IBleDelegate::OnPeripheralStateChanged() - state changed when peripheral is connected ✔️
Exception or Log output
instead of logs. seems like problem is here: this.Clear(); List of cached IPeripheral's on BleManager cleared every time after starting a new scan, and when connection status is changed, BleManager calls p.ReceiveStateChange(status);, where p - another, newly created, instance of IPeripheral that refers on the same physical device, and first instance of IPeripheral does not receive state change
Code Sample
Code of Conduct