2012-05-02 00:40:56 -05:00
|
|
|
<!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</span>
|
|
|
|
|
</div>
|
2012-06-09 19:35:49 -05:00
|
|
|
<div id="projectbrief">Cross-platform serial port library written in C++</div>
|
2012-05-02 00:40:56 -05:00
|
|
|
</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>
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00041"></a>00041 <span class="preprocessor">#include <string></span>
|
2012-06-09 19:35:49 -05:00
|
|
|
<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>00087 } <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>;
|
|
|
|
|
<a name="l00088"></a>00088
|
|
|
|
|
<a name="l00095"></a><a class="code" href="structserial_1_1_timeout.html">00095</a> <span class="keyword">struct </span><a class="code" href="structserial_1_1_timeout.html">Timeout</a> {
|
|
|
|
|
<a name="l00096"></a><a class="code" href="structserial_1_1_timeout.html#adc68e33d2f94bfa33ba1062c363b9151">00096</a> <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="l00106"></a><a class="code" href="structserial_1_1_timeout.html#aa4fbd72e16f47c9aea9fb3c32ca17828">00106</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="l00107"></a>00107 <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="l00108"></a>00108 }
|
|
|
|
|
<a name="l00109"></a>00109
|
|
|
|
|
<a name="l00111"></a><a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">00111</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">inter_byte_timeout</a>;
|
|
|
|
|
<a name="l00113"></a><a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">00113</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">read_timeout_constant</a>;
|
|
|
|
|
<a name="l00117"></a><a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">00117</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">read_timeout_multiplier</a>;
|
|
|
|
|
<a name="l00119"></a><a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">00119</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">write_timeout_constant</a>;
|
|
|
|
|
<a name="l00123"></a><a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">00123</a> uint32_t <a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">write_timeout_multiplier</a>;
|
|
|
|
|
<a name="l00124"></a>00124
|
|
|
|
|
<a name="l00125"></a><a class="code" href="structserial_1_1_timeout.html#a1a454b17f5d653b8e1b04b3ec2fead59">00125</a> <a class="code" href="structserial_1_1_timeout.html#a1a454b17f5d653b8e1b04b3ec2fead59">Timeout</a> (uint32_t inter_byte_timeout_=0, uint32_t read_timeout_constant_=0,
|
|
|
|
|
<a name="l00126"></a>00126 uint32_t read_timeout_multiplier_=0, uint32_t write_timeout_constant_=0,
|
|
|
|
|
<a name="l00127"></a>00127 uint32_t write_timeout_multiplier_=0)
|
|
|
|
|
<a name="l00128"></a>00128 : <a class="code" href="structserial_1_1_timeout.html#ada15f2a0ae478cbb62ef79d1633b2b81">inter_byte_timeout</a>(inter_byte_timeout_),
|
|
|
|
|
<a name="l00129"></a>00129 <a class="code" href="structserial_1_1_timeout.html#a099244649dec66b6e0548480edeb2b9f">read_timeout_constant</a>(read_timeout_constant_),
|
|
|
|
|
<a name="l00130"></a>00130 <a class="code" href="structserial_1_1_timeout.html#a64412753eb2edf1621716dd9f1a4e71e">read_timeout_multiplier</a>(read_timeout_multiplier_),
|
|
|
|
|
<a name="l00131"></a>00131 <a class="code" href="structserial_1_1_timeout.html#accf01b97f83564f4ce3d6e5f63e21006">write_timeout_constant</a>(write_timeout_constant_),
|
|
|
|
|
<a name="l00132"></a>00132 <a class="code" href="structserial_1_1_timeout.html#a31ddae32907cff9c3d27fa763981317d">write_timeout_multiplier</a>(write_timeout_multiplier_)
|
|
|
|
|
<a name="l00133"></a>00133 {}
|
|
|
|
|
<a name="l00134"></a>00134 };
|
|
|
|
|
<a name="l00135"></a>00135
|
|
|
|
|
<a name="l00139"></a><a class="code" href="classserial_1_1_serial.html">00139</a> <span class="keyword">class </span><a class="code" href="classserial_1_1_serial.html">Serial</a> {
|
|
|
|
|
<a name="l00140"></a>00140 <span class="keyword">public</span>:
|
|
|
|
|
<a name="l00170"></a>00170 <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="l00171"></a>00171 uint32_t baudrate = 9600,
|
|
|
|
|
<a name="l00172"></a>00172 <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="l00173"></a>00173 <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize = <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8a47f14d952cf9bed6c3f7ae5985161990">eightbits</a>,
|
|
|
|
|
<a name="l00174"></a>00174 <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity = <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481a31cbb2b3cf0870d1a089d66295918416">parity_none</a>,
|
|
|
|
|
<a name="l00175"></a>00175 <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> stopbits = <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469ab70806555a14cb43e5cc43f6f3d01157">stopbits_one</a>,
|
|
|
|
|
<a name="l00176"></a>00176 <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> flowcontrol = <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351a083bc02a6e8e7c6540a28654c0f95bb0">flowcontrol_none</a>);
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00177"></a>00177
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00179"></a>00179 <span class="keyword">virtual</span> <a class="code" href="classserial_1_1_serial.html#a5b32c394c0ff923a4ef1c13cfb20a6ba">~Serial</a> ();
|
|
|
|
|
<a name="l00180"></a>00180
|
|
|
|
|
<a name="l00194"></a>00194 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00195"></a>00195 <a class="code" href="classserial_1_1_serial.html#af3644ed1a9d899b70e9d63bb9b808d62">open</a> ();
|
|
|
|
|
<a name="l00196"></a>00196
|
|
|
|
|
<a name="l00201"></a>00201 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00202"></a>00202 <a class="code" href="classserial_1_1_serial.html#af9895af496189f7f0aba7c097f5fa9c1">isOpen</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00203"></a>00203
|
|
|
|
|
<a name="l00205"></a>00205 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00206"></a>00206 <a class="code" href="classserial_1_1_serial.html#afbe59407e718bc3d22ea4a67b304db6c">close</a> ();
|
|
|
|
|
<a name="l00207"></a>00207
|
|
|
|
|
<a name="l00209"></a>00209 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00210"></a>00210 <a class="code" href="classserial_1_1_serial.html#afafe25b2f3bb0809550abdc72c51a234">available</a> ();
|
|
|
|
|
<a name="l00211"></a>00211
|
|
|
|
|
<a name="l00237"></a>00237 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00238"></a>00238 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (uint8_t *buffer, <span class="keywordtype">size_t</span> size);
|
|
|
|
|
<a name="l00239"></a>00239
|
|
|
|
|
<a name="l00248"></a>00248 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00249"></a>00249 <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="l00250"></a>00250
|
|
|
|
|
<a name="l00259"></a>00259 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00260"></a>00260 <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="l00261"></a>00261
|
|
|
|
|
<a name="l00269"></a>00269 std::string
|
|
|
|
|
<a name="l00270"></a>00270 <a class="code" href="classserial_1_1_serial.html#a0261dbfb9361784ecb3eee98b85fa103">read</a> (<span class="keywordtype">size_t</span> size = 1);
|
|
|
|
|
<a name="l00271"></a>00271
|
|
|
|
|
<a name="l00282"></a>00282 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00283"></a>00283 <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="l00284"></a>00284
|
|
|
|
|
<a name="l00294"></a>00294 std::string
|
|
|
|
|
<a name="l00295"></a>00295 <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="l00296"></a>00296
|
|
|
|
|
<a name="l00308"></a>00308 std::vector<std::string>
|
|
|
|
|
<a name="l00309"></a>00309 <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="l00310"></a>00310
|
|
|
|
|
<a name="l00322"></a>00322 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00323"></a>00323 <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="l00324"></a>00324
|
|
|
|
|
<a name="l00333"></a>00333 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00334"></a>00334 <a class="code" href="classserial_1_1_serial.html#aa020880cdff3a370ddc574f594379c3c">write</a> (<span class="keyword">const</span> std::vector<uint8_t> &data);
|
|
|
|
|
<a name="l00335"></a>00335
|
|
|
|
|
<a name="l00344"></a>00344 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00345"></a>00345 <a class="code" href="classserial_1_1_serial.html#aa020880cdff3a370ddc574f594379c3c">write</a> (<span class="keyword">const</span> std::string &data);
|
|
|
|
|
<a name="l00346"></a>00346
|
|
|
|
|
<a name="l00355"></a>00355 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00356"></a>00356 <a class="code" href="classserial_1_1_serial.html#acecb0a5102ae0c944fe4b78e4adf839a">setPort</a> (<span class="keyword">const</span> std::string &port);
|
|
|
|
|
<a name="l00357"></a>00357
|
|
|
|
|
<a name="l00364"></a>00364 std::string
|
|
|
|
|
<a name="l00365"></a>00365 <a class="code" href="classserial_1_1_serial.html#ae95cd057e90258b1b3203ff8972a3567">getPort</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00366"></a>00366
|
|
|
|
|
<a name="l00401"></a>00401 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00402"></a>00402 <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="l00403"></a>00403
|
|
|
|
|
<a name="l00405"></a>00405 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00406"></a><a class="code" href="classserial_1_1_serial.html#a4b4be39af3e1c68bc6ac09cb55788c86">00406</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="l00407"></a>00407 uint32_t read_timeout_multiplier, uint32_t write_timeout_constant,
|
|
|
|
|
<a name="l00408"></a>00408 uint32_t write_timeout_multiplier)
|
|
|
|
|
<a name="l00409"></a>00409 {
|
|
|
|
|
<a name="l00410"></a>00410 <a class="code" href="structserial_1_1_timeout.html">Timeout</a> timeout(inter_byte_timeout, read_timeout_constant,
|
|
|
|
|
<a name="l00411"></a>00411 read_timeout_multiplier, write_timeout_constant,
|
|
|
|
|
<a name="l00412"></a>00412 write_timeout_multiplier);
|
|
|
|
|
<a name="l00413"></a>00413 <span class="keywordflow">return</span> <a class="code" href="classserial_1_1_serial.html#a4fc63af4b800a9f9e757414f38f3e8b3">setTimeout</a>(timeout);
|
|
|
|
|
<a name="l00414"></a>00414 }
|
|
|
|
|
<a name="l00415"></a>00415
|
|
|
|
|
<a name="l00423"></a>00423 <a class="code" href="structserial_1_1_timeout.html">Timeout</a>
|
|
|
|
|
<a name="l00424"></a>00424 <a class="code" href="classserial_1_1_serial.html#a765fccd0e53562773626fb39bb2efcb6">getTimeout</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00425"></a>00425
|
|
|
|
|
<a name="l00438"></a>00438 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00439"></a>00439 <a class="code" href="classserial_1_1_serial.html#ad4f7e9edff11b464199e94a43dfd19bf">setBaudrate</a> (uint32_t baudrate);
|
|
|
|
|
<a name="l00440"></a>00440
|
|
|
|
|
<a name="l00449"></a>00449 uint32_t
|
|
|
|
|
<a name="l00450"></a>00450 <a class="code" href="classserial_1_1_serial.html#a9b57d6da619d53f58cddc3621c78c32b">getBaudrate</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00451"></a>00451
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00460"></a>00460 <span class="keywordtype">void</span>
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00461"></a>00461 <a class="code" href="classserial_1_1_serial.html#adba430fd704f6898a5a1d99fd39a94fa">setBytesize</a> (<a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize);
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00462"></a>00462
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00469"></a>00469 <a class="code" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>
|
|
|
|
|
<a name="l00470"></a>00470 <a class="code" href="classserial_1_1_serial.html#a4fce90ef7a9a46525efa373a94a1bfbd">getBytesize</a> () <span class="keyword">const</span>;
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00471"></a>00471
|
|
|
|
|
<a name="l00479"></a>00479 <span class="keywordtype">void</span>
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00480"></a>00480 <a class="code" href="classserial_1_1_serial.html#a1e1896aa59ec35ac5bd263b87614ef01">setParity</a> (<a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity);
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00481"></a>00481
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00488"></a>00488 <a class="code" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>
|
|
|
|
|
<a name="l00489"></a>00489 <a class="code" href="classserial_1_1_serial.html#a89d876e1d3f0afadb0d6c21b08ed8931">getParity</a> () <span class="keyword">const</span>;
|
2012-05-02 21:50:05 -05:00
|
|
|
<a name="l00490"></a>00490
|
2012-06-09 19:35:49 -05:00
|
|
|
<a name="l00498"></a>00498 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00499"></a>00499 <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="l00500"></a>00500
|
|
|
|
|
<a name="l00507"></a>00507 <a class="code" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>
|
|
|
|
|
<a name="l00508"></a>00508 <a class="code" href="classserial_1_1_serial.html#a42887bb76243bf6bbb3f69ff60f9792e">getStopbits</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00509"></a>00509
|
|
|
|
|
<a name="l00518"></a>00518 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00519"></a>00519 <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="l00520"></a>00520
|
|
|
|
|
<a name="l00527"></a>00527 <a class="code" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>
|
|
|
|
|
<a name="l00528"></a>00528 <a class="code" href="classserial_1_1_serial.html#acdc6da48a5434b936b1db20f36caf41f">getFlowcontrol</a> () <span class="keyword">const</span>;
|
|
|
|
|
<a name="l00529"></a>00529
|
|
|
|
|
<a name="l00531"></a>00531 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00532"></a>00532 <a class="code" href="classserial_1_1_serial.html#a63b7abf172cad25bfc998b3b1f98310f">flush</a> ();
|
|
|
|
|
<a name="l00533"></a>00533
|
|
|
|
|
<a name="l00535"></a>00535 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00536"></a>00536 <a class="code" href="classserial_1_1_serial.html#afa2c1f9114a37b7d140fc2292d1499b9">flushInput</a> ();
|
|
|
|
|
<a name="l00537"></a>00537
|
|
|
|
|
<a name="l00539"></a>00539 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00540"></a>00540 <a class="code" href="classserial_1_1_serial.html#a256ee4bb93ab0e79d7a66b50f08dce53">flushOutput</a> ();
|
|
|
|
|
<a name="l00541"></a>00541
|
|
|
|
|
<a name="l00543"></a>00543 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00544"></a>00544 <a class="code" href="classserial_1_1_serial.html#ade90ff8f03525ea6d7b702fcd0f336de">sendBreak</a> (<span class="keywordtype">int</span> duration);
|
|
|
|
|
<a name="l00545"></a>00545
|
|
|
|
|
<a name="l00547"></a>00547 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00548"></a>00548 <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="l00549"></a>00549
|
|
|
|
|
<a name="l00551"></a>00551 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00552"></a>00552 <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="l00553"></a>00553
|
|
|
|
|
<a name="l00555"></a>00555 <span class="keywordtype">void</span>
|
|
|
|
|
<a name="l00556"></a>00556 <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="l00557"></a>00557
|
|
|
|
|
<a name="l00572"></a>00572 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00573"></a>00573 <a class="code" href="classserial_1_1_serial.html#a419dc984258956a5adb41fb8c86f5449">waitForChange</a> ();
|
|
|
|
|
<a name="l00574"></a>00574
|
|
|
|
|
<a name="l00576"></a>00576 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00577"></a>00577 <a class="code" href="classserial_1_1_serial.html#a809f048546c4c72b74e205139b97648c">getCTS</a> ();
|
|
|
|
|
<a name="l00578"></a>00578
|
|
|
|
|
<a name="l00580"></a>00580 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00581"></a>00581 <a class="code" href="classserial_1_1_serial.html#a6b9a0c485e1fe599dbb5e9e15b1a65d6">getDSR</a> ();
|
|
|
|
|
<a name="l00582"></a>00582
|
|
|
|
|
<a name="l00584"></a>00584 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00585"></a>00585 <a class="code" href="classserial_1_1_serial.html#afb96e6968f040c4bff7576095f4ba6e7">getRI</a> ();
|
|
|
|
|
<a name="l00586"></a>00586
|
|
|
|
|
<a name="l00588"></a>00588 <span class="keywordtype">bool</span>
|
|
|
|
|
<a name="l00589"></a>00589 <a class="code" href="classserial_1_1_serial.html#a9795a3e83e6745a14c64f657e68061fb">getCD</a> ();
|
|
|
|
|
<a name="l00590"></a>00590
|
|
|
|
|
<a name="l00591"></a>00591 <span class="keyword">private</span>:
|
|
|
|
|
<a name="l00592"></a>00592 <span class="comment">// Disable copy constructors</span>
|
|
|
|
|
<a name="l00593"></a>00593 <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="l00594"></a>00594 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classserial_1_1_serial.html">Serial</a>&);
|
|
|
|
|
<a name="l00595"></a>00595 <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="l00596"></a>00596
|
|
|
|
|
<a name="l00597"></a>00597 std::string read_cache_;
|
|
|
|
|
<a name="l00598"></a>00598
|
|
|
|
|
<a name="l00599"></a>00599 <span class="comment">// Pimpl idiom, d_pointer</span>
|
|
|
|
|
<a name="l00600"></a>00600 <span class="keyword">class </span>SerialImpl;
|
|
|
|
|
<a name="l00601"></a>00601 SerialImpl *pimpl_;
|
|
|
|
|
<a name="l00602"></a>00602
|
|
|
|
|
<a name="l00603"></a>00603 <span class="comment">// Scoped Lock Classes</span>
|
|
|
|
|
<a name="l00604"></a>00604 <span class="keyword">class </span>ScopedReadLock;
|
|
|
|
|
<a name="l00605"></a>00605 <span class="keyword">class </span>ScopedWriteLock;
|
|
|
|
|
<a name="l00606"></a>00606
|
|
|
|
|
<a name="l00607"></a>00607 <span class="comment">// Read common function</span>
|
|
|
|
|
<a name="l00608"></a>00608 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00609"></a>00609 read_ (uint8_t *buffer, <span class="keywordtype">size_t</span> size);
|
|
|
|
|
<a name="l00610"></a>00610 <span class="comment">// Write common function</span>
|
|
|
|
|
<a name="l00611"></a>00611 <span class="keywordtype">size_t</span>
|
|
|
|
|
<a name="l00612"></a>00612 write_ (<span class="keyword">const</span> uint8_t *data, <span class="keywordtype">size_t</span> length);
|
|
|
|
|
<a name="l00613"></a>00613
|
|
|
|
|
<a name="l00614"></a>00614 };
|
|
|
|
|
<a name="l00615"></a>00615
|
|
|
|
|
<a name="l00616"></a><a class="code" href="classserial_1_1_serial_execption.html">00616</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="l00617"></a>00617 {
|
|
|
|
|
<a name="l00618"></a>00618 <span class="comment">// Disable copy constructors</span>
|
|
|
|
|
<a name="l00619"></a>00619 <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="l00620"></a>00620 <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="l00621"></a>00621 <span class="keyword">const</span> <span class="keywordtype">char</span>* e_what_;
|
|
|
|
|
<a name="l00622"></a>00622 <span class="keyword">public</span>:
|
|
|
|
|
<a name="l00623"></a><a class="code" href="classserial_1_1_serial_execption.html#aa4b29d2631c6a9a0ebe591834bbc4609">00623</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="l00624"></a><a class="code" href="classserial_1_1_serial_execption.html#a824b52fe58b37de592d7bd13e7949860">00624</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="l00625"></a>00625 e_what_ = other.e_what_;
|
|
|
|
|
<a name="l00626"></a>00626 }
|
|
|
|
|
<a name="l00627"></a>00627
|
|
|
|
|
<a name="l00628"></a><a class="code" href="classserial_1_1_serial_execption.html#a5cb17e5438390e95731ddd230524922d">00628</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="l00629"></a>00629 {
|
|
|
|
|
<a name="l00630"></a>00630 std::stringstream ss;
|
|
|
|
|
<a name="l00631"></a>00631 ss << <span class="stringliteral">"SerialException "</span> << e_what_ << <span class="stringliteral">" failed."</span>;
|
|
|
|
|
<a name="l00632"></a>00632 <span class="keywordflow">return</span> ss.str ().c_str ();
|
|
|
|
|
<a name="l00633"></a>00633 }
|
|
|
|
|
<a name="l00634"></a>00634 };
|
|
|
|
|
<a name="l00635"></a>00635
|
|
|
|
|
<a name="l00636"></a><a class="code" href="classserial_1_1_i_o_exception.html">00636</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="l00637"></a>00637 {
|
|
|
|
|
<a name="l00638"></a>00638 <span class="comment">// Disable copy constructors</span>
|
|
|
|
|
<a name="l00639"></a>00639 <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="l00640"></a>00640 <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="l00641"></a>00641 std::string file_;
|
|
|
|
|
<a name="l00642"></a>00642 <span class="keywordtype">int</span> line_;
|
|
|
|
|
<a name="l00643"></a>00643 <span class="keyword">const</span> <span class="keywordtype">char</span>* e_what_;
|
|
|
|
|
<a name="l00644"></a>00644 <span class="keywordtype">int</span> errno_;
|
|
|
|
|
<a name="l00645"></a>00645 <span class="keyword">public</span>:
|
|
|
|
|
<a name="l00646"></a><a class="code" href="classserial_1_1_i_o_exception.html#acb2f2cf7a5cc8090945f6cbfcef3ef1e">00646</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="l00647"></a>00647 : file_(file), line_(line), e_what_ (strerror (errnum)), errno_(errnum) {}
|
|
|
|
|
<a name="l00648"></a><a class="code" href="classserial_1_1_i_o_exception.html#acc1d2c650832cc8127f2cd777072b2cd">00648</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="l00649"></a>00649 : file_(file), line_(line), e_what_ (description), errno_(0) {}
|
|
|
|
|
<a name="l00650"></a><a class="code" href="classserial_1_1_i_o_exception.html#a026ae2e6abc57c6069915f0f8c701390">00650</a> <span class="keyword">virtual</span> <a class="code" href="classserial_1_1_i_o_exception.html#a026ae2e6abc57c6069915f0f8c701390">~IOException</a>() throw() {}
|
|
|
|
|
<a name="l00651"></a><a class="code" href="classserial_1_1_i_o_exception.html#af65196a71b800d11b5e5c367caf5b354">00651</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="l00652"></a>00652 e_what_ = other.e_what_;
|
|
|
|
|
<a name="l00653"></a>00653 }
|
|
|
|
|
<a name="l00654"></a>00654
|
|
|
|
|
<a name="l00655"></a><a class="code" href="classserial_1_1_i_o_exception.html#a91d5ee5241dd49fb39e8e762564b6cc5">00655</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="l00656"></a>00656
|
|
|
|
|
<a name="l00657"></a><a class="code" href="classserial_1_1_i_o_exception.html#a5151f78cf0309db2c79f3dc4c779c774">00657</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="l00658"></a>00658 {
|
|
|
|
|
<a name="l00659"></a>00659 std::stringstream ss;
|
|
|
|
|
<a name="l00660"></a>00660 <span class="keywordflow">if</span> (errno_ == 0)
|
|
|
|
|
<a name="l00661"></a>00661 ss << <span class="stringliteral">"IO Exception: "</span> << e_what_;
|
|
|
|
|
<a name="l00662"></a>00662 <span class="keywordflow">else</span>
|
|
|
|
|
<a name="l00663"></a>00663 ss << <span class="stringliteral">"IO Exception ("</span> << errno_ << <span class="stringliteral">"): "</span> << e_what_;
|
|
|
|
|
<a name="l00664"></a>00664 ss << <span class="stringliteral">", file "</span> << file_ << <span class="stringliteral">", line "</span> << line_ << <span class="stringliteral">"."</span>;
|
|
|
|
|
<a name="l00665"></a>00665 <span class="keywordflow">return</span> ss.str ().c_str ();
|
|
|
|
|
<a name="l00666"></a>00666 }
|
|
|
|
|
<a name="l00667"></a>00667 };
|
|
|
|
|
<a name="l00668"></a>00668
|
|
|
|
|
<a name="l00669"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html">00669</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="l00670"></a>00670 {
|
|
|
|
|
<a name="l00671"></a>00671 <span class="comment">// Disable copy constructors</span>
|
|
|
|
|
<a name="l00672"></a>00672 <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="l00673"></a>00673 <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="l00674"></a>00674 <span class="keyword">const</span> <span class="keywordtype">char</span> * e_what_;
|
|
|
|
|
<a name="l00675"></a>00675 <span class="keyword">public</span>:
|
|
|
|
|
<a name="l00676"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#acd2213fae864534eae6a580f74c5ab1b">00676</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="l00677"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#ae8b466d10d496a53ed8e9f949e9e628c">00677</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="l00678"></a>00678 e_what_ = other.e_what_;
|
|
|
|
|
<a name="l00679"></a>00679 }
|
|
|
|
|
<a name="l00680"></a>00680
|
|
|
|
|
<a name="l00681"></a><a class="code" href="classserial_1_1_port_not_opened_exception.html#a314c997ecfe3990c4af147b247e8d9ce">00681</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="l00682"></a>00682 {
|
|
|
|
|
<a name="l00683"></a>00683 std::stringstream ss;
|
|
|
|
|
<a name="l00684"></a>00684 ss << e_what_ << <span class="stringliteral">" called before port was opened."</span>;
|
|
|
|
|
<a name="l00685"></a>00685 <span class="keywordflow">return</span> ss.str ().c_str ();
|
|
|
|
|
<a name="l00686"></a>00686 }
|
|
|
|
|
<a name="l00687"></a>00687 };
|
|
|
|
|
<a name="l00688"></a>00688
|
|
|
|
|
<a name="l00689"></a>00689 } <span class="comment">// namespace serial</span>
|
|
|
|
|
<a name="l00690"></a>00690
|
|
|
|
|
<a name="l00691"></a>00691 <span class="preprocessor">#endif</span>
|
2012-05-02 00:40:56 -05:00
|
|
|
</pre></div></div><!-- contents -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<hr class="footer"/><address class="footer"><small>
|
2012-06-09 19:35:49 -05:00
|
|
|
Generated on Sat Jun 9 2012 19:35:04 for serial by  <a href="http://www.doxygen.org/index.html">
|
2012-05-02 00:40:56 -05:00
|
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
|
|
|
</a> 1.8.0
|
|
|
|
|
</small></address>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|