Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!CORY.BERKELEY.EDU!dillon
From: dillon@CORY.BERKELEY.EDU.UUCP
Newsgroups: comp.sys.amiga
Subject: Re: Carrier detect and signals
Message-ID: <8711252059.AA19323@cory.Berkeley.EDU>
Date: Wed, 25-Nov-87 15:59:49 EST
Article-I.D.: cory.8711252059.AA19323
Posted: Wed Nov 25 15:59:49 1987
Date-Received: Sun, 29-Nov-87 04:49:15 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 34

>I need to know how to set up the serial device to generate a signal when
>the carrier drops.  I am writting the serail routines for my BBS and
>don't want to have to do a CheckCarrier() type of thing all over the place.
>Yes, I know about the SDCMD_QUERY, but that's not what I want.  If I did that,
>I could set up a timer_request to check the carrier once a second, but I
>would rather have it tell me when the carrier drops.  At least, it would be
>nice if I could have a flag like SERB_CHECKCD that would enable checking of
>the carrier and return an error of SerErr_NOCD if the carrier is lost.

	I just do this before sending a CMD_READ... since you want to do
a SDCMD_QUERY anyway to get the number of bytes in the read buffer (You NEVER
read one character at a time if you can help it).  You need some sort of
timeout on the CMD_READ anyway or your BBS can hang even with an active
carrier (e.g. xmodem transfer dies, user doesn't do anything for 10 minutes..)

	I agree, there should be a way for the serial.device to signal you.
Still, most modems send a 'NO CARRIER' message when the carrier drops and you
would catch it then.  But if you *still* want to do this, you would have to
create a separate task which periodically sends SDCMD_QUERY requests to the
serial.device and sets some global variable.  But I say you can do it within
your read/write routines just as easily.

SPEED CONSIDERATIONS:
	As long as you read as many chars that are available (in one CMD_READ),
and write as many chars as you can (in one CMD_WRITE), you can easily do a 
SDCMD_QUERY in between without slowing the program down.  Remember that 
syncronous IO calls such as SDCMD_QUERY are extremely fast.

	Additionaly, it should be noted that by using asyncronous CMD_WRITE's
a SDCMD_QUERY done after the CMD_WRITE is issued (using a different iorequest
of course) would be completely absorbed by the write-time.
    
				-Matt