Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telepathy Communications Library - <b>tp_waitfor()</b> - wait for one of several strings http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_waitfor() - wait for one of several strings

   nWhich := tp_waitfor(nPort, nTimeout, acList|cString...,
       [lIgnoreCase])

   nPort       Serial port number.
   nTimeout    Maximum time to wait, in seconds.
   acList      Array of strings.
   cString     One or more literal strings.
   lIgnoreCase Specify TRUE to ignore case.

   Waits for one of several strings to be received by the serial port.
   The strings may be specified either as separate parameters to the
   function, or by passing an array of strings.  Any characters received
   while waiting are discarded.  (If you want to do something with the
   characters besides discarding them, see tp_waitproc().)

   If lIgnoreCase is present and true, tp_waitfor() ignores upper/lower
   case distinctions when comparing characters.  By default, it is case-
   sensitive.

   None of the strings may be empty.  An empty string and any that
   follow it in the parameter list or array are ignored.

   Examples:

       nWhich := tp_waitfor(nPort, 30, "CONNECT", "NO DIAL", ;
           "BUSY", "NO ANSWER", "NO CARRIER")
       do case
       case nWhich == 1
           ? "Connected!"
       case nWhich < 0
           ? tp_errmsg()
       otherwise
           ? "No connection"
       endcase

       tp_send(nPort, "Give me a cookie!" + chr(13) + chr(10))
       tp_waitfor(nPort, -1, "cookie", .T.)

See Also: tp_waitproc()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson