blob: d15177ef1b9c9d7115c0a4e787ad0fee2350030b [file] [log] [blame]
Jack Jansendcb0a9b1995-03-01 14:05:27 +00001\section{Built-in module \sectcode{ctb}}
2\bimodindex{ctb}
Jack Jansen64f08451995-03-01 14:06:52 +00003\renewcommand{\indexsubitem}{(in module ctb)}
Jack Jansendcb0a9b1995-03-01 14:05:27 +00004
5This module provides a partial interface to the Macintosh
6Communications Toolbox. Currently, only Connection Manager tools are
7supported.
8
9\begin{datadesc}{error}
10The exception raised on errors.
11\end{datadesc}
12
13\begin{datadesc}{cmData}
14\dataline{cmCntl}
15\dataline{cmAttn}
16Flags for the \var{channel} argument of the \var{Read} and \var{Write}
17methods.
18\end{datadesc}
19
20\begin{datadesc}{cmFlagsEOM}
21End-of-message flag for \var{Read} and \var{Write}.
22\end{datadesc}
23
24\begin{datadesc}{choose*}
25Values returned by \var{Choose}.
26\end{datadesc}
27
28\begin{datadesc}{cmStatus*}
29Bits in the status as returned by \var{Status}.
30\end{datadesc}
31
32\begin{funcdesc}{available}{}
33Returns 1 if the communication toolbox is available, zero otherwise.
34\end{funcdesc}
35
36\begin{funcdesc}{CMNew}{name\, sizes}
37Create a connection object using the connection tool named
38\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in,
39data out, control in, control out, attention in and attention out.
40Alternatively, passing \var{None} will result in default buffer sizes.
41\end{funcdesc}
42
43\subsection{connection object}
44For all connection methods that take a \var{timeout} argument, a value
45of \code{-1} is indefinite, meaning that the command runs to completion.
46
47\renewcommand{\indexsubitem}{(connection object method)}
48
49\begin{datadesc}{callback}
50If this member is set to a value other than \var{None} it should point
51to a function accepting a single argument (the connection
52object). This will make all connection object methods work
53asynchronously, with the callback routine being called upon
54completion.
55
56{\em Note:} for reasons beyond my understanding the callback routine
57is never called currently. You are advised against using asynchronous
58calls for the time being.
59\end{datadesc}
60
61
62\begin{funcdesc}{Open}{timeout}
63Open an outgoing connection, waiting at most \var{timeout} seconds for
64the connection to be established.
65\end{funcdesc}
66
67\begin{funcdesc}{Listen}{timeout}
68Wait for an incoming connection. Stop waiting after \var{timeout}
69seconds. This call is only meaningful to some tools.
70\end{funcdesc}
71
72\begin{funcdesc}{accept}{yesno}
73Accept (when \var{yesno} is non-zero) or reject an incoming call after
74\var{Listen} returned.
75\end{funcdesc}
76
77\begin{funcdesc}{Close}{timeout\, now}
78Close a connection. When \var{now} is zero, the close is orderly
79(i.e. outstanding output is flushed, etc) with a timeout of
80\var{timeout} seconds. When \var{now} is non-zero the close is
81immedeate, discarding output.
82\end{funcdesc}
83
84\begin{funcdesc}{Read}{len\, chan\, timeout}
85Read \var{len} bytes or until \var{timeout} seconds have passed from
86the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or
87\var{cmAttn}). Returns a 2-tuple: the data read and the end-of-message
88flag.
89\end{funcdesc}
90
91\begin{funcdesc}{Write}{buf\, chan\, timeout\, eom}
92Write \var{buf} to channel \var{chan}, aborting after \var{timeout}
93seconds. When \var{eom} has the value \var{cmFlagsEOM} an
94end-of-message indicator will be written after the data (if this
95concept has a meaning for this communication tool). The method returns
96the number of bytes written.
97\end{funcdesc}
98
99\begin{funcdesc}{Status}{}
100Return connection status as the 2-tuple \code{(sizes,
101flags)}. \var{Sizes} is a 6-tuple giving the actual buffer sizes used
102(see \var{CMNew}), \var{flags} is a set of bits describing the state
103of the connection.
104\end{funcdesc}
105
106\begin{funcdesc}{GetConfig}{}
107Return the configuration string of the communication tool. These
108configuration strings are tool-dependent, but usually easily parsed
109and modified.
110\end{funcdesc}
111
112\begin{funcdesc}{SetConfig}{str}
113Set the configuration string for the tool. The strings are parsed
114left-to-right, with later values taking precedence. This means
115individual configuration parameters can be modified by simply appending
116something like \code{'baud 4800'} to the end of the string returned by
117\var{GetConfig} and passing that to this method. The method returns
118the number of characters actually parsed by the tool before it
119encountered an error (or completed successfully).
120\end{funcdesc}
121
122\begin{funcdesc}{Choose}{}
123Present the user with a dialog to choose a communication tool and
124configure it. If there is an outstanding connection some choices (like
125selecting a different tool) may cause the connection to be
126aborted. The return value (one of the \var{choose*} constants) will
127indicate this.
128\end{funcdesc}
129
130\begin{funcdesc}{Idle}{}
131Give the tool a chance to use the processor. You should call this
132method regularly.
133\end{funcdesc}
134
135\begin{funcdesc}{Abort}{}
136Abort an outstanding asynchronous \var{Open} or \var{Listen}.
137\end{funcdesc}
138
139\begin{funcdesc}{Reset}{}
140Reset a connection. Exact meaning depends on the tool.
141\end{funcdesc}
142
143\begin{funcdesc}{Break}{length}
144Send a break. Whether this means anything, what it means and
145interpretation of the \var{length} parameter depend on the tool in
146use.
147\end{funcdesc}