node-poweredup/docs/BaseHub.html

1419 lines
22 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>node-poweredup Class: BaseHub</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="BaseHub.html">BaseHub</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="MoveHub.html">MoveHub</a></li><li><a href="RemoteControl.html">RemoteControl</a></li><li><a href="TechnicMediumHub.html">TechnicMediumHub</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="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:accel">DuploTrainBase#event:accel</a></li><li><a href="DuploTrainBase.html#event:button">DuploTrainBase#event:button</a></li><li><a href="DuploTrainBase.html#event:tilt">DuploTrainBase#event:tilt</a></li><li><a href="DuploTrainBaseColorSensor.html#event:color">DuploTrainBaseColorSensor#event:color</a></li><li><a href="DuploTrainBaseSpeedometer.html#event:speed">DuploTrainBaseSpeedometer#event:speed</a></li><li><a href="Hub.html#event:accel">Hub#event:accel</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:disconnect">Hub#event:disconnect</a></li><li><a href="Hub.html#event:tilt">Hub#event:tilt</a></li><li><a href="LPF2Hub.html#event:accel">LPF2Hub#event:accel</a></li><li><a href="LPF2Hub.html#event:button">LPF2Hub#event:button</a></li><li><a href="LPF2Hub.html#event:tilt">LPF2Hub#event:tilt</a></li><li><a href="MotionSensor.html#event:distance">MotionSensor#event:distance</a></li><li><a href="MoveHub.html#event:accel">MoveHub#event:accel</a></li><li><a href="MoveHub.html#event:button">MoveHub#event:button</a></li><li><a href="MoveHub.html#event:tilt">MoveHub#event:tilt</a></li><li><a href="MoveHubTiltSensor.html#event:tilt">MoveHubTiltSensor#event:tilt</a></li><li><a href="RemoteControl.html#event:accel">RemoteControl#event:accel</a></li><li><a href="RemoteControl.html#event:button">RemoteControl#event:button</a></li><li><a href="RemoteControl.html#event:tilt">RemoteControl#event:tilt</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_ambient%2520Percentage.html#event:from0to100.">TechnicColorSensor#ambient Percentage,event: from 0 to 100.</a></li><li><a href="TechnicColorSensor.html#event:color">TechnicColorSensor#event:color</a></li><li><a href="TechnicColorSensor_reflect%2520Percentage.html#event:from0to100.">TechnicColorSensor#reflect Percentage,event: from 0 to 100.</a></li><li><a href="TechnicDistanceSensor_distance%2520Distance.html#event:from40to2500mm">TechnicDistanceSensor#distance Distance,event: from 40 to 2500mm</a></li><li><a href="TechnicDistanceSensor_fastDistance%2520Distance.html#event:from50to320mm">TechnicDistanceSensor#fastDistance Distance,event: from 50 to 320mm</a></li><li><a href="TechnicForceSensor.html#event:touchTouchedon/off(boolean).">TechnicForceSensor#event:touch Touched on/off (boolean).</a></li><li><a href="TechnicForceSensor_force%2520Force.html#event:innewtons(0-10).">TechnicForceSensor#force Force,event: in newtons (0-10).</a></li><li><a href="TechnicForceSensor_tapped%2520How%2520hard%2520the%2520sensor%2520was%2520tapped.html#event:from0-3.">TechnicForceSensor#tapped How hard the sensor was tapped,event: from 0-3.</a></li><li><a href="TechnicMediumHub.html#event:accel">TechnicMediumHub#event:accel</a></li><li><a href="TechnicMediumHub.html#event:button">TechnicMediumHub#event:button</a></li><li><a href="TechnicMediumHub.html#event:tilt">TechnicMediumHub#event:tilt</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="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: BaseHub</h1>
<section>
<header>
<h2>
BaseHub
</h2>
</header>
<article>
<div class="container-overview">
<hr>
<dt>
<h4 class="name" id="BaseHub"><span class="type-signature"></span>new BaseHub()</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="hubs_basehub.js.html">hubs/basehub.js</a>,
<a href="hubs_basehub.js.html#sunlight-1-line-43">line 43</a>
</li>
</ul>
</dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li>EventEmitter</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="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-125">line 125</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="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-97">line 97</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>firmwareVersion</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="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-104">line 104</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="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-76">line 76</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="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-90">line 90</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="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-111">line 111</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="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-132">line 132</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="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-83">line 83</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="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-118">line 118</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.3</a>
on Fri Feb 7th 2020
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>