UHF RFID reader module for ORCA-50 handheld device
To install run:
pnpm add orca-rfid-reader
or
npm install orca-rfid-reader
or
yarn add orca-rfid-reader
This makes the connection to UHF RFID reader and starts scanning the background. It starts an observer in the native code and returns a boolean indicating if the connection was successful.
It accepts two arguments:
- Serial port, which is the serial port to connect to for the UHF RFID reade. The value should be
one of the values returned by
listSerialPorts
. - Baud rate, which is the baud rate to use for the serial connection. The value should be one of
the values returned by
listBaudRates
.
import OrcaRfidReader from "orca-rfid-reader";
const isConnected = OrcaRfidReader.startReader("uhf", "/dev/ttyS4", 115200);
This returns the current power of the UHF RFID reader. This value is normalized to a range of 0-100.
import OrcaRfidReader from "orca-rfid-reader";
const power = OrcaRfidReader.getReaderPower();
This sets the power of the UHF RFID reader. The value should be in the range of 0-100.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.setReaderPower(50);
This adds a listener to the UHF RFID reader. The listener is called whenever a tag is read.
This won't receive any data until the reader is started.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.addRFIDReadListener(({ rssi, epc }) => {
console.log(rssi, epc);
});
This returns a function that can be called to remove the listener.
This returns a list of available serial ports on the device (the options that can be passed to
startReader
).
import OrcaRfidReader from "orca-rfid-reader";
const ports = OrcaRfidReader.listSerialPorts();
This returns a list of available baud rates that can be passed to startReader
. The available
rates are hardcoded to the following values: [9600, 19200, 38400, 57600, 115200]
.
import OrcaRfidReader from "orca-rfid-reader";
const baudRates = OrcaRfidReader.listBaudRates();
This enables the beep sound when a tag is read.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.enableBeep();
This disables the beep sound when a tag is read.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.disableBeep();
This returns the current status of the beep sound when a tag is read.
import OrcaRfidReader from "orca-rfid-reader";
const isBeepEnabled = OrcaRfidReader.getBeepStatus();
This sets the EPCs to match against when reading tags. The EPCs should a string composed of EPCs separated by commas.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.setMatchEPCs(
"E28011606000000000000000,E28011606000000000000001"
);
Based on the value of the matching criteria, the reader will beep when the tag is read.
This resets the EPCs to match against when reading tags.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.resetMatchEPCs();
We want this because when no EPCs are set, the reader will beep when any tag is read.
This disconnects the UHF RFID reader and stops scanning. This should be called when the reader is no longer needed to free up resources and prevent battery drain.
import OrcaRfidReader from "orca-rfid-reader";
OrcaRfidReader.stopReader();