Author Topic: Disconnection from USB  (Read 3820 times)

craigTheBrit

  • Guest
Disconnection from USB
« 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?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Disconnection from USB
« Reply #1 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.

craigTheBrit

  • Guest
Re: Disconnection from USB
« Reply #2 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!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Disconnection from USB
« Reply #3 on: September 16, 2009, 12:48:54 PM »
Hi,

I will take a look on it and try to fix.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Disconnection from USB
« Reply #4 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.

craigTheBrit

  • Guest
Re: Disconnection from USB
« Reply #5 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

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Disconnection from USB
« Reply #6 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 :)

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Re: Disconnection from USB
« Reply #7 on: November 11, 2009, 07:32:09 PM »
Players? What players?

 

Sitemap 1 2 3 4 5 6 7 8 9