home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
ad109u40.zip
/
adeptrexxcomfuncs.doc
< prev
next >
Wrap
Text File
|
1997-02-20
|
23KB
|
809 lines
AdeptXBBS REXX INTERFACE
Comm & Raw Comm Routines
Copyright (c) 1993 - 1996 by AdeptSoft
portions Copyright (c) 1991-1994 M. Kimes
All Rights Reserved
AdeptSoft, AdeptXBBS, GateKeeper,
are trademarks of AdeptSoft.
"XBBS" Copyright (c) 1988 - 1994 by M. Kimes. The "XBBS" name is a
Trademark of M. Kimes.
FUNCTION LISTING
---------------------------------------------------------------------------
AdeptComDial()
FUNCTION USAGE
call AdeptComDial LineNumber, "STRING TO DIAL"
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
String to Dial:
A string enclosed in quotes that you want to be sent to the modem.
RETURNED VALUE
DESCRIPTION
AdeptComDial will parse a string to the modem through the dialing
translation. I.E. "v~^ATDT555-1212|" will be translated to
LOWER DTR, PAUSE FOR A SECOND, RAISE DTR, SEND 'ATDT555-1212' then
a CR (Carriage Return to the modem).
NOTES
Dialing Translation Table:
'v' - Lower DTR
'^' - Raise DTR
'~' - Pause for one Second
'`' - Pause for 1/10th of a second
'|' - Carriage Return
'\\' - Escape Character
EXAMPLE
The following EXAMPLE will dial the number 555-1212:
Call AdeptComDial LineNumber,"v~^~ATDT555-1212|"
RELATED FUNCTIONS
AdeptComWaitConnect()
---------------------------------------------------------------------------
AdeptComDoDTR()
FUNCTION USAGE
call AdeptComDoDTR LineNumber, `0' or `1'
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
Type:
0 - Drop DTR (Will leave it dropped)
1 - Raise DTR (Will Leave it raised)
RETURNED VALUE
DESCRIPTION
The AdeptComDoDTR function will raise or drop DTR to the node
specified with the LineNumber parameter.
NOTES
EXAMPLE
This Example will drop the DTR:
call AdeptComDoDTR LineNumber,'0'
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptComFlush()
FUNCTION USAGE
call AdeptComFlush LineNumber
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
RETURNED VALUE
DESCRIPTION
AdeptComFlush will flush the output stream of the current com
port.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will flush the contents of the line's output stream:
call AdeptComFlush LineNumber
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptComGetBlock()
FUNCTION USAGE
call AdeptComGetBlock LineNumber, Length, Time, Stem
or
value = AdeptComGetBlock(LineNumber, Length, Time, Stem)
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
Length:
Length of block to receive.
Time:
Timeout period. In milliseconds.
Stem:
Received block is stored in this variable.
RETURNED VALUE
-1 Carrier Drop
0 Timeout
DESCRIPTION
AdeptComGetBlock will read the input queue until the timeout period
expires or 'Length' characters are received, whichever comes first.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will get a block of 12 characters with a timeout period
of 5 seconds and store it in the variable String:
call AdeptComGetBlock line, 12, 5000, 'String'
RELATED FUNCTIONS
AdeptComGetByte()
AdeptComGetString()
---------------------------------------------------------------------------
AdeptComGetByte()
FUNCTION USAGE
value = AdeptComGetByte(LineNumber, Time)
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
Time:
Timeout period. In milliseconds.
RETURNED VALUE
-1 Carrier Drop
0 Timeout
If the function does not time out or notice a carrier drop, it will
return the byte received.
DESCRIPTION
AdeptComGetByte receives a byte from the input stream.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following example get a byte from the current lines' input
stream and stores it in the variable char:
char = AdeptComGetByte(line, 1000)
RELATED FUNCTIONS
AdeptComGetBlock()
AdeptComGetString()
---------------------------------------------------------------------------
AdeptComGetString()
FUNCTION USAGE
call AdeptComGetString LineNumber, Length, Time, Chr, Ignore, Stem
or
value = AdeptComGetString(LineNumber, Length, Time, Chr, Ignore, Stem)
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
Length:
Length of string to receive.
Time:
Timeout period. In milliseconds.
Chr:
Ignored but required.
Ignore:
Ignored but required.
Stem:
Variable to place received string in.
RETURNED VALUE
-1 Carrier Drop
0 Timeout
DESCRIPTION
AdeptComGetString will read the input queue until 'time' expires or
length characters are received, whichever comes first.
This function is identical to AdeptComGetBlock apart from the syntax.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will get a block of 12 characters with a timeout period
of 5 seconds and store it in the variable String:
call AdeptComGetString line, 12, 5000, 'Chr', 'Ignore', 'String'
RELATED FUNCTIONS
AdeptComGetBlock()
AdeptComGetByte()
---------------------------------------------------------------------------
AdeptComPeekByte()
FUNCTION USAGE
value = AdeptComPeekByte(LineNumber, Time)
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
Time:
The timeout period is in the format of milliseconds.
RETURNED VALUE
-1 Carrier Drop
0 Timeout
If the function does not time out or notice a carrier drop, it will
return the next byte in the input queue.
DESCRIPTION
Returns the next character on the input stream but does not remove
it from the stream.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following will wait 5 seconds for the next character on the
input queue. It will return this character into the variable char
but leave the character in the input queue.
char = AdeptComPeekByte(line, 5000)
RELATED FUNCTIONS
AdeptComGetByte()
---------------------------------------------------------------------------
AdeptComPutC()
FUNCTION USAGE
call AdeptComPutC LineNumber, Char
or
Value = AdeptComPutC(LineNumber, Char)
ARGUMENTS
LineNumber:
Node number passed to REXX routine from Adept as first parameter.
Char:
Character to put into the com output stream.
RETURNED VALUE
-1 Carrier Drop
DESCRIPTION
AdeptComPutC will put a character into the Com port output stream.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This would put the letter 'A' in the Com Port's output stream.
call AdeptComPutC LineNumber,'A'
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptComWaitConnect()
FUNCTION USAGE
call AdeptComWaitConnect LineNumber, Time
or
Value = AdeptComWaitConnect(LineNumber, Time)
ARGUMENTS
LineNumber:
Node number passed to REXX routine from Adept as first parameter.
Time:
The time is in the format of milliseconds.
RETURNED VALUE
-1 Carrier Drop
0 Time out.
If it doesn't timeout it will then return the return code from the
modem i.e. 'CONNECT 28800' 'ERROR', 'OK', 'NO CARRIER'.
DESCRIPTION
AdeptComWaitConnect will wait for a modem connect, error code,
timeout or carrier drop.
NOTES
EXAMPLE
The following example will dial the number 555-1212 and wait then
display the response:
Call AdeptComDial LineNumber, "v~^~ATDT555-1212|"
connectresponse = AdeptComWaitConnect(LineNumber, 10000)
if(connectresponse>0) then
Call AdeptPrint LineNumber, "Connect Result: "||connectresponse
RELATED FUNCTIONS
AdeptComDial()
---------------------------------------------------------------------------
AdeptComWrite()
FUNCTION USAGE
call AdeptComWrite LineNumber, "string"
or
Value = AdeptComWrite(LineNumber, "string")
ARGUMENTS
LineNumber:
Node Number passed to REXX routine from Adept as first parameter.
String:
A string enclosed in quotes.
RETURNED VALUE
-1 Carrier Drop
DESCRIPTION
AdeptComWrite will place a string into the com port's output
stream.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following EXAMPLE would be used to Display "Hello!" to the output
stream, if the carrier is dropped, it would signal NoCarrier and the
script would be terminated.
rc = AdeptComWrite(LineNumber,"Hello!")
if (rc = '-1') then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptRawComClose()
FUNCTION USAGE
call AdeptRawComClose ComInfo
or
value = AdeptRawComClose(ComInfo)
ARGUMENTS
ComInfo:
ComInfo handle created by AdeptRawComOpen.
RETURNED VALUE
DESCRIPTION
Closes an Open Com Port Handle.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
call AdeptRawComClose ComInfo
RELATED FUNCTIONS
AdeptRawComOpen()
---------------------------------------------------------------------------
AdeptRawComGetBlock()
FUNCTION USAGE
call AdeptRawComGetBlock ComInfo, Buffer, Length, Time(ms), CDetect,
Bytename
or
Value = AdeptRawComGetBlock(ComInfo, Buffer, Length, Time(ms),
CDetect, Bytename)
ARGUMENTS
ComInfo:
ComInfo handle created by AdeptRawComOpen.
Buffer:
Data received is stored in this variable.
Length:
Number of characters to receive.
Time:
Timeout period. In milliseconds.
CDetect:
Carrier detect. TRUE or FALSE.
Bytename:
Number Of bytes read is stored in this variable.
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
Gets a block from the input stream. Stopping at Length or Time.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following example reads 12 characters into the variable buffer.
The timeout period is 5 seconds.
rc = AdeptRawComGetBlock(ComInfoHandle, 'buffer', 12, 5000, TRUE,
'len')
if (rc=65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
AdeptRawComOpen()
AdeptRawComGetString()
---------------------------------------------------------------------------
AdeptRawComGetString()
FUNCTION USAGE
call AdeptRawComGetString ComInfo, Buffer, Length, Term, Time, CDBuf
or
value = AdeptRawComGetString(ComInfo, Buffer, Length, Term, Time,
CDBuf)
ARGUMENTS
ComInfo:
ComInfo handle created by AdeptRawComOpen.
Buffer:
String received is stored in this variable.
Length:
Length of string to receive.
Term:
Character to terminate input at.
Time:
Timeout period. In milliseconds.
CDBuf:
Carrier Detect. TRUE or FALSE.
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
AdeptRawComGetString Gets a string from the ComInfo handle. Stopping
at Length characters or Time milliseconds, or if it finds Term
character. For example if the user enters "Hello" followed by enter
and the Term character was set to '\r' then AdeptRawComGetString would
return the string even if the timeout period had not expired or the
number of characters received was less than Length.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will attempt to receive 12 characters with a timeout
period of 5 seconds from the port stored in ComInfoHandle. It will
return the string before the timeout period or 12 characters are
received if the user presses enter. If the function times out or
detects a carrier drop, it will exit the script.
rc = AdeptRawComGetString(ComInfoHandle,'buffer',12,'\r',5000,TRUE)
if (rc=65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
AdeptRawComOpen()
AdeptRawComGetBlock()
---------------------------------------------------------------------------
AdeptRawComLink()
FUNCTION USAGE
call AdeptRawComLink LineNumber, ToComInfo
or
Value = AdeptRawComLink(LineNumber, ToComInfo)
ARGUMENTS
LineNumber:
Node number passed to REXX routine from Adept as first parameter.
ToComInfo:
ComInfo handle to link the current line to.
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
This function links an open ComInfo handle to the current line.
NOTES
** BE CAREFUL**
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will open a telnet connection to Address on port Port.
It will then link this connection to the current line.
rc = AdeptRawOpenSocket(ISTELNETCLIENT, Address, Port, 'Port')
if (rc=65588) then
signal NoCarrier
rc = AdeptRawComLink(line, Port)
if (rc=65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptRawComOpen()
FUNCTION USAGE
call AdeptRawComOpen Port, Baud, Chr, Parity, Stopbit, Flags, Stem
or
Value = AdeptRawComOpen(Port, Baud, Chr, Parity, Stopbit, Flags, Stem)
ARGUMENTS
Port:
Port to Open.
Baud:
Baudrate to open Port at.
Chr:
Data bits to set port at. ie 7,8 etc.
Parity:
Parity to set port at.
StopBit:
Stopbit to set port at.
Flags:
LEAVEPORTOPEN (0x00000001)
OPENPORTSHARED (0x00000002)
OPENWRITETHROUGH (0x00000004)
IGNORECARRIER (0x00000040)
ISSERIAL (0x00000200)
Stem:
ComInfo Descriptor
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
Opens a ComInfo Handle used by the AdeptRaw set of functions.
NOTES
** BE CAREFUL**
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This Example will create ComInfoHandle, a handle to a ComInfo
structure to be used in the various AdeptRawCom functions.
Call AdeptRawComOpen 'COM4',9600,8,N,1,,'ComInfoHandle'
RELATED FUNCTIONS
AdeptRawComClose()
AdeptRawOpenSocket()
---------------------------------------------------------------------------
AdeptRawComWrite()
FUNCTION USAGE
call AdeptRawComWrite ComInfo, Buffer, Length, CDetect
or
value = AdeptRawComWrite(ComInfo, Buffer, Length, CDetect)
ARGUMENTS
ComInfo:
ComInfo handle created by AdeptRawComOpen.
Buffer:
Buffer to write into com output stream.
Length:
Length of buffer to output.
CDetect:
Carrier Detect? TRUE or FALSE
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
Writes Buffer up to Length characters to the ComInfo output stream.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following example will send the contents of Buffer to the output
stream, if the carrier is dropped, it would signal NoCarrier and the
script would be terminated.
rc = AdeptRawComWrite(ComInfoHandle, Buffer, LENGTH(Buffer), TRUE)
if (rc = 65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptRawOpenSocket()
FUNCTION USAGE
call AdeptRawOpenSocket Flags, Hostname, Port, Stem
or
ComInfo = AdeptRawOpenSocket(Flags, Hostname, Port, Stem)
ARGUMENTS
Flags:
ISTELNETCLIENT (0x00000100)
ISSOCKETCLIENT (0x00000800)
Hostname:
Host to connect to.
Port:
Port to connect to.
Stem:
ComInfo Descriptor.
RETURNED VALUE
0 No Error
65592 Time Out/Error Connecting
65588 Connection/Carrier lost
DESCRIPTION
Opens a socket connection to hostname and port. Places the ComInfo
handle in Stem.
NOTES
** BE CAREFUL **
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
The following example opens a telnet link to Address:Port then links
the port to the user.
rc = AdeptRawOpenSocket(ISTELNETCLIENT, Address, Port, 'Port')
if (rc=65588) then
signal NoCarrier
rc = AdeptRawComLink(line, Port)
if (rc=65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
---------------------------------------------------------------------------
AdeptRawSetBPS() * Note this won't work for AdeptXBBS v1.07f/g4&5
FUNCTION USAGE
call AdeptRawSetBPS ComInfo, Baudrate
or
Value = AdeptRawSetBPS(ComInfo, Baudrate)
ARGUMENTS
ComInfo:
ComInfo handle created by AdeptRawComOpen.
Baudrate:
Baudrate to set the port at.
RETURNED VALUE
0 No Error
65592 Time Out.
65588 Connection/Carrier lost
DESCRIPTION
Sets an open ComInfo handle to baudrate.
NOTES
** BE CAREFUL**
This is a RAW com function. This is only to be used by
professionals or people experienced with programming serial based
products.
EXAMPLE
This example will set the baudrate of ComInfoHandle to 14400 baud:
rc = AdeptRawSetBPS(ComInfoHandle, '14400')
if (rc=65588) then
signal NoCarrier
NoCarrier:
exit
RELATED FUNCTIONS
---------------------------------------------------------------------------
*** End Of AdeptXBBS AdeptRexx Com and RawCom Function Documentation. ***
---------------------------------------------------------------------------