FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour WriteComm()
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: WriteComm()
Posted: Mon Feb 24, 2014 04:16 PM
Jeff,

I'm not trying to connect to a usb port.

Some laptops have built-in bluetooth and some use a usb bluetooth adapter. Similar idea to a usb wifi adapter.
As in the case of a USB wifi adapter, the wifi is seen as a regular wifi connection. Same applies to the com ports via bluetooth.

However, if you have a computer that may or may not have a bluetooth adapter in the USB port, then when there is no adapter, you are trying to communicate with an empty USB port, correct? This is likely different than trying to communicate with an empty serial port, and that may be the cause of the hang.

Exactly what is the configuration of the hardware you are testing. What ports, what OS ver?

I emailed your requested files compiled using FWH 13.04/xHarbour.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: WriteComm()
Posted: Mon Feb 24, 2014 09:18 PM
James,

James Bott wrote:However, if you have a computer that may or may not have a bluetooth adapter in the USB port, then when there is no adapter, you are trying to communicate with an empty USB port, correct?


No, you are just trying to communicate with a non-existent serial port (COM4). Unfortunately, this doesn't explain why SetCommState() is returning .T. ... :-)

EMG
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: WriteComm()
Posted: Tue Feb 25, 2014 12:09 AM

Ok guys, I am officially losing my mind on this one....

Nothing has changed since yesterday.
I haven't even rebooted my laptop.

BuildCommDcb() still returns .f. and SetComState() still returns .t. BUT now WriteComm() does timeout.
I swear I didn't do anything different since yesterday.

I ran the test files James sent me and things worked. Then I looked at the prg files he sent with them and noticed that I forgot to add the "!" to the IF BuildcommDbc...
Since I left out the "!", the error message (which in this case would not actually be an error) did not appear which tells me it actually returned .f. but it worked.

Then I just tried my program again and it worked as I wanted it to. (using BuildcommDcb() without the IF statement)

Now explain that one :shock:

I have my FindCom() function working (for now)... I'm going to run it on a few other computers with different operating systems and see what happens.

Thanks for all your help with this one ... not sure why it works today ... just gotta love programming :)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: WriteComm()
Posted: Tue Feb 25, 2014 12:21 AM
Jeff,

Thanks for all your help with this one ... not sure why it works today ... just gotta love programming


If it was easy, then anyone could do it!

Glad to hear you got it working. Now you need to try it on multiple computers.

At least for me, I learned something new.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: WriteComm()
Posted: Tue Feb 25, 2014 01:41 AM

I learn something new every time I look at this forum :wink:

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: WriteComm()
Posted: Tue Feb 25, 2014 09:41 AM
Jeff,

Jeff Barnes wrote:BuildCommDcb() still returns .f.


If BuildCommDcb() returns .f. there is something wrong for sure...

EMG
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: WriteComm()
Posted: Tue Feb 25, 2014 12:17 PM

I remember back a while ago I ran into this BuildCommDcb issue...
It appears that with the Toshiba Bluetooth Stack BuilcCommDcb will return .t.
With no code changes, BuildCommDcb returns .f. with the Microsoft Bluetooth Stack.

The unfortunate part is that most people use the Microsoft Bluetooth Stack.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion