Documentation
    Preparing search index...

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

    Index

    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).

      • Optionalname: string

      Returns PixelSession

    Properties

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

    Accessors

    • get lastConnectionStatus(): | "ready"
      | "connecting"
      | "connected"
      | "failedToConnect"
      | "disconnecting"
      | "disconnected"

      Gets the last known connection status.

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

    • get pixelName(): string | undefined

      Gets the Pixel name.

      Returns string | undefined

      It may be undefined until connected.

    • get systemId(): string

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

      Returns string

    Methods

    • Parameters

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

      Returns void

    • Parameters

      • name: string

      Returns void

    • Connects to the Pixel.

      Parameters

      • timeoutMs: number

      Returns Promise<void>

    • Disconnects from the Pixel.

      Returns Promise<void>

    • Release resources used by the session object.

      Returns void

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

      Parameters

      • OptionalconnectionStatusListener: (ev: PixelSessionConnectionEvent) => void

        The function called when the Pixel connection status changes.

      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.

      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>