Author Topic: BluetoothManager_OnStatusChanged is not always firing  (Read 132 times)

Offline MrPaulCarpenter

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
BluetoothManager_OnStatusChanged is not always firing
« on: October 01, 2020, 10:48:49 PM »
I have a Winform .Net 4.6.1 application where BluetoothManager_OnStatusChanged is not always firing

The first thing the program does (in terms of Bluetooth) is:
and it is running on the wclThread

The situation is that I have a  form showing with ShowDialog().  During this time I have a System.Timers.Timer set at 200 milliseconds to call a function that uses Invoke() to change the display.  As part of that it calls

BluetoothManager.GetRadio(out wclBluetooth.wclBluetoothRadio radio);

And then updates the display based on radio.Plugged and radio.Available

Meanwhile, I am using Windows / Settings to toggle Bluetooth on and off.  I would expect this to instantly change the value of radio.Available
And to cause BluetoothManager_OnStatusChanged() to be called.

I do have a console test app that uses APC and I do see BluetoothManager_OnStatusChanged() getting called when I toggle it using Windows settings.  I am not sure why it works one place, but not the other

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3538
  • Karma: 1000
    • Wireless Communication Libraries
Re: BluetoothManager_OnStatusChanged is not always firing
« Reply #1 on: October 02, 2020, 05:46:19 AM »
You have to call any aleartable wait function to process APC (SleepEx, WaitForXXXEx or similar. In UI application it can be called from Application OnIddle (or similar) event).


Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14