[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
COM_SKEY()
Monitors the port using key traps during background transmission
------------------------------------------------------------------------------
Syntax
COM_SKEY([<nComPort>],[<nKeyValue1|cKeyValue1>],
[<nKeyValue2|cKeyValue2>]) --> lActive
Arguments
<nComPort> Designates the port (1 to 4) that is monitored in the
background during transmission.
<nKeyValue1|cKeyValue1> Designates the key code placed in the
keyboard buffer as soon as the port send buffer has been cleared. Like
the values available in CA-Clipper's SET KEY TO command, the key value
can be a numeric value or an individual character. When this parameter
is not passed, the supervision of buffer overflow can be switched off.
<nKeyValue2|cKeyValue2> Designates the key code that the function
places in the keyboard buffer at the start of a software or hardware
handshake. Like the values in CA-Clipper's SET KEY TO command, the key
value can be a numeric value or an individual character. When this
parameter is not passed, the supervision of buffer overflow can be
switched off.
Returns
COM_SKEY() returns .T. when the selected character is placed in the
keyboard buffer by the corresponding event.
Description
This function allows you to monitor a transmission in the background
with regard to the hardware or software handshake and the contents of
the buffers. If you have designated <nKeyValue1>, it is deposited in
the keyboard buffer as soon as the sending buffer is empty.
If the software or hardware handshake has been implemented by COM_SOFT()
or COM_HARD(), then the COM interface program places <nKeyValue2> in the
keyboard buffer when an XOFF is encountered or the CTS input is
deactivated. If you have passed <nKeyValue1>, it is deposited in the
keyboard buffer as soon as the sending buffer is empty.
Both events can prove very effective when combined with a CA-Clipper key
trap. In this way the program does not constantly have to review the
status of the sending buffer; it simply "takes note" when something
happens. The specific event is then determined with COM_SMODE() within
the called procedure.
Note
Important! After each execution of a trap, COM_SKEY() must be
reactivated.
Examples
. Determine if the port 2 buffer is empty:
COM_SKEY(2, , 225) // Place code 225
. Monitor the software and hardware handshakes for port 2:
SET KEY 225 TO HANDSHAKE
? COM_SKEY(2, , 225) // OK when returns .T.
COM_SOFT(2, .T.) // Software handshake on
COM_HARD(2, .T.) // Hardware handshake on
COM_SEND(2, LongText) // Transmit something...
. It is important that you always send the parameter:
PROCEDURE HANDSHAKE(A, B, C)
* Your Program
COM_SKEY(2, 225) // Must be reactivated
RETURN
See Also:
COM_SOFT()
LASTKLINE()
LASTKPROC()
LASTKFUNC()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson