Author Topic: How to identify devices disconnected  (Read 17648 times)

chicosaf

  • Guest
How to identify devices disconnected
« on: September 23, 2019, 07:37:16 PM »
Hi experts,

           I have a requirement to show a message when the device disconnects. My application it is a windows forms .net 3.5 using Bluetooth framework 7.4.3.0. I'm using the wclGattClient to connect to the devices.

          I tried to use the OnDisconnect event to show the message, but did not work. It only fire the event when the disconnect method runs. Also it's showing a popup error if the message "0x00050015", as soon i close the pop up another one shows again.

         Any one can help me to prevent the popup and show a customized message?   

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: How to identify devices disconnected
« Reply #1 on: September 23, 2019, 08:34:05 PM »
You are going right way. You need to use OnDisconnect event. However, it may takes some time to fire when remote device disconnects. Bluetooth low level protocol tries to reconnect and/or waits for a remote device reconnects so The OnDisconnect event when internal (Bluetooth driver) timeout expired.

chicosaf

  • Guest
Re: How to identify devices disconnected
« Reply #2 on: September 24, 2019, 03:30:34 AM »
Hi Mike, thanks for the answer.

   Wait to the timeout it's not an issue. I can do that. The problem is, after i disconnect the device, the application starts to show an error popup with the error code "0x00050015". What i should do to not show the popup, i could not figure out where it's throwing that message.

    I have a timer to read the device data from time to time, but it not seems to be there. I'm check if the device it is connected before everything and also have a try/catch to prevent all possible exceptions.

    Let me know if you need more information.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: How to identify devices disconnected
« Reply #3 on: September 24, 2019, 06:24:19 AM »
Hi,

Bluetooth Framework itself does not show any error messages. So check the application codeand remove ShowMessage (or MessageBo.xShow).

 

Sitemap 1 2 3 4 5 6 7