Represents a session with a Pixel die. This class is used to abstract the underlying platform used to connect to Pixels.

Constructors

  • Instantiates a session with a Pixel. No attempt is made to connect to the die at this point.

    Parameters

    • systemId: string

      The peripheral system id (as assigned by the OS).

    Returns PixelSession

Properties

_connStatusCb?: ((ev) => void)

Type declaration

_lastConnStatus: any
_systemId: string

Accessors

  • get pixelName(): undefined | string
  • Gets the Pixel name.

    Returns undefined | string

    Remarks

    It may be undefined until connected.

  • get systemId(): string
  • Gets the peripheral system id (as assigned by the OS).

    Returns string

Methods

  • Parameters

    Returns void

  • Connects to the Pixel.

    Returns Promise<void>

  • Disconnects from the Pixel.

    Returns Promise<void>

  • Sets the function to be called when the Pixel connection status changes.

    Parameters

    • Optional connectionStatusListener: ((ev) => void)

      The function called when the Pixel connection status changes.

    Returns void

  • Subscribes to the "notify" characteristic and returns unsubscribe function.

    Parameters

    • listener: ((dataView) => void)

      The function to be called when the Pixel connection status changes.

        • (dataView): void
        • Parameters

          • dataView: DataView

          Returns void

    Returns Promise<(() => void)>

  • Sends data to Pixel using the "write" characteristic

    Parameters

    • data: ArrayBuffer

      The raw data to send to the Pixel.

    • Optional withoutResponse: boolean

      Whether or not to request the device to acknowledge having received the data.

    • Optional timeoutMs: number

      The timeout in milliseconds before throwing an error when waiting for the device to acknowledgement.

    Returns Promise<void>

Generated using TypeDoc