sacn
Version:
💡 🎠Send and Receive sACN data (DMX over IP)
63 lines (62 loc) • 2.41 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from 'events';
import { type Options } from './packet';
/** @deprecated - use {@link Sender.Props} instead */
export declare type SenderProps = Sender.Props;
export declare namespace Sender {
interface Props {
/** The universe to send to. Must be within 1-63999 */
universe: number;
/**
* The multicast port to use. All professional consoles broadcast to the default port.
* @default 5568
*/
port?: number;
/**
* Allow multiple programs on your computer to send to the same sACN universe.
* @default false
*/
reuseAddr?: boolean;
/**
* How often the data should be re-sent (**in Hertz/Hz**), even if it hasn't changed.
*
* By default data will only be sent once (equivilant of setting `refreshRate: 0`).
*
* To re-send data 5 times per second (`5Hz`), set `refreshRate: 5`. This is equivilant to `200ms`.
*
* @default 0
*/
minRefreshRate?: number;
/** some options can be sepecified when you instantiate the sender, instead of sepecifying them on every packet */
defaultPacketOptions?: Pick<Options, 'cid' | 'sourceName' | 'priority' | 'useRawDmxValues'>;
iface?: string;
/**
* If you set this option to an IP address, then data will be sent
* purely to this address, instead of the whole network.
*
* This option is not recommended and may not be supported by all devices.
*/
useUnicastDestination?: string;
}
interface EventMap {
changedResendStatus: boolean;
error: Error;
}
}
export declare interface Sender {
on<K extends keyof Sender.EventMap>(type: K, listener: (event: Sender.EventMap[K]) => void): this;
}
export declare class Sender extends EventEmitter {
#private;
private socket;
private readonly port;
readonly universe: Sender.Props['universe'];
private readonly defaultPacketOptions;
private sequence;
resendStatus: boolean;
constructor({ universe, port, reuseAddr, minRefreshRate, defaultPacketOptions, iface, useUnicastDestination, }: Sender.Props);
send(packet: Omit<Options, 'sequence' | 'universe'>): Promise<void>;
private reSend;
private updateResendStatus;
close(): this;
}