node-poweredup/docs/LPF2Hub.html

4538 lines
53 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>DocStrap Class: LPF2Hub</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">DocStrap</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="BoostMoveHub.html">BoostMoveHub</a></li><li><a href="DuploTrainBase.html">DuploTrainBase</a></li><li><a href="Hub.html">Hub</a></li><li><a href="LPF2Hub.html">LPF2Hub</a></li><li><a href="PoweredUP.html">PoweredUP</a></li><li><a href="PUPHub.html">PUPHub</a></li><li><a href="PUPRemote.html">PUPRemote</a></li><li><a href="WeDo2SmartHub.html">WeDo2SmartHub</a></li>
</ul>
</li>
<li class="dropdown">
<a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="BoostMoveHub.html#event:attach">BoostMoveHub#event:attach</a></li><li><a href="BoostMoveHub.html#event:button">BoostMoveHub#event:button</a></li><li><a href="BoostMoveHub.html#event:color">BoostMoveHub#event:color</a></li><li><a href="BoostMoveHub.html#event:colorAndDistance">BoostMoveHub#event:colorAndDistance</a></li><li><a href="BoostMoveHub.html#event:detach">BoostMoveHub#event:detach</a></li><li><a href="BoostMoveHub.html#event:distance">BoostMoveHub#event:distance</a></li><li><a href="BoostMoveHub.html#event:rotate">BoostMoveHub#event:rotate</a></li><li><a href="BoostMoveHub.html#event:tilt">BoostMoveHub#event:tilt</a></li><li><a href="DuploTrainBase.html#event:color">DuploTrainBase#event:color</a></li><li><a href="DuploTrainBase.html#event:speed">DuploTrainBase#event:speed</a></li><li><a href="Hub.html#event:attach">Hub#event:attach</a></li><li><a href="Hub.html#event:detach">Hub#event:detach</a></li><li><a href="LPF2Hub.html#event:attach">LPF2Hub#event:attach</a></li><li><a href="LPF2Hub.html#event:button">LPF2Hub#event:button</a></li><li><a href="LPF2Hub.html#event:color">LPF2Hub#event:color</a></li><li><a href="LPF2Hub.html#event:colorAndDistance">LPF2Hub#event:colorAndDistance</a></li><li><a href="LPF2Hub.html#event:detach">LPF2Hub#event:detach</a></li><li><a href="LPF2Hub.html#event:distance">LPF2Hub#event:distance</a></li><li><a href="LPF2Hub.html#event:rotate">LPF2Hub#event:rotate</a></li><li><a href="LPF2Hub.html#event:speed">LPF2Hub#event:speed</a></li><li><a href="LPF2Hub.html#event:tilt">LPF2Hub#event:tilt</a></li><li><a href="PoweredUP.html#event:discover">PoweredUP#event:discover</a></li><li><a href="PUPHub.html#event:attach">PUPHub#event:attach</a></li><li><a href="PUPHub.html#event:button">PUPHub#event:button</a></li><li><a href="PUPHub.html#event:color">PUPHub#event:color</a></li><li><a href="PUPHub.html#event:colorAndDistance">PUPHub#event:colorAndDistance</a></li><li><a href="PUPHub.html#event:detach">PUPHub#event:detach</a></li><li><a href="PUPHub.html#event:distance">PUPHub#event:distance</a></li><li><a href="PUPHub.html#event:tilt">PUPHub#event:tilt</a></li><li><a href="PUPRemote.html#event:button">PUPRemote#event:button</a></li><li><a href="PUPRemote.html#event:colorAndDistance">PUPRemote#event:colorAndDistance</a></li><li><a href="WeDo2SmartHub.html#event:attach">WeDo2SmartHub#event:attach</a></li><li><a href="WeDo2SmartHub.html#event:button">WeDo2SmartHub#event:button</a></li><li><a href="WeDo2SmartHub.html#event:color">WeDo2SmartHub#event:color</a></li><li><a href="WeDo2SmartHub.html#event:detach">WeDo2SmartHub#event:detach</a></li><li><a href="WeDo2SmartHub.html#event:distance">WeDo2SmartHub#event:distance</a></li><li><a href="WeDo2SmartHub.html#event:rotate">WeDo2SmartHub#event:rotate</a></li><li><a href="WeDo2SmartHub.html#event:tilt">WeDo2SmartHub#event:tilt</a></li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html">Global</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<h1 class="page-title">Class: LPF2Hub</h1>
<section>
<header>
<h2>
LPF2Hub
</h2>
</header>
<article>
<div class="container-overview">
<hr>
<dt>
<h4 class="name" id="LPF2Hub"><span class="type-signature"></span>new LPF2Hub()</h4>
</dt>
<dd>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-14">line 14</a>
</li>
</ul>
</dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="Hub.html">Hub</a></li>
</ul>
<h3 class="subsection-title">Members</h3>
<dl>
<hr>
<dt class="name" id="batteryLevel">
<h4 id="batteryLevel"><span class="type-signature">&lt;readonly> </span>batteryLevel<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>batteryLevel</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Battery level of the hub (Percentage between 0-100)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#batteryLevel">Hub#batteryLevel</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-73">line 73</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="firmwareVersion">
<h4 id="firmwareVersion"><span class="type-signature">&lt;readonly> </span>firmwareVersion<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>firmwareVersion</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Firmware version of the hub</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#firmwareVersion">Hub#firmwareVersion</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-52">line 52</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="name">
<h4 id="name"><span class="type-signature">&lt;readonly> </span>name<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Name of the hub</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#name">Hub#name</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-45">line 45</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="rssi">
<h4 id="rssi"><span class="type-signature">&lt;readonly> </span>rssi<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>rssi</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Signal strength of the hub</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#rssi">Hub#rssi</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-66">line 66</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="uuid">
<h4 id="uuid"><span class="type-signature">&lt;readonly> </span>uuid<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>uuid</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>UUID of the hub</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#uuid">Hub#uuid</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-59">line 59</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="voltage">
<h4 id="voltage"><span class="type-signature">&lt;readonly> </span>voltage<span class="type-signature"></span></h4>
</dt>
<dd>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>voltage</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Voltage of the hub (Volts)</p></td>
</tr>
</tbody>
</table>
</dl>
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#voltage">Hub#voltage</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-80">line 80</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<hr>
<dt>
<h4 class="name" id="connect"><span class="type-signature"></span>connect()</h4>
</dt>
<dd>
<div class="description">
<p>Connect to the Hub.</p>
</div>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#connect">Hub#connect</a>
</li>
</ul>
</dd>
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="Hub.html#connect">Hub#connect</a>
</li></ul></dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-90">line 90</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful connect.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="disconnect"><span class="type-signature"></span>disconnect()</h4>
</dt>
<dd>
<div class="description">
<p>Disconnect the Hub.</p>
</div>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#disconnect">Hub#disconnect</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-139">line 139</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful disconnect.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="getHubType"><span class="type-signature"></span>getHubType()</h4>
</dt>
<dd>
<div class="description">
<p>Get the hub type.</p>
</div>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#getHubType">Hub#getHubType</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-207">line 207</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#HubType">HubType</a></span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="getPortDeviceType"><span class="type-signature"></span>getPortDeviceType(port)</h4>
</dt>
<dd>
<div class="description">
<p>Get the device type for a given port.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#getPortDeviceType">Hub#getPortDeviceType</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-215">line 215</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#DeviceType">DeviceType</a></span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="setLEDColor"><span class="type-signature"></span>setLEDColor(color)</h4>
</dt>
<dd>
<div class="description">
<p>Set the color of the LED on the Hub via a color value.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Color">Color</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-75">line 75</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful issuance of command.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="setLEDRGB"><span class="type-signature"></span>setLEDRGB(red, green, blue)</h4>
</dt>
<dd>
<div class="description">
<p>Set the color of the LED on the Hub via RGB values.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>red</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>green</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>blue</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-93">line 93</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful issuance of command.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="setName"><span class="type-signature"></span>setName(name)</h4>
</dt>
<dd>
<div class="description">
<p>Set the name of the Hub.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>New name of the hub (14 characters or less, ASCII only).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-55">line 55</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful issuance of command.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="shutdown"><span class="type-signature"></span>shutdown()</h4>
</dt>
<dd>
<div class="description">
<p>Shutdown the Hub.</p>
</div>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-43">line 43</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful disconnect.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="sleep"><span class="type-signature"></span>sleep(delay)</h4>
</dt>
<dd>
<div class="description">
<p>Sleep a given amount of time.</p>
<p>This is a helper method to make it easier to add delays into a chain of commands.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>delay</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>How long to sleep (in milliseconds).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#sleep">Hub#sleep</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-183">line 183</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved after the delay is finished.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="subscribe"><span class="type-signature"></span>subscribe(port [, mode])</h4>
</dt>
<dd>
<div class="description">
<p>Subscribe to sensor notifications on a given port.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>mode</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>The sensor mode to activate. If no mode is provided, the default for that sensor will be chosen.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#subscribe">Hub#subscribe</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-151">line 151</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful issuance of command.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="unsubscribe"><span class="type-signature"></span>unsubscribe(port)</h4>
</dt>
<dd>
<div class="description">
<p>Unsubscribe to sensor notifications on a given port.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#unsubscribe">Hub#unsubscribe</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-169">line 169</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved upon successful issuance of command.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="wait"><span class="type-signature"></span>wait(commands)</h4>
</dt>
<dd>
<div class="description">
<p>Wait until a given list of concurrently running commands are complete.</p>
<p>This is a helper method to make it easier to wait for concurrent commands to complete.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>commands</code></td>
<td class="type">
<span class="param-type">Array.&lt;Promise.&lt;any>></span>
</td>
<td class="description last"><p>Array of executing commands.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#wait">Hub#wait</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-196">line 196</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved after the commands are finished.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Events</h3>
<dl>
<hr>
<dt>
<h4 class="name" id="event:attach">attach</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a motor or sensor is attached to the Hub.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type"><a href="global.html#DeviceType">DeviceType</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#event:attach">Hub#event:attach</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-252">line 252</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:button">button</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a button is pressed.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>button</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>state</code></td>
<td class="type">
<span class="param-type"><a href="global.html#ButtonState">ButtonState</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-171">line 171</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:color">color</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a color sensor is activated.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Color">Color</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-271">line 271</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:colorAndDistance">colorAndDistance</h4>
</dt>
<dd>
<div class="description">
<p>A combined color and distance event, emits when the sensor is activated.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Color">Color</a></span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Distance, in millimeters.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-287">line 287</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:detach">detach</h4>
</dt>
<dd>
<div class="description">
<p>Emits when an attached motor or sensor is detached from the Hub.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="Hub.html#event:detach">Hub#event:detach</a>
</li>
</ul>
</dd>
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hub.js.html">hub.js</a>,
<a href="hub.js.html#sunlight-1-line-264">line 264</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:distance">distance</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a distance sensor is activated.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>distance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Distance, in millimeters.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-261">line 261</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:rotate">rotate</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a rotation sensor is activated.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>rotation</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-316">line 316</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:speed">speed</h4>
</dt>
<dd>
<div class="description">
<p>Emits on a speed change.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>speed</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-364">line 364</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:tilt">tilt</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a tilt sensor is activated.</p>
</div>
<h5>Parameters:</h5>
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>If the event is fired from the Move Hub's in-built tilt sensor, the special port &quot;TILT&quot; is used.</p></td>
</tr>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="lpf2hub.js.html">lpf2hub.js</a>,
<a href="lpf2hub.js.html#sunlight-1-line-304">line 304</a>
</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="copyright">
node-poweredup by Nathan Kellenicki licensed under the MIT license.
</span>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
on Wed Jan 30th 2019
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>