home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a081 / 2.ddi / CTFXX.EXE / FOXCOM06.PRG < prev    next >
Encoding:
Text File  |  1993-05-12  |  6.2 KB  |  216 lines

  1. *.............................................................................
  2. *   Program Name: FOXCOM06         Copyright: Magna Carta Software, Inc.
  3. *   Date Created: 06-24-91         Language:  FoxPro 2.0
  4. *.............................................................................
  5. * Description: FOXCOM03 plus...
  6. * a) Modem commands may be issued from a menu.
  7. *.............................................................................
  8. CLEAR ALL
  9. SET TALK OFF
  10. SET ESCAPE OFF
  11.  
  12. * Load the right library
  13. foxid = VERS()
  14. IF "2.0" $ foxid
  15.     SET LIBR TO ctf                 && Identified FoxPro 2.0
  16. ELSE
  17.     IF "2.5" $ VERS()
  18.         IF "Windows" $ foxid        && Identified FoxPro 2.5 for Windows
  19.             SET LIBR TO ctfw
  20.         ELSE
  21.             SET LIBR TO ctf25       && Identified FoxPro 2.5 for DOS
  22.         ENDIF
  23.     ENDIF
  24. ENDIF
  25.  
  26. SET COLOR OF SCHEME 17 TO SCHEME 1  && save default color scheme
  27. SET COLOR OF SCHEME 18 TO SCHEME 2
  28.  
  29. DO ctfhdr
  30. DO ctfutil
  31. DEFINE PAD p_ct_modem  OF main_menu PROMPT "\<Modem Command" AT 00, 37
  32.     ON SELECTION PAD p_ct_modem OF main_menu =ct_modem(portid, 37)
  33.  
  34. SET PROCEDURE TO CTFUTIL
  35. version = 6
  36. portid  = 0
  37.  
  38. ACTIVATE WINDOW w_status
  39. ACTIVATE WINDOW w_term
  40.  
  41. ret = u8250_init(portid, COM1, 2400, 8, PARITY_NONE, 1)
  42. IF ret < 0
  43.     ? ret
  44.     =INKEY(0)
  45.     CANCEL
  46. ENDIF
  47. =CT_SET_WIN(portid)
  48. ret =install_ipr(portid, RECEIVE, NULL, 2048)
  49. IF ret < 0
  50.     ? ret-1
  51.     =INKEY(0)
  52.     CANCEL
  53. ENDIF
  54. ret =install_isr(portid, 4, NULL)               && IRQ4 (use 3 for COM2)
  55. IF ret < 0
  56.     ? ret-2
  57.     =INKEY(0)
  58.     CANCEL
  59. ENDIF
  60.  
  61. @ 00,00 SAY "CommTools Terminal Version " +;
  62.     ALLTRIM(STR(version)) + ": Press ESC for a list of commands"
  63. =set_rx_xlat(0, LOCAL_ECHO, TRUE)           && turn on RX echo
  64. =set_rx_xlat(0, TEXTCASE, UPPERCASE)        && convert RX to uppercase
  65.  
  66. ACTIVATE MENU main_menu
  67.  
  68.  
  69. FUNCTION ct_online
  70.     PARAMETERS portid
  71.  
  72.     ACTIVATE WINDOW w_term
  73.     =c_term(portid)                 && switch to dumb terminal mode
  74. RETURN (0)
  75.  
  76.  
  77.  
  78. *
  79. * MODEM_MENU(expN portid, expC number)
  80. * Show a menu that allows the user to send commands to the modem.
  81. *
  82. FUNCTION ct_modem
  83.     PARAMETERS portid, col
  84.  
  85.     DEFINE POPUP pop_modem FROM 01, col;
  86.         IN SCREEN;
  87.         SHADOW
  88.         DEFINE BAR 1  OF pop_modem PROMPT "Return"
  89.         DEFINE BAR 2  OF pop_modem PROMPT "Initialize"
  90.         DEFINE BAR 3  OF pop_modem PROMPT "Dial"
  91.         DEFINE BAR 4  OF pop_modem PROMPT "Hang Up"
  92.  
  93.     ON SELECTION POPUP pop_modem =_ct_modem(portid, BAR())
  94.     ACTIVATE POPUP pop_modem
  95.     RELEASE pop_modem
  96. RETURN (0)
  97.  
  98.  
  99. FUNCTION _ct_modem
  100.     PARAMETERS portid, choice
  101.     PRIVATE motype
  102.     DIMENSION modem_type[17]
  103.  
  104.     modem_type[1]  = "UNKNOWN"
  105.     modem_type[2]  = "HAYES 300"
  106.     modem_type[3]  = "HAYES 1200"
  107.     modem_type[4]  = "HAYES 1200EF"
  108.     modem_type[5]  = "HAYES 2400"
  109.     modem_type[6]  = "HAYES 9600"
  110.     modem_type[7]  = "TELEBIT RA12C"
  111.     modem_type[8]  = "TELEBIT RA12E"
  112.     modem_type[9]  = "TELEBIT RM12C"
  113.     modem_type[10] = "TELEBIT T18PC"
  114.     modem_type[11] = "TELEBIT T18SA"
  115.     modem_type[12] = "TELEBIT T18RMM"
  116.     modem_type[13] = "UDS 9600"
  117.     modem_type[14] = "UDS V3224"
  118.     modem_type[15] = "UDS V3225"
  119.     modem_type[16] = "USR 9600 DUAL STD."
  120.     DO CASE
  121.         CASE choice = 1
  122.         CASE Choice = 2
  123.             ret=status_msg(0, "Obtaining modem type information...")
  124.             motype = modem_id(portid)
  125.             ret=status_msg(0, "Modem Type is: " + get_modem(motype))
  126.             =mspause(1000)
  127.             ret=status_msg(0, "Initializing...")
  128.             =modem_init(portid, motype)
  129.             ret=status_msg(0, "Ready")
  130.         CASE Choice = 3
  131.             ret=status_msg(0, "Dialing: " + LTRIM(number))
  132.             ret = modem_dial(portid, number)
  133.             ret = status_msg(0, "Dial Return Code: " + STR(ret))
  134.             =INKEY(0)
  135.             IF ret < 0
  136.                 =status_msg(0, "Modem not initialized")
  137.                 =INKEY(0)
  138.             ENDIF
  139.         CASE Choice = 4
  140.             =status_msg(0, "Attempting to hang up modem")
  141.             ret = modem_hangup(portid)
  142.             IF ret >= 0
  143.                 =status_msg(0, "Modem successfully hung up")
  144.             ELSE
  145.                 =status_msg(0, "Error while attempting to hang up modem")
  146.             ENDIF
  147.     ENDCASE
  148.     DEACTIVATE POPUP pop_modem
  149. RETURN (Choice)
  150.  
  151.  
  152. FUNCTION get_modem
  153.     PARAMETERS type
  154.  
  155.     DO CASE
  156.         CASE type = 0
  157.             strtype = "UNKNOWN"
  158.         CASE type = 3
  159.             strtype = "HAYES 300"
  160.         CASE type = 12
  161.             strtype = "HAYES 1200"
  162.         CASE type = 13
  163.             strtype = "HAYES 1200EF"
  164.         CASE type = 24
  165.             strtype = "HAYES 2400"
  166.         CASE type = 96
  167.             strtype = "HAYES 9600"
  168.         CASE type = 961
  169.             strtype = "TELEBIT RA12C"
  170.         CASE type = 962
  171.             strtype = "TELEBIT RA12E"
  172.         CASE type = 963
  173.             strtype = "TELEBIT RM12C"
  174.         CASE type = 964
  175.             strtype = "TELEBIT T18PC"
  176.         CASE type = 965
  177.             strtype = "TELEBIT T18SA"
  178.         CASE type = 966
  179.             strtype = "TELEBIT T18RMM"
  180.         CASE type = 901
  181.             strtype = "UDS 9600"
  182.         CASE type = 1
  183.             strtype = "UDS V3224"
  184.         CASE type = 2
  185.             strtype = "UDS V3225"
  186.         CASE type = 144
  187.             strtype = "USR 9600 DUAL STD"
  188.         OTHERWISE
  189.             strtype = "UNKNOWN"
  190.     ENDCASE
  191. RETURN (strtype)
  192.  
  193.  
  194. *
  195. * C_TERM -- This is a dumb terminal loop in FoxPro.
  196. * Alternately poll the serial input buffer and the keyboard for data.
  197. *
  198. FUNCTION c_term
  199.     PARAMETERS portid
  200.     PRIVATE c
  201.  
  202.     ?
  203.     DO WHILE .T.
  204.         * CHECK SERIAL PORT FOR BYTE *
  205.         c = c_getc(portid)                      && check the serial port for a byte
  206.         * CHECK KEYBOARD FOR A KEY PRESS *
  207.         c = INKEY()                             && check keyboard for a key
  208.         DO CASE                                 && evaluate the received key
  209.             CASE c == ESC                       && ESC was pressed
  210.                 RETURN (0)
  211.             CASE c <> 0
  212.                 =c_putc(portid, c)
  213.         ENDCASE
  214.     ENDDO                                       && do while .t.
  215. RETURN (0)
  216.