shinyorg / shiny

.NET Framework for Backgrounding & Device Hardware Services (iOS, Android, & Catalyst)

Home Page:https://shinylib.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IBleManager.IsScanning is always False in Apple

munkii opened this issue · comments

Component/Nuget

BluetoothLE Client (Shiny.BluetoothLE)

What operating system(s) are effected?

  • iOS (13+ supported)
  • Mac Catalyst
  • Android (8+ supported)
  • Windows (.NET 7 Target - only Core is currently supported, BLE is coming)

Version(s) of Operation Systems

Tested on iOS 17.1.1

Hosting Model

  • MAUI
  • Native/Classic Xamarin
  • Manual

Steps To Reproduce

Call Scan on the IBleManager. In the Subscribe action simply write out this.shinyBleManager.IsScanning to debug.

Expected Behavior

IsScanning would be True.

Actual Behavior

IsScanning is false. Looking at the implementation of BleManager for Apple I can see that IsScanning is never set to True whereas it is on Android.

Exception or Log output

No response

Code Sample

if (!this.IsScanning)
{
    try
    {
        this.scan = this.shinyBleManager
                        .Scan(scanConfig)
                        .Buffer(TimeSpan.FromSeconds(1))
                        .Subscribe(
                                    results =>
                                              {
                                                  System.Diagnostics.Debug.WriteLine("IsScanning: "  + this.shinyBleManager.IsScanning);
                                                  
                                                  // Only raise events if there's items to return
                                                  if (results.Any())
                                                  {
                                                      this.ScanResultUpdated?.Invoke(this, results.Select(x => new ScanResultWrapper(x)));
                                                  }
                                              }, 
                                    errorAction);
    }
    catch (Exception ex) 
    {
        System.Diagnostics.Debug.WriteLine("InternalStartScan Exception " + ex.Message);
    }
}

Code of Conduct

  • I have supplied a reproducible sample that is NOT FROM THE SHINY SAMPLES!
  • I am a Sponsor OR I am using the LATEST stable/beta version from nuget (v3.0 stable - ALPHAS are not taking issues - Sponsors can still send v2 issues)
  • I am Sponsor OR My GitHub account is 30+ days old
  • I understand that if I am checking these boxes and I am not actually following what they are saying, I will be removed from this repository!