card-scanner

1.0.2 • Public • Published

card-scanner

Card scanner package that enables reading of MiFare cards using Silicon Labs driver.

This package is based off node-serialport.

An example of using this code is shown in Abakus vote

Usage

Listing devices

const { refresh } from 'card-scanner';

refresh().then(ports => {
  // Handle port logic
});

Connecting to devices

const { connect } from 'card-scanner';

const devicePath = '/dev/tty.XXX'; // Retrieved from port.comName
const callback = (response) => {
  console.log('data read', response);
}

connect(devicePath, callback).then(() => {
  // Connect successful
}).catch(err => {
  // Connect rejected
});

The connect() promise also supports a third argument, disableThrottle, that removes the throttle behavior that disables re-reading the same card multiple times a second with a 500ms read delay.

Readme

Keywords

none

Package Sidebar

Install

npm i card-scanner

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

10.2 kB

Total Files

7

Last publish

Collaborators

  • webkom