Author Topic: Force disconnect  (Read 2329 times)

Offline edbell

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Force disconnect
« on: June 22, 2011, 05:00:02 PM »
Is it possible to use the WCL to disconnect devices that are connected prior to the WCLAPI being loaded? i.e. if the program crashes out without unloading the API.

If not is it possible to disable/enable the radio device?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Re: Force disconnect
« Reply #1 on: June 22, 2011, 05:45:22 PM »
Unfortunately no as WCL can't know about previously connected devices. However we may think about adding some features for disable/enabled radio (as disabling/enabling BT Radio driver).

Offline edbell

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Force disconnect
« Reply #2 on: June 24, 2011, 03:24:07 PM »
That would be really useful. I'm trying to get to the point where the user never has to go anywhere near the BT stack.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Re: Force disconnect
« Reply #3 on: June 24, 2011, 03:35:58 PM »
Ok, Will think on it.

Offline martidem

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Force disconnect
« Reply #4 on: January 24, 2012, 10:22:38 PM »
I know that this is an older thread, but I was wondering if there have been any changes in this area.  I'm having the same issue as the OP (i.e. if my application crashes, the paired device stays connected).  I'm actually creating a serial connection, and it's that connection that's causing me problems.  I can re-pair to the device, but when I attempt to make another wclClient connection, I get a "driver error" (error code: 2).

I attempted to track which device was last connected, and if I'm attempting to connect with that device and get an error, ignore it and attempt to send the serial data anyway.  Not surprisingly, the result was a "not connected" error (error code: 40).

This seems to only be happening on XP machines.  Vista and W7 disconnect from the device when the application process ends.  Unfortunately, my customer uses XP, and my customer is insistent that the application be able to recover from a crash (simulated by ending the process in Task Manager) without requiring a reboot or having to go into BT device settings and manually disconnect the device.

I am using C# with .NET and WCL version 6.8.0, commercial developer license.  That's a bit behind the current WCL version, so I'm hoping that there may have been additional functionality added to search for devices connected outside the API.

Thanks!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Re: Force disconnect
« Reply #5 on: January 25, 2012, 07:06:20 AM »
Hello,

We thought about this problem but unfortunately not all stacks allow to know about connected device so we decided to do not implement it (a way to know about currently connected device). I think th eonly way to solve your problem is crash catching (something like global try/except block) so you can Unload wclAPI when your application ends. Unloading closes all active connections.

 

Sitemap 1 2 3 4 5 6 7 8 9