Telepathy
Telepathy is a serial communications library for Clipper. It is compatible with Clipper 5.x and Summer '87 and supports Kermit, Xmodem, Ymodem, Ymodem-G and Zmodem protocols, as well as standard ASCII. Supported terminal emulations include TTY, PC ANSI, and VT102.
Telepathy lets you build superior serial communications functions into your Clipper applications. A powerful notification mechanism allows Telepathy communication functions to run in the background, provides easy status display updates and supports the direct use of serial devices such as bar code wands in place of the keyboard.
User Defined Functions (UDF's) can hook directly into file transfer protocols and terminal emulators. Telepathy also supports multiple port cards and comes with unmatched scripting primitives.
Download Telepathy demo (Telecom, a Procomm like program)
Telepathy Basic I/O Functions
nOldBaud = tp_baud(nPort, [nNewBaud])
nOldData = tp_data(nPort, [nNewData])
cOldPar = tp_parity(nPort, [cNewPar])
nOldStop = tp_stop(nPort, [nNewStop])
Read or change comm port setting. Telepathy supports baud rates from 75 to 115,200.
tp_break(nPort, [nTime])
Send BREAK signal.
tp_clearin(nPort)
Clear input buffer.
tp_clearout(nPort)
Clear output buffer.
tp_close([nPort], [nTimeout], [lNoReset])
Close port, or all open ports.
nOldCtrl = tp_ctrlCTS(nPort, [nNewCtrl])
nOldCtrl = tp_ctrlDCD(nPort, [nNewCtrl])
nOldCtrl = tp_ctrlDSR(nPort, [nNewCtrl])
nOldCtrl = tp_ctrlDTR(nPort, [nNewCtrl])
nOldCtrl = tp_ctrlRTS(nPort, [nNewCtrl])
nbsp;Read or change handshaking mode.
nOldHshk = tp_hshk(nPort, [nNewHshk])
Read or change handshake setting. Combines all tp_ctrl...() functions into one.
nOldCtrl = tp_ctrlx(nPort, [nNewCtrl])
> Read or change XON/XOFF flow-control mode.
tp_digiMC(nAddress, nIRQ )
tp_digiPC(nAddress, nIRQ )
Configure DigiBoard MC/X or PC/X multi-port serial card.
Error = tp_error()
Return error code from last operation.
cMessage = tp_errmsg([nError])
Return error message string corresponding to an error code.
cSeq = tp_escseq()
Return last emulator escape sequence as character string.
nOldFIFO = tp_fifo(nPort, [nNewFIFO])
Read or change 16550 UART FIFO buffer mode.
cStatus = tp_flowchk(nPort)
Check whether output stopped waiting for a handshake.
tp_flowon(nPort)
Override received XOFF.
nError = tp_flush(nPort, [nTimeout])
Wait until output buffer empty, up to nTimeout seconds.
nOldHigh = tp_himark(nPort, [nNewHigh])
nOldLow = tp_lomark(nPort, [nNewLow])
Get or set flow-control high/low-water mark.
tp_hostess(nAddress, nIRQ)
Configure Comtrol Hostess multi-port serial card.
lFail = tp_idle()
This function is called whenever Telepathy is waiting for input or output. By replacing this library function with one of your own, you can perform other processing while waiting, or control how long to delay before giving up.
nChrs = tp_inchrs(nPort)
Return number of characters in input buffer.
nFree = tp_infree(nPort)
Return amount of free space in input buffer.
lCTS = tp_isCTS(nPort)
lDCD = tp_isDCD(nPort)
lDSR = tp_isDSR(nPort)
lRI = tp_isRI(nPort)
Return current state of modem control lines.
lFlag = tp_isport(nPort)
Check whether serial port adapter is installed and functioning.
lFound = tp_lookfo(nPort, cChar)
Check whether character present anywhere in the input buffer.
cStatus = tp_lstat(nPort)
Check serial line status.
cStatus = tp_mstat(nPort)
Check modem handshaking signal status.
nError = tp_open(nPort, [nRsize], [nTsize], [nBaud],
[nData],[cParity], [nStop])
Open serial port
nChrs = tp_outchrs(nPort)
Return number of characters in output buffer.
nFree = tp_outfree(nPort)
Return amount of free space in output buffer.
tp_pcserial(nIRQ)
Configure normal PC serial port.
cString = tp_recv(nPort, [nLength], [nTimeout])
Receive specified number of characters.
cString = tp_recvln(nPort, [nLength], [nTimeout])
Receive a line of input. This function allows editing of input, supporting backspace, tabs, word-erase, line-cancel, and abort-input keys.
cString = tp_recvto(nPort, cTerm, [nLength], [nTimeout])
Receive characters from a port until finding a termination character.
nError = tp_reopen(nPort, [nRsize], [nTsize])
Open port using current parameter settings.
nSent = tp_send(nPort, cString, [nTimeout])
Send character string.
nSent = tp_sendsub(nPort, cString, nStart, [nLength], [nTimeout])
Send character substring.
tp_setln([nFlags], [cBacksp], [cCancel], [cWord], [cBreak], [nTabs])
Line editing configuration. This function allows you to set up all the special characters and options used by tp_recvln().
tp_setport(nPort, nAddress, nIRQ)
Set up nonstandard port configuration.
lOldFlag = tp_striphi(nPort, [lNewFlag])
Read or set strip-high-bit flag.
tp_uninstall()
Close all serial ports and disable Telepathy's interrupt handlers.
nWhich = tp_waitfor(nPort, nTimeout, cString...|caString)
Wait for one of several strings to be received.
nOldCtrl = tp_xiorts(nNewCtrl)
Get/set file transfer I/O RTS control.
Telepathy Terminal Emulations
nError = tp_tty(nPort, nTop, nLeft, nBottom, nRight, cFunction|nKey)
nError = tp_ansi(nPort, nTop, nLeft, nBottom, nRight, cFunction|nKey)
nError = tp_vt102(nPort, nTop, nLeft, nBottom,nRight,cFunction|nKey)
Telepathy Input Watches
nWatch = tp_watch(nPort, cString, [lIgnoreCase])
Register a watch string. Telepathy will invisibly scan all input watching for the string. Up to 16 watches may be active at once.
lFound = tp_iswatch(nWatch)
Check whether watch string has been received.
nWatch = tp_getwatch()
Check whether any watch string has been received.
Telepathy Notifications
Telepathy supports a feature called ``notifications''. Even if your program is stopped in the middle of a READ, notifications make it possible to handle special events in real time without interfering with actions at the user console. You specify a UDF to be called when one of these special events occurs.
tp_delay(nTime)
Delay specified number of seconds, while watching for notifications.
nKey = tp_inkey([nTime])
This replacement for the standard inkey() function handles notifications while waiting for a keypress.
tp_noteoff([nHandle])
Disable pending notification.
nHandle = tp_onchar(nPort, cChar, cFunction)
Request notification when character is received.
nHandle = tp_onempty(nPort, cFunction)
Request notification when output buffer becomes empty.
nHandle = tp_onhimark(nPort, cFunction)
Request notification when input buffer fills up to high-water mark.
nHandle = tp_oninput(nPort, cFunction)
Request notification when any character is received.
nHandle = tp_onmodem(nPort, nMask, cFunction)
Request notification when modem status changes.
tp_resume()
Resume notifications after suspension by tp_suspend().
tp_suspend()
Suspend notifications.
Telepathy File Transfer Functions
Telepathy supports the most popular binary file transfer protocols: Xmodem (and Xmodem-CRC and Xmodem-1K), batch-mode Ymodem and Ymodem-G, Kermit, Zmodem.
Progress functions are unique to Telepathy. During a transfer, your own user-defined function will be called at various times (start or end of a file or transfer, end of a block, or on protocol errors) to allow you to update screen displays and control the progress of the transfer.
nError = tp_skermit(nPort, cFile|caFiles, [cProgress])
nError = tp_sxmodem(nPort, cFile, [cProgress])
nError = tp_sx1k(nPort, cFile, [cProgress])
nError = tp_symodem(nPort, cFile|caFiles, [cProgress])
nError = tp_szmodem(nPort, cFile|caFiles, [cProgress])
Send file to remote system.
nError = tp_rkermit(nPort, cDirectory, [cProgress])
nError = tp_rxmodem(nPort, cFile, [cProgress])
nError = tp_rxcrc(nPort, cFile, [cProgress])
nError = tp_rx1k(nPort, cFile, [cProgress])
nError = tp_rymodem(nPort, cDirectory, [cProgress])
nError = tp_rzmodem(nPort, cDirectory, [cProgress])
Receive file from remote system.
Goto ( Basic I/O - Terminal - Watches - File Transfer - Utility - Notifications )
nResult = bin_and(nValue...)
nResult = bin_or(nValue...)
nResult = bin_xor(nValue...)
nResult = bin_not(nValue)
These functions perform binary operations on integer values.
cHex = tp_strhex(cString)
Convert an ASCII string to a string of two-digit hexadecimal values.