Wireless Communication Library Support Forum

Legacy => Wireless Communication Library => Topic started by: edbell on June 22, 2011, 05:00:02 PM

Title: Force disconnect
Post by: edbell 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?
Title: Re: Force disconnect
Post by: Mike Petrichenko 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).
Title: Re: Force disconnect
Post by: edbell 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.
Title: Re: Force disconnect
Post by: Mike Petrichenko on June 24, 2011, 03:35:58 PM
Ok, Will think on it.
Title: Re: Force disconnect
Post by: martidem 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.

Title: Re: Force disconnect
Post by: Mike Petrichenko on January 25, 2012, 07:06:20 AM

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.