@signalk/streams
Version:
Utilities for handling streams of Signal K data
54 lines • 2.1 kB
TypeScript
import { Writable, Transform, TransformCallback } from 'stream';
import TimestampThrottle from './timestamp-throttle';
import type { DeltaCache } from './types';
interface AutodetectOptions {
app: {
selfContext: string;
isNmea2000OutAvailable: boolean;
deltaCache: DeltaCache;
on(event: string, cb: (...args: any[]) => void): void;
emit(event: string, ...args: unknown[]): void;
handleMessage(id: string, delta: object): void;
signalk: {
emit(event: string, ...args: unknown[]): void;
};
};
providerId: string;
noThrottle?: boolean;
useCanboatjs?: boolean;
[key: string]: unknown;
}
interface TimestampedMessage {
timestamp: number | string;
discriminator: string;
data: string;
fromFile?: boolean;
}
declare class ToTimestamped extends Transform {
private readonly deMultiplexer;
private readonly options;
private multiplexedFormat;
constructor(deMultiplexer: DeMultiplexer, options: AutodetectOptions);
_transform(msg: string | Buffer, encoding: BufferEncoding, done: TransformCallback): void;
private handleMixed;
private handleMultiplexed;
}
declare class Splitter extends Transform {
private readonly demuxEmitData;
private readonly fromN2KJson;
private readonly fromActisenseSerial;
private readonly fromNMEA0183;
constructor(deMultiplexer: DeMultiplexer, options: AutodetectOptions);
_transform(msg: TimestampedMessage, encoding: BufferEncoding, done: TransformCallback): void;
pipe<T extends NodeJS.WritableStream>(target: T): T;
}
export default class DeMultiplexer extends Writable {
readonly toTimestamped: ToTimestamped;
readonly timestampThrottle: TimestampThrottle;
readonly splitter: Splitter;
constructor(options: AutodetectOptions);
pipe<T extends NodeJS.WritableStream>(target: T): T;
write(chunk: unknown, encodingOrCallback?: BufferEncoding | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
}
export {};
//# sourceMappingURL=autodetect.d.ts.map