<* You run this script to establish a CDPD connection *>
<* between the ftp Software TCP/IP kernel and the *>
<* PCSI Ubiquity 1000/2000 or AMPS Cellular/CDPD *>
<* "PAL" phone. Actually, this script should work *>
<* with any PCSI modem that speaks the Ubi 2000 *>
<* AT command set. *>
<* Be vary careful of variable names in here... *>
<* Things defined with (define, are case sensitive. *>
<* Check to see if physical is high, if it is, bypass all *>
<* this, because "Ubi" is probably in "SLIP" mode, and *>
<* will not respond to AT commands, anyway. *>
<* However, exiting this script will place the serial driver *>
<* into packet mode, so if PC was shut down without serial CDPD *>
<* connection "idleld", this (bypassing init due to carrier high), *>
<* will probably restore the CDPD connection. *>
(poll, physical, open, 1000, ,
{
(status, {CDPD device initialization is in progress.})
(output,
(cr)(lf)
{The dialer is initializing the CDPD device,}
(cr)(lf){and placing it in CDPD mode.}
(cr)(lf))
(slang_init_modem) <* Blast out string from modem.ini *>
(remecho,off)
<* Tell user why there's such a long wait... *>
(status, {CDPD network synchronization is in progress.})
(output,
{Waiting for the CDPD device to synchronize with CDPD network.}
(cr)(lf))
<* Although we say it to user, we're really not synchronizing, *>
<* as much as waiting for Network to process Ubi's CDPD *>
<* credentials.*>
(status, {Signal strength determination is in progress.})
(output,
(cr)(lf)
{Dialer is determining the available signal strength.}
(cr)(lf))
(send, {AT!RSSI}(cr))
<* The wait value of 4 seconds (4000) was determined empiracly, and *>
<* might need to be tweaked on a faster PC. *>
(define, Signal, (receive, 4000))
<* Remove the AT!RSSI(cr) from the return string, so all we have left *>
<* is the numeric value of signal. The compare primitive gets very *>
<* cranky if the string being compared is not a number. *>
(replace, Signal, {AT!RSSI}(cr), ,)
<* Signal values -- good estimates from testing, not cast in stone. *>
(define, NoNetSig, -113)
(define, PoorSig, -96)
(define, GoodSig, -95)
(status, {Signal received; calculation is in progress.})
(output,
{Dialer is determining if the signal strength is sufficient.}
(cr)(lf))
<* Check for absoultely no signal... *>
(define, SigWarn,
(compare, (value, Signal), (value, NoNetSig),
ContinueScript, StopScript, StopScript))
(has, SigWarn, StopScript,
{(message,
{There is not enough cellular signal strength to initiate the CDPD connection. The script will stop. Try the connection from a location with stronger signal strength.},
OK,s)} {(status, {Insufficient signal strength. This connection attempt stopping.})
(exit)},)
<* Check for so-so signal. *>
(define, SigWarn,
(compare, (value, Signal), (value, PoorSig),
ContinueScript, PauseScript, PauseScript))
(has, SigWarn, PauseScript,
{(status, {Marginal signal strength. User decision required.})
(define, Answer, (message,
{The cellular signal strength is weak. It might not be possible to make or sustain a CDPD connection. Do you want to continue?},
YESNO,e,2,ContinueSript, StopScript))},)
<* The user says whether or not to continue. *>
(has, SigWarn, StopScript, {(exit)},)
(status, {CDPD registration in progress.})
(output,
{Signal strength is sufficient to make and sustain a CDPD connection.}
(cr)(lf))
(output, (cr)(lf){Dialer is waiting for CDPD network registration confirmation.}(cr)(lf))
<* wait a second; we're doing so much other stuff, we'll probably *>
<* register on the first or second try. *>
(define, WaitVal, (receive, 1500))
(delete, WaitVal)
(output, (cr)(lf))
(loop,
{
(send, {AT!REGSTATE}(cr))
(define, RegState, (receive, 3000))
(has, RegState, OK,
{
(output,
(cr)(lf)
{CDPD Network registration has completed successfully.}
(cr)(lf))
(lbreak)
},
{
<* Yes, we're outputing a '.' w/out cr/lf *>
(output, {.})
}
)
}, 10)
(status, {Entering SLIP mode.})
(output,
(cr)(lf)
{Dialer is attempting to place CDPD device in SLIP mode.}
(cr)(lf))
(has, RegState, OK,
{
(send, {AT!SLIP}(cr))
(define, SlipState, (receive, 3000))
(has, SlipState, OK,
{
(poll, physical, open, 5000,
{
(status,
{CDPD device registeration is complete.})
(output,
(cr)(lf)
{CDPD device is registered; Dialer is starting serial driver.}
(cr)(lf))
(lbreak)
},
{
(message,
{The Dialer cannot connect to the CDPD device in CDPD mode.},
OK, STOP)
}
)
},
{
(message,
{The CDPD device did not enter SLIP mode.}, OK, STOP)
}
)
},
{
(message,
{The CDPD device did not register with the CDPD network.},
OK,STOP )
(send, {AT!IDLE}(cr))
(exit)
}
)
(status, {CDPD connection is established})
(output, {CDPD connection attempt was successful.}(cr)(lf))