Hi Maurilio,
I finally got it sorted! :-)
The problem on transmit was the lack of a time-out parameter for tp_send.
In telepathy.prg the time-out defaults to 0, so if no time-out parameter
is passed
it will not send as it thinks it has already timed out.
The sample testtp.prg sends no parameter and can not work.
Either the default needs changing or testtp.prg needs a parameter adding.
I now have testtp.prg as :-
function main
?
tp_open( 1,,, 9600, 8, "N", 1 )
tp_send( 1, "Hi there Bob",1 ) // One second time-out
tp_inkey( .5 )
? tp_recv( 1 )
?
?
tp_Close( 1 )
return nil
function ThreadSleep ( millisecs )
secs = millisecs/1000
now = seconds()
DO WHILE seconds()<now+secs
hb_ReleaseCPU()
ENDDO
return nil
This now works with a loopback plug:-
[...@jackodesktop hbr]$ a.out
Hi there Bob
[...@jackodesktop hbr]$
However, strangely, it also works with a comma missing in tp_open(),
probably because the same parameters are used in this test for transmit
and receive.
What are your thoughts on the hb_ReleaseCPU() line? It does work without
it, but I guess it probably hangs the machine for the duration of the delay.
Thanks everyone for your help - I can now get on with my project. :-)
Cheers,
Barry
Maurilio Longo wrote:
Barry,
I never used a loopbak device, I did attach a modem and send to it an ATIx
command which makes the modem answer back with some internal data/status.
I was even able to print to a serial printer from linux (an old mandrake).
That said, tp_xxx is just a prof of concept and it was not finished nor
polished because the project that should have used it never saw the light.
So, I'd look at the C code, is very simple, maybe you can put some printf()
there to see what happens at the low level.
I'd also try a tp_recv( 1, 1 ) // see second one, which is num of chars to wait.
Also, tp_recv() calls fetchchars() which calls p_ReadPort() which is the
function that does the real work and is written in C.
Hope this helps you in some way.
Maurilio.
Barry Jackson wrote:
Marilio,
I just tested with the laptop and hbtpathy is now receiving - only - hence
the loopback fail.
Send String = g
FetchChars = ffff
Handle 3
Recv string = ffff
ffff
So we are half way there!
Pity it's this way round as my application only needs to send !
Barry
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour