enttec-open-dmx-usb
Version:
A Node.js library for interacting with the Enttec Open DMX USB interface
57 lines (56 loc) • 1.98 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from "eventemitter3";
export declare const VENDOR_ID = "0403";
export declare const PRODUCT_ID = "6001";
interface Events {
ready: [];
error: [Error];
}
type Usleep = (microSeconds: number) => unknown;
export declare class EnttecOpenDMXUSBDevice extends EventEmitter<Events> {
private shouldBeSending;
private sendTimeout;
private buffer;
private readonly port;
private readonly usleep;
/**
* @param path A path returned by {@link EnttecOpenDMXUSBDevice.listDevices} or
* {@link EnttecOpenDMXUSBDevice.getFirstAvailableDevice}.
* @param [startSending=true] Whether the device should start sending as soon as it is ready.
* @param [usleep=null] A function blocking the event loop for `n` microseconds. See the README.md for more information.
*/
constructor(path: string, startSending?: boolean, usleep?: Usleep | null);
/**
* Start sending.
* @param [interval=0] The milliseconds between each attempt to send. Most of the time `0` works fine.
* @throws When the device is not ready yet.
*/
startSending(interval?: number): void;
/**
* Stop sending.
*/
stopSending(): void;
/**
* Set channel values.
* If channels is an Object, the keys are the channel numbers.
*
* @param channels
* @param [clear=false] Whether all previously assigned channels should be set to `0`
*/
setChannels(channels: Buffer | number[] | Record<number, number>, clear?: boolean): void;
/**
* @returns A Promise resolved when the whole universe was sent.
* @private
*/
_sendUniverse(): Promise<void>;
/**
* Get the paths of all available devices.
*/
static listDevices(): Promise<string[]>;
/**
* Get the path of the first available device.
* @throws When no device is found.
*/
static getFirstAvailableDevice(): Promise<string>;
}
export {};