node-serialport-bindings-cpp/packages/serialport-util/docs/SlipEncoderParser.html
2018-07-24 03:06:08 -04:00

199 lines
No EOL
3.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SlipEncoderParser - 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/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<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="ByteLengthParser.html">ByteLengthParser</a></li><li><a href="CCTalkParser.html">CCTalkParser</a></li><li><a href="DelimiterParser.html">DelimiterParser</a></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="SlipEncoderParser.html">SlipEncoderParser</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">SlipEncoderParser</h1>
<section>
<header>
<h2>
SlipEncoderParser
</h2>
<div class="class-description"><p>A transform stream that emits SLIP-encoded data for each incoming packet.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="SlipEncoderParser"><span class="type-signature"></span>new SlipEncoderParser<span class="signature">()</span><span class="type-signature"></span></h4>
<p class="summary"><p>Runs in O(n) time, adding a 0xC0 character at the end of each<br>received packet and escaping characters, according to RFC 1055. Adds another<br>0xC0 character at the beginning if the <code>bluetoothQuirk</code> option is truthy (as<br>per the Bluetooth Core Specification 4.0, Volume 4, Part D, Chapter 3 &quot;SLIP Layer&quot;).<br>Runs in O(n) time.</p></p>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser-slip-encoder_slip-encoder.js.html">parser-slip-encoder/slip-encoder.js</a>, <a href="parser-slip-encoder_slip-encoder.js.html#line29">line 29</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>// Read lines from a text file, then SLIP-encode each and send them to a serial port
const SerialPort = require('serialport')
const SlipEncoder = require('@serialport/parser-slip-encoder')
const Readline = require('parser-readline')
const fileReader = require('fs').createReadStream('/tmp/some-file.txt');
const port = new SerialPort('/dev/tty-usbserial1')
const lineParser = fileReader.pipe(new Readline({ delimiter: '\r\n' }));
const encoder = fileReader.pipe(new SlipEncoder({ bluetoothQuirk: false }));
encoder.pipe(port);</code></pre>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li>Transform</li>
</ul>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Jun 23 2018 21:24:37 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>