SendSerial 1.04 is FREEWARE Copyright © Michael Dreher Preface ------- SendSerial is a little program to send a command to the modem and wait for the result ("OK", "BUSY", "ERROR", ...). I wrote it to initialize my modem in a batch file and to assure that it is ready. There are several options, which allow you to use it with other, than the built-in serial port. Usage : SendSerial options -------------------------- The options are : ? : show this little help-page -d Devicename : name of the device ("serial.device") -u Unitnumber : unitnumber of the device (0) -b Baudrate : baudrate to use (set by Prefs/Serial) -c Command : command to send to modem ("ATZ") -r Modemresponse : expected response of the modem ("OK") -p PreWaitTime : time to wait after opening the device (2 seconds) -t MaxDelayTime : maximum time to wait for a response of the modem (10 seconds) NOECHO : the modem is set to ATE0 and doesn't echo commands OUTPUT : show the output of the modem LOCK : use LockDevUnit instead of AttemptDevUnit of OwnDevUnit Library NOODU : disable OwnDevUnit.library support All omitted options will get the defaults in parentheses. Some of them are set by Prefs/Serial. On success the returncode will be set to zero. If the modemresponse doesn't match the expected string the returncode will be 5 (WARN), on other errors it will be 10 (ERROR). Remember that many modems drop the line or even reset themselve when the serial.device gets closed. To avoid this, you have to tell the modem to ignore the DTR signal (for USR modems this is AT&D0). OwnDevUnit support ------------------ SendSerial attempts to open the OwnDevUnit.library version 1, but it will also work without the OwnDevUnit.library. Normally SendSerial uses AttemptDevUnit to obtain a lock to the device, but you can use the switch 'LOCK' to use LockDevUnit. Without 'LOCK' SendSerial will fail after about 5 seconds when it doesn't get the device. When you specify 'LOCK' at the commandline, it will wait until it gets the device. You can't use CTRL-C to break it when it waits for the lock ! The 'OUTPUT' option ------------------- The 'OUTPUT' option can be used to call SendSerial by other programs and to check the result of the modem command. Be careful : when the returncode is 10 or above, there was a serios error and the message you get is the errormessage of SendSerial and not the message of the modem ! Examples -------- 1> sendserial Send "ATZ" to the modem, using the serial.device, unit 0 with the default baudrate, which can be adjusted with Prefs/Serial. Wait 2 seconds (PreWaitTime) after opening the device to assure the modem is ready to receive the command. If the modem doesn't answer "OK" within 10 seconds, the returncode will be 5. On other errors (device can't be opened, ...) the returncode will be 10 and an errormessage will be displayed. 1> sendserial -d ibmser.device -u 2 -b 19200 -c ATDT1-800-TRAPDOOR -r CONNECT -p 5 -t 60 OUTPUT ATDT1-800-TRAPDOOR NO CARRIER Send "ATDT1-800-TRAPDOOR" to the modem, using the ibmser.device, unit 2 and baudrate 19200. Wait 5 seconds after opening the device. If the modem doesn't answer "CONNECT" within 60 seconds, the returncode will be 5. Sendserial does not compare more characters than the length of the string "CONNECT", that means that any message which starts with "CONNECT" will result in a returncode of zero. The messages of the modem will be echoed. Comments on the program ----------------------- SendSerial requires AmigaOS >= 2.04 (V37). It supports the OwnDevUnit.library, opens the named device in shared-mode and sets the SERF_RAD_BOOGIE flag. SendSerial can not be run from Workbench ! Copyright --------- This program is Freeware, you can copy and use it for free. Programmer ---------- Michael Dreher Wielandstr. 12 71229 Leonberg Germany Fido Netmail : 2:246/1216.1 Intuition-Base ++49-7152-45768 UseNet: 641287@rz.fht-esslingen.de or michael@galaga.stgt.sub.org