npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

llrp-ts

v1.0.0

Published

UHF Tag reader for connecting with RFID reader through LLRP. (LLRP UHF RFID Driver)

Downloads

17

Readme

llrp-ts

Tag reader for connecting with RFID reader through LLRP(LLRP UHF RFID Driver for node.js/TypeScript)

==========

llrp protocol implementation

Nodejs module to read RFID tags by connecting to a RFID reader through LLRP protocol.

Version history

v.0.0.1 - version based on https://github.com/GeenenTijd/llrp-nodejs

v.0.0.2 - Code refactoring. Add Impinj Specific message for AddRoSpec. Add close connection public method. Add parsing for AntennaID, PeakRSSI, LastSeenTimestampUTC.

v.0.0.3 - Code refactoring. Add llrp message creator. Fixed bugs in endode.js. Add received EPC96 or EPC numbers. Add disableRFTransmitter and enableRFTransmitter methods.

v.0.0.4 - Converted code to TypeScript. Add unit tests.

v.0.0.5 - Add reading of TID number.

v.0.0.6 - Add configuration for antennas number.

v.0.0.7 - Add antenna power configuration.

v.0.0.8 - Fix sending command when socket is closed.

v.0.0.9 - Add radio transmitter on/off commands and events.

Authors

Yaroslav Slipchuk

Installation

todo

Config

You can provide a config object with the following values:

ipaddress - IP of the RFID reader (default 192.168.0.30)

port - port of the RFID reader (default 5084)

log - log messages in the console (default false)

isReaderConfigSet - is the reader config set (default false)

isStartROSpecSent - has START_ROSPEC message been sent to the reader (default false)

Methods

connect() disconnect() disableRFTransmitter() enableRFTransmitter()

Example

import { LLRP, RfidReaderEvent } from './index';

import { ReaderConfig, TagInformation } from './interfaces/llrp';

// reader tcp/ip config
const config: ReaderConfig = {
    ipaddress: '192.168.1.90',
    port : 5084,
    radioOperationConfig: {
        enableReadingTid: true,
        modeIndex: 3,
        tagPopulation: 4,
        channelIndex: 1,
        inventorySearchMode: 1, // 1 - Single target (impinj custom parameter)
        antennasConfig: [
        // NOTE:
        // if no object in array it is switch all antennas on
        //  { number: 0, power: 31.5 } - switch all antennas on with 31.5 dBm
        //  { number: 1, power: 10.0 } - switch the first antenna on with 10 dBm
            { number: 1, power: 31.5 },
            // { number: 2, power: 31.5 },
            // { number: 3, power: 31.5 },
            // { number: 4, power: 31.5 }
        ]
    }
};

const reader: LLRP = new LLRP(config, console);

reader.connect();

reader.on(RfidReaderEvent.Timeout, () => {
    console.log('timeout');
});

reader.on(RfidReaderEvent.Disconnect, (error: Error) => {
    console.log('disconnect', error);
});

reader.on(RfidReaderEvent.Error, (error: any) => {
    console.log(`error: JSON.stringify(${ error })`);
});

reader.on(RfidReaderEvent.DisabledRadioOperation, () => {
    console.log('disabledRadioOperation');
});

reader.on(RfidReaderEvent.StartedRadioOperation, () => {
    console.log('startedRadioOperation');
});

reader.on(RfidReaderEvent.LlrpError, (error: Error) => {
    console.log('protocol error:', error);
});

reader.on(RfidReaderEvent.DidSeeTag, (tag: TagInformation) => {
    console.log(`Read: ${ JSON.stringify(tag) }`);
    // if (tag.EPC96) console.log('EPC96: ' + JSON.stringify(tag.EPC96));
    // if (tag.EPCData) console.log('EPCData: ' + JSON.stringify(tag.EPCData));
    // if (tag.TID) console.log('TID: ' + JSON.stringify(tag.TID));
});

setInterval(
    () => {
        reader.disableRFTransmitter();
        console.log('RFID:disable rfid');
    },
    10000
);

setTimeout(
    () => setInterval(
        () => {
            reader.enableRFTransmitter();
            console.log('RFID:enable rfid');
        },
        10000
    ),
    5000
);

function normalExit(): void {
    reader.disconnect();
    setTimeout(() => { process.exit(0); }, 1000);
}

process.on('SIGINT', () => {
    console.log('SIGINT');
    normalExit();
});

process.on('SIGQUIT', () => {
    console.log('SIGQUIT');
    normalExit();
});

process.on('SIGTERM', () => {
    console.log('SIGTERM');
    normalExit();
});

// catches uncaught exceptions
process.on('uncaughtException', () => {
    console.log('uncaughtException');
    normalExit();
});

// catches unhandled promise rejection
process.on('unhandledRejection', () => {
    console.log('unhandledRejection');
    normalExit();
});