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

Constructors

Properties

_connStatusCb?: ((ev: PixelSessionConnectionEvent) => void)
_systemId: string

Accessors

  • get lastConnectionStatus():
        | "connected"
        | "connecting"
        | "disconnected"
        | "failedToConnect"
        | "ready"
        | "disconnecting"
  • Gets the last known connection status.

    Returns
        | "connected"
        | "connecting"
        | "disconnected"
        | "failedToConnect"
        | "ready"
        | "disconnecting"

Methods

  • Parameters

    • status:
          | "connected"
          | "connecting"
          | "disconnected"
          | "failedToConnect"
          | "ready"
          | "disconnecting"
    • reason:
          | "canceled"
          | "success"
          | "unknown"
          | "host"
          | "timeout"
          | "notSupported"
          | "linkLoss"
          | "bluetoothOff"
          | "peripheral" = "success"

    Returns void

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

    Parameters

    • listener: ((dataView: 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.

    • OptionalwithoutResponse: boolean

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

    • OptionaltimeoutMs: number

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

    Returns Promise<void>