ccoms-html/commserv.htm

558 lines
15 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>CommServ</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="400" height="40">&nbsp;</td>
<td width="30" height="40"><a
href="../../../epoc32/doc/group/sdk.html"><img
src="../../../epoc32/doc/group/library.gif"
alt="SDK Home" align="top" border="0" width="30"
height="30"></a></td>
<td width="30" height="40"><a
href="../../../epoc32/doc/glossary/glossary.html"><img
src="../../../epoc32/doc/group/glossary.gif"
alt="Glossary" align="top" border="0" width="30"
height="30"></a></td>
<td width="30" height="40"><a
href="../../../epoc32/doc/index/id-toc.html"><img
src="../../../epoc32/doc/group/index.gif" alt="Index"
align="top" border="0" width="30" height="30"></a></td>
<td width="30" height="40"><a href="commcfg1.htm"><b><img
src="../../../epoc32/doc/group/stoneleft.gif" alt="Left"
align="top" border="0" width="30" height="30"></b></a></td>
<td width="30" height="40"><a href="commservcfg.htm"><b><img
src="../../../epoc32/doc/group/stoneright.gif"
alt="Right" align="top" border="0" width="30" height="30"></b></a></td>
<td width="30" height="40"><a href="programm.htm"><b><img
src="../../../epoc32/doc/group/stoneup.gif" alt="Up"
align="top" border="0" width="30" height="30"></b></a></td>
</tr>
</table>
<hr>
<h1>CommServ class</h1>
<hr>
<p><em>Section contents</em></p>
<ul>
<li><a href="#Overview"><strong>Overview</strong></a></li>
<li><a href="#Construction"><strong>Construction /
destruction</strong></a><ul>
<li><a href="#NewCommServ"><strong>NewCommServ -
Constructor</strong></a></li>
<li><a href="#DeleteCommServ"><strong>DeleteCommServ
- Destructor</strong></a></li>
</ul>
</li>
<li><a href="#Methods provided"><strong>Methods provided</strong></a><ul>
<li><a href="#Close"><strong>CommServClose</strong></a></li>
<li><a href="#Connect"><strong>CommServConnect</strong></a></li>
<li><a href="#GetPortInfo"><strong>CommServGetPortInfo</strong></a></li>
<li><a href="commserv.htm#GetPortInfo2"><strong>CommServGetPortInfo2</strong></a></li>
<li><a href="#LoadCommModule"><strong>CommServLoadCommModule</strong></a></li>
<li><a href="#NumPorts"><strong>CommServNumPorts</strong></a></li>
<li><a href="#UnloadCommModule"><strong>CommServUnloadCommModule</strong></a></li>
<li><a href="#Version"><strong>CommServVersion</strong></a></li>
</ul>
</li>
</ul>
<hr>
<h2><a name="Overview">Overview</a></h2>
<h5>Defined in</h5>
<p><code>ccomms.oxh</code></p>
<hr>
<h2><a name="Construction">Construction / destruction</a></h2>
<hr size="1">
<h3><a name="NewCommServ">NewCommServ - Constructor</a></h3>
<h5>Usage</h5>
<p><code>this&amp; = NewCommServ&amp;:</code></p>
<h5>Description</h5>
<p>Creates a comms server object and returns a handle which
allows the object to be manipulated.</p>
<h5>Return Value</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>An value which represents the created object</td>
</tr>
</table>
<h5>Error Handling</h5>
<p>If the object could not be created then an error is generated
which should be trapped by an <font face="Times New Roman"><code>ONERR</code></font>
handler.</p>
<h5>Example</h5>
<pre> LOCAL this&amp;
<strong>this&amp; = NewCommServ&amp;:</strong>
DeleteCommServ:(this&amp;) </pre>
<hr size="1">
<h3><a name="DeleteCommServ">DeleteCommServ - Destructor</a></h3>
<h5>Usage</h5>
<p><code>DeleteCommServ:(BYREF this&amp;)</code></p>
<h5>Description</h5>
<p>Destroys the comms server object.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>BYREF this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;
this&amp; = NewCommServ&amp;:
<strong>DeleteCommServ:(this&amp;)</strong> </pre>
<hr>
<h2><a name="Methods provided">Methods provided</a></h2>
<hr size="1">
<h3><a name="Close">CommServClose</a></h3>
<h5>Usage</h5>
<p><code>CommServClose:(this&amp;)</code></p>
<h5>Description</h5>
<p>Closes a connection to the comms server.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;,result%
this&amp; = NewCommServ&amp;:
result% = CommServConnect%:(this&amp;)
<strong>CommServClose:(this&amp;)</strong>
DeleteCommServ:(this&amp;) </pre>
<h5>See Also</h5>
<p><a href="#Connect">CommServConnect</a></p>
<hr size="1">
<h3><a name="Connect">CommServConnect</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServConnect%:(this&amp;)</code></p>
<h5>Description</h5>
<p>Opens a connection to the comms server.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;,result%
this&amp; = NewCommServ&amp;:
<strong>result% = CommServConnect%:(this&amp;)</strong>
CommServClose:(this&amp;)
DeleteCommServ:(this&amp;) </pre>
<h5>See Also</h5>
<p><a href="#Close">CommServClose</a></p>
<hr size="1">
<h3><a name="GetPortInfo">CommServGetPortInfo</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServGetPortInfo%:(this&amp;,name$,info&amp;)</code></p>
<h5>Description</h5>
<p>Obtains the port information for a comms module specified by
name (for example, <code>ECUART</code> for RS232).</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
<tr>
<td><code>name$</code></td>
<td>A name of a serial port</td>
</tr>
<tr>
<td><code>info&amp;</code></td>
<td>A handle to a <a href="../Documentation/serialin.htm">serial
information</a> object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;,info&amp;,result%
this&amp; = NewCommServ&amp;:
info&amp; = NewSerialInfo&amp;:
result% = CommServConnect%:(this&amp;)
<strong>result% = CommServGetPortInfo%:(this&amp;,&quot;ECUART&quot;,info&amp;)</strong>
CommServClose:(this&amp;)
DeleteSerialInfo:(info&amp;)
DeleteCommServ:(this&amp;) </pre>
<h5>See Also</h5>
<p><a href="#GetPortInfo2">CommServGetPortInfo2</a></p>
<hr size="1">
<h3><a name="GetPortInfo2">CommServGetPortInfo2</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServGetPortInfo2%:(this&amp;,index&amp;,module&amp;,info&amp;)</code></p>
<h5>Description</h5>
<p>Obtains the port information for a comms module specified by
an index number from 0. This allows you to enumerate through the
loaded comms modules. You can obtain the current number of loaded
comms modules by calling <a href="#NumPorts"><font size="4"><code><tt>CommServNumPorts</tt></code></font></a>.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
<tr>
<td><code>index&amp;</code></td>
<td>Index of the port (starting at 0)</td>
</tr>
<tr>
<td><code>modeul&amp;</code></td>
<td>A <a href="../../CDescriptor/Documentation/des.htm">descriptor</a>
to return the name of a loaded module</td>
</tr>
<tr>
<td><code>info&amp;</code></td>
<td>A handle to a <a href="../Documentation/serialin.htm">serial
information</a> object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<h5>See Also</h5>
<p><a href="#GetPortInfo">CommServGetPortInfo</a></p>
<hr size="1">
<h3><a name="LoadCommModule">CommServLoadCommModule</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServLoadCommModule%:(this&amp;,name$)</code></p>
<h5>Description</h5>
<p>Use this function to load a comms module.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<h5>Notes</h5>
<ol>
<li>There is no need for an extension (<code>.CSY</code>) is
automatically appended by this function. </li>
<li>This function automatically searches the <code>/System/Libs</code>
directories on all drives for this file </li>
<li>Two module are always available as standard. ECUART
drives the built in serial port on an ARM in RS232 mode.
IRCOMM drives the infra-red port on an ARM in infra-red
mode. </li>
</ol>
<h5>Example</h5>
<pre> LOCAL this&amp;
this&amp; = NewCommServ&amp;:
result% = CommServConnect%:(this&amp;)
<strong>result% = CommServLoadCommModule%:(this&amp;,&quot;IRCOMM&quot;)</strong>
result% = CommServUnloadCommModule%:(this&amp;,&quot;IRCOMM&quot;)
CommServClose:(this&amp;)
DeleteCommServ:(this&amp;) </pre>
<h5>See Also</h5>
<p><a href="#UnloadCommModule">CommServUnloadCommModule</a></p>
<hr size="1">
<h3><a name="NumPorts">CommServNumPorts</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServNumPorts%:(this&amp;,BYREF num&amp;)</code></p>
<h5>Description</h5>
<p>Use this function to find out how many comms module (CSYs) are
loaded</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
<tr>
<td><code>BYREF num&amp;</code></td>
<td>On return, holds the number of loaded CSYs</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<hr size="1">
<h3><a name="UnloadCommModule">CommServUnloadCommModule</a></h3>
<h5>Usage</h5>
<p><code>result% = CommServUnloadCommModule%:(this&amp;,name$)</code></p>
<h5>Description</h5>
<p>Use this function to unload a comms module &nbsp;&#151; for
instance, if switching from RS232 to infra-red operation.</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>result%</code></td>
<td>An error code</td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;
this&amp; = NewCommServ&amp;:
result% = CommServConnect%:(this&amp;)
result% = CommServLoadCommModule%:(this&amp;,&quot;IRCOMM&quot;)
<strong>result% = CommServUnloadCommModule%:(this&amp;,&quot;IRCOMM&quot;)</strong>
CommServClose:(this&amp;)
DeleteCommServ:(this&amp;) </pre>
<h5>Note</h5>
<p>There is no need to unload a comms module when the connection
to the server is closed, as this is done automatically.</p>
<h5>See Also</h5>
<p><a href="#LoadCommModule">CommServLoadCommModule</a></p>
<hr size="1">
<h3><a name="Version">CommServVersion</a></h3>
<h5>Usage</h5>
<p><code>version&amp; = CommServVersion&amp;:(this&amp;)</code></p>
<h5>Description</h5>
<p>Creates and returns a handle to a version object.</p>
<p>The version number may be incremented in future releases of
the file server. If extra features are added in such releases,
the version number may be used by application programs as a basis
for assessing the capabilities of the file server</p>
<h5>Arguments</h5>
<table border="1">
<tr>
<td><code>this&amp;</code></td>
<td>A handle to a comms server object</td>
</tr>
</table>
<h5>Return value</h5>
<table border="1">
<tr>
<td><code>version&amp;</code></td>
<td>A handle to a <a
href="../../CE32Base/Documentation/version.htm">version</a>
object. This must be freeded with a call to <a
href="../../CE32Base/Documentation/version.htm#DeleteVersion"><code>DeleteVersion:</code></a></td>
</tr>
</table>
<h5>Example</h5>
<pre> LOCAL this&amp;,version&amp;
this&amp; = NewCommServ&amp;:
<strong>version&amp; = CommServVersion&amp;:(this&amp;)</strong>
DeleteVersion:(version&amp;)
DeleteCommServ:(this&amp;) </pre>
<hr>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="400" height="40">&nbsp;</td>
<td width="30" height="40"><a
href="../../../epoc32/doc/group/sdk.html"><img
src="../../../epoc32/doc/group/library.gif"
alt="SDK Home" align="top" border="0" width="30"
height="30"></a></td>
<td width="30" height="40"><a
href="../../../epoc32/doc/glossary/glossary.html"><img
src="../../../epoc32/doc/group/glossary.gif"
alt="Glossary" align="top" border="0" width="30"
height="30"></a></td>
<td width="30" height="40"><a
href="../../../epoc32/doc/index/id-toc.html"><img
src="../../../epoc32/doc/group/index.gif" alt="Index"
align="top" border="0" width="30" height="30"></a></td>
<td width="30" height="40"><a href="commcfg1.htm"><b><img
src="../../../epoc32/doc/group/stoneleft.gif" alt="Left"
align="top" border="0" width="30" height="30"></b></a></td>
<td width="30" height="40"><a href="commservcfg.htm"><b><img
src="../../../epoc32/doc/group/stoneright.gif"
alt="Right" align="top" border="0" width="30" height="30"></b></a></td>
<td width="30" height="40"><a href="programm.htm"><b><img
src="../../../epoc32/doc/group/stoneup.gif" alt="Up"
align="top" border="0" width="30" height="30"></b></a></td>
</tr>
</table>
</body>
</html>