@ginden/blinkstick-v2
    Preparing search index...

    Class BlinkStickLibUsb

    Version of BlinkStick that uses libusb for communication.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _animation?: AnimationRunner
    _inverse: boolean = false
    abortController: AbortController = ...
    commandDebug: null | string
    debugWriteStream: null | WriteStream = null
    defaultRetryCount: number = 5

    Changes the default retry count for sending feature reports.

    deviceDescription: null | KnownDeviceInfo
    deviceInfo: MinimalDeviceInfo
    interpretParameters: <AdditionalOptions>(
        this: void,
        ...args: ColorOptions<AdditionalOptions>,
    ) => NormalizedColorOptions = interpretParameters
    isLinux: boolean = ...
    isSync: boolean = false
    ledCount: number
    manufacturer: string
    product: string
    requiresSoftwareColorPatch: boolean
    serial: string
    versionMajor: number
    versionMinor: number

    Accessors

    • get animation(): null | AnimationRunner

      Gets animation runner for the device. If device has unknown number of LEDs, getter will return null. If device is in inverse mode, getter will return null.

      Returns null | AnimationRunner

    • get inverse(): boolean

      Returns boolean

    • set inverse(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    Methods

    • Get the current color frame on BlinkStick Pro

      Parameters

      • count: number

      Returns Promise<Buffer<ArrayBufferLike>>

      Callback returns an array of LED data in the following format: [g0, r0, b0, g1, r1, b1...] *

      .getColors(8);
      
    • Get the current color as hex string.

      Parameters

      • index: number = 0

        The index of the LED, 0 is default

      Returns Promise<`#${string}`>

      Use utils functions instead

    • Get a feature report from the device, retrying if necessary.

      Parameters

      • reportId: number

        Report ID to receive

      • length: number

        Expected length of the report

      • maxRetries: number = ...

        Maximum number of retries

      Returns Promise<Buffer<ArrayBufferLike>>

    • Gets a feature report from the device without retries.

      Parameters

      • reportId: number
      • length: number

      Returns Promise<Buffer<ArrayBufferLike>>

    • Get the infoblock1 of the device. This is a 32 byte array that can contain any data. It's supposed to hold the "Name" of the device making it easier to identify rather than a serial number.

      Returns Promise<Buffer<ArrayBufferLike>>

    • Get the infoblock2 of the device. This is a 32 byte array that can contain any data.

      Returns Promise<Buffer<ArrayBufferLike>>

    • Returns the serial number of device.

      BSnnnnnn-1.0
      ||  |    | |- Software minor version
      ||  |    |--- Software major version
      ||  |-------- Denotes sequential number
      ||----------- Denotes BlinkStick device
      

      Software version defines the capabilities of the device

      Returns string

      Use .serial directly

    • Morphs to specified RGB color from current color.

      Function supports the following overloads:

      Parameters

      Returns Promise<void>

      //Available overloads
      morph(red, green, blue, [options], [callback]); // use [0..255] ranges for intensity

      morph(color, [options], [callback]); // use '#rrggbb' format

      morph(color_name, [options], [callback]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names

      Options can contain the following parameters for object:

      - channel=0: Channel is represented as 0=R, 1=G, 2=B
      - index=0: The index of the LED
      - duration=1000: How long should the morph animation last in milliseconds
      - steps=50: How many steps for color changes

      Use animation API instead

    • Pulses specified RGB color.

      Function supports the following overloads:

      Parameters

      Returns Promise<void>

      //Available overloads
      pulse(red, green, blue, [options], [callback]); // use [0..255] ranges for intensity

      pulse(color, [options], [callback]); // use '#rrggbb' format

      pulse(color_name, [options], [callback]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names

      Options can contain the following parameters for object:

      - channel=0: Channel is represented as 0=R, 1=G, 2=B
      - index=0: The index of the LED
      - duration=1000: How long should the pulse animation last in milliseconds (this time is actually doubled, keeping it in-line with legacy behavior)
      - steps=50: How many steps for color changes

      Use animation API instead

    • Low-level method that directly sends a feature report to the device.

      Parameters

      • data: Buffer<ArrayBufferLike> | number[]

      Returns Promise<number>

    • Set the color of LEDs

      Parameters

      Returns Promise<void>

      //Available overloads
      setColor(red, green, blue, [options]); // use [0..255] ranges for intensity

      setColor(color, [options]); // use '#rrggbb' format

      setColor(color_name, [options]); // use 'random', 'red', 'green', 'yellow' and other CSS supported names
    • Set the color frame on BlinkStick Pro Missing colors are filled with zeros. Note - this method seemingly has DIFFERENT behavior on different devices.

      Parameters

      • channel: Channel

        Channel is represented as 0=R, 1=G, 2=B

      • data: Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | number[]

        LED data in the following format: [g0, r0, b0, g1, r1, b1...]

      Returns Promise<void>

    • Set a feature report to the device.

      Parameters

      • data: Buffer

        First byte is report ID, the rest is data

      • maxRetries: number = 5

      Returns Promise<void>

    • Set a feature report to the device, and returns read data from the device.

      Parameters

      • reportId: number

        Report ID to receive

      • data: Buffer

        Data to send to the device

      • maxRetries: number = ...

        Maximum number of retries

      Returns Promise<Buffer<ArrayBufferLike>>

    • Sets the infoblock1 with specified string. It fills the rest of bytes with zeros.

      Usage:

      Parameters

      • data: Buffer

      Returns Promise<void>

          setInfoBlock1(Buffer.from("abcdefg", 'hex'));
      
    • Set inverse mode for IKEA DIODER in conjunction with BlinkStick Pro Seemingly, this is effectively deprecated in favor of setting mode on BlinkStick Pro directly.

      Parameters

      • inverse: boolean

        Set true for inverse mode and false otherwise

      Returns void

      Use .inverse directly

    • Experimental

      Sets the number of LEDs on "supported" devices. Note that unplugging and plugging the device may be necessary for the change to take effect.

      Parameters

      • count: number

      Returns Promise<void>

    • Set a random color on BlinkStick.

      Parameters

      • index: number = 0

        The index of the LED, 0 is default

      Returns Promise<void>

    • This method is used to write debug commands to the debug stream. It should never be called if commandDebug is not set.

      Parameters

      • type: string
      • ...args: unknown[]

      Returns void