@nordicid/nurapi
v0.9.9
Published
NUR RFID Reader API — core library
Maintainers
Readme
@nordicid/nurapi
Core library for communicating with Nordic ID NUR RFID reader modules. Provides the complete API for connecting to a reader and performing inventory, tag read/write, configuration, streaming, and more.
Install
npm install @nordicid/nurapiYou also need a transport package for your platform:
- Node.js —
npm install @nordicid/nurapi-node(serial port, TCP socket) - Browser —
npm install @nordicid/nurapi-web(Web Serial, Web Bluetooth)
Quick Start
import { NurApi } from '@nordicid/nurapi';
import '@nordicid/nurapi-node'; // registers ser:// and tcp:// transports
const reader = new NurApi();
await reader.connect('tcp://192.168.1.100');
// Read reader info
const info = await reader.getReaderInfo();
console.log(`Reader: ${info.name}, Serial: ${info.serial}`);
// Run inventory and fetch tags
const result = await reader.inventory();
const tags = await reader.fetchTags();
console.log(`Found ${result.tagsFound} tags`);
for (const tag of tags) {
console.log(` EPC: ${tag.epcHex}, RSSI: ${tag.rssi}`);
}
await reader.disconnect();Connection
NurApi uses URI-based connection — the transport is resolved automatically from a registry:
| URI scheme | Transport | Package |
|---|---|---|
| tcp://host:port | TCP socket | @nordicid/nurapi-node |
| ser://COM3 | Serial port | @nordicid/nurapi-node |
| ws://host:port | WebSocket | @nordicid/nurapi (built-in) |
| ser://request | Web Serial (browser) | @nordicid/nurapi-web |
| ble://request | Web Bluetooth (browser) | @nordicid/nurapi-web |
Auto-reconnect is enabled by default with exponential backoff (1s to 30s).
Events
// Connection lifecycle
reader.on('connecting', () => console.log('Connecting...'));
reader.on('connected', () => console.log('Connected'));
reader.on('disconnected', () => console.log('Disconnected'));
// Streaming inventory
reader.on('inventoryStream', (event) => {
console.log(`Tags so far: ${event.tagsAdded}`);
});Streaming Inventory
reader.on('inventoryStream', (event) => {
const tags = reader.tagStorage.toArray();
console.log(`${tags.length} unique tags seen`);
});
await reader.startInventoryStream();
// ... tags arrive via events ...
await reader.stopInventoryStream();Documentation
See the full API reference, guides, and advanced topics (Accessory Extension, Gen2v2, TAM authentication) at nordicid.github.io/nur_nurapi_typescript.
License
See LICENSE.
