home *** CD-ROM | disk | FTP | other *** search
/ Electronics Boutique Holiday Catalog 1996 / EB1996Holiday.iso / a3w_data / cnnct.scr < prev    next >
Text File  |  1996-06-28  |  2KB  |  84 lines

  1. # Clear the receive buffer
  2.  
  3. ClearBuffer ;
  4.  
  5. # Close and open the port
  6. # note: some modems require this sequence be sent twice
  7.  
  8. ClosePort ;
  9. Wait Seconds(1);
  10. OpenPort  baud(%BAUD%) Bits(7);
  11. Wait Seconds(1);
  12. ClosePort ;
  13. Wait Seconds(1);
  14. OpenPort  baud(%BAUD%) Bits(7);
  15.  
  16. #Send the 'reset to factory config' command and check for OK or ERROR
  17.  
  18. Say String(%RESET%);
  19.  
  20. :check_1
  21.  
  22. GetAnswer Timeout(2);
  23. IfAnswer is(Equal) to(ERROR) goto(ok_1);
  24. IfAnswer is(NotEqual) to(OK) goto(check_1) MaxRepeat(2);
  25.  
  26.  
  27. # Send the modem initilization string
  28.  
  29. :ok_1
  30.  
  31. ClearBuffer ;
  32. Say String(%INIT%) ;
  33.  
  34. :check_2
  35.  
  36. # Use line mode to receive data up to the Carriage Return.  This way
  37. # we are sure to get the baudrate with the CONNECT message from the modem.
  38.  
  39. GetAnswer Timeout(2);
  40. IfAnswer is(Equal) to(ERROR) goto(ok_2);
  41. IfAnswer is(NotEqual) to(OK) goto(check_2) MaxRepeat(05);
  42.  
  43. # Now send the dial command to the modem
  44. :ok_2
  45. ClearBuffer ;
  46. Say String(ATD%PTYPE%%ESC%%PHONE%);
  47.  
  48. # Wait for the CONNECT from the modem for 60 seconds  (30 * 2)
  49.  
  50. :check_3
  51.  
  52. GetAnswer Timeout(2) Mode(LINE);
  53. IfAnswer is(Equal) to(BUSY) goto(exit_bad);
  54. IfAnswer is(Equal) to(NO CARRIER) goto(exit_bad);
  55. IfAnswer is(NotEqual) to(CONNECT) goto(check_3) maxrepeat(30);
  56. IfAnswer is(NotEqual) to(CONNECT) goto(exit_bad);
  57.  
  58.  
  59. # Send characters necessary for autobps for the Series/1
  60.  
  61. say cr(y);
  62. Wait Seconds(2);
  63. say cr(y);
  64.  
  65. # Get the connect baud rate and put it in CNNCTBAUD to be displayed
  66. # using the display script.
  67. # We do this here to make sure we received all characters in the
  68. # baud rate (instead of CONNECT 240)
  69. GetAnswer Timeout(0);
  70. IfAnswer is(Equal) to(NO CARRIER) goto(exit_bad);
  71. GetValue after(CONNECT ) into(CNNCTBAUD);
  72.  
  73. Go to(exit_ok);
  74.  
  75. # Error return - no CONNECT message
  76.  
  77. :exit_bad
  78. Return code(12130);
  79.  
  80. # Normal return - continue processing
  81.  
  82. :exit_OK
  83. Return code(0);
  84.