Represents a list of scanned Pixels that is updated when scanning. Set a callback to PixelScanner.scanListener to get notified when the list is updated.

When powered on but not yet connected, a Pixels die will periodically emit information which is picked up by the scanner. Typically the information is send a few times per second.

Calls to the async methods of this class are queued and executed in order across all instances.

Remarks

Even though the roll state and roll face are included in a ScannedPixel instance, this data is not emitted in a reliable way.

To get reliably notified for rolls, first connect to the die and listen for roll events.

Constructors

Properties

_keepAliveDuration: number = 5000
_lastUpdate: Date = ...
_minNotifyInterval: number = 200
_notifyTimeoutId?: Timeout
_onBluetoothState?: ((ev) => void)

Type declaration

_pixels: ScannedPixel[] = []
_pruneTimeoutId?: Timeout
_scanFilter: PixelScannerFilter
_startPromise?: Promise<void>
_status: ScanStatus = "stopped"
_touched: Set<number> = ...
_sharedQueue: SequentialPromiseQueue = ...

Accessors

Methods

  • Queues a command to start a Bluetooth scan for Pixels and update the list as advertisement packets are being received. If the instance is already scanning it will just notify of pending list operations or clear the list if clearOnStop is true.

    Returns Promise<void>

    A promise.

    Remarks

    Calls to the async methods of this class are queued and executed in order.

    On Android, BLE scanning will fail without error when started more than 5 times over the last 30 seconds.

Generated using TypeDoc