node-poweredup/docs/Hub.html
Nathan Kellenicki 2e43ee7cf0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Fixed Duplo color sensor, color sensor output on all sensors
2021-08-29 20:07:10 -07:00

3852 lines
51 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>node-poweredup Class: Hub</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">node-poweredup</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="AbsoluteMotor.html">AbsoluteMotor</a></li><li><a href="BaseHub.html">BaseHub</a></li><li><a href="BasicMotor.html">BasicMotor</a></li><li><a href="ColorDistanceSensor.html">ColorDistanceSensor</a></li><li><a href="CurrentSensor.html">CurrentSensor</a></li><li><a href="Device.html">Device</a></li><li><a href="DuploTrainBase.html">DuploTrainBase</a></li><li><a href="DuploTrainBaseColorSensor.html">DuploTrainBaseColorSensor</a></li><li><a href="DuploTrainBaseMotor.html">DuploTrainBaseMotor</a></li><li><a href="DuploTrainBaseSpeaker.html">DuploTrainBaseSpeaker</a></li><li><a href="DuploTraniBaseSpeedometer.html">DuploTraniBaseSpeedometer</a></li><li><a href="Hub.html">Hub</a></li><li><a href="HubLED.html">HubLED</a></li><li><a href="Light.html">Light</a></li><li><a href="LPF2Hub.html">LPF2Hub</a></li><li><a href="Mario.html">Mario</a></li><li><a href="MarioAccelerometer.html">MarioAccelerometer</a></li><li><a href="MarioBarcodeSensor.html">MarioBarcodeSensor</a></li><li><a href="MarioPantsSensor.html">MarioPantsSensor</a></li><li><a href="MediumLinearMotor.html">MediumLinearMotor</a></li><li><a href="MotionSensor.html">MotionSensor</a></li><li><a href="MoveHub.html">MoveHub</a></li><li><a href="MoveHubMediumLinearMotor.html">MoveHubMediumLinearMotor</a></li><li><a href="MoveHubTiltSensor.html">MoveHubTiltSensor</a></li><li><a href="PiezoBuzzer.html">PiezoBuzzer</a></li><li><a href="RemoteControl.html">RemoteControl</a></li><li><a href="RemoteControlButton.html">RemoteControlButton</a></li><li><a href="SimpleMediumLinearMotor.html">SimpleMediumLinearMotor</a></li><li><a href="TachoMotor.html">TachoMotor</a></li><li><a href="TechnicColorSensor.html">TechnicColorSensor</a></li><li><a href="TechnicDistanceSensor.html">TechnicDistanceSensor</a></li><li><a href="TechnicForceSensor.html">TechnicForceSensor</a></li><li><a href="TechnicLargeAngularMotor.html">TechnicLargeAngularMotor</a></li><li><a href="TechnicLargeLinearMotor.html">TechnicLargeLinearMotor</a></li><li><a href="TechnicMediumAngularMotor.html">TechnicMediumAngularMotor</a></li><li><a href="TechnicMediumHub.html">TechnicMediumHub</a></li><li><a href="TechnicMediumHubAccelerometerSensor.html">TechnicMediumHubAccelerometerSensor</a></li><li><a href="TechnicMediumHubGyroSensor.html">TechnicMediumHubGyroSensor</a></li><li><a href="TechnicMediumHubTiltSensor.html">TechnicMediumHubTiltSensor</a></li><li><a href="TechnicXLargeLinearMotor.html">TechnicXLargeLinearMotor</a></li><li><a href="TiltSensor.html">TiltSensor</a></li><li><a href="TrainMotor.html">TrainMotor</a></li><li><a href="VoltageSensor.html">VoltageSensor</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="AbsoluteMotor.html#event:absolute">AbsoluteMotor#event:absolute</a></li><li><a href="AbsoluteMotor.html#event:rotate">AbsoluteMotor#event:rotate</a></li><li><a href="ColorDistanceSensor.html#event:color">ColorDistanceSensor#event:color</a></li><li><a href="ColorDistanceSensor.html#event:colorAndDistance">ColorDistanceSensor#event:colorAndDistance</a></li><li><a href="ColorDistanceSensor.html#event:distance">ColorDistanceSensor#event:distance</a></li><li><a href="CurrentSensor.html#event:current">CurrentSensor#event:current</a></li><li><a href="DuploTrainBase.html#event:button">DuploTrainBase#event:button</a></li><li><a href="DuploTrainBaseColorSensor.html#event:color">DuploTrainBaseColorSensor#event:color</a></li><li><a href="DuploTrainBaseColorSensor.html#event:intensity">DuploTrainBaseColorSensor#event:intensity</a></li><li><a href="DuploTrainBaseColorSensor.html#event:reflect">DuploTrainBaseColorSensor#event:reflect</a></li><li><a href="DuploTrainBaseColorSensor.html#event:rgb">DuploTrainBaseColorSensor#event:rgb</a></li><li><a href="DuploTrainBaseSpeedometer.html#event:speed">DuploTrainBaseSpeedometer#event:speed</a></li><li><a href="Hub.html#event:attach">Hub#event:attach</a></li><li><a href="Hub.html#event:button">Hub#event:button</a></li><li><a href="Hub.html#event:detach">Hub#event:detach</a></li><li><a href="Hub.html#event:disconnect">Hub#event:disconnect</a></li><li><a href="LPF2Hub.html#event:button">LPF2Hub#event:button</a></li><li><a href="Mario.html#event:button">Mario#event:button</a></li><li><a href="MarioAccelerometer.html#event:accel">MarioAccelerometer#event:accel</a></li><li><a href="MarioAccelerometer.html#event:gest">MarioAccelerometer#event:gest</a></li><li><a href="MarioBarcodeSensor.html#event:barcode">MarioBarcodeSensor#event:barcode</a></li><li><a href="MarioBarcodeSensor.html#event:rgb">MarioBarcodeSensor#event:rgb</a></li><li><a href="MarioPantsSensor.html#event:pants">MarioPantsSensor#event:pants</a></li><li><a href="MediumLinearMotor.html#event:rotate">MediumLinearMotor#event:rotate</a></li><li><a href="MotionSensor.html#event:distance">MotionSensor#event:distance</a></li><li><a href="MoveHub.html#event:button">MoveHub#event:button</a></li><li><a href="MoveHubMediumLinearMotor.html#event:rotate">MoveHubMediumLinearMotor#event:rotate</a></li><li><a href="MoveHubTiltSensor.html#event:tilt">MoveHubTiltSensor#event:tilt</a></li><li><a href="RemoteControl.html#event:button">RemoteControl#event:button</a></li><li><a href="RemoteControlButton.html#event:button">RemoteControlButton#event:button</a></li><li><a href="TachoMotor.html#event:rotate">TachoMotor#event:rotate</a></li><li><a href="TechnicColorSensor.html#event:ambient">TechnicColorSensor#event:ambient</a></li><li><a href="TechnicColorSensor.html#event:color">TechnicColorSensor#event:color</a></li><li><a href="TechnicColorSensor.html#event:reflect">TechnicColorSensor#event:reflect</a></li><li><a href="TechnicDistanceSensor.html#event:distance">TechnicDistanceSensor#event:distance</a></li><li><a href="TechnicDistanceSensor.html#event:fastDistance">TechnicDistanceSensor#event:fastDistance</a></li><li><a href="TechnicForceSensor.html#event:force">TechnicForceSensor#event:force</a></li><li><a href="TechnicForceSensor.html#event:tapped">TechnicForceSensor#event:tapped</a></li><li><a href="TechnicForceSensor.html#event:touch">TechnicForceSensor#event:touch</a></li><li><a href="TechnicLargeAngularMotor.html#event:absolute">TechnicLargeAngularMotor#event:absolute</a></li><li><a href="TechnicLargeAngularMotor.html#event:rotate">TechnicLargeAngularMotor#event:rotate</a></li><li><a href="TechnicLargeLinearMotor.html#event:absolute">TechnicLargeLinearMotor#event:absolute</a></li><li><a href="TechnicLargeLinearMotor.html#event:rotate">TechnicLargeLinearMotor#event:rotate</a></li><li><a href="TechnicMediumAngularMotor.html#event:absolute">TechnicMediumAngularMotor#event:absolute</a></li><li><a href="TechnicMediumAngularMotor.html#event:rotate">TechnicMediumAngularMotor#event:rotate</a></li><li><a href="TechnicMediumHub.html#event:button">TechnicMediumHub#event:button</a></li><li><a href="TechnicMediumHubAccelerometerSensor.html#event:accel">TechnicMediumHubAccelerometerSensor#event:accel</a></li><li><a href="TechnicMediumHubGyroSensor.html#event:gyro">TechnicMediumHubGyroSensor#event:gyro</a></li><li><a href="TechnicMediumHubTiltSensor.html#event:tilt">TechnicMediumHubTiltSensor#event:tilt</a></li><li><a href="TechnicXLargeLinearMotor.html#event:absolute">TechnicXLargeLinearMotor#event:absolute</a></li><li><a href="TechnicXLargeLinearMotor.html#event:rotate">TechnicXLargeLinearMotor#event:rotate</a></li><li><a href="TiltSensor.html#event:tilt">TiltSensor#event:tilt</a></li><li><a href="VoltageSensor.html#event:voltage">VoltageSensor#event:voltage</a></li><li><a href="WeDo2SmartHub.html#event:button">WeDo2SmartHub#event:button</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: Hub</h1>
<section>
<header>
<h2>
Hub
</h2>
</header>
<article>
<div class="container-overview">
<hr>
<dt>
<h4 class="name" id="Hub"><span class="type-signature"></span>new Hub()</h4>
</dt>
<dd>
<div class="description">
<p>The Hub is emitted if the discovered device is a 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="hubs_hub.js.html">hubs/hub.js</a>,
<a href="hubs_hub.js.html#sunlight-1-line-31">line 31</a>
</li>
</ul>
</dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="LPF2Hub.html">LPF2Hub</a></li>
<li><a href="BaseHub.html">BaseHub</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="BaseHub.html#batteryLevel">BaseHub#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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-141">line 141</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="BaseHub.html#firmwareVersion">BaseHub#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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-113">line 113</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="hardwareVersion">
<h4 id="hardwareVersion"><span class="type-signature">&lt;readonly> </span>hardwareVersion<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>hardwareVersion</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Hardware 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="BaseHub.html#hardwareVersion">BaseHub#hardwareVersion</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-120">line 120</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="BaseHub.html#name">BaseHub#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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-92">line 92</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="ports">
<h4 id="ports"><span class="type-signature">&lt;readonly> </span>ports<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>ports</code></td>
<td class="type">
<span class="param-type">Array.&lt;string></span>
</td>
<td class="description last"><p>Array of port names</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="BaseHub.html#ports">BaseHub#ports</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-106">line 106</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="primaryMACAddress">
<h4 id="primaryMACAddress"><span class="type-signature">&lt;readonly> </span>primaryMACAddress<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>primaryMACAddress</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Primary MAC address 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="BaseHub.html#primaryMACAddress">BaseHub#primaryMACAddress</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-127">line 127</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="BaseHub.html#rssi">BaseHub#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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-148">line 148</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt class="name" id="type">
<h4 id="type"><span class="type-signature">&lt;readonly> </span>type<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>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Hub type</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="BaseHub.html#type">BaseHub#type</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-99">line 99</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="BaseHub.html#uuid">BaseHub#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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-134">line 134</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="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-151">line 151</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="createVirtualPort"><span class="type-signature"></span>createVirtualPort(firstPortName, secondPortName)</h4>
</dt>
<dd>
<div class="description">
<p>Combines two ports with into a single virtual port.</p>
<p>Note: The devices attached to the ports must be of the same device type.</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>firstPortName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>First port name</p></td>
</tr>
<tr>
<td class="name"><code>secondPortName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Second port name</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="LPF2Hub.html#createVirtualPort">LPF2Hub#createVirtualPort</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="hubs_lpf2hub.js.html">hubs/lpf2hub.js</a>,
<a href="hubs_lpf2hub.js.html#sunlight-1-line-90">line 90</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="disconnect"><span class="type-signature"></span>disconnect()</h4>
</dt>
<dd>
<div class="description">
<p>Disconnect 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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-165">line 165</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="getDeviceAtPort"><span class="type-signature"></span>getDeviceAtPort(portName)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieves the device attached to 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>portName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the port to retrieve the device from.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-173">line 173</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>The device attached to the port.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Device.html">Device</a></span>
|
<span class="param-type">undefined</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="getDevices"><span class="type-signature"></span>getDevices()</h4>
</dt>
<dd>
<div class="description">
<p>Retrieves all attached devices.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-213">line 213</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Array of all attached devices.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="Device.html">Device</a>></span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="getDevicesByType"><span class="type-signature"></span>getDevicesByType(deviceType)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieves an array of devices of the specified type.</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>deviceType</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The device type to lookup.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-221">line 221</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Array of all devices of the specified type.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;<a href="Device.html">Device</a>></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="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="LPF2Hub.html#setName">LPF2Hub#setName</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="hubs_lpf2hub.js.html">hubs/lpf2hub.js</a>,
<a href="hubs_lpf2hub.js.html#sunlight-1-line-61">line 61</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="inherited-from method-doc-label method-doc-details-label">Inherited From:</dt>
<dd class="inherited-from">
<ul class="dummy">
<li>
<a href="LPF2Hub.html#shutdown">LPF2Hub#shutdown</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="hubs_lpf2hub.js.html">hubs/lpf2hub.js</a>,
<a href="hubs_lpf2hub.js.html#sunlight-1-line-53">line 53</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>Note: 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="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-266">line 266</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="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>Note: 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="tag-source method-doc-label method-doc-details-label">Source:</dt>
<dd class="tag-source">
<ul class="dummy">
<li>
<a href="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-279">line 279</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>
<hr>
<dt>
<h4 class="name" id="waitForDeviceAtPort"><span class="type-signature"></span>waitForDeviceAtPort(portName)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieves the device attached to a given port, waiting until one is attached if there isn't one.</p>
<p>Note: If a device is never attached, the returned promise may never resolve.</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>portName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the port to retrieve the device from.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-188">line 188</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved once a device is attached, or resolved immediately if a device is already attached.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="waitForDeviceByType"><span class="type-signature"></span>waitForDeviceByType(deviceType)</h4>
</dt>
<dd>
<div class="description">
<p>Retrieves the first device attached of the specified type, waiting until one is attached if there isn't one.</p>
<p>Note: If a device is never attached, the returned promise may never resolve.</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>deviceType</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The device type to lookup.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-230">line 230</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Resolved once a device is attached, or resolved immediately if a device is already attached.</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 device 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>device</code></td>
<td class="type">
<span class="param-type"><a href="Device.html">Device</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-321">line 321</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">ButtonState</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="LPF2Hub.html#event:button">LPF2Hub#event:button</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="hubs_lpf2hub.js.html">hubs/lpf2hub.js</a>,
<a href="hubs_lpf2hub.js.html#sunlight-1-line-182">line 182</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:detach">detach</h4>
</dt>
<dd>
<div class="description">
<p>Emits when a device 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>device</code></td>
<td class="type">
<span class="param-type"><a href="Device.html">Device</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-338">line 338</a>
</li>
</ul>
</dd>
</dl>
</dd>
<hr>
<dt>
<h4 class="name" id="event:disconnect">disconnect</h4>
</dt>
<dd>
<div class="description">
<p>Emits when the hub is disconnected.</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-81">line 81</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.6.7</a>
on Sun Aug 29th 2021
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>