Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 9c481c872fb0ae0cbadccdc2f4a18ab6 > files > 224

libasync-devel-0.17.0-5.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Async: Async::Serial Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceAsync.html">Async</a>::<a class="el" href="classAsync_1_1Serial.html">Serial</a>
  </div>
</div>
<div class="contents">
<h1>Async::Serial Class Reference</h1><!-- doxytag: class="Async::Serial" -->
<p>A class for using asyncronous serial communications.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>&gt;</code></p>

<p><a href="classAsync_1_1Serial-members.html">List of all members.</a></p>
<h2>Public Types</h2>
<ul>
<li>enum <a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">Parity</a> { <a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bca5da2349db85b90a230c03abed17a8a81">PARITY_NONE</a>, 
<a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bcaec3161f64c3e8020b0ecd6df1d4fa967">PARITY_EVEN</a>, 
<a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bca52cd62c3e3c8c7165161838f5538e67d">PARITY_ODD</a>
 }
<dl class="el"><dd class="mdescRight"><p>A type that defines the possible choices for parity. </p>
 <a href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">More...</a><br/></dl><li>enum <a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">Flow</a> { <a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61a47021b4d27b5bdd8ddee3213fe2465ec">FLOW_NONE</a>, 
<a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61a58c7397ce4fde9fd1dffa7bb836367ea">FLOW_HW</a>, 
<a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61a5c4f3f4d69a8ae429f06e0ede422b493">FLOW_XONOFF</a>
 }
<dl class="el"><dd class="mdescRight"><p>A type that defines the possible choices for flow control. </p>
 <a href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">More...</a><br/></dl><li>enum <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Pin</a> { <br/>
&nbsp;&nbsp;<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47da78585281bc6a0c7defed062e6cf2649e">PIN_NONE</a>, 
<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47dad7717ebce686a14d774a2ddd9c9cc151">PIN_RTS</a>, 
<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47da2c81e31ec783d57ce5dc0daf250fdaf3">PIN_DTR</a>, 
<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47da83969c7df7485ffb91493bb17ced04ab">PIN_CTS</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47dafbcef9b6945727705f58811271b12893">PIN_DSR</a>, 
<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47da8ccddd9b43649cab174b86792a4d7776">PIN_DCD</a>, 
<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47dacd7d556f45c9e2fbaced114e01a37c23">PIN_RI</a>
<br/>
 }
<dl class="el"><dd class="mdescRight"><p>A type that defines the read/write pins in the serial port. </p>
 <a href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">More...</a><br/></dl></ul>
<h2>Public Member Functions</h2>
<ul>
<li><a class="el" href="classAsync_1_1Serial.html#a1e028dd2da210ecfa36cd385827877a1">Serial</a> (const std::string &amp;serial_port)
<dl class="el"><dd class="mdescRight">Constuctor.  <a href="#a1e028dd2da210ecfa36cd385827877a1"></a><br/></dl><li><a class="el" href="classAsync_1_1Serial.html#a61e0316947bd97cb072d39781c9b10df">~Serial</a> (void)
<dl class="el"><dd class="mdescRight">Destructor.  <a href="#a61e0316947bd97cb072d39781c9b10df"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#a45989c15c443d6e776230645751ccc73">setParams</a> (int speed, <a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">Parity</a> parity, int bits, int stop_bits, <a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">Flow</a> flow)
<dl class="el"><dd class="mdescRight">Setup the serial port communications parameters.  <a href="#a45989c15c443d6e776230645751ccc73"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#ae6abc206c1ce20e231eb8823efe14b3d">open</a> (void)
<dl class="el"><dd class="mdescRight">Open the serial port.  <a href="#ae6abc206c1ce20e231eb8823efe14b3d"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#a4b23c3541564680c21944e23c95df56f">close</a> (void)
<dl class="el"><dd class="mdescRight">Close a previously opened serial port.  <a href="#a4b23c3541564680c21944e23c95df56f"></a><br/></dl><li>int <a class="el" href="classAsync_1_1Serial.html#a6be9ecfdb9dcd22b1be0c52597504143">write</a> (const char *buf, size_t count)
<dl class="el"><dd class="mdescRight">Write data to the serial port.  <a href="#a6be9ecfdb9dcd22b1be0c52597504143"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#aa69ca8e6f61f5590f587bcc1b93b0c27">setCanonical</a> (bool canonical)
<dl class="el"><dd class="mdescRight">Set or clear canonical mode.  <a href="#aa69ca8e6f61f5590f587bcc1b93b0c27"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#a97fa0a47aba962dea2f679e731ff9323">stopInput</a> (bool stop)
<dl class="el"><dd class="mdescRight">Stop/start input of data.  <a href="#a97fa0a47aba962dea2f679e731ff9323"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#a7ae847ef7d132141d91b1badb2703ea1">setPin</a> (<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Pin</a> pin, bool set)
<dl class="el"><dd class="mdescRight">Set the state of one of the output pins in the serial port.  <a href="#a7ae847ef7d132141d91b1badb2703ea1"></a><br/></dl><li>bool <a class="el" href="classAsync_1_1Serial.html#ae22eede9f8ad93081b1d2871bb92f32d">getPin</a> (<a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Pin</a> pin, bool &amp;is_set)
<dl class="el"><dd class="mdescRight">Get the state of one of the input pins in the serial port.  <a href="#ae22eede9f8ad93081b1d2871bb92f32d"></a><br/></dl></ul>
<h2>Public Attributes</h2>
<ul>
<li>SigC::Signal2&lt; void, char *, int &gt; <a class="el" href="classAsync_1_1Serial.html#a354b99acfd0c1390889b8d868ae35c5a">charactersReceived</a>
<dl class="el"><dd class="mdescRight">A signal that is emitted when there is data to read.  <a href="#a354b99acfd0c1390889b8d868ae35c5a"></a><br/></dl></ul>
<h2>Static Public Attributes</h2>
<ul>
<li>static const int <a class="el" href="classAsync_1_1Serial.html#a8597654759f1ff16d7528f2280b8e2d0">READ_BUFSIZE</a> = 1024
<dl class="el"><dd class="mdescRight">The maximum number of characters that can be read at once.  <a href="#a8597654759f1ff16d7528f2280b8e2d0"></a><br/></dl></ul>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A class for using asyncronous serial communications. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Tobias Blomberg </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2004-08-02 </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>The flow control code is untested. Report success/failure to me.</dd></dl>
<p>This class is used to communicate over an asynchronous serial link (e.g. RS-232 port). An example of how to use it is shown below.</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;stdio.h&gt;</span>
<span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;cstdlib&gt;</span>

<span class="preprocessor">#include &lt;<a class="code" href="AsyncCppApplication_8h.html" title="The core class for writing asyncronous cpp applications.">AsyncCppApplication.h</a>&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="AsyncSerial_8h.html" title="A class for using asynchronous serial communications.">AsyncSerial.h</a>&gt;</span>

<span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>Async;

<span class="keyword">class </span>MyClass : <span class="keyword">public</span> SigC::Object
{
  <span class="keyword">public</span>:
    MyClass(<span class="keywordtype">void</span>)
    {
      serial = <span class="keyword">new</span> <a class="code" href="classAsync_1_1Serial.html#a1e028dd2da210ecfa36cd385827877a1" title="Constuctor.">Serial</a>(<span class="stringliteral">&quot;/dev/ttyS0&quot;</span>);
      serial-&gt;charactersReceived.connect(
          slot(*<span class="keyword">this</span>, &amp;MyClass::onCharactersReceived));

      <span class="keywordflow">if</span> (!serial-&gt;open())
      {
        perror(<span class="stringliteral">&quot;Open serial port failed&quot;</span>);
        exit(1);
      }
      serial-&gt;setParams(9600, <a class="code" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bca5da2349db85b90a230c03abed17a8a81" title="Parity not used.">Serial::PARITY_NONE</a>, 8, 1, <a class="code" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61a47021b4d27b5bdd8ddee3213fe2465ec" title="No flow control in use.">Serial::FLOW_NONE</a>);
      
      serial-&gt;write(<span class="stringliteral">&quot;Hello, serial\n&quot;</span>, 14);
    }
    
    ~MyClass(<span class="keywordtype">void</span>)
    {
      serial-&gt;close();
      <span class="keyword">delete</span> serial;
    }

  <span class="keyword">private</span>:
    <a class="code" href="classAsync_1_1Serial.html#a1e028dd2da210ecfa36cd385827877a1" title="Constuctor.">Serial</a> *serial;
    
    <span class="keywordtype">void</span> onCharactersReceived(<span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> count)
    {
      cout &lt;&lt; <span class="stringliteral">&quot;Read &quot;</span> &lt;&lt; count &lt;&lt; <span class="stringliteral">&quot; characters from serial port: &quot;</span>
           &lt;&lt; buf &lt;&lt; endl;
    }
};

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  CppApplication app;
  MyClass my_class;
  app.exec();
}
</pre></div> <dl><dt><b>Examples: </b></dt><dd>
<p><a class="el" href="AsyncSerial__demo_8cpp-example.html#_a0">AsyncSerial_demo.cpp</a>.</p>
</dd>
</dl>
<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00129">129</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>
<hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="a10c109663cbee56341bb70863e598a61"></a><!-- doxytag: member="Async::Serial::Flow" ref="a10c109663cbee56341bb70863e598a61" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">Async::Serial::Flow</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A type that defines the possible choices for flow control. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a10c109663cbee56341bb70863e598a61a47021b4d27b5bdd8ddee3213fe2465ec"></a><!-- doxytag: member="FLOW_NONE" ref="a10c109663cbee56341bb70863e598a61a47021b4d27b5bdd8ddee3213fe2465ec" args="" -->FLOW_NONE</em>&nbsp;</td><td>
<p>No flow control in use. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a10c109663cbee56341bb70863e598a61a58c7397ce4fde9fd1dffa7bb836367ea"></a><!-- doxytag: member="FLOW_HW" ref="a10c109663cbee56341bb70863e598a61a58c7397ce4fde9fd1dffa7bb836367ea" args="" -->FLOW_HW</em>&nbsp;</td><td>
<p>Use hardware flow control. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a10c109663cbee56341bb70863e598a61a5c4f3f4d69a8ae429f06e0ede422b493"></a><!-- doxytag: member="FLOW_XONOFF" ref="a10c109663cbee56341bb70863e598a61a5c4f3f4d69a8ae429f06e0ede422b493" args="" -->FLOW_XONOFF</em>&nbsp;</td><td>
<p>Use software (XON/XOFF) flow control. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00145">145</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<a class="anchor" id="a7428061313a2989bce6355b0207728bc"></a><!-- doxytag: member="Async::Serial::Parity" ref="a7428061313a2989bce6355b0207728bc" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">Async::Serial::Parity</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A type that defines the possible choices for parity. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a7428061313a2989bce6355b0207728bca5da2349db85b90a230c03abed17a8a81"></a><!-- doxytag: member="PARITY_NONE" ref="a7428061313a2989bce6355b0207728bca5da2349db85b90a230c03abed17a8a81" args="" -->PARITY_NONE</em>&nbsp;</td><td>
<p>Parity not used. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a7428061313a2989bce6355b0207728bcaec3161f64c3e8020b0ecd6df1d4fa967"></a><!-- doxytag: member="PARITY_EVEN" ref="a7428061313a2989bce6355b0207728bcaec3161f64c3e8020b0ecd6df1d4fa967" args="" -->PARITY_EVEN</em>&nbsp;</td><td>
<p>Use even parity. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a7428061313a2989bce6355b0207728bca52cd62c3e3c8c7165161838f5538e67d"></a><!-- doxytag: member="PARITY_ODD" ref="a7428061313a2989bce6355b0207728bca52cd62c3e3c8c7165161838f5538e67d" args="" -->PARITY_ODD</em>&nbsp;</td><td>
<p>Use odd parity. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00135">135</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47d"></a><!-- doxytag: member="Async::Serial::Pin" ref="a659f4cc316ddf7517927f7ee61d0c47d" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Async::Serial::Pin</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A type that defines the read/write pins in the serial port. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47da78585281bc6a0c7defed062e6cf2649e"></a><!-- doxytag: member="PIN_NONE" ref="a659f4cc316ddf7517927f7ee61d0c47da78585281bc6a0c7defed062e6cf2649e" args="" -->PIN_NONE</em>&nbsp;</td><td>
<p>No pin. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47dad7717ebce686a14d774a2ddd9c9cc151"></a><!-- doxytag: member="PIN_RTS" ref="a659f4cc316ddf7517927f7ee61d0c47dad7717ebce686a14d774a2ddd9c9cc151" args="" -->PIN_RTS</em>&nbsp;</td><td>
<p>Output: Request To Send. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47da2c81e31ec783d57ce5dc0daf250fdaf3"></a><!-- doxytag: member="PIN_DTR" ref="a659f4cc316ddf7517927f7ee61d0c47da2c81e31ec783d57ce5dc0daf250fdaf3" args="" -->PIN_DTR</em>&nbsp;</td><td>
<p>Output: Data Terminal Ready. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47da83969c7df7485ffb91493bb17ced04ab"></a><!-- doxytag: member="PIN_CTS" ref="a659f4cc316ddf7517927f7ee61d0c47da83969c7df7485ffb91493bb17ced04ab" args="" -->PIN_CTS</em>&nbsp;</td><td>
<p>Input: Clear To Send. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47dafbcef9b6945727705f58811271b12893"></a><!-- doxytag: member="PIN_DSR" ref="a659f4cc316ddf7517927f7ee61d0c47dafbcef9b6945727705f58811271b12893" args="" -->PIN_DSR</em>&nbsp;</td><td>
<p>Input: Data Set Ready. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47da8ccddd9b43649cab174b86792a4d7776"></a><!-- doxytag: member="PIN_DCD" ref="a659f4cc316ddf7517927f7ee61d0c47da8ccddd9b43649cab174b86792a4d7776" args="" -->PIN_DCD</em>&nbsp;</td><td>
<p>Input: Data Carrier Detect. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a659f4cc316ddf7517927f7ee61d0c47dacd7d556f45c9e2fbaced114e01a37c23"></a><!-- doxytag: member="PIN_RI" ref="a659f4cc316ddf7517927f7ee61d0c47dacd7d556f45c9e2fbaced114e01a37c23" args="" -->PIN_RI</em>&nbsp;</td><td>
<p>Input: Ring Indicate. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00155">155</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1e028dd2da210ecfa36cd385827877a1"></a><!-- doxytag: member="Async::Serial::Serial" ref="a1e028dd2da210ecfa36cd385827877a1" args="(const std::string &amp;serial_port)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Serial::Serial </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>serial_port</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constuctor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>serial_port</em>&nbsp;</td><td>The device name of the serial port to use</td></tr>
  </table>
  </dd>
</dl>
<p>This is the constructor for the serial port class. It is possible to create multiple instances connected to the same serial port. For this to work, the given device name string must be exactly the same in all instances. </p>

</div>
</div>
<a class="anchor" id="a61e0316947bd97cb072d39781c9b10df"></a><!-- doxytag: member="Async::Serial::~Serial" ref="a61e0316947bd97cb072d39781c9b10df" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::Serial::~Serial </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a4b23c3541564680c21944e23c95df56f"></a><!-- doxytag: member="Async::Serial::close" ref="a4b23c3541564680c21944e23c95df56f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::close </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Close a previously opened serial port. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Use this method to close a previously opened serial port. If the port is already closed, <em>true</em> is returned and nothing is done. If the port has been opened by multiple instances, it will not be closed until the last instance has closed it. </p>

</div>
</div>
<a class="anchor" id="ae22eede9f8ad93081b1d2871bb92f32d"></a><!-- doxytag: member="Async::Serial::getPin" ref="ae22eede9f8ad93081b1d2871bb92f32d" args="(Pin pin, bool &amp;is_set)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::getPin </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Pin</a>&nbsp;</td>
          <td class="paramname"> <em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool &amp;&nbsp;</td>
          <td class="paramname"> <em>is_set</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the state of one of the input pins in the serial port. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pin</em>&nbsp;</td><td>The pin to get the state of. See <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Serial::Pin</a>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>is_set</em>&nbsp;</td><td>The result will be returned in this variable. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Use this function to read the state of one of the input pins in the serial port. For a list of available pins see <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Serial::Pin</a>. </p>

</div>
</div>
<a class="anchor" id="ae6abc206c1ce20e231eb8823efe14b3d"></a><!-- doxytag: member="Async::Serial::open" ref="ae6abc206c1ce20e231eb8823efe14b3d" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::open </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Open the serial port. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Call this method to open the serial port. No special setup of the port is done during the open call. The old setup is saved and restored when the port is closed. To setup the port operating parameters, use the setParams method after calling open. If the open method is called when the port is already opened, it just returns <em>true</em> without doing anything. </p>

</div>
</div>
<a class="anchor" id="aa69ca8e6f61f5590f587bcc1b93b0c27"></a><!-- doxytag: member="Async::Serial::setCanonical" ref="aa69ca8e6f61f5590f587bcc1b93b0c27" args="(bool canonical)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::setCanonical </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>canonical</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set or clear canonical mode. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Call this method to configure the serial port for canonical mode. In this mode, a couple of control characters are parsed by the kernel driver and interpreted in special ways. Most notably, only whole lines of text are sent up to the application. Don't use canonical mode when the serial stream is not readable text that is split into lines with a line feed character.</p>
<p>This function may be called both before or after the port has been opened and the setting is remembered after a close. </p>

</div>
</div>
<a class="anchor" id="a45989c15c443d6e776230645751ccc73"></a><!-- doxytag: member="Async::Serial::setParams" ref="a45989c15c443d6e776230645751ccc73" args="(int speed, Parity parity, int bits, int stop_bits, Flow flow)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::setParams </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>speed</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">Parity</a>&nbsp;</td>
          <td class="paramname"> <em>parity</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>bits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>stop_bits</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">Flow</a>&nbsp;</td>
          <td class="paramname"> <em>flow</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Setup the serial port communications parameters. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>speed</em>&nbsp;</td><td>The serial speed to use </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parity</em>&nbsp;</td><td>The parity to use (see <a class="el" href="classAsync_1_1Serial.html#a7428061313a2989bce6355b0207728bc">Serial::Parity</a>) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>bits</em>&nbsp;</td><td>The number of bits in each serial word </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stop_bits</em>&nbsp;</td><td>The number of stop bits to use </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>flow</em>&nbsp;</td><td>The type of flow control to use (see <a class="el" href="classAsync_1_1Serial.html#a10c109663cbee56341bb70863e598a61">Serial::Flow</a>) </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failure. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>This function is used to setup the serial communications parameters for the serial port. This must be done after calling the open function. </p>

</div>
</div>
<a class="anchor" id="a7ae847ef7d132141d91b1badb2703ea1"></a><!-- doxytag: member="Async::Serial::setPin" ref="a7ae847ef7d132141d91b1badb2703ea1" args="(Pin pin, bool set)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::setPin </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Pin</a>&nbsp;</td>
          <td class="paramname"> <em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>set</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the state of one of the output pins in the serial port. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pin</em>&nbsp;</td><td>The pin to set. See <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Serial::Pin</a>. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>set</em>&nbsp;</td><td>If <em>true</em> the pin is set, if <em>false</em> the pin is cleared </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Use this function to control one of the output pins in the serial port. For a list of available pins see <a class="el" href="classAsync_1_1Serial.html#a659f4cc316ddf7517927f7ee61d0c47d">Serial::Pin</a>. </p>

</div>
</div>
<a class="anchor" id="a97fa0a47aba962dea2f679e731ff9323"></a><!-- doxytag: member="Async::Serial::stopInput" ref="a97fa0a47aba962dea2f679e731ff9323" args="(bool stop)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Async::Serial::stopInput </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>stop</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Stop/start input of data. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stop</em>&nbsp;</td><td>Stop input if <em>true</em> or start input if <em>false</em> </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return <em>true</em> on success or else <em>false</em> on failue. On failure the global variable <em>errno</em> will be set to indicate the cause of the error.</dd></dl>
<p>Use this function to start/stop input of data when the flow control has been enabled. </p>

</div>
</div>
<a class="anchor" id="a6be9ecfdb9dcd22b1be0c52597504143"></a><!-- doxytag: member="Async::Serial::write" ref="a6be9ecfdb9dcd22b1be0c52597504143" args="(const char *buf, size_t count)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Async::Serial::write </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>count</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write data to the serial port. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buf</em>&nbsp;</td><td>A buffer containing the data to write </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>The number of bytes to write </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written is returned on success. If an error occurs, -1 is returned and the global variable <em>errno</em> is set to indicate the cause of the error. </dd></dl>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00243">243</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a354b99acfd0c1390889b8d868ae35c5a"></a><!-- doxytag: member="Async::Serial::charactersReceived" ref="a354b99acfd0c1390889b8d868ae35c5a" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SigC::Signal2&lt;void, char*, int&gt; <a class="el" href="classAsync_1_1Serial.html#a354b99acfd0c1390889b8d868ae35c5a">Async::Serial::charactersReceived</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A signal that is emitted when there is data to read. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>buf</em>&nbsp;</td><td>A buffer containing the data that has been read </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>count</em>&nbsp;</td><td>The number of bytes that was read </td></tr>
  </table>
  </dd>
</dl>
<dl class="note"><dt><b>Note:</b></dt><dd>For maximum buffer size see <a class="el" href="classAsync_1_1Serial.html#a8597654759f1ff16d7528f2280b8e2d0">Serial::READ_BUFSIZE</a></dd></dl>
<p>This signal is emitted whenever one or more characters has been received on the serial port. The buffer is always null-terminated but the null is not included in the count. </p>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00314">314</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<a class="anchor" id="a8597654759f1ff16d7528f2280b8e2d0"></a><!-- doxytag: member="Async::Serial::READ_BUFSIZE" ref="a8597654759f1ff16d7528f2280b8e2d0" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const int <a class="el" href="classAsync_1_1Serial.html#a8597654759f1ff16d7528f2280b8e2d0">Async::Serial::READ_BUFSIZE</a> = 1024<code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The maximum number of characters that can be read at once. </p>

<p>Definition at line <a class="el" href="AsyncSerial_8h_source.html#l00169">169</a> of file <a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="AsyncSerial_8h_source.html">AsyncSerial.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>