home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / os2 / at2-13b.arj / AT2.DOC next >
Encoding:
Text File  |  1992-06-04  |  9.1 KB  |  222 lines

  1.  
  2.                     AT2  Version 1.3  ---  by Rob Hamerling
  3.  
  4.   AT2
  5.  
  6.  
  7.  
  8.   INTRODUCTION
  9.  
  10.   AT2 is a simple OS/2 program with a limited but nevertheless very useful
  11.   function: it sends characters from the commandline as AT-command to a Hayes
  12.   compatible modem (with blanks suppressed).
  13.  
  14.   AT2 also shows the modem responses, if any.  All AT2 output, including the
  15.   modem-responses, may be redirected, for example to be stored in a file.
  16.  
  17.  
  18.   WHO MAY USE AT2?
  19.  
  20.   AT2 may be used for private personal use only, not in a commercial or
  21.   business environment.  Please contact the author if you have a business
  22.   need for AT2.
  23.  
  24.      R. Hamerling
  25.      Vianen, The Netherlands
  26.      Phone: ++31.3473.72136 (voice, might be the answering machine)
  27.      FIDOnet: 2:512/4.1098
  28.  
  29.   AT2 may be distributed freely, without chargeing a fee.
  30.  
  31.  
  32.   AT2 PARAMETERS
  33.  
  34.   AT2 builds the string to be sent to the modem with all commandline
  35.   parameters.  They may be specified as a single string, or as separate
  36.   commands which will be concatenated by AT2 to form a single string.  The
  37.   string will be preceeded with 'AT' and terminated with a Carrier Return
  38.   character (ASCII 13).
  39.  
  40.   The string will be sent to the modem in 8-bit, NO parity, 1 stop-bit mode.
  41.  
  42.  
  43.   SPECIAL PARAMETERS
  44.  
  45.   AT2 accepts 2 optional parameters to control its behaviour.  These must be
  46.   specified as first parameters on the commandline, and can only be numeric
  47.   to distinguish them from modem-commands.  Of course these parameters will
  48.   not be sent to the modem, AT2 will send the first non-numeric and all
  49.   subsequent parameters (even when numeric) to the modem.  So you can even
  50.   send a dial-string to your modem.
  51.  
  52.   1.  A value from 1 to 8 will be considered as port number (COM1...COM8).
  53.       COM1 will be addressed by default.
  54.  
  55.   2.  A value higher than 8 will be considered as port-speed to be set and
  56.       subsequently used to transmit the AT-command and receive the modem
  57.       response.  When not specified, the speed with which the COM-port has
  58.       been initialised before will be used and not changed.
  59.  
  60.   When either the port is not available (not installed or in use), or the
  61.   speed is an unacceptable value for OS/2, AT2 will terminate with an error
  62.   message, and not issue an AT-command.  The most common errors are:
  63.  
  64.  
  65.                     AT2  Version 1.3  ---  by Rob Hamerling
  66.  
  67.   ■   invalid port number will result in a DosOpen failure (rc=110)
  68.   ■   unacceptable speed will give a DosDevIOCtl error (rc=87)
  69.  
  70.   AT2 does not perform any kind of syntax checking for modem commands.
  71.  
  72.  
  73.   EXAMPLES
  74.  
  75.   Here some examples for AT2:
  76.  
  77.   AT2 E1         Set modem command-echoing ON: AT2 will send 'ATE1<CR>' to
  78.                  the modem.
  79.  
  80.   AT2 19200 M1   Set the com-port to 19200 bps and set modem-speaker on.
  81.  
  82.   AT2 2 \S       Report modem configuration of modem on COM2.
  83.  
  84.   AT2 ^&v >modem.cfg Report current and stored modem profiles, and store
  85.                  modem responses in file 'modem.cfg'.
  86.  
  87.                  Note: A '^'-character is needed as escape-character in front
  88.                  of every '&'-character on the commandline of AT2!  The
  89.                  '&'-character otherwise acts as command separator.  See your
  90.                  OS/2 command reference manual for details.
  91.  
  92.   AT2 ^&Z0=0347372136 Store (replace) a telephone number in the modem
  93.                  directory.
  94.  
  95.   Of course these are just examples, use your imagination!
  96.  
  97.  
  98.   IMPLEMENTATION
  99.  
  100.   AT2 is written in C-language, and uses the standard OS/2 Application
  101.   Programmers Interface and functions provided by the COM-port driver
  102.   COMxx.SYS of OS/2.  It is distributed as a 16-bit program, and has been
  103. | tested with OS/2 versions 1.3 and 2.0.
  104.  
  105.  
  106. | CONTROL OF THE DTR SIGNAL
  107.  
  108. | AT2 does (by default) not set DTR true during execution.  The reason for
  109. | this is that modems which are programmed with a phone number to be dialed
  110. | when DTR becomes true would inadvertently start to dial that number when
  111. | AT2 only tries to deliver an AT command.  On the other hand there are
  112. | modems which do not accept an AT command when DTR is not true, and almost
  113. | certainly will not deliver responses in that case.
  114.  
  115. | To make AT2 generally useful for many if not all modems in different
  116. | configurations, AT2 scans for an environmentstring "AT2" during its startup
  117. | phase.  When this string is set to "DTR", AT2 does set DTR true before
  118. | delivering its AT-command (and drops it before termination).  In all other
  119. | cases AT2 keeps DTR false.
  120.  
  121. | So enter (e.g. in your CONFIG.SYS):
  122.  
  123. |      SET AT2=DTR
  124.  
  125. | in case you have a modem that needs DTR to work with AT2.  Just try with
  126. | and without this SET command to see if there is a different behaviour!
  127.  
  128.                     AT2  Version 1.3  ---  by Rob Hamerling
  129.  
  130.   Note: RTS is made true during execution of AT2, otherwise many modems would
  131.   not listen at all.
  132.  
  133.  
  134.   LIMITATIONS
  135.  
  136.   The following minor restrictions may make AT2 a less useful to you:
  137.  
  138.   ■   Most Hayes-compatible modems have a commandbuffer of 40 characters.
  139.       Therefore AT2 limits the command-string to 40 characters.  The
  140.       '^'-characters do not appear to AT2 and will not be included.  The
  141.       first parameter that would make the length of the AT-command string
  142. |     exceed 40 and all subsequent parameters will be ignored.
  143.  
  144. | ■   Even if your modem responds as expected to the commands delivered by
  145. |     AT2, it may require DTR true for a dial-command.  If that is the case
  146. |     for your modem, and if you want to use AT2 for dialing, you'll have to
  147. |     set the environment variable AT2=DTR, as explained in "Control of the
  148. |     DTR signal" on page 2.
  149.  
  150.   ■   For communication with the modem, AT2 may change certain COM-port
  151.       parameter settings.  These parameters are not reset to their previous
  152.       values after AT2 has finished.  This may leave the port in a setting
  153.       that you may want differently.
  154.  
  155.   Always issue a MODE command with the proper parameters after using AT2.
  156.  
  157.  
  158.   AT2 IS NOT A REPLACEMENT FOR MODE
  159.  
  160.   I have considered making AT2 a stand-in for the MODE command, dedicated for
  161.   the COM-port, but I dropped the idea:
  162.  
  163.   ■   It would make AT2 considerably more complicated and error-prone.
  164.   ■   Every OS/2 installation has the MODE-command available, so why
  165.       duplicate good work?
  166.  
  167.   The exception is the setting of port-speed.  This is just for convenience.
  168.  
  169.   Using the MODE-command for setting the speed of the COM-port has the
  170.   potential problem that it may make DTR come true.  This should in
  171.   particular be avoided if the modem is programmed to dial a telephone number
  172.   on rising DTR.
  173.  
  174.   Note: The same applies to the use of ECHO to send AT-commands to a modem!
  175.  
  176.   Use AT2 to control your modem, use MODE to control your COM-port.
  177.  
  178.  
  179.   AT2 DESIGN ISSUES
  180.  
  181.   It was originally designed for just switching a modem from SYNC to ASYNC
  182.   mode (and vice versa) in a situation where communications services are used
  183.   of which some use Synchronous (SDLC) protocol and others use Asynchrounous
  184.   protocol.  This could be done with redirecting an ECHO command (ECHO ATE1
  185.   >COM1), which works perfectly for DOS in combination with some modems.
  186.   However, OS/2 and some other modems behave differently.
  187.  
  188.   MODE and ECHO may result in DTR becoming true.  And the modem might be
  189.   programmed to dial a built-in phone number to a SYNC connection point when
  190.  
  191.                     AT2  Version 1.3  ---  by Rob Hamerling
  192.  
  193. | DTR becomes true.  This may have some undesirable effects:
  194.  
  195. | ■   It is in most cases not useful to start dialing the programmed number
  196. |     when you are in the process of configuring your COM-port or modem.
  197. | ■   It is certainly not useful to dial a service with Synchronous protocol
  198. |     when the modem is connected to an ASYNC port (which is the only
  199. |     possibility to deliver AT-commands)!
  200.  
  201. | To avoid these problems, AT2 opens the COM-port by default without making
  202. | DTR true
  203.  
  204. | With AT2 you must be able to send any AT-string to the modem.  To avoid a
  205. | possible interpretation error (whether a commandline parameter is meant to
  206. | be a program-parameter or a modem-command), an environment variable is used
  207. | to control the DTR signal.
  208.  
  209.   AT2 waits about 0.5 seconds for the modem to transfer a response after
  210.   receiving an AT command.  This timeout is long enough for most modems.  On
  211.   the other hand it ensures that AT2 terminates quickly when there is no
  212.   response, or even when there is no modem connected to the port at all.
  213.  
  214.   Some modems have multiple output screens to show its configuration after
  215.   being requested so (for example with the command AT\S).  The operator is
  216.   requested to hit the ENTER key before the modem shows the next screen of
  217.   information.  AT2 tries to anticipate on this situation by issuing a CR
  218.   (Carriage Return) when the modem stops sending data.  If this works for
  219.   your modem you'll get the modem-configuration in 1 single outputstream.
  220.   Otherwise you may get the remaining screens at the next occasion, for
  221.   example when your 'real' communications program opens the COM-port.
  222.