home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / XFER.ZIP / EMUACT.INC next >
Text File  |  1991-10-06  |  10KB  |  286 lines

  1. action SetupModemDB is
  2. make ModemDB permanent 
  3.     check FlowControl  in ModemDB
  4.     check Parity  in ModemDB
  5.     check StopBits  in ModemDB
  6.     check DataBits  in ModemDB
  7.     check Baud  in ModemDB
  8.     check ComPort  in ModemDB
  9.  
  10. action QueryModemDB is
  11. copy (checked in group FlowControlRB from ModemDB) to FlowControl
  12. copy (checked in group ParityGroup from ModemDB) to Parity
  13. copy (checked in group StopbitsGroup from ModemDB) to StopBits
  14. copy (checked in group DatabitsGroup from ModemDB) to DataBits
  15. copy (checked in group BaudGroup from ModemDB) to Baud
  16. copy (checked in group ComPortGroup from ModemDB) to ComPort
  17.  
  18. action QueryUploadDB is
  19. copy text of FilenameEF in UploadDB to Filename
  20. copy parameter of (checked in group UploadGroup from UploadDB) in UploadDB to TransferMode
  21.  
  22.  
  23. action QueryDownloadDB is
  24. copy text of FilenameEF in DownloadDB to Filename
  25. copy parameter of (checked in group DownloadGroup from DownloadDB) in DownloadDB to TransferMode
  26.  
  27.  
  28. action QueryDialDB is
  29. copy text of PhonenumberEF in DialDB to Phonenumber
  30.  
  31. subroutine PerformSetup() is
  32.    begin guarded
  33.       response to start
  34.          make ModemDB permanent
  35.          action SetupModemDB
  36.          make ModemDB visible
  37.  
  38.       response to Cancel in ModemDB
  39.          make ModemDB temporary 
  40.          make ModemDB invisible 
  41.          leave block
  42.  
  43.       response to OK in ModemDB
  44.          action QueryModemDB
  45.          make ModemDB temporary 
  46.          make ModemDB invisible 
  47.          leave block
  48.  
  49.       response to ParityEvenRB in ModemDB
  50.          copy checked in group DatabitsGroup from ModemDB to TempString
  51.          if (TempString = Databits8RB) then
  52.             copy ReplyToMessage("Invalid Databits",
  53.                                 "If Even or Odd parity is to be used then you must specify 7 Data Bits.",
  54.                                 MEssageOK, 1, MessageIconExclamation) to TempString
  55.             check Databits7RB in ModemDB
  56.          end if
  57.  
  58.       response to ParityOddRB in ModemDB
  59.          copy checked in group DatabitsGroup from ModemDB to TempString
  60.          if (TempString = Databits8RB) then
  61.             copy ReplyToMessage("Invalid Databits",
  62.                                 "If Even or Odd parity is to be used then you must specify 7 Data Bits.",
  63.                                 MEssageOK, 1, MessageIconExclamation) to TempString
  64.             check Databits7RB in ModemDB
  65.          end if
  66.  
  67.       response to Databits8RB in ModemDB
  68.          copy checked in group ParityGroup from ModemDB to TempString
  69.          if ((TempString = ParityOddRB) or (TempString = ParityEvenRB)) then
  70.             copy ReplyToMessage("Invalid Parity",
  71.                                 "If 8 Data Bits are to be used then you must specify No Parity.",
  72.                                 MEssageOK, 1, MessageIconExclamation) to TempString
  73.             check ParityNoneRB in ModemDB
  74.          end if
  75.             
  76.  
  77.    end
  78.  
  79. subroutine GetNumber(boolean: Status) is
  80.    begin guarded
  81.       response to start
  82.          make DialDB permanent
  83.          make DialDB visible
  84.  
  85.       response to Cancel in DialDB
  86.          make DialDB temporary 
  87.          make DialDB invisible
  88.          copy false to Status 
  89.          leave block
  90.  
  91.       response to OK in DialDB
  92.          action QueryDialDB
  93.          make DialDB temporary 
  94.          make DialDB invisible 
  95.          copy true to Status
  96.          leave block
  97.    end
  98. subroutine GetUploadInformation(boolean: Status) is
  99.    begin guarded
  100.       response to start
  101.          make UploadDB permanent
  102.          make UploadDB visible
  103.  
  104.       response to Cancel in UploadDB
  105.          make UploadDB temporary 
  106.          make UploadDB invisible
  107.          copy false to Status
  108.          leave block
  109.  
  110.       response to OK in UploadDB
  111.          action QueryUploadDB
  112.          make UploadDB temporary 
  113.          make UploadDB invisible 
  114.          copy true to Status
  115.          leave block
  116.    end
  117.  
  118. subroutine GetDownloadInformation(boolean: Status) is
  119.    begin guarded
  120.       response to start
  121.          copy "" to TempString
  122.          make DownloadDB permanent
  123.          make DownloadDB visible
  124.  
  125.       response to Cancel in DownloadDB
  126.          make DownloadDB temporary 
  127.          make DownloadDB invisible 
  128.          copy false to Status
  129.          leave block
  130.  
  131.       response to OK in DownloadDB
  132.          action QueryDownloadDB
  133.          make DownloadDB temporary 
  134.          make DownloadDB invisible 
  135.          copy true to Status
  136.          leave block
  137.  
  138.       response to XModemRB in DownloadDB
  139.          enable FilenameEF in DownloadDB
  140.          change FilenameEF in DownloadDB text to TempString
  141.  
  142.       response to YModemRB in DownloadDB
  143.          disable FilenameEF in DownloadDB
  144.          copy text of FilenameEF in DownloadDB to TempString
  145.          change FilenameEF in DownloadDB text to ""
  146.    end
  147.  
  148. subroutine MonitorTransfer(string: Command) is
  149. string ExtractString
  150.  
  151.    make FileTransferDB permanent
  152.    change FilenameST in FileTransferDB text to Filename
  153.    change TotalPacketsST in FileTransferDB text to " "
  154.    change CurrentPacketST in FileTransferDB text to " "
  155.    change AttemptST in FileTransferDB text to " "
  156.    change LastMessageST in FileTransferDB text to " "
  157.    make FileTransferDB visible
  158.    send Command to Modem
  159.    begin guarded
  160.       response to line "Waiting for remote" from Modem
  161.          change LastMessageST in FileTransferDB text to "Waiting for remote"
  162.  
  163.       response to line "XY receive: File" from Modem
  164.          extract from input
  165.             skip 17
  166.             take to last ExtractString
  167.          change FilenameST in FileTransferDB text to ExtractString
  168.  
  169.       response to line "total packets" from Modem
  170.          extract from input
  171.             skip to ":"
  172.             skip 1
  173.             take number ExtractString
  174.          change TotalPacketsST in FileTransferDB text to ExtractString
  175.  
  176.       response to line "Packet" from Modem
  177.          extract from input
  178.             skip to "Packet"
  179.             skip 7
  180.             take number ExtractString
  181.          change CurrentPacketST in FileTransferDB text to ExtractString
  182.          change AttemptST in FileTransferDB text to " "
  183.  
  184.       response to line "Attempt" from Modem
  185.          extract from input
  186.             skip to "Attempt"
  187.             skip 8
  188.             take number ExtractString
  189.          change AttemptST in FileTransferDB text to ExtractString
  190.  
  191.       response to line "Empty File" from Modem
  192.          change LastMessageST in FileTransferDB text to "Empty File"
  193.  
  194.       response to line "Bad packet" from Modem
  195.          change LastMessageST in FileTransferDB text to "Bad Packet"
  196.  
  197.       response to line "Out of synch" from Modem
  198.          change LastMessageST in FileTransferDB text to "Out of Sync"
  199.  
  200.       response to line "Packet timeout" from Modem
  201.          change LastMessageST in FileTransferDB text to "Packet Timeout"
  202.  
  203.       response to line "Unable to open" from Modem
  204.          change LastMessageST in FileTransferDB text to "File open failed"
  205.  
  206.       response to line "Startup not acknowledged" from Modem
  207.          change LastMessageST in FileTransferDB text to "Startup failed"
  208.  
  209.       response to line "Transfer complete" from Modem
  210.          change LastMessageST in FileTransferDB text to "Transfer complete"
  211.  
  212.       response to line "Batch transfer complete" from Modem
  213.          change LastMessageST in FileTransferDB text to "Transfer complete"
  214.  
  215.       response to line "END" from Modem
  216.          copy ReplyToMessage("End Transfer", "File Transfer has ended", MessageOK, 1,  
  217.                              MessageIconExclamation) to TempString
  218.          make FileTransferDB invisible
  219.          make FileTransferDB temporary
  220.          leave block
  221.    end
  222.  
  223.  
  224.  
  225. subroutine StartModemAndDial() is
  226. boolean ESLASYNC_OK
  227.  
  228.    make ModemDB permanent
  229.    copy (parameter of ComPort) " " to TempString
  230.    append (parameter of Baud) " " to TempString
  231.    append (parameter of Parity) " " to TempString
  232.    append (parameter of DataBits) " " to TempString
  233.    append (parameter of StopBits) " " to TempString
  234.    append (parameter of FlowControl) to TempString
  235.    make ModemDB temporary
  236.    start local Modem "ESLASYNC.EXE" TempString
  237.    begin guarded
  238.       response to line "READY"  from Modem
  239.          copy true to ESLASYNC_OK
  240.          leave block
  241.  
  242.       response to line "ERROR" from Modem
  243.          copy ReplyToMessage("ESLASYNC.EXE", input, MessageOK, 1,  
  244.                              MessageIconExclamation) to TempString
  245.          copy false to ESLASYNC_OK
  246.          leave block
  247.  
  248.      response to timeout 10
  249.          copy ReplyToMessage("TIMEOUT", "ESLASYNC.EXE not responding", 
  250.                              MessageOK, 1, MessageIconExclamation) to TempString
  251.          copy false to ESLASYNC_OK
  252.          leave block
  253.    end
  254.    if (ESLASYNC_OK) then
  255.       send "T ATDT " Phonenumber "\r\^D" to Modem
  256.       begin guarded
  257.          response to line "CONNECT" from Modem
  258.             copy ReplyToMessage("CONNECT", "Modem connection achieved.", 
  259.                                 MessageOK, 1,  MessageIconExclamation) to TempString
  260.             enable item Upload from PrimaryWindowAB in PrimaryWindow
  261.             enable item Download from PrimaryWindowAB in PrimaryWindow
  262.             enable item Disconnect from PrimaryWindowAB in PrimaryWindow
  263.             disable item Dial from PrimaryWindowAB in PrimaryWindow
  264.             leave block
  265.  
  266.          response to line "BUSY" from Modem
  267.             copy ReplyToMessage("BUSY", "Unable to connect.", 
  268.                                 MessageOK, 1,  MessageIconExclamation) to TempString
  269.             leave block
  270.  
  271.          response to line "NO CARRIER" from Modem
  272.             copy ReplyToMessage("NO CARRIER", "Unable to connect.", 
  273.                                 MessageOK, 1,  MessageIconExclamation) to TempString
  274.             leave block
  275.  
  276.          response to timeout 60
  277.             copy ReplyToMessage("Timeout", "Unable to connect within 60 seconds.", 
  278.                                 MessageOK, 1,  MessageIconExclamation) to TempString
  279.             leave block
  280.          
  281.       end
  282.    end if
  283.  
  284.  
  285.  
  286.