Nine Pedestrians Mesmerized

    @curium.rocks/serial-emitter
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1-alpha.16 • Public • Published

    Serial-Emitter

    Security Rating Coverage Quality Gate Status

    How To Install

    npm install --save @curium.rocks/serial-emitter

    Example(s)

    import {SerialDataFormat, SerialEmitterFactory, SerialParity} from "@curium.rocks/serial-emitter";
    import {IDataEmitter, IDataEvent} from "@curium.rocks/data-emitter-base";
    
    const factory:SerialEmitterFactory = new SerialEmitterFactory();
    
    const emitter:IDataEmitter = await factory.build({
        portName: '/dev/ttyUSB0',
        dataBits: 8,
        parity: SerialParity.NONE,
        stopBits: 1,
        baudRate: 9600,
        format: SerialDataFormat.ASCII_LINES
    }, 'unique-id', 'my-test-serial-port', 'A longer description')
    
    const dataListener = emitter.onData((dataEvent:IDataEvent) => {
        console.log(`data: ${dataEvent.data}, emitted at: ${dataEvent.timestamp}, from: ${dataEvent.emitter.name}`)
    })
    
    const statusListener = emitter.onStatus((statusEvent) => {
        console.log(`status: connected = ${statusEvent.connected}, at = ${statusEvent.timestamp}, BIT = ${statusEvent.bit}`);
    })
    
    dataListener.dispose();
    statusListener.dispose();

    Install

    npm i @curium.rocks/serial-emitter

    DownloadsWeekly Downloads

    3

    Version

    0.1.1-alpha.16

    License

    MIT

    Unpacked Size

    24.8 kB

    Total Files

    12

    Last publish

    Collaborators

    • akboyd88