mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
423 lines
42 KiB
HTML
423 lines
42 KiB
HTML
|
|
<!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"/>
|
||
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||
|
|
<title>serial: include/serial/serial.h Source File</title>
|
||
|
|
|
||
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
|
|
||
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||
|
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
|
<script type="text/javascript" src="search/search.js"></script>
|
||
|
|
<script type="text/javascript">
|
||
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
||
|
|
</script>
|
||
|
|
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id="top"><!-- do not remove this div! -->
|
||
|
|
|
||
|
|
|
||
|
|
<div id="titlearea">
|
||
|
|
<table cellspacing="0" cellpadding="0">
|
||
|
|
<tbody>
|
||
|
|
<tr style="height: 56px;">
|
||
|
|
|
||
|
|
|
||
|
|
<td style="padding-left: 0.5em;">
|
||
|
|
<div id="projectname">serial
|
||
|
|
 <span id="projectnumber">1.0.1</span>
|
||
|
|
</div>
|
||
|
|
<div id="projectbrief">Cross-platform serial port library written in C++</div>
|
||
|
|
</td>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<!-- Generated by Doxygen 1.8.0 -->
|
||
|
|
<script type="text/javascript">
|
||
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||
|
|
</script>
|
||
|
|
<div id="navrow1" class="tabs">
|
||
|
|
<ul class="tablist">
|
||
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
||
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
||
|
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
||
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
||
|
|
<li>
|
||
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
||
|
|
<span class="left">
|
||
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
||
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
|
alt=""/>
|
||
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
||
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
||
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
||
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
||
|
|
</span><span class="right">
|
||
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
<div id="navrow2" class="tabs2">
|
||
|
|
<ul class="tablist">
|
||
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
||
|
|
<li><a href="globals.html"><span>Globals</span></a></li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<!-- window showing the filter options -->
|
||
|
|
<div id="MSearchSelectWindow"
|
||
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
||
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
||
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Defines</a></div>
|
||
|
|
|
||
|
|
<!-- iframe showing the search results (closed by default) -->
|
||
|
|
<div id="MSearchResultsWindow">
|
||
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
||
|
|
name="MSearchResults" id="MSearchResults">
|
||
|
|
</iframe>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="header">
|
||
|
|
<div class="headertitle">
|
||
|
|
<div class="title">include/serial/serial.h</div> </div>
|
||
|
|
</div><!--header-->
|
||
|
|
<div class="contents">
|
||
|
|
<a href="serial_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
|
||
|
|
<a name="l00036"></a>00036 <span class="preprocessor">#ifndef SERIAL_H</span>
|
||
|
|
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define SERIAL_H</span>
|
||
|
|
<a name="l00038"></a>00038 <span class="preprocessor"></span>
|
||
|
|
<a name="l00039"></a>00039 <span class="preprocessor">#include <limits></span>
|
||
|
|
<a name="l00040"></a>00040 <span class="preprocessor">#include <vector></span>
|
||
|
|
<a name="l00041"></a>00041 <span class="preprocessor">#include <string></span>
|
||
|
|
<a name="l00042"></a>00042 <span class="preprocessor">#include <cstring></span>
|
||
|
|
<a name="l00043"></a>00043 <span class="preprocessor">#include <sstream></span>
|
||
|
|
<a name="l00044"></a>00044 <span class="preprocessor">#include <exception></span>
|
||
|
|
<a name="l00045"></a>00045 <span class="preprocessor">#include <stdexcept></span>
|
||
|
|
<a name="l00046"></a>00046 <span class="preprocessor">#include <<a class="code" href="v8stdint_8h.html">serial/v8stdint.h</a>></span>
|
||
|
|
<a name="l00047"></a>00047
|
||
|
|
<a name="l00048"></a><a class="code" href="serial_8h.html#a25cffc64bd967636d69d7c3c82af1030">00048</a> <span class="preprocessor">#define THROW(exceptionClass, message) throw exceptionClass(__FILE__, \</span>
|
||
|
|
<a name="l00049"></a>00049 <span class="preprocessor">__LINE__, (message) )</span>
|
||
|
|
<a name="l00050"></a>00050 <span class="preprocessor"></span>
|
||
|
|
<a name="l00051"></a>00051 <span class="keyword">namespace </span>serial {
|
||
|
|
<a name="l00052"></a>00052
|
||
|
|
<a name="l00056"></a><a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">00056</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
|
||
|
|
<a name="l00057"></a><a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8af09eeaf7333d2feda0bd3d748d5e3123">00057</a> <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8af09eeaf7333d2feda0bd3d748d5e3123">fivebits</a> = 5,
|
||
|
|
<a name="l00058"></a><a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a608eb93b80fe8531d626b4e588c5bc8b">00058</a> <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a608eb93b80fe8531d626b4e588c5bc8b">sixbits</a> = 6,
|
||
|
|
<a name="l00059"></a><a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a7cf0a3607e326ff6736941008ea8174d">00059</a> <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a7cf0a3607e326ff6736941008ea8174d">sevenbits</a> = 7,
|
||
|
|
<a name="l00060"></a><a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a47f14d952cf9bed6c3f7ae5985161990">00060</a> <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a47f14d952cf9bed6c3f7ae5985161990">eightbits</a> = 8
|
||
|
|
<a name="l00061"></a>00061 } <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>;
|
||
|
|
<a name="l00062"></a>00062
|
||
|
|
<a name="l00066"></a><a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">00066</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
|
||
|
|
<a name="l00067"></a><a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481a31cbb2b3cf0870d1a089d66295918416">00067</a> <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481a31cbb2b3cf0870d1a089d66295918416">parity_none</a> = 0,
|
||
|
|
<a name="l00068"></a><a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481affd8fd58edf7c25bab458cafaebecb10">00068</a> <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481affd8fd58edf7c25bab458cafaebecb10">parity_odd</a> = 1,
|
||
|
|
<a name="l00069"></a><a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481abe15d241d407528bc8a199b02301ed46">00069</a> <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481abe15d241d407528bc8a199b02301ed46">parity_even</a> = 2
|
||
|
|
<a name="l00070"></a>00070 } <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>;
|
||
|
|
<a name="l00071"></a>00071
|
||
|
|
<a name="l00075"></a><a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">00075</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
|
||
|
|
<a name="l00076"></a><a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ab70806555a14cb43e5cc43f6f3d01157">00076</a> <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ab70806555a14cb43e5cc43f6f3d01157">stopbits_one</a> = 1,
|
||
|
|
<a name="l00077"></a><a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469abb25fb831662d361d99cf12fb0da45ec">00077</a> <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469abb25fb831662d361d99cf12fb0da45ec">stopbits_one_point_five</a>,
|
||
|
|
<a name="l00078"></a><a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ae0b1b8af1ece65afeacbe9fff198fa47">00078</a> <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ae0b1b8af1ece65afeacbe9fff198fa47">stopbits_two</a> = 2
|
||
|
|
<a name="l00079"></a>00079 } <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>;
|
||
|
|
<a name="l00080"></a>00080
|
||
|
|
<a name="l00084"></a><a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">00084</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
|
||
|
|
<a name="l00085"></a><a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a083bc02a6e8e7c6540a28654c0f95bb0">00085</a> <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a083bc02a6e8e7c6540a28654c0f95bb0">flowcontrol_none</a> = 0,
|
||
|
|
<a name="l00086"></a><a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351ab3390af5eee11740af5e09d71ad419a6">00086</a> <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351ab3390af5eee11740af5e09d71ad419a6">flowcontrol_software</a>,
|
||
|
|
<a name="l00087"></a><a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a84d411ac86fd25d659eef30aade04c43">00087</a> <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a84d411ac86fd25d659eef30aade04c43">flowcontrol_hardware</a>
|
||
|
|
<a name="l00088"></a>00088 } <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>;
|
||
|
|
<a name="l00089"></a>00089
|
||
|
|
<a name="l00096"></a><a class="code" href="structserial_1_1_timeout.html">00096</a> <span class="keyword">struct </span><a class="code" href="structserial_1_1_timeout.html">Timeout</a> {
|
||
|
|
<a name="l00097"></a>00097 <span class="preprocessor">#ifdef max</span>
|
||
|
|
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor"># undef max</span>
|
||
|
|
<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||
|
|
<a name="l00100"></a><a class="code" href="structserial_1_1_timeout.html#adc68e33d2f94bfa33ba1062c363b9151">00100</a> <span class="preprocessor"></span> <span class="keyword">static</span> uint32_t <a class="code" href="structserial_1_1_timeout.html#adc68e33d2f94bfa33ba1062c363b9151">max</a>() {<span class="keywordflow">return</span> <a class="code" href="structserial_1_1_timeout.html#adc68e33d2f94bfa33ba1062c363b9151">std::numeric_limits<uint32_t>::max</a>();}
|
||
|
|
<a name="l00110"></a><a class="code" href="structserial_1_1_timeout.html#aa4fbd72e16f47c9aea9fb3c32ca17828">00110</a> <span class="keyword">static</span> <a class="code" href="structserial_1_1_timeout.html">Timeout</a> <a class="code" href="structserial_1_1_timeout.html#aa4fbd72e16f47c9aea9fb3c32ca17828">simpleTimeout</a>(uint32_t timeout) {
|
||
|
|
<a name="l00111"></a>00111 <span class="keywordflow">return</span> <a class="code" href="structserial_1_1_timeout.html#a1a454b17f5d653b8e1b04b3ec2fead59">Timeout</a>(<a class="code" href="structserial_1_1_timeout.html#adc68e33d2f94bfa33ba1062c363b9151">max</a>(), timeout, 0, timeout, 0);
|
||
|
|
<a name="l00112"></a>00112 }
|
||
|
|
<a name="l00113"></a>00113
|
||
|
|
<a name="l00115"></a><a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">00115</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">inter_byte_timeout</a>;
|
||
|
|
<a name="l00117"></a><a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">00117</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">read_timeout_constant</a>;
|
||
|
|
<a name="l00121"></a><a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">00121</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">read_timeout_multiplier</a>;
|
||
|
|
<a name="l00123"></a><a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">00123</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">write_timeout_constant</a>;
|
||
|
|
<a name="l00127"></a><a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">00127</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">write_timeout_multiplier</a>;
|
||
|
|
<a name="l00128"></a>00128
|
||
|
|
<a name="l00129"></a><a class="code" href="structserial_1_1_timeout.html#a1a454b17f5d653b8e1b04b3ec2fead59">00129</a> <span class="keyword">explicit</span> <a class="code" href="structserial_1_1_timeout.html#a1a454b17f5d653b8e1b04b3ec2fead59">Timeout</a> (uint32_t inter_byte_timeout_=0,
|
||
|
|
<a name="l00130"></a>00130 uint32_t read_timeout_constant_=0,
|
||
|
|
<a name="l00131"></a>00131 uint32_t read_timeout_multiplier_=0,
|
||
|
|
<a name="l00132"></a>00132 uint32_t write_timeout_constant_=0,
|
||
|
|
<a name="l00133"></a>00133 uint32_t write_timeout_multiplier_=0)
|
||
|
|
<a name="l00134"></a>00134 : <a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">inter_byte_timeout</a>(inter_byte_timeout_),
|
||
|
|
<a name="l00135"></a>00135 <a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">read_timeout_constant</a>(read_timeout_constant_),
|
||
|
|
<a name="l00136"></a>00136 <a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">read_timeout_multiplier</a>(read_timeout_multiplier_),
|
||
|
|
<a name="l00137"></a>00137 <a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">write_timeout_constant</a>(write_timeout_constant_),
|
||
|
|
<a name="l00138"></a>00138 <a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">write_timeout_multiplier</a>(write_timeout_multiplier_)
|
||
|
|
<a name="l00139"></a>00139 {}
|
||
|
|
<a name="l00140"></a>00140 };
|
||
|
|
<a name="l00141"></a>00141
|
||
|
|
<a name="l00145"></a><a class="code" href="classserial_1_1_serial.html">00145</a> <span class="keyword">class </span><a class="code" href="classserial_1_1_serial.html">Serial</a> {
|
||
|
|
<a name="l00146"></a>00146 <span class="keyword">public</span>:
|
||
|
|
<a name="l00176"></a>00176 <a class="code" href="classserial_1_1_serial.html#aecbc4cc1723143805ae5a4aa79ba9332">Serial</a> (<span class="keyword">const</span> std::string &port = <span class="stringliteral">""</span>,
|
||
|
|
<a name="l00177"></a>00177 uint32_t baudrate = 9600,
|
||
|
|
<a name="l00178"></a>00178 <a class="code" href="structserial_1_1_timeout.html">Timeout</a> timeout = <a class="code" href="structserial_1_1_timeout.html">Timeout</a>(),
|
||
|
|
<a name="l00179"></a>00179 <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize = <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a47f14d952cf9bed6c3f7ae5985161990">eightbits</a>,
|
||
|
|
<a name="l00180"></a>00180 <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity = <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481a31cbb2b3cf0870d1a089d66295918416">parity_none</a>,
|
||
|
|
<a name="l00181"></a>00181 <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> stopbits = <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ab70806555a14cb43e5cc43f6f3d01157">stopbits_one</a>,
|
||
|
|
<a name="l00182"></a>00182 <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> flowcontrol = <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a083bc02a6e8e7c6540a28654c0f95bb0">flowcontrol_none</a>);
|
||
|
|
<a name="l00183"></a>00183
|
||
|
|
<a name="l00185"></a>00185 <span class="keyword">virtual</span> <a class="code" href="classserial_1_1_serial.html#a5b32c394c0ff923a4ef1c13cfb20a6ba">~Serial</a> ();
|
||
|
|
<a name="l00186"></a>00186
|
||
|
|
<a name="l00200"></a>00200 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00201"></a>00201 <a class="code" href="classserial_1_1_serial.html#af3644ed1a9d899b70e9d63bb9b808d62">open</a> ();
|
||
|
|
<a name="l00202"></a>00202
|
||
|
|
<a name="l00207"></a>00207 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00208"></a>00208 <a class="code" href="classserial_1_1_serial.html#af9895af496189f7f0aba7c097f5fa9c1">isOpen</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00209"></a>00209
|
||
|
|
<a name="l00211"></a>00211 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00212"></a>00212 <a class="code" href="classserial_1_1_serial.html#afbe59407e718bc3d22ea4a67b304db6c">close</a> ();
|
||
|
|
<a name="l00213"></a>00213
|
||
|
|
<a name="l00215"></a>00215 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00216"></a>00216 <a class="code" href="classserial_1_1_serial.html#afafe25b2f3bb0809550abdc72c51a234">available</a> ();
|
||
|
|
<a name="l00217"></a>00217
|
||
|
|
<a name="l00243"></a>00243 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00244"></a>00244 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (uint8_t *buffer, <span class="keywordtype">size_t</span> size);
|
||
|
|
<a name="l00245"></a>00245
|
||
|
|
<a name="l00254"></a>00254 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00255"></a>00255 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (std::vector<uint8_t> &buffer, <span class="keywordtype">size_t</span> size = 1);
|
||
|
|
<a name="l00256"></a>00256
|
||
|
|
<a name="l00265"></a>00265 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00266"></a>00266 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (std::string &buffer, <span class="keywordtype">size_t</span> size = 1);
|
||
|
|
<a name="l00267"></a>00267
|
||
|
|
<a name="l00275"></a>00275 std::string
|
||
|
|
<a name="l00276"></a>00276 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (<span class="keywordtype">size_t</span> size = 1);
|
||
|
|
<a name="l00277"></a>00277
|
||
|
|
<a name="l00288"></a>00288 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00289"></a>00289 <a class="code" href="classserial_1_1_serial.html#a010b18ec545dfe1a7bb1c95be4bdaa54">readline</a> (std::string &buffer, <span class="keywordtype">size_t</span> size = 65536, std::string eol = <span class="stringliteral">"\n"</span>);
|
||
|
|
<a name="l00290"></a>00290
|
||
|
|
<a name="l00300"></a>00300 std::string
|
||
|
|
<a name="l00301"></a>00301 <a class="code" href="classserial_1_1_serial.html#a010b18ec545dfe1a7bb1c95be4bdaa54">readline</a> (<span class="keywordtype">size_t</span> size = 65536, std::string eol = <span class="stringliteral">"\n"</span>);
|
||
|
|
<a name="l00302"></a>00302
|
||
|
|
<a name="l00314"></a>00314 std::vector<std::string>
|
||
|
|
<a name="l00315"></a>00315 <a class="code" href="classserial_1_1_serial.html#a99f77b9bbdc128b6704cc59db77686c5">readlines</a> (<span class="keywordtype">size_t</span> size = 65536, std::string eol = <span class="stringliteral">"\n"</span>);
|
||
|
|
<a name="l00316"></a>00316
|
||
|
|
<a name="l00328"></a>00328 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00329"></a>00329 <a class="code" href="classserial_1_1_serial.html#aa020880cdff3a370ddc574f594379c3c">write</a> (<span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> size);
|
||
|
|
<a name="l00330"></a>00330
|
||
|
|
<a name="l00339"></a>00339 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00340"></a>00340 <a class="code" href="classserial_1_1_serial.html#aa020880cdff3a370ddc574f594379c3c">write</a> (<span class="keyword">const</span> std::vector<uint8_t> &data);
|
||
|
|
<a name="l00341"></a>00341
|
||
|
|
<a name="l00350"></a>00350 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00351"></a>00351 <a class="code" href="classserial_1_1_serial.html#aa020880cdff3a370ddc574f594379c3c">write</a> (<span class="keyword">const</span> std::string &data);
|
||
|
|
<a name="l00352"></a>00352
|
||
|
|
<a name="l00361"></a>00361 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00362"></a>00362 <a class="code" href="classserial_1_1_serial.html#acecb0a5102ae0c944fe4b78e4adf839a">setPort</a> (<span class="keyword">const</span> std::string &port);
|
||
|
|
<a name="l00363"></a>00363
|
||
|
|
<a name="l00370"></a>00370 std::string
|
||
|
|
<a name="l00371"></a>00371 <a class="code" href="classserial_1_1_serial.html#ae95cd057e90258b1b3203ff8972a3567">getPort</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00372"></a>00372
|
||
|
|
<a name="l00407"></a>00407 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00408"></a>00408 <a class="code" href="classserial_1_1_serial.html#a4fc63af4b800a9f9e757414f38f3e8b3">setTimeout</a> (<a class="code" href="structserial_1_1_timeout.html">Timeout</a> &timeout);
|
||
|
|
<a name="l00409"></a>00409
|
||
|
|
<a name="l00411"></a>00411 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00412"></a><a class="code" href="classserial_1_1_serial.html#a4b4be39af3e1c68bc6ac09cb55788c86">00412</a> <a class="code" href="classserial_1_1_serial.html#a4fc63af4b800a9f9e757414f38f3e8b3">setTimeout</a> (uint32_t inter_byte_timeout, uint32_t read_timeout_constant,
|
||
|
|
<a name="l00413"></a>00413 uint32_t read_timeout_multiplier, uint32_t write_timeout_constant,
|
||
|
|
<a name="l00414"></a>00414 uint32_t write_timeout_multiplier)
|
||
|
|
<a name="l00415"></a>00415 {
|
||
|
|
<a name="l00416"></a>00416 <a class="code" href="structserial_1_1_timeout.html">Timeout</a> timeout(inter_byte_timeout, read_timeout_constant,
|
||
|
|
<a name="l00417"></a>00417 read_timeout_multiplier, write_timeout_constant,
|
||
|
|
<a name="l00418"></a>00418 write_timeout_multiplier);
|
||
|
|
<a name="l00419"></a>00419 <span class="keywordflow">return</span> <a class="code" href="classserial_1_1_serial.html#a4fc63af4b800a9f9e757414f38f3e8b3">setTimeout</a>(timeout);
|
||
|
|
<a name="l00420"></a>00420 }
|
||
|
|
<a name="l00421"></a>00421
|
||
|
|
<a name="l00429"></a>00429 <a class="code" href="structserial_1_1_timeout.html">Timeout</a>
|
||
|
|
<a name="l00430"></a>00430 <a class="code" href="classserial_1_1_serial.html#a765fccd0e53562773626fb39bb2efcb6">getTimeout</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00431"></a>00431
|
||
|
|
<a name="l00444"></a>00444 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00445"></a>00445 <a class="code" href="classserial_1_1_serial.html#ad4f7e9edff11b464199e94a43dfd19bf">setBaudrate</a> (uint32_t baudrate);
|
||
|
|
<a name="l00446"></a>00446
|
||
|
|
<a name="l00455"></a>00455 uint32_t
|
||
|
|
<a name="l00456"></a>00456 <a class="code" href="classserial_1_1_serial.html#a9b57d6da619d53f58cddc3621c78c32b">getBaudrate</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00457"></a>00457
|
||
|
|
<a name="l00466"></a>00466 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00467"></a>00467 <a class="code" href="classserial_1_1_serial.html#adba430fd704f6898a5a1d99fd39a94fa">setBytesize</a> (<a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize);
|
||
|
|
<a name="l00468"></a>00468
|
||
|
|
<a name="l00475"></a>00475 <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>
|
||
|
|
<a name="l00476"></a>00476 <a class="code" href="classserial_1_1_serial.html#a4fce90ef7a9a46525efa373a94a1bfbd">getBytesize</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00477"></a>00477
|
||
|
|
<a name="l00485"></a>00485 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00486"></a>00486 <a class="code" href="classserial_1_1_serial.html#a1e1896aa59ec35ac5bd263b87614ef01">setParity</a> (<a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity);
|
||
|
|
<a name="l00487"></a>00487
|
||
|
|
<a name="l00494"></a>00494 <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>
|
||
|
|
<a name="l00495"></a>00495 <a class="code" href="classserial_1_1_serial.html#a89d876e1d3f0afadb0d6c21b08ed8931">getParity</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00496"></a>00496
|
||
|
|
<a name="l00504"></a>00504 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00505"></a>00505 <a class="code" href="classserial_1_1_serial.html#ab72284b5aab723b81013fb560bd6acc5">setStopbits</a> (<a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> stopbits);
|
||
|
|
<a name="l00506"></a>00506
|
||
|
|
<a name="l00513"></a>00513 <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>
|
||
|
|
<a name="l00514"></a>00514 <a class="code" href="classserial_1_1_serial.html#a42887bb76243bf6bbb3f69ff60f9792e">getStopbits</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00515"></a>00515
|
||
|
|
<a name="l00524"></a>00524 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00525"></a>00525 <a class="code" href="classserial_1_1_serial.html#ade41650d6bfe91b6432e5a0a60c03969">setFlowcontrol</a> (<a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> flowcontrol);
|
||
|
|
<a name="l00526"></a>00526
|
||
|
|
<a name="l00533"></a>00533 <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>
|
||
|
|
<a name="l00534"></a>00534 <a class="code" href="classserial_1_1_serial.html#acdc6da48a5434b936b1db20f36caf41f">getFlowcontrol</a> () <span class="keyword">const</span>;
|
||
|
|
<a name="l00535"></a>00535
|
||
|
|
<a name="l00537"></a>00537 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00538"></a>00538 <a class="code" href="classserial_1_1_serial.html#a63b7abf172cad25bfc998b3b1f98310f">flush</a> ();
|
||
|
|
<a name="l00539"></a>00539
|
||
|
|
<a name="l00541"></a>00541 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00542"></a>00542 <a class="code" href="classserial_1_1_serial.html#afa2c1f9114a37b7d140fc2292d1499b9">flushInput</a> ();
|
||
|
|
<a name="l00543"></a>00543
|
||
|
|
<a name="l00545"></a>00545 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00546"></a>00546 <a class="code" href="classserial_1_1_serial.html#a256ee4bb93ab0e79d7a66b50f08dce53">flushOutput</a> ();
|
||
|
|
<a name="l00547"></a>00547
|
||
|
|
<a name="l00549"></a>00549 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00550"></a>00550 <a class="code" href="classserial_1_1_serial.html#ade90ff8f03525ea6d7b702fcd0f336de">sendBreak</a> (<span class="keywordtype">int</span> duration);
|
||
|
|
<a name="l00551"></a>00551
|
||
|
|
<a name="l00553"></a>00553 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00554"></a>00554 <a class="code" href="classserial_1_1_serial.html#a2a27912b1ca5cdad4a4aba7b9ddbc206">setBreak</a> (<span class="keywordtype">bool</span> level = <span class="keyword">true</span>);
|
||
|
|
<a name="l00555"></a>00555
|
||
|
|
<a name="l00557"></a>00557 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00558"></a>00558 <a class="code" href="classserial_1_1_serial.html#ab43ddc05e5d69ff2778f698aa7062370">setRTS</a> (<span class="keywordtype">bool</span> level = <span class="keyword">true</span>);
|
||
|
|
<a name="l00559"></a>00559
|
||
|
|
<a name="l00561"></a>00561 <span class="keywordtype">void</span>
|
||
|
|
<a name="l00562"></a>00562 <a class="code" href="classserial_1_1_serial.html#ac9b0bbf613a5fe68f05d1d40181a1bb3">setDTR</a> (<span class="keywordtype">bool</span> level = <span class="keyword">true</span>);
|
||
|
|
<a name="l00563"></a>00563
|
||
|
|
<a name="l00578"></a>00578 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00579"></a>00579 <a class="code" href="classserial_1_1_serial.html#a419dc984258956a5adb41fb8c86f5449">waitForChange</a> ();
|
||
|
|
<a name="l00580"></a>00580
|
||
|
|
<a name="l00582"></a>00582 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00583"></a>00583 <a class="code" href="classserial_1_1_serial.html#a809f048546c4c72b74e205139b97648c">getCTS</a> ();
|
||
|
|
<a name="l00584"></a>00584
|
||
|
|
<a name="l00586"></a>00586 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00587"></a>00587 <a class="code" href="classserial_1_1_serial.html#a6b9a0c485e1fe599dbb5e9e15b1a65d6">getDSR</a> ();
|
||
|
|
<a name="l00588"></a>00588
|
||
|
|
<a name="l00590"></a>00590 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00591"></a>00591 <a class="code" href="classserial_1_1_serial.html#afb96e6968f040c4bff7576095f4ba6e7">getRI</a> ();
|
||
|
|
<a name="l00592"></a>00592
|
||
|
|
<a name="l00594"></a>00594 <span class="keywordtype">bool</span>
|
||
|
|
<a name="l00595"></a>00595 <a class="code" href="classserial_1_1_serial.html#a9795a3e83e6745a14c64f657e68061fb">getCD</a> ();
|
||
|
|
<a name="l00596"></a>00596
|
||
|
|
<a name="l00597"></a>00597 <span class="keyword">private</span>:
|
||
|
|
<a name="l00598"></a>00598 <span class="comment">// Disable copy constructors</span>
|
||
|
|
<a name="l00599"></a>00599 <a class="code" href="classserial_1_1_serial.html#aecbc4cc1723143805ae5a4aa79ba9332">Serial</a>(<span class="keyword">const</span> <a class="code" href="classserial_1_1_serial.html">Serial</a>&);
|
||
|
|
<a name="l00600"></a>00600 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classserial_1_1_serial.html">Serial</a>&);
|
||
|
|
<a name="l00601"></a>00601 <span class="keyword">const</span> <a class="code" href="classserial_1_1_serial.html">Serial</a>& operator=(<a class="code" href="classserial_1_1_serial.html">Serial</a>);
|
||
|
|
<a name="l00602"></a>00602
|
||
|
|
<a name="l00603"></a>00603 std::string read_cache_;
|
||
|
|
<a name="l00604"></a>00604
|
||
|
|
<a name="l00605"></a>00605 <span class="comment">// Pimpl idiom, d_pointer</span>
|
||
|
|
<a name="l00606"></a>00606 <span class="keyword">class </span>SerialImpl;
|
||
|
|
<a name="l00607"></a>00607 SerialImpl *pimpl_;
|
||
|
|
<a name="l00608"></a>00608
|
||
|
|
<a name="l00609"></a>00609 <span class="comment">// Scoped Lock Classes</span>
|
||
|
|
<a name="l00610"></a>00610 <span class="keyword">class </span>ScopedReadLock;
|
||
|
|
<a name="l00611"></a>00611 <span class="keyword">class </span>ScopedWriteLock;
|
||
|
|
<a name="l00612"></a>00612
|
||
|
|
<a name="l00613"></a>00613 <span class="comment">// Read common function</span>
|
||
|
|
<a name="l00614"></a>00614 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00615"></a>00615 read_ (uint8_t *buffer, <span class="keywordtype">size_t</span> size);
|
||
|
|
<a name="l00616"></a>00616 <span class="comment">// Write common function</span>
|
||
|
|
<a name="l00617"></a>00617 <span class="keywordtype">size_t</span>
|
||
|
|
<a name="l00618"></a>00618 write_ (<span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> length);
|
||
|
|
<a name="l00619"></a>00619
|
||
|
|
<a name="l00620"></a>00620 };
|
||
|
|
<a name="l00621"></a>00621
|
||
|
|
<a name="l00622"></a><a class="code" href="classserial_1_1_serial_execption.html">00622</a> <span class="keyword">class </span><a class="code" href="classserial_1_1_serial_execption.html">SerialExecption</a> : <span class="keyword">public</span> std::exception
|
||
|
|
<a name="l00623"></a>00623 {
|
||
|
|
<a name="l00624"></a>00624 <span class="comment">// Disable copy constructors</span>
|
||
|
|
<a name="l00625"></a>00625 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classserial_1_1_serial_execption.html">SerialExecption</a>&);
|
||
|
|
<a name="l00626"></a>00626 <span class="keyword">const</span> <a class="code" href="classserial_1_1_serial_execption.html">SerialExecption</a>& operator=(<a class="code" href="classserial_1_1_serial_execption.html">SerialExecption</a>);
|
||
|
|
<a name="l00627"></a>00627 <span class="keyword">const</span> <span class="keywordtype">char</span>* e_what_;
|
||
|
|
<a name="l00628"></a>00628 <span class="keyword">public</span>:
|
||
|
|
<a name="l00629"></a><a class="code" href="classserial_1_1_serial_execption.html#aa4b29d2631c6a9a0ebe591834bbc4609">00629</a> <a class="code" href="classserial_1_1_serial_execption.html#aa4b29d2631c6a9a0ebe591834bbc4609">SerialExecption</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *description) : e_what_ (description) {}
|
||
|
|
<a name="l00630"></a><a class="code" href="classserial_1_1_serial_execption.html#a824b52fe58b37de592d7bd13e7949860">00630</a> <a class="code" href="classserial_1_1_serial_execption.html#a824b52fe58b37de592d7bd13e7949860">SerialExecption</a> (<span class="keyword">const</span> <a class="code" href="classserial_1_1_serial_execption.html">SerialExecption</a>& other) {
|
||
|
|
<a name="l00631"></a>00631 e_what_ = other.e_what_;
|
||
|
|
<a name="l00632"></a>00632 }
|
||
|
|
<a name="l00633"></a>00633
|
||
|
|
<a name="l00634"></a><a class="code" href="classserial_1_1_serial_execption.html#a5cb17e5438390e95731ddd230524922d">00634</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classserial_1_1_serial_execption.html#a5cb17e5438390e95731ddd230524922d">what</a> () <span class="keyword">const</span> throw ()
|
||
|
|
<a name="l00635"></a>00635 {
|
||
|
|
<a name="l00636"></a>00636 std::stringstream ss;
|
||
|
|
<a name="l00637"></a>00637 ss << <span class="stringliteral">"SerialException "</span> << e_what_ << <span class="stringliteral">" failed."</span>;
|
||
|
|
<a name="l00638"></a>00638 <span class="keywordflow">return</span> ss.str ().c_str ();
|
||
|
|
<a name="l00639"></a>00639 }
|
||
|
|
<a name="l00640"></a>00640 };
|
||
|
|
<a name="l00641"></a>00641
|
||
|
|
<a name="l00642"></a><a class="code" href="classserial_1_1_i_o_exception.html">00642</a> <span class="keyword">class </span><a class="code" href="classserial_1_1_i_o_exception.html">IOException</a> : <span class="keyword">public</span> std::exception
|
||
|
|
<a name="l00643"></a>00643 {
|
||
|
|
<a name="l00644"></a>00644 <span class="comment">// Disable copy constructors</span>
|
||
|
|
<a name="l00645"></a>00645 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classserial_1_1_i_o_exception.html">IOException</a>&);
|
||
|
|
<a name="l00646"></a>00646 <span class="keyword">const</span> <a class="code" href="classserial_1_1_i_o_exception.html">IOException</a>& operator=(<a class="code" href="classserial_1_1_i_o_exception.html">IOException</a>);
|
||
|
|
<a name="l00647"></a>00647 std::string file_;
|
||
|
|
<a name="l00648"></a>00648 <span class="keywordtype">int</span> line_;
|
||
|
|
<a name="l00649"></a>00649 <span class="keyword">const</span> <span class="keywordtype">char</span>* e_what_;
|
||
|
|
<a name="l00650"></a>00650 <span class="keywordtype">int</span> errno_;
|
||
|
|
<a name="l00651"></a>00651 <span class="keyword">public</span>:
|
||
|
|
<a name="l00652"></a><a class="code" href="classserial_1_1_i_o_exception.html#acb2f2cf7a5cc8090945f6cbfcef3ef1e">00652</a> <span class="keyword">explicit</span> <a class="code" href="classserial_1_1_i_o_exception.html#acb2f2cf7a5cc8090945f6cbfcef3ef1e">IOException</a> (std::string file, <span class="keywordtype">int</span> line, <span class="keywordtype">int</span> errnum)
|
||
|
|
<a name="l00653"></a>00653 : file_(file), line_(line), e_what_ (strerror (errnum)), errno_(errnum) {}
|
||
|
|
<a name="l00654"></a><a class="code" href="classserial_1_1_i_o_exception.html#acc1d2c650832cc8127f2cd777072b2cd">00654</a> <span class="keyword">explicit</span> <a class="code" href="classserial_1_1_i_o_exception.html#acb2f2cf7a5cc8090945f6cbfcef3ef1e">IOException</a> (std::string file, <span class="keywordtype">int</span> line, <span class="keyword">const</span> <span class="keywordtype">char</span> * description)
|
||
|
|
<a name="l00655"></a>00655 : file_(file), line_(line), e_what_ (description), errno_(0) {}
|
||
|
|
<a name="l00656"></a><a class="code" href="classserial_1_1_i_o_exception.html#a026ae2e6abc57c6069915f0f8c701390">00656</a> <span class="keyword">virtual</span> <a class="code" href="classserial_1_1_i_o_exception.html#a026ae2e6abc57c6069915f0f8c701390">~IOException</a>() throw() {}
|
||
|
|
<a name="l00657"></a><a class="code" href="classserial_1_1_i_o_exception.html#af65196a71b800d11b5e5c367caf5b354">00657</a> <a class="code" href="classserial_1_1_i_o_exception.html#af65196a71b800d11b5e5c367caf5b354">IOException</a> (<span class="keyword">const</span> <a class="code" href="classserial_1_1_i_o_exception.html">IOException</a>& other) {
|
||
|
|
<a name="l00658"></a>00658 e_what_ = other.e_what_;
|
||
|
|
<a name="l00659"></a>00659 }
|
||
|
|
<a name="l00660"></a>00660
|
||
|
|
<a name="l00661"></a><a class="code" href="classserial_1_1_i_o_exception.html#a91d5ee5241dd49fb39e8e762564b6cc5">00661</a> <span class="keywordtype">int</span> <a class="code" href="classserial_1_1_i_o_exception.html#a91d5ee5241dd49fb39e8e762564b6cc5">getErrorNumber</a> () { <span class="keywordflow">return</span> errno_; }
|
||
|
|
<a name="l00662"></a>00662
|
||
|
|
<a name="l00663"></a><a class="code" href="classserial_1_1_i_o_exception.html#a5151f78cf0309db2c79f3dc4c779c774">00663</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classserial_1_1_i_o_exception.html#a5151f78cf0309db2c79f3dc4c779c774">what</a> () <span class="keyword">const</span> throw ()
|
||
|
|
<a name="l00664"></a>00664 {
|
||
|
|
<a name="l00665"></a>00665 std::stringstream ss;
|
||
|
|
<a name="l00666"></a>00666 <span class="keywordflow">if</span> (errno_ == 0)
|
||
|
|
<a name="l00667"></a>00667 ss << <span class="stringliteral">"IO Exception: "</span> << e_what_;
|
||
|
|
<a name="l00668"></a>00668 <span class="keywordflow">else</span>
|
||
|
|
<a name="l00669"></a>00669 ss << <span class="stringliteral">"IO Exception ("</span> << errno_ << <span class="stringliteral">"): "</span> << e_what_;
|
||
|
|
<a name="l00670"></a>00670 ss << <span class="stringliteral">", file "</span> << file_ << <span class="stringliteral">", line "</span> << line_ << <span class="stringliteral">"."</span>;
|
||
|
|
<a name="l00671"></a>00671 <span class="keywordflow">return</span> ss.str ().c_str ();
|
||
|
|
<a name="l00672"></a>00672 }
|
||
|
|
<a name="l00673"></a>00673 };
|
||
|
|
<a name="l00674"></a>00674
|
||
|
|
<a name="l00675"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html">00675</a> <span class="keyword">class </span><a class="code" href="classserial_1_1_port_not_opened_exception.html">PortNotOpenedException</a> : <span class="keyword">public</span> std::exception
|
||
|
|
<a name="l00676"></a>00676 {
|
||
|
|
<a name="l00677"></a>00677 <span class="comment">// Disable copy constructors</span>
|
||
|
|
<a name="l00678"></a>00678 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classserial_1_1_port_not_opened_exception.html">PortNotOpenedException</a>&);
|
||
|
|
<a name="l00679"></a>00679 <span class="keyword">const</span> <a class="code" href="classserial_1_1_port_not_opened_exception.html">PortNotOpenedException</a>& operator=(<a class="code" href="classserial_1_1_port_not_opened_exception.html">PortNotOpenedException</a>);
|
||
|
|
<a name="l00680"></a>00680 <span class="keyword">const</span> <span class="keywordtype">char</span> * e_what_;
|
||
|
|
<a name="l00681"></a>00681 <span class="keyword">public</span>:
|
||
|
|
<a name="l00682"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#acd2213fae864534eae6a580f74c5ab1b">00682</a> <a class="code" href="classserial_1_1_port_not_opened_exception.html#acd2213fae864534eae6a580f74c5ab1b">PortNotOpenedException</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> * description) : e_what_ (description) {}
|
||
|
|
<a name="l00683"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#ae8b466d10d496a53ed8e9f949e9e628c">00683</a> <a class="code" href="classserial_1_1_port_not_opened_exception.html#ae8b466d10d496a53ed8e9f949e9e628c">PortNotOpenedException</a> (<span class="keyword">const</span> <a class="code" href="classserial_1_1_port_not_opened_exception.html">PortNotOpenedException</a>& other) {
|
||
|
|
<a name="l00684"></a>00684 e_what_ = other.e_what_;
|
||
|
|
<a name="l00685"></a>00685 }
|
||
|
|
<a name="l00686"></a>00686
|
||
|
|
<a name="l00687"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#a314c997ecfe3990c4af147b247e8d9ce">00687</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classserial_1_1_port_not_opened_exception.html#a314c997ecfe3990c4af147b247e8d9ce">what</a> () <span class="keyword">const</span> throw ()
|
||
|
|
<a name="l00688"></a>00688 {
|
||
|
|
<a name="l00689"></a>00689 std::stringstream ss;
|
||
|
|
<a name="l00690"></a>00690 ss << e_what_ << <span class="stringliteral">" called before port was opened."</span>;
|
||
|
|
<a name="l00691"></a>00691 <span class="keywordflow">return</span> ss.str ().c_str ();
|
||
|
|
<a name="l00692"></a>00692 }
|
||
|
|
<a name="l00693"></a>00693 };
|
||
|
|
<a name="l00694"></a>00694
|
||
|
|
<a name="l00695"></a>00695 } <span class="comment">// namespace serial</span>
|
||
|
|
<a name="l00696"></a>00696
|
||
|
|
<a name="l00697"></a>00697 <span class="preprocessor">#endif</span>
|
||
|
|
</pre></div></div><!-- contents -->
|
||
|
|
|
||
|
|
|
||
|
|
<hr class="footer"/><address class="footer"><small>
|
||
|
|
Generated on Mon Aug 27 2012 11:36:46 for serial by  <a href="http://www.doxygen.org/index.html">
|
||
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
||
|
|
</a> 1.8.0
|
||
|
|
</small></address>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
</html>
|