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

rfid_nur

v0.0.10

Published

Small lib for Nordic RFiD reader

Downloads

12

Readme

Library to use Nordic ID reader with nur protocol. (only a few command implemented and some of them partially)

The program is partially tested with Nordic ID Sampo This very early library so not use it, except checking commands structure

Original documentation of the protocol: https://github.com/NordicID/nur_sdk/tree/master/Docs

Change ip.of.the.reader to the actual ip of the reader

Sample program:

var net = require('net'),
    Nur = require('rfid_nur'),
    nur = new Nur();

var processTag = function(data){
        if (data.status === 0) {
            console.log("Tag found, EPC: " + data.EPC);
            var newEPC = '00000025',
                password = 0x00000000,
                bank = 1 //EPC bank
            ;
            console.log("Changing EPC to " + newEPC);
            // dont know why need '1000' prefix and seems to not update how much lenght will be used
            client.write(nur.cmd.writeTag(procesWrite, 0x02, password, bank, 32, data.EPC.length * 4, Buffer.from(data.EPC, 'hex'), bank, 1, Buffer.from('1000' + newEPC, 'hex') ));
        } else {
            console.log("No tag found: 0x" + data.status.toString(16));
        }
    },
    procesWrite = function(data){
        if (data.status === 0){
            console.log("Succesfull write, " + data.error + " word written.");
        } else {
            console.log("Failed to write: " + data.status);
        }
    };

var client = new net.Socket();
client.connect(4333, 'ip.of.the.reader', function() {
    console.log('Connected');
    client.write(nur.cmd.ping(console.log));
    // client.write(nur.cmd.getReaderInformation(console.log));
    client.write(nur.cmd.scanSingleTag(processTag, 1000));
    // console.log("write");
    //console.log(nur.cmd.writeTag(console.log, 0x02, 0x00000000, 1, 32, 96, Buffer.from('2000020101000000000006DB', 'hex'), 3, 0, Buffer.from('0101020203030404','hex') ));
    //controlFlags, password, bank, bitAddress, maskBitLength, mask, bankToWrite, bitAddressWrite, data
    //client.write(nur.cmd.writeTag(console.log, 0x02, 0x00000000, 1, 32, 32, Buffer.from('00080025', 'hex'), 1, 1, Buffer.from('100000000025','hex') ));

});


client.on('data', function(data) {
    nur.parseStream(data);
});

client.on('close', function() {
    console.log('Connection closed');
});

client.on("error", function(err) {
    console.log("Caught socket error: " + err.message);
});

// nur.on('answer', console.log);
// nur.on('unsolicited', console.log);
nur.on('inventory', console.log);

nur.on('unsolicited', function(data){
    // console.log(nur.parseAnswer(data));
    if (data.readUInt8() === 0x81){
        client.write(nur.cmd.scanSingleTag(processTag, 1000));
    }
});

/*
nur.on('answer', function(data){
    console.log(nur.parseAnswer(data));
});*/