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

uhf-uart-reader

v0.0.6

Published

UHF RFID reader module through UART interface designed for `rk3128_box` device.

Downloads

604

Readme

UHF UART Reader

UHF RFID reader module through UART interface designed for rk3128_box device.

Installation

To install run:

pnpm add uhf-uart-reader

or

npm install uhf-uart-reader

or

yarn add uhf-uart-reader

This module contains an Expo Config Plugin that will automatically add the changes to gradle configuration files when the module is installed. If you are not using Expo, you will need to manually add the changes to the gradle configuration files.

Expo Config Plugin

Add uhf-uart-reader to the plugins in app.json or app.config.ts:

{
	"expo": {
		"plugins": ["uhf-uart-reader"]
	}
}

Manual Installation

android/build.gradle

Update the minSdkVersion and targetSdkVersion to 21:

android/app/build.gradle

Add the following:

...
android {
  ...
  defaultConfig {
    ...
    ndk {
      abiFilters "armeabi-v7a", "armeabi"
    }
  }
}
...

Usage

connectUhfReader

This connects to the UHF reader on the given serial port and specified baud rate, starts reading in the background and returns a boolean indicating if the connection was successful.

import { connectUhfReader } from "uhf-uart-reader";

const connected = await connectUhfReader("/dev/ttyS0", 115200);

setReaderPower

This sets the power of the UHF reader, the power should be a number between 0 and 100.

import { setReaderPower } from "uhf-uart-reader";

setReaderPower(50);

addUhfListener

Note: This function should be called after connectUhfReader has been called.

This adds a listener to the UHF reader, the listener will be called every time a new tag is read.

import { addUhfListener } from "uhf-uart-reader";

addUhfListener((tag) => {
	console.log(`Tag EPC: ${tag.epc}`);
});

This returns a function that can be called to remove the listener.

disconnectUhfReader

This disconnects the UHF reader, it should be called when the reader is no longer needed.

import { disconnectUhfReader } from "uhf-uart-reader";

disconnectUhfReader();

isUhfReaderConnected

This returns a boolean indicating if the UHF reader is connected.

import { isUhfReaderConnected } from "uhf-uart-reader";

const connected = isUhfReaderConnected();

listSerialPorts

This returns a list of available serial ports on the device (the options that can be passed to connectUhfReader).

import { listSerialPorts } from "uhf-uart-reader";

const ports = await listSerialPorts();

listBaudRates

This returns a list of available baud rates that can be passed to connectUhfReader. The baud rates are hardcoded to the following values: [9600, 19200, 38400, 57600, 115200].

import { listBaudRates } from "uhf-uart-reader";

const baudRates = listBaudRates();