Skip to content

Commit

Permalink
RC fixes. Release Candidate 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Am6er committed Dec 20, 2023
1 parent 204a0b6 commit d938e93
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
19 changes: 16 additions & 3 deletions BecquerelMonitor/DeviceConfigForm.cs
Expand Up @@ -275,10 +275,23 @@ void PrepareDeviceForm(DeviceType type)
{
this.inputDeviceForm.FormClosing();
}
this.inputDeviceForm = (InputDeviceForm)Activator.CreateInstance(type.DeviceConfigFormType, new object[]
try
{
this
});
this.inputDeviceForm = (InputDeviceForm)Activator.CreateInstance(type.DeviceConfigFormType, new object[]
{
this
});
} catch (Exception ex)
{
if (ex.Message.IndexOf("Windows.Devices.Bluetooth.BluetoothLEDevice") > 0)
{
MessageBox.Show("Error while loading Radiacode section. It seems, that you don't have BLE support on your OS.");
} else
{
MessageBox.Show("Device specific section. It seems, that you don't have BLE support on your OS.");
}
return;
}
this.tabControl1.TabPages[1].Controls.Clear();
this.tabControl1.TabPages[1].Controls.Add(this.inputDeviceForm);
if (type.Name == "AtomSpectraVCP")
Expand Down
16 changes: 11 additions & 5 deletions BecquerelMonitor/RadiaCodeDeviceForm.cs
Expand Up @@ -5,6 +5,7 @@
using BecquerelMonitor.Properties;
using System.Linq;
using System.Threading;
using System.Diagnostics;

namespace BecquerelMonitor
{
Expand Down Expand Up @@ -45,9 +46,10 @@ private void ScanBLEDevices()
adressBLE.Clear();
devices.Clear();
if (watcher == null) watcher = new BluetoothLEAdvertisementWatcher();
Thread.Sleep(200);
watcher.Stop();
watcher.SignalStrengthFilter.InRangeThresholdInDBm = -110;
watcher.SignalStrengthFilter.OutOfRangeThresholdInDBm = -110;
//watcher.SignalStrengthFilter.InRangeThresholdInDBm = -110;
//watcher.SignalStrengthFilter.OutOfRangeThresholdInDBm = -110;
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Received += Watcher_Recived;
watcher.Start();
Expand All @@ -58,14 +60,18 @@ private async void Watcher_Recived(BluetoothLEAdvertisementWatcher sender, Bluet
dev = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
Tuple<ulong, BluetoothLEDevice> tup = new Tuple<ulong, BluetoothLEDevice>(args.BluetoothAddress, dev);

if (dev != null)
if (dev != null && args != null)
{
if (dev.Name == null) return;
if (dev.Name.IndexOf("RadiaCode-10") == -1) return;
try
{
if (dev.Name == null) return;
if (dev.Name.IndexOf("RadiaCode-10") == -1) return;
} catch (Exception) { }
if (!devices.ContainsKey(args.BluetoothAddress))
{
try
{
Trace.WriteLine($"Found {dev.Name} with addr {args.BluetoothAddress}");
devices.Add(args.BluetoothAddress, dev);
String name = dev.Name.Split('#')[1];
comboBox1.Invoke(new Action(() =>
Expand Down

0 comments on commit d938e93

Please sign in to comment.