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.
The duration in milliseconds for which a Scanned Pixel should
be considered available since the last received advertisement.
A value of 0 keeps the dice forever.
Returns number
Remarks
Removed Scanned Pixels are notified with respect to the value
of minNotifyInterval.
For a value greater than 0, Scanned Pixels are all immediately
removed when Bluetooth becomes unavailable.
Default
7000.
set keepAliveDuration(duration): void
Parameters
duration: number
Returns void
minNotifyInterval
get minNotifyInterval(): number
The minimum time interval in milliseconds between two "onScanListChange"
notifications.
(calls to PixelScanner.scanListener).
A value of 0 will generate a notification on every scan event.
An optional filter to only keep certain Pixels in the list.
Setting a new filter will only affect new scan events, the current list of
scanned Pixels will stay unchanged.
Registers a listener function that will be called when the specified
event is raised.
See PixelScannerEventMap for the list of events and their
associated data.
Unregisters a listener from receiving events identified by
the given event name.
See PixelScannerEventMap for the list of events and their
associated data.
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.
stopAsync
stopAsync(): Promise<void>
Stops scanning for Pixels.
Returns Promise<void>
A promise.
Remarks
Calls to the async methods of this class are queued and executed in order.
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.