I am building an application to run in Mandriva Linux that needs com port
functions as in Clipper tools. I have built an xhgtk GUI front end which is
now working fine thanks to help here. I am now trying to use the functions
in telepath.prg to provide the com functions.
I have tested telepath.prg with the original testtp.prg and a loopback plug,
but it fails, so to check whether it is failing on both send and receive I
did the following:-
I tested my com port with a loopback and a port test program built from
source in Linux and it works.
I have an old laptop with a terminal emulation program (mine in Clipper)
that also works OK with the loopback.
The port test program in Linux talks to the laptop and vice versa via a null
modem cable.
However my test program (below) does not send OR receive. Baud rate parity
etc. OK.
The only modifications I have made to hbtpathy.prg  are small debug prints
to screen and a delay function to replace ThreadSleep() which may be a
problem. I have made a small test program to send single characters and
check the receive buffer at each key press:-

function main
tp_open( 1,, 9600, 8, "N", 1 )
  do while !LASTKEY()=27
    tp_send( 1, CHR(LASTKEY()))
    tp_delay(0.5)           //uses ThreadSleep()
    ? tp_recv( 1 )
    inkey(0)
  enddo
tp_Close( 1 )
return nil

function ThreadSleep ( millisecs )
secs = millisecs/1000
now = seconds()
DO WHILE seconds()<now+secs
ENDDO
return nil

I have compiled and linked the test program as follows:-

[...@jackodesktop hbr]$ hbcmp -gc -n telepath.prg
Harbour 1.1.0dev (Rev. 9956)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling 'telepath.prg'...
Lines 1137, Functions/Procedures 31
Generating C source output to 'telepath.c'... Done.

[...@jackodesktop hbr]$ hbcmp -gc testtp.prg
Harbour 1.1.0dev (Rev. 9956)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling 'testtp.prg'...
Lines 19, Functions/Procedures 3
Generating C source output to 'testtp.c'... Done.

[...@jackodesktop hbr]$ hbcc testtp.c telepath.c tpcommon.c tplinux.c
[...@jackodesktop hbr]$

Then with loopback plug connected :-

[...@jackodesktop hbr]$ a.out

Send String =                                                      
FetchChars =                           // from debug line added to function
fetchchars
Handle          3                         // debug line added to function
fetchchars
Recv string =                           // first loop should fetch nothing
                                            // Hit key "a"
Send String = a
FetchChars =
Handle          3
Recv string =                           //this should receive "a"


I admit that I have now hit a brick wall with this. 
I have stepped through in debug as far as I can.
Any help would be appreciated. Has anyone used telepath functions 
in Linux who could send me some working code to test in Mandriva?
Anyone got any debugging ideas? 
Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Using--contrib-hbtpathy-fuctions-in-Linux-tp21339751p21339751.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to