diff --git a/Source/BLE.Client/BLE.Client.WinConsole.Installer/BLE.Client.WinConsole.Installer.vdproj b/Source/BLE.Client/BLE.Client.WinConsole.Installer/BLE.Client.WinConsole.Installer.vdproj
index e99469ce..14f2e748 100644
--- a/Source/BLE.Client/BLE.Client.WinConsole.Installer/BLE.Client.WinConsole.Installer.vdproj
+++ b/Source/BLE.Client/BLE.Client.WinConsole.Installer/BLE.Client.WinConsole.Installer.vdproj
@@ -69,6 +69,14 @@
"PrivateKeyFile" = "8:"
"TimeStampServer" = "8:"
"InstallerBootstrapper" = "3:2"
+ "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
+ {
+ "Enabled" = "11:TRUE"
+ "PromptEnabled" = "11:TRUE"
+ "PrerequisitesLocation" = "2:1"
+ "Url" = "8:"
+ "ComponentsUrl" = "8:"
+ }
}
}
"Deployable"
@@ -156,15 +164,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:BLE.Client.WinConsole"
- "ProductCode" = "8:{F6BA5731-7436-4762-A612-E16066951342}"
- "PackageCode" = "8:{D8837791-AD30-4637-A38E-E4873DBC15A2}"
+ "ProductCode" = "8:{5F449E95-7E87-4E64-B500-80A6AF1D97DA}"
+ "PackageCode" = "8:{B9329BAB-7161-4B70-A339-EFC0E40F2D22}"
"UpgradeCode" = "8:{2DC56EBC-822F-4B47-93C7-DCBD97994976}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
- "ProductVersion" = "8:1.0.0"
+ "ProductVersion" = "8:1.0.2"
"Manufacturer" = "8:Plugin.BLE"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
@@ -172,7 +180,7 @@
"Subject" = "8:"
"ARPCONTACT" = "8:Ask Bojesen"
"Keywords" = "8:"
- "ARPCOMMENTS" = "8:v1.0.0"
+ "ARPCOMMENTS" = "8:v1.0.2"
"ARPURLINFOABOUT" = "8:https://github.com/dotnet-bluetooth-le/dotnet-bluetooth-le"
"ARPPRODUCTICON" = "8:"
"ARPIconIndex" = "3:0"
diff --git a/Source/BLE.Client/BLE.Client.WinConsole/BLE.Client.WinConsole.csproj b/Source/BLE.Client/BLE.Client.WinConsole/BLE.Client.WinConsole.csproj
index 82eb346e..1b68f6ed 100644
--- a/Source/BLE.Client/BLE.Client.WinConsole/BLE.Client.WinConsole.csproj
+++ b/Source/BLE.Client/BLE.Client.WinConsole/BLE.Client.WinConsole.csproj
@@ -5,7 +5,7 @@
net8.0-windows10.0.22621.0
disable
enable
- 1.0.0
+ 1.0.2
diff --git a/Source/BLE.Client/BLE.Client.WinConsole/PluginDemos.cs b/Source/BLE.Client/BLE.Client.WinConsole/PluginDemos.cs
index d1ef8980..e390e4f5 100644
--- a/Source/BLE.Client/BLE.Client.WinConsole/PluginDemos.cs
+++ b/Source/BLE.Client/BLE.Client.WinConsole/PluginDemos.cs
@@ -98,18 +98,19 @@ public async Task ShowBondState()
dev.Dispose();
}
- public async Task Connect_Read_Services_Disconnect_5X()
+ public async Task Connect_Read_Services_Disconnect_Loop()
{
string bleaddress = BleAddressSelector.GetBleAddress();
var id = bleaddress.ToBleDeviceGuid();
var connectParameters = new ConnectParameters(connectionParameterSet: ConnectionParameterSet.Balanced);
-
+ new Task(ConsoleKeyReader).Start();
using (IDevice dev = await Adapter.ConnectToKnownDeviceAsync(id, connectParameters))
{
- for (int i = 0; i < 5; i++)
+ int count = 1;
+ while(true)
{
await Task.Delay(100);
- Write($"---------------- {i} ------------------");
+ Write($"---------------- {count++} ------- (Esc to stop) ------");
if (dev.State != DeviceState.Connected)
{
Write("Connecting");
@@ -135,19 +136,25 @@ public async Task Connect_Read_Services_Disconnect_5X()
Write("Disconnecting");
await Adapter.DisconnectDeviceAsync(dev);
Write("Test_Connect_Disconnect done");
+ if (consoleKey == ConsoleKey.Escape)
+ {
+ break;
+ }
}
}
}
- public async Task Connect_Read_Services_Dispose_5X()
+ public async Task Connect_Read_Services_Dispose_Loop()
{
string bleaddress = BleAddressSelector.GetBleAddress();
var id = bleaddress.ToBleDeviceGuid();
var connectParameters = new ConnectParameters(connectionParameterSet: ConnectionParameterSet.Balanced);
- for (int i = 0; i < 5; i++)
+ new Task(ConsoleKeyReader).Start();
+ int count = 1;
+ while (true)
{
await Task.Delay(100);
- Write($"---------------- {i} ------------------");
+ Write($"---------------- {count++} ------- (Esc to stop) ------");
IDevice dev = await Adapter.ConnectToKnownDeviceAsync(id, connectParameters);
Write("Reading services");
var services = await dev.GetServicesAsync();
@@ -165,7 +172,7 @@ public async Task Connect_Read_Services_Dispose_5X()
charlist.Clear();
Write("Waiting 3 secs");
await Task.Delay(3000);
- //await Adapter.DisconnectDeviceAsync(dev);
+ await Adapter.DisconnectDeviceAsync(dev);
Write("Disposing");
dev.Dispose();
}
diff --git a/Source/BLE.Client/BLE.Client.WinConsole/Program.cs b/Source/BLE.Client/BLE.Client.WinConsole/Program.cs
index 830de1bb..f97f9131 100644
--- a/Source/BLE.Client/BLE.Client.WinConsole/Program.cs
+++ b/Source/BLE.Client/BLE.Client.WinConsole/Program.cs
@@ -7,7 +7,7 @@
using Windows.Media.Capture;
Console.WriteLine("Hello, BLE World!");
-Console.WriteLine($"BleImplementation.OsRuntimeBuildNumber: {BleImplementation.OsRuntimeBuildNumber}");
+Console.WriteLine($"Environment.OSVersion.Version.Build: {Environment.OSVersion.Version.Build}");
using (var ct = new ConsoleTracer())
{
@@ -25,8 +25,8 @@
{ConsoleKey.D4, new Demo("Pair -> Connect -> Disconnect", ppemos.Pair_Connect_Disconnect) },
{ConsoleKey.D5, new Demo("Connect -> Change Parameters -> Disconnect", ppemos.Connect_Change_Parameters_Disconnect) },
{ConsoleKey.D6, new Demo("Run GetSystemConnectedOrPairedDevices", ppemos.RunGetSystemConnectedOrPairedDevices) },
- {ConsoleKey.D7, new Demo("5X: Connect -> Read services -> Disconnect", ppemos.Connect_Read_Services_Disconnect_5X) },
- {ConsoleKey.D8, new Demo("5X: Connect -> Read services -> Dispose", ppemos.Connect_Read_Services_Dispose_5X) },
+ {ConsoleKey.D7, new Demo("Loop: Connect -> Read services -> Disconnect", ppemos.Connect_Read_Services_Disconnect_Loop) },
+ {ConsoleKey.D8, new Demo("Loop: Connect -> Read services -> Dispose", ppemos.Connect_Read_Services_Dispose_Loop) },
{ConsoleKey.D9, new Demo("Connect -> Loop: ConnectionLost -> Connect", ppemos.Connect_ConnectionLost_Reconnect) },
{ConsoleKey.Q, new Demo("Adapter.BondAsync", ppemos.BondAsync) },
{ConsoleKey.W, new Demo("Adapter.BondedDevices", ppemos.GetBondedDevices) },
diff --git a/Source/Plugin.BLE/Plugin.BLE.csproj b/Source/Plugin.BLE/Plugin.BLE.csproj
index 91a21682..c063470c 100644
--- a/Source/Plugin.BLE/Plugin.BLE.csproj
+++ b/Source/Plugin.BLE/Plugin.BLE.csproj
@@ -3,6 +3,7 @@
netstandard2.0;net7.0-android33.0;net8.0-android34.0
$(TargetFrameworks);net7.0-ios;net7.0-maccatalyst;net8.0-ios;net8.0-maccatalyst
$(TargetFrameworks);MonoAndroid13.0;Xamarin.iOS10;Xamarin.Mac20;uap10.0.19041;net7.0-windows10.0.19041;net8.0-windows10.0.19041;net8.0-windows10.0.22000.0
+ net8.0-windows10.0.22000.0
Plugin.BLE
Plugin.BLE
3.1.0-rc.1
diff --git a/Source/Plugin.BLE/Windows/Adapter.cs b/Source/Plugin.BLE/Windows/Adapter.cs
index e2d8a2c0..17ee937d 100644
--- a/Source/Plugin.BLE/Windows/Adapter.cs
+++ b/Source/Plugin.BLE/Windows/Adapter.cs
@@ -138,7 +138,7 @@ private void Device_ConnectionStatusChanged(BluetoothLEDevice nativeDevice, obje
&& ConnectedDeviceRegistry.TryGetValue(id, out var connectedDevice))
{
#if WINDOWS10_0_22000_0_OR_GREATER
- if (BleImplementation.OsRuntimeBuildNumber >= 22000)
+ if (Environment.OSVersion.Version.Build >= 22000)
{
var conpar = nativeDevice.GetConnectionParameters();
Trace.Message(
diff --git a/Source/Plugin.BLE/Windows/BleImplementation.cs b/Source/Plugin.BLE/Windows/BleImplementation.cs
index 22d3de50..9df8c411 100644
--- a/Source/Plugin.BLE/Windows/BleImplementation.cs
+++ b/Source/Plugin.BLE/Windows/BleImplementation.cs
@@ -20,26 +20,6 @@ public class BleImplementation : BleImplementationBase
public static BluetoothCacheMode CacheModeGetCharacteristics { get; set; } = BluetoothCacheMode.Cached;
public static BluetoothCacheMode CacheModeGetServices { get; set; } = BluetoothCacheMode.Cached;
- private static int? runtimeBuildNumber = null;
-
- ///
- /// Get the Windows runtime build number
- /// Eg running on Windows 10 gives 19041 even though it is executing an application compiled as eg net8.0-windows10.0.22621.0
- /// ref https://learn.microsoft.com/en-us/windows/release-health/release-information
- /// ref https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information
- ///
- public static int OsRuntimeBuildNumber
- {
- get
- {
- if (runtimeBuildNumber is null)
- {
- runtimeBuildNumber = Environment.OSVersion.Version.Build;
- }
- return runtimeBuildNumber.Value;
- }
- }
-
protected override IAdapter CreateNativeAdapter()
{
return new Adapter(btAdapter);
diff --git a/Source/Plugin.BLE/Windows/Device.cs b/Source/Plugin.BLE/Windows/Device.cs
index c40c8b85..5fb0e4ad 100644
--- a/Source/Plugin.BLE/Windows/Device.cs
+++ b/Source/Plugin.BLE/Windows/Device.cs
@@ -131,7 +131,7 @@ protected override bool UpdateConnectionIntervalNative(ConnectionInterval interv
static bool MaybeRequestPreferredConnectionParameters(BluetoothLEDevice device, ConnectParameters connectParameters)
{
#if WINDOWS10_0_22000_0_OR_GREATER
- if (BleImplementation.OsRuntimeBuildNumber < 22000)
+ if (Environment.OSVersion.Version.Build < 22000)
{
return false;
}