node-serialport-bindings-cpp/docs/BaseBinding.html
Francis Gulotta 1523233326 chore: merge serialport-utils into main repo
- integrate the generators
- integrate the docs
- move files into the right location
- update readmes
- lint fix
2018-07-24 03:06:08 -04:00

2376 lines
No EOL
34 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>BaseBinding - SerialPort Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<a href="https://github.com/node-serialport/node-serialport" class="github-corner" aria-label="View source on Github">
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#e31c60; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>
</a>
<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<!-- http://tholman.com/github-corners/ -->
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BaseBinding.html">BaseBinding</a><ul class='methods'><li data-type='method'><a href="BaseBinding.html#.list">list</a></li><li data-type='method'><a href="BaseBinding.html#close">close</a></li><li data-type='method'><a href="BaseBinding.html#drain">drain</a></li><li data-type='method'><a href="BaseBinding.html#flush">flush</a></li><li data-type='method'><a href="BaseBinding.html#get">get</a></li><li data-type='method'><a href="BaseBinding.html#getBaudRate">getBaudRate</a></li><li data-type='method'><a href="BaseBinding.html#open">open</a></li><li data-type='method'><a href="BaseBinding.html#read">read</a></li><li data-type='method'><a href="BaseBinding.html#set">set</a></li><li data-type='method'><a href="BaseBinding.html#update">update</a></li><li data-type='method'><a href="BaseBinding.html#write">write</a></li></ul></li><li><a href="ByteLengthParser.html">ByteLengthParser</a></li><li><a href="CCTalkParser.html">CCTalkParser</a></li><li><a href="DarwinBinding.html">DarwinBinding</a></li><li><a href="DelimiterParser.html">DelimiterParser</a></li><li><a href="LinuxBinding.html">LinuxBinding</a></li><li><a href="MockBinding.html">MockBinding</a></li><li><a href="Poller.html">Poller</a><ul class='methods'><li data-type='method'><a href="Poller.html#once">once</a></li><li data-type='method'><a href="Poller.html#poll">poll</a></li><li data-type='method'><a href="Poller.html#stop">stop</a></li></ul></li><li><a href="ReadLineParser.html">ReadLineParser</a></li><li><a href="ReadyParser.html">ReadyParser</a></li><li><a href="RegexParser.html">RegexParser</a></li><li><a href="SerialPort.html">SerialPort</a><ul class='methods'><li data-type='method'><a href="SerialPort.html#.list">list</a></li><li data-type='method'><a href="SerialPort.html#close">close</a></li><li data-type='method'><a href="SerialPort.html#drain">drain</a></li><li data-type='method'><a href="SerialPort.html#flush">flush</a></li><li data-type='method'><a href="SerialPort.html#get">get</a></li><li data-type='method'><a href="SerialPort.html#open">open</a></li><li data-type='method'><a href="SerialPort.html#pause">pause</a></li><li data-type='method'><a href="SerialPort.html#read">read</a></li><li data-type='method'><a href="SerialPort.html#resume">resume</a></li><li data-type='method'><a href="SerialPort.html#set">set</a></li><li data-type='method'><a href="SerialPort.html#update">update</a></li><li data-type='method'><a href="SerialPort.html#write">write</a></li></ul></li><li><a href="SlipEncoderParser.html">SlipEncoderParser</a></li><li><a href="WindowsBinding.html">WindowsBinding</a></li></ul><h3>Events</h3><ul><li><a href="global.html#event:close">close</a></li><li><a href="global.html#event:data">data</a></li><li><a href="global.html#event:error">error</a></li><li><a href="global.html#event:open">open</a></li></ul><h3>Global</h3><ul><li><a href="global.html#Binding">Binding</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">BaseBinding</h1>
<section>
<header>
<h2>
BaseBinding
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="BaseBinding"><span class="type-signature"></span>new BaseBinding<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<p>You never have to use <code>Binding</code> objects directly. SerialPort uses them to access the underlying hardware. This documentation is geared towards people who are making bindings for different platforms. This class can be inherited from to get type checking for each method.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>options for the biding</p></td>
</tr>
</tbody>
</table>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>isOpen</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>Required property. <code>true</code> if the port is open, <code>false</code> otherwise. Should be read-only.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-since">Since:</dt>
<dd class="tag-since"><ul class="dummy"><li>5.0.0</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".list"><span class="type-signature">(static) </span>list<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Retrieves a list of available serial ports with metadata. The <code>comName</code> must be guaranteed, and all other fields should be undefined if unavailable. The <code>comName</code> is either the path or an identifier (eg <code>COM1</code>) used to open the serialport.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line29">line 29</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>resolves to an array of port <a href="#module_serialport--SerialPort.list">info objects</a>.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="close"><span class="type-signature"></span>close<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Closes an open connection</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line68">line 68</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves once the connection is closed.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="drain"><span class="type-signature"></span>drain<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Drain waits until all output data is transmitted to the serial port. An in progress write should be completed before this returns.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line222">line 222</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves once the drain operation finishes.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="flush"><span class="type-signature"></span>flush<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Flush (discard) data received but not read, and written but not transmitted.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line209">line 209</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves once the flush operation finishes.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Get the control flags (CTS, DSR, DCD) on the open port.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line182">line 182</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves with the retrieved flags.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="getBaudRate"><span class="type-signature"></span>getBaudRate<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Get the OS reported baud rate for the open port.<br>Used mostly for debugging custom baud rates.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line196">line 196</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves with the current baud rate.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="open"><span class="type-signature"></span>open<span class="signature">(path, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Opens a connection to the serial port referenced by the path.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the path or com port to open</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><a href="global.html#openOptions">openOptions</a></span>
</td>
<td class="description last"><p>openOptions for the serialport</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line47">line 47</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves after the port is opened and configured.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="read"><span class="type-signature"></span>read<span class="signature">(buffer, offset, length)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Request a number of bytes from the SerialPort. This function is similar to Node's <a href="http://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback"><code>fs.read</code></a> except it will always return at least one byte.</p>
<p>The in progress reads must error when the port is closed with an error object that has the property <code>canceled</code> equal to <code>true</code>. Any other error will cause a disconnection.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buffer</code></td>
<td class="type">
<span class="param-type">buffer</span>
</td>
<td class="description last"><p>Accepts a <a href="http://nodejs.org/api/buffer.html"><code>Buffer</code></a> object.</p></td>
</tr>
<tr>
<td class="name"><code>offset</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>The offset in the buffer to start writing at.</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>Specifies the maximum number of bytes to read.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line87">line 87</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves with the number of bytes read after a read operation.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Set control flags on an open port.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>All options are operating system default when the port is opened. Every flag is set on each call to the provided or default values. All options are always provided.</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>brk</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>flag for brk</p></td>
</tr>
<tr>
<td class="name"><code>cts</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>flag for cts</p></td>
</tr>
<tr>
<td class="name"><code>dsr</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>flag for dsr</p></td>
</tr>
<tr>
<td class="name"><code>dtr</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>flag for dtr</p></td>
</tr>
<tr>
<td class="name"><code>rts</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>flag for rts</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line166">line 166</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves once the port's flags are set.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Changes connection settings on an open port. Only <code>baudRate</code> is supported.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Only supports <code>baudRate</code>.</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>baudRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>If provided a baud rate that the bindings do not support, it should pass an error to the callback.</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line139">line 139</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves once the port's baud rate changes.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="write"><span class="type-signature"></span>write<span class="signature">(buffer)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
<p>Write bytes to the SerialPort. Only called when there is no pending write operation.</p>
<p>The in progress writes must error when the port is closed with an error object that has the property <code>canceled</code> equal to <code>true</code>. Any other error will cause a disconnection.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buffer</code></td>
<td class="type">
<span class="param-type">buffer</span>
</td>
<td class="description last"><p>Accepts a <a href="http://nodejs.org/api/buffer.html"><code>Buffer</code></a> object.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="serialport_lib_bindings_base.js.html">serialport/lib/bindings/base.js</a>, <a href="serialport_lib_bindings_base.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>When given invalid arguments, a <code>TypeError</code> is thrown.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TypeError</span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolves after the data is passed to the operating system for writing.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated at Tue Jul 24 2018 02:01:22 GMT-0400 (EDT)
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>