home *** CD-ROM | disk | FTP | other *** search
- *.............................................................................
- * Program Name: FOXCOM06 Copyright: Magna Carta Software, Inc.
- * Date Created: 06-24-91 Language: FoxPro 2.0
- *.............................................................................
- * Description: FOXCOM03 plus...
- * a) Modem commands may be issued from a menu.
- *.............................................................................
- CLEAR ALL
- SET TALK OFF
- SET ESCAPE OFF
-
- * Load the right library
- foxid = VERS()
- IF "2.0" $ foxid
- SET LIBR TO ctf && Identified FoxPro 2.0
- ELSE
- IF "2.5" $ VERS()
- IF "Windows" $ foxid && Identified FoxPro 2.5 for Windows
- SET LIBR TO ctfw
- ELSE
- SET LIBR TO ctf25 && Identified FoxPro 2.5 for DOS
- ENDIF
- ENDIF
- ENDIF
-
- SET COLOR OF SCHEME 17 TO SCHEME 1 && save default color scheme
- SET COLOR OF SCHEME 18 TO SCHEME 2
-
- DO ctfhdr
- DO ctfutil
- DEFINE PAD p_ct_modem OF main_menu PROMPT "\<Modem Command" AT 00, 37
- ON SELECTION PAD p_ct_modem OF main_menu =ct_modem(portid, 37)
-
- SET PROCEDURE TO CTFUTIL
- version = 6
- portid = 0
-
- ACTIVATE WINDOW w_status
- ACTIVATE WINDOW w_term
-
- ret = u8250_init(portid, COM1, 2400, 8, PARITY_NONE, 1)
- IF ret < 0
- ? ret
- =INKEY(0)
- CANCEL
- ENDIF
- =CT_SET_WIN(portid)
- ret =install_ipr(portid, RECEIVE, NULL, 2048)
- IF ret < 0
- ? ret-1
- =INKEY(0)
- CANCEL
- ENDIF
- ret =install_isr(portid, 4, NULL) && IRQ4 (use 3 for COM2)
- IF ret < 0
- ? ret-2
- =INKEY(0)
- CANCEL
- ENDIF
-
- @ 00,00 SAY "CommTools Terminal Version " +;
- ALLTRIM(STR(version)) + ": Press ESC for a list of commands"
- =set_rx_xlat(0, LOCAL_ECHO, TRUE) && turn on RX echo
- =set_rx_xlat(0, TEXTCASE, UPPERCASE) && convert RX to uppercase
-
- ACTIVATE MENU main_menu
-
-
- FUNCTION ct_online
- PARAMETERS portid
-
- ACTIVATE WINDOW w_term
- =c_term(portid) && switch to dumb terminal mode
- RETURN (0)
-
-
-
- *
- * MODEM_MENU(expN portid, expC number)
- * Show a menu that allows the user to send commands to the modem.
- *
- FUNCTION ct_modem
- PARAMETERS portid, col
-
- DEFINE POPUP pop_modem FROM 01, col;
- IN SCREEN;
- SHADOW
- DEFINE BAR 1 OF pop_modem PROMPT "Return"
- DEFINE BAR 2 OF pop_modem PROMPT "Initialize"
- DEFINE BAR 3 OF pop_modem PROMPT "Dial"
- DEFINE BAR 4 OF pop_modem PROMPT "Hang Up"
-
- ON SELECTION POPUP pop_modem =_ct_modem(portid, BAR())
- ACTIVATE POPUP pop_modem
- RELEASE pop_modem
- RETURN (0)
-
-
- FUNCTION _ct_modem
- PARAMETERS portid, choice
- PRIVATE motype
- DIMENSION modem_type[17]
-
- modem_type[1] = "UNKNOWN"
- modem_type[2] = "HAYES 300"
- modem_type[3] = "HAYES 1200"
- modem_type[4] = "HAYES 1200EF"
- modem_type[5] = "HAYES 2400"
- modem_type[6] = "HAYES 9600"
- modem_type[7] = "TELEBIT RA12C"
- modem_type[8] = "TELEBIT RA12E"
- modem_type[9] = "TELEBIT RM12C"
- modem_type[10] = "TELEBIT T18PC"
- modem_type[11] = "TELEBIT T18SA"
- modem_type[12] = "TELEBIT T18RMM"
- modem_type[13] = "UDS 9600"
- modem_type[14] = "UDS V3224"
- modem_type[15] = "UDS V3225"
- modem_type[16] = "USR 9600 DUAL STD."
- DO CASE
- CASE choice = 1
- CASE Choice = 2
- ret=status_msg(0, "Obtaining modem type information...")
- motype = modem_id(portid)
- ret=status_msg(0, "Modem Type is: " + get_modem(motype))
- =mspause(1000)
- ret=status_msg(0, "Initializing...")
- =modem_init(portid, motype)
- ret=status_msg(0, "Ready")
- CASE Choice = 3
- ret=status_msg(0, "Dialing: " + LTRIM(number))
- ret = modem_dial(portid, number)
- ret = status_msg(0, "Dial Return Code: " + STR(ret))
- =INKEY(0)
- IF ret < 0
- =status_msg(0, "Modem not initialized")
- =INKEY(0)
- ENDIF
- CASE Choice = 4
- =status_msg(0, "Attempting to hang up modem")
- ret = modem_hangup(portid)
- IF ret >= 0
- =status_msg(0, "Modem successfully hung up")
- ELSE
- =status_msg(0, "Error while attempting to hang up modem")
- ENDIF
- ENDCASE
- DEACTIVATE POPUP pop_modem
- RETURN (Choice)
-
-
- FUNCTION get_modem
- PARAMETERS type
-
- DO CASE
- CASE type = 0
- strtype = "UNKNOWN"
- CASE type = 3
- strtype = "HAYES 300"
- CASE type = 12
- strtype = "HAYES 1200"
- CASE type = 13
- strtype = "HAYES 1200EF"
- CASE type = 24
- strtype = "HAYES 2400"
- CASE type = 96
- strtype = "HAYES 9600"
- CASE type = 961
- strtype = "TELEBIT RA12C"
- CASE type = 962
- strtype = "TELEBIT RA12E"
- CASE type = 963
- strtype = "TELEBIT RM12C"
- CASE type = 964
- strtype = "TELEBIT T18PC"
- CASE type = 965
- strtype = "TELEBIT T18SA"
- CASE type = 966
- strtype = "TELEBIT T18RMM"
- CASE type = 901
- strtype = "UDS 9600"
- CASE type = 1
- strtype = "UDS V3224"
- CASE type = 2
- strtype = "UDS V3225"
- CASE type = 144
- strtype = "USR 9600 DUAL STD"
- OTHERWISE
- strtype = "UNKNOWN"
- ENDCASE
- RETURN (strtype)
-
-
- *
- * C_TERM -- This is a dumb terminal loop in FoxPro.
- * Alternately poll the serial input buffer and the keyboard for data.
- *
- FUNCTION c_term
- PARAMETERS portid
- PRIVATE c
-
- ?
- DO WHILE .T.
- * CHECK SERIAL PORT FOR BYTE *
- c = c_getc(portid) && check the serial port for a byte
- * CHECK KEYBOARD FOR A KEY PRESS *
- c = INKEY() && check keyboard for a key
- DO CASE && evaluate the received key
- CASE c == ESC && ESC was pressed
- RETURN (0)
- CASE c <> 0
- =c_putc(portid, c)
- ENDCASE
- ENDDO && do while .t.
- RETURN (0)
-