Wireless Communication Library Support Forum

Frameworks => Serial Framework => Topic started by: craigTheBrit on September 14, 2009, 08:22:46 AM

Title: Disconnection from USB
Post by: craigTheBrit on September 14, 2009, 08:22:46 AM
Our code uses the USB connection to exchange data between a phone and a PC. At the moment we're having trouble in the scenario that goes like this:
 1. Program runs
 2. Phone connected to PC
 3. Program connects to the right port
 4. Phone disconnected from PC
 ...
 5. Program quits

When the program quits it seems to hang. Further, it seems that the wclClient isn't receiving an OnDisconnect event when the cable is taken out. Can you think of why that would be?
Title: Re: Disconnection from USB
Post by: Mike Petrichenko on September 14, 2009, 11:29:14 AM
Hi

Serial ports do not generate Disconnect event because there is no way to know is device connected or not. You should terminate connection by timeout or use TwclSerialDiscovery monitoring feature (added in 6.6.2.0) to detect moment when used port disappears.
Title: Re: Disconnection from USB
Post by: craigTheBrit on September 16, 2009, 12:13:03 PM
I'm having a little trouble detecting those DeviceLost events. It seems that they aren't triggered when a device is unplugged if it is connected via the serial client component. Can you confirm?

So the program contains both a wclSerialDiscovery and a wclClient. When the wclClient is connected (via USB), the wclSerialDiscovery is blinded to connections and disconnections, it seems. The result is that I never get to disconnect properly, and when my program quits it just hangs...

Really appreciate the speed of your replies Mike, I'm very impressed!
Title: Re: Disconnection from USB
Post by: Mike Petrichenko on September 16, 2009, 12:48:54 PM
Hi,

I will take a look on it and try to fix.
Title: Re: Disconnection from USB
Post by: Mike Petrichenko on September 16, 2009, 01:26:09 PM
Hi,

Tested and fixed (and now OnDisconnect fires for serial ports as well).

If you have the sources I can give you a changes, otherwise you have to wait when I publish next release.
Title: Re: Disconnection from USB
Post by: craigTheBrit on September 17, 2009, 02:57:47 AM
Wow, that was fast! It's a little urgent, would it be possible to send a .dcu file for the corrected unit? I'm using Delphi 2006.

Craig
Title: Re: Disconnection from USB
Post by: Mike Petrichenko on September 17, 2009, 07:27:37 AM
Unfortunatly there was some other changes so only dcu will not help/work. The new updates is planned to this weekend so it is just few days to wait.

P.S. That is why better to have the library sources - you can apply updates without waitng :)
Title: Re: Disconnection from USB
Post by: Mike Petrichenko on November 11, 2009, 07:32:09 PM
Players? What players?