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

  1. *.............................................................................
  2. *   Program Name: CTFMODEM         Copyright: Magna Carta Software, Inc.
  3. *   Date Created: 06-24-91         Language:  FoxPro 2.0
  4. *.............................................................................
  5. * Description: Modem routines for 'CommTools -- Fox' examples.
  6. * Do NOT run this file directly.  It is DOed by FOXCOMxx examples, starting
  7. * with FOXCOM07
  8. *.............................................................................
  9.  
  10.  
  11. *
  12. * CT_MODEM(expN portid, expC number)
  13. * Show a menu that allows the user to send commands to the modem.
  14. *
  15. FUNCTION ct_modem
  16.     PARAMETERS portid, col
  17.  
  18.     DEFINE POPUP pop_modem FROM 01, col;
  19.         IN SCREEN;
  20.         SHADOW
  21.         DEFINE BAR 1  OF pop_modem PROMPT "Return"
  22.         DEFINE BAR 2  OF pop_modem PROMPT "Initialize"
  23.         DEFINE BAR 3  OF pop_modem PROMPT "Dial"
  24.         DEFINE BAR 4  OF pop_modem PROMPT "Hang Up"
  25.  
  26.     ON SELECTION POPUP pop_modem =_ct_modem(portid, BAR())
  27.     ACTIVATE POPUP pop_modem
  28.     RELEASE pop_modem
  29. RETURN (0)
  30.  
  31.  
  32. FUNCTION _ct_modem
  33.     PARAMETERS portid, choice
  34.  
  35.     DO CASE
  36.         CASE choice = 1
  37.         CASE Choice = 2
  38.             ret=status_msg(0, "Obtaining modem type information...")
  39.             motype = modem_id(portid)
  40.             ret=status_msg(0, "Modem Type is: " + get_modem(motype))
  41.             =mspause(1000)
  42.             ret=status_msg(0, "Initializing...")
  43.             =modem_init(portid, motype)
  44.             ret=status_msg(0, "Ready")
  45.  
  46.         CASE Choice = 3
  47.             ret=status_msg(0, "Dialing: " + LTRIM(number))
  48.             ret = modem_dial(portid, number)
  49.             ret = status_msg(0, "Dial Return Code: " + STR(ret))
  50.             =INKEY(0)
  51.             IF ret < 0
  52.                 =status_msg(0, "Modem not initialized")
  53.                 =INKEY(0)
  54.             ENDIF
  55.             ret = status_msg(0, "Carrier speed: " + ALLTRIM(STR(get_carrier_speed(portid)));
  56.                 + ". Port speed: " + ALLTRIM(STR(get_speed(portid))))
  57.  
  58.         CASE Choice = 4
  59.             =status_msg(0, "Attempting to hang up modem")
  60.             ret = modem_hangup(portid)
  61.             IF ret >= 0
  62.                 =status_msg(0, "Modem successfully hung up")
  63.             ELSE
  64.                 =status_msg(0, "Error while attempting to hang up modem")
  65.             ENDIF
  66.     ENDCASE
  67.     DEACTIVATE POPUP pop_modem
  68. RETURN (Choice)
  69.  
  70.  
  71. FUNCTION get_modem
  72.     PARAMETERS type
  73.     PRIVATE strtype
  74.  
  75.     DO CASE
  76.         CASE type = 0
  77.             strtype = "UNKNOWN"
  78.         CASE type = 300
  79.             strtype = "Hayes Compatible 300 bps"
  80.         CASE type = 1200
  81.             strtype = "Hayes Compatible 1200 bps"
  82.         CASE type = 1300
  83.             strtype = "Hayes Compatible 1200EF"
  84.         CASE type = 2400
  85.             strtype = "Hayes Compatible 2400 bps"
  86.         CASE type = 9600
  87.             strtype = "Hayes Compatible 9600 bps"
  88.         CASE type = 14400
  89.             strtype = "Hayes Compatible 14400 bps"
  90.         CASE type = 961
  91.             strtype = "TELEBIT RA12C"
  92.         CASE type = 962
  93.             strtype = "TELEBIT RA12E"
  94.         CASE type = 963
  95.             strtype = "TELEBIT RM12C"
  96.         CASE type = 964
  97.             strtype = "TELEBIT T18PC"
  98.         CASE type = 965
  99.             strtype = "TELEBIT T18SA"
  100.         CASE type = 966
  101.             strtype = "TELEBIT T18RMM"
  102.         CASE type = 901
  103.             strtype = "UDS 9600"
  104.         CASE type = 1
  105.             strtype = "UDS V3224"
  106.         CASE type = 2
  107.             strtype = "UDS V3225"
  108.         CASE type = 144
  109.             strtype = "USR 9600 DUAL STD"
  110.         OTHERWISE
  111.             strtype = "UNKNOWN"
  112.     ENDCASE
  113. RETURN (strtype)
  114.  
  115.