Skip to content

Commit

Permalink
Fix. RadiaCode error handling with disabled BT device. Enabling it, i…
Browse files Browse the repository at this point in the history
…f we can.
  • Loading branch information
Am6er committed Jul 1, 2024
1 parent eda86b8 commit fe446cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion BecquerelMonitor/BecquerelMonitor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>index.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>2024.06.27.1</ApplicationVersion>
<ApplicationVersion>2024.07.01.1</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
4 changes: 2 additions & 2 deletions BecquerelMonitor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion("2024.06.27.1")]
[assembly: AssemblyVersion("2024.07.1.1")]
[assembly: AssemblyProduct("BecquerelMonitor")]
[assembly: AssemblyCopyright("free")]
[assembly: AssemblyTrademark("none")]
[assembly: AssemblyConfiguration("")]
[assembly: Guid("40110b38-4882-47c1-ad94-a71e58dcb5f8")]
[assembly: AssemblyFileVersion("2024.06.27.1")]
[assembly: AssemblyFileVersion("2024.07.1.1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("free")]
[assembly: CompilationRelaxations(8)]
Expand Down
21 changes: 15 additions & 6 deletions BecquerelMonitor/RadiaCodeIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,25 @@ private async Task TestBT()
}
}

private void doDiscovery()
private async void doDiscovery()
{
await TestBT();
Trace.WriteLine("Run discovery, to awaiken device");
if (watcher == null) watcher = new BluetoothLEAdvertisementWatcher();
watcher.ScanningMode = BluetoothLEScanningMode.Active;
watcher.Received += Watcher_Recived;
watcher.Start();
Thread.Sleep(5000);
watcher.Stop();
try
{
watcher.Start();
Thread.Sleep(5000);
}
catch (Exception ex) {
MessageBox.Show($"{ex.Message}: {ex.StackTrace}", "Error doing discovery", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (PortFailure != null) { PortFailure(this, null); }
} finally
{
watcher.Stop();
}
}

private void Watcher_Recived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
Expand Down Expand Up @@ -379,14 +389,13 @@ public string GUID
get { return this.guid; }
}

public async void setDeviceSerial(string devSerial, string addrBle)
public void setDeviceSerial(string devSerial, string addrBle)
{
if (addrBle != null)
{
this.deviceserial = devSerial;
this.addressble = addrBle;
this.device_serial_changed = true;
await TestBT();
} else
{
sendTroubleShoot("Address BLE is empty, nothing to test");
Expand Down

0 comments on commit fe446cf

Please sign in to comment.