1.0.0 • Published 1 year ago

react-native-honeywell-datacollection v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Native Honeywell Barcode Reader for data collection

This package works with Honeywell devices that have an integrated barcode scanner, like the Honeywell EDA50K (tested).

Installation

npm i react-native-honeywell-datacollection -S

Usage

First you'll want to check whether the device is a Honeywell scanner:

import HoneywellBarcodeReader from 'react-native-honeywell-datacollection';

HoneywellBarcodeReader.isCompatible // true or false

The barcode reader needs to be "claimed" by your application; meanwhile no other application can use it. You can do that like this:

HoneywellBarcodeReader.register().then((claimed) => {
    console.log(claimed ? 'Barcode reader is claimed' : 'Barcode reader is busy');
});

Enable automation the barcode scanner:

HoneywellBarcodeReader.automatic()

To get events from the barcode scanner:

HoneywellBarcodeReader.onBarcodeReadSuccess(event => {
    console.log('Received data', event);
});

HoneywellBarcodeReader.onBarcodeReadFail(() => {
    console.log('Barcode read failed');
});

To free the claim and stop the reader, also freeing up resources:

HoneywellBarcodeReader.unRegister().then(() => {
    console.log('Freedom!');
});

To stop receiving events:

HoneywellBarcodeReader.offBarcodeReadSuccess();
HoneywellBarcodeReader.offBarcodeReadFail();

To get events from the barcode software trigger:

HoneywellBarcodeReader.onTriggerStateChange(state => {
    console.log('onTriggerStateChange', state);
});

To stop receiving events:

HoneywellBarcodeReader.offTriggerStateChange();

Get barcode scanner info:

HoneywellBarcodeReader.barcodeReaderInfo(details => {
    console.log('barcodeReaderClaimed', details);
});