[comp.sys.mac.programmer] Communications ToolBox and CMListen

tel@adimail.UUCP (Terry Monks) (09/13/90)

 I am having trouble adapting the Surfer application to wait for
 a call. When nothing happened, I put a CMlisten after the the CMOpen
 and had a callback proc which did a CMAccept, but I still get nothing.

 Can anyone let me see some source code that uses CMlisten correctly?
 [Yes, I did set the connection tool to Answer on 2 rings, and the
 tool is Modem Tool.]


-- 
Terry Monks        Automata Design Inc    (703) 472-9400

kazim@Apple.COM (Alex Kazim) (09/15/90)

In article <532@adimail.UUCP> tel@adimail.UUCP (Terry Monks) writes:
>
> I am having trouble adapting the Surfer application to wait for
> a call. When nothing happened, I put a CMlisten after the the CMOpen
> and had a callback proc which did a CMAccept, but I still get nothing.
>

The fault is mine.  I wrote Surfer (the program and the article) a long,
long time ago.  I left out Listen 'cuz I thought I'd write another article
on stuff like this, but we all know how those plans of mice and men go.

First, you don't need to explicitly put the modem tool in answer mode -- this
is essentially the same thing as using CMListen.

Second, don't call CMOpen.  In the Modem tool (in answer mode) this will look
like a CMListen, but the ADSP tool doesn't have an answer mode.  

What you do need to do is call CMListen after CMNew.  You must also do this if
CMChoose returns an OKMajor (i.e. a new tool).  In your idle loop, call 
CMStatus and check for the cmStatusIncomingCallPresent flag.  If it's set,
use CMAccept.  You connection is now set.

==========================================================================
Alex Kazim, Apple Computer
Surf the trough
==========================================================================