Class: Hub

Hub


new Hub()

The Hub is emitted if the discovered device is a Hub.

Source:

Extends

Members


<readonly> batteryLevel

Properties:
Name Type Description
batteryLevel number

Battery level of the hub (Percentage between 0-100)

Inherited From:
Source:

<readonly> firmwareVersion

Properties:
Name Type Description
firmwareVersion string

Firmware version of the hub

Inherited From:
Source:

<readonly> hardwareVersion

Properties:
Name Type Description
firmwareVersion string

Hardware version of the hub

Inherited From:
Source:

<readonly> name

Properties:
Name Type Description
name string

Name of the hub

Inherited From:
Source:

<readonly> ports

Properties:
Name Type Description
ports Array.<string>

Array of port names

Inherited From:
Source:

<readonly> primaryMACAddress

Properties:
Name Type Description
primaryMACAddress string

Primary MAC address of the hub

Inherited From:
Source:

<readonly> rssi

Properties:
Name Type Description
rssi number

Signal strength of the hub

Inherited From:
Source:

<readonly> type

Properties:
Name Type Description
type string

Hub type

Inherited From:
Source:

<readonly> uuid

Properties:
Name Type Description
uuid string

UUID of the hub

Inherited From:
Source:

Methods


connect()

Connect to the Hub.

Source:
Returns:

Resolved upon successful connect.

Type
Promise

disconnect()

Disconnect the Hub.

Source:
Returns:

Resolved upon successful disconnect.

Type
Promise

setName(name)

Set the name of the Hub.

Parameters:
Name Type Description
name string

New name of the hub (14 characters or less, ASCII only).

Inherited From:
Source:
Returns:

Resolved upon successful issuance of command.

Type
Promise

shutdown()

Shutdown the Hub.

Inherited From:
Source:
Returns:

Resolved upon successful disconnect.

Type
Promise

sleep(delay)

Sleep a given amount of time.

This is a helper method to make it easier to add delays into a chain of commands.

Parameters:
Name Type Description
delay number

How long to sleep (in milliseconds).

Source:
Returns:

Resolved after the delay is finished.

Type
Promise

wait(commands)

Wait until a given list of concurrently running commands are complete.

This is a helper method to make it easier to wait for concurrent commands to complete.

Parameters:
Name Type Description
commands Array.<Promise.<any>>

Array of executing commands.

Source:
Returns:

Resolved after the commands are finished.

Type
Promise

Events


accel

Emits when accelerometer detects movement. Measured in mG.

Parameters:
Name Type Description
port string
x number
y number
z number
Inherited From:
Source:

attach

Emits when a device is attached to the Hub.

Parameters:
Name Type Description
device Device
Source:

attach

Emits when a device is detached from the Hub.

Parameters:
Name Type Description
device Device
Source:

button

Emits when a button is pressed.

Parameters:
Name Type Description
button string
state ButtonState
Inherited From:
Source:

disconnect

Emits when the hub is disconnected.

Source:

tilt

Emits when a tilt sensor is activated.

Parameters:
Name Type Description
x number
y number
Inherited From:
Source: