Short: Query some flags from the serial port Uploader: thomas-rapp@web.de (Thomas Rapp) Author: thomas-rapp@web.de (Thomas Rapp) Type: comm/misc -------- Function -------- SerQuery sends the SDCMD_QUERY command to a serial device driver to query some flags. With no parameters (except device name and unit) the flags are printed to the shell window. If you name some flags that should be checked, then the return code is set according to the result (0 = match, 5 = no match). ------- Purpose ------- Miami and MiamiDx have a feature to quick reconnect to the internet after a failure or reboot of the Amiga, if the modem hasn't disconnected. The option is called "Use CD". But there is no option to go online automatically only if then modem connection is intact and to stay offline if the modem has disconnected. You have to use the Online button manualy. With SerQuery you can query the CD flag in a shell script and go online if it is set. ----- Usage ----- SerQuery must be called from the DOS shell (or in a shell script). It either writes all flags into the shell window or checks the named flags and sets the return code according (with no output at all). Parameters DEVICE The name of the device driver (default is serial.device) UNIT/N The unit number of the device to query (default is 0) Flags to be tested to be set: DSR/S Data Set Ready CTS/S Clear To Send CD/S Carrier Detect RTS/S Ready To Send DTR/S Data Terminal Ready Flags to be tested to be unset: NODSR/S NOCTS/S NOCD/S Return code will be 0 if all flags tested match the named NORTS/S status. Otherwise RC will be 5 (WARN). NODTR/S VERBOSE/S Show some internal data. For debugging purpose only. ------- Example ------- Use this script to start Miami and go online automatically only if the modem is connected: rx >nil: "" ; Start RexxMast if it is not already started. WaitForPort AREXX ; Wait for ARexx to become active if `rx "say show('P','MIAMI.1')"` eq 0 ; Check if Miami is already started run >nil: Miami:Miami ; If not, start Miami WaitForPort MIAMI.1 ; Wait for Miami to become active endif serquery CD hyperCOM3.device 1 ; Query CD flag of hyperCOM3.device unit 1 if not warn ; If flag is set rx "address MIAMI.1 ONLINE" ; Tell Miami to go online endif