UNPKG

1.9 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from "eventemitter3";
3export declare const VENDOR_ID = "0403";
4export declare const PRODUCT_ID = "6001";
5interface Events {
6 ready: [];
7 error: [Error];
8}
9export declare class EnttecOpenDMXUSBDevice extends EventEmitter<Events> {
10 private shouldBeSending;
11 private sendTimeout;
12 private buffer;
13 private readonly port;
14 /**
15 * @param {string} path A path returned by {@link EnttecOpenDMXUSBDevice.listDevices} or
16 * {@link EnttecOpenDMXUSBDevice.getFirstAvailableDevice}.
17 * @param {boolean} [startSending=true] If the device should start sending as soon as it is ready.
18 */
19 constructor(path: string, startSending?: boolean);
20 /**
21 * Starts sending.
22 * @param {number} [interval=0] The time between each attempt to send.
23 * @throws Error If the device is not ready yet.
24 */
25 startSending(interval?: number): void;
26 /**
27 * Stops sending.
28 */
29 stopSending(): void;
30 /**
31 * Sets the channel values.
32 * If channels is an Object, the keys are the channel numbers.
33 *
34 * @param {Buffer|Object|Array} channels
35 * @param {boolean} [clear=false] Whether all previously assigned channels should be set to 0
36 */
37 setChannels(channels: Buffer | number[] | Record<number, number>, clear?: boolean): void;
38 /**
39 * @returns {Promise} Resolves when the whole universe was send.
40 * @private
41 */
42 private sendUniverse;
43 /**
44 * Lists the paths of all available devices.
45 * @returns {Promise<string[]>}
46 */
47 static listDevices(): Promise<string[]>;
48 /**
49 * Gets the path of the first available device found.
50 * @throws Error when no device is found.
51 * @returns {Promise<string>}
52 */
53 static getFirstAvailableDevice(): Promise<string>;
54}
55export {};