Skip to content

Commit

Permalink
Merge pull request #845 from janusw/win_ext_adv_supported
Browse files Browse the repository at this point in the history
Implement Adapter.SupportsExtendedAdvertising on Windows
  • Loading branch information
janusw committed May 11, 2024
2 parents 3525524 + abe9edf commit a5f8e6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Source/Plugin.BLE/Windows/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Plugin.BLE.Windows
{
public class Adapter : AdapterBase
{
private readonly BluetoothAdapter _bluetoothAdapter;
private BluetoothLEAdvertisementWatcher _bleWatcher;

/// <summary>
Expand All @@ -24,8 +25,9 @@ public class Adapter : AdapterBase
/// </summary>
private readonly IDictionary<string, IDevice> disconnectingRegistry = new ConcurrentDictionary<string, IDevice>();

public Adapter()
public Adapter(BluetoothAdapter adapter)
{
_bluetoothAdapter = adapter;
}

public override async Task BondAsync(IDevice device)
Expand Down Expand Up @@ -199,7 +201,7 @@ protected override IReadOnlyList<IDevice> GetBondedDevices()
this,
bluetoothLeDevice,
0, id);
devlist.Add(device);
devlist.Add(device);
Trace.Message("GetBondedDevices: {0}: {1}", dev.Id, dev.Name);
}
else
Expand Down Expand Up @@ -298,5 +300,10 @@ public override IReadOnlyList<IDevice> GetKnownDevicesByIds(Guid[] ids)
// TODO: implement this
return new List<IDevice>();
}

public override bool SupportsExtendedAdvertising()
{
return _bluetoothAdapter.IsExtendedAdvertisingSupported;
}
}
}
}
2 changes: 1 addition & 1 deletion Source/Plugin.BLE/Windows/BleImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BleImplementation : BleImplementationBase

protected override IAdapter CreateNativeAdapter()
{
return new Adapter();
return new Adapter(btAdapter);
}

protected override BluetoothState GetInitialStateNative()
Expand Down

0 comments on commit a5f8e6c

Please sign in to comment.