cordova-plugin-zebra-scanner-spectrum-2.0

1.0.12 • Public • Published

Zebra Barcode

This plugin defines an window.plugins.zebra.scanner object which provides an API for interacting with scanner hardware scanner on Zebra devices.
The window.plugins.zebra.scanner object is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(window.plugins.zebra.scanner);
}

This plugin is based on https://github.com/darryncampbell/EnterpriseBarcodePoC by Darryn Campbell

Install

Cordova: cordova plugin add cordova-plugin-zebra-scanner-spectrum-2.0

Tested successfully with

  • Zebra TC21 - Android 10

Supported Platforms

  • Android

window.plugins.zebra.scanner.available

Boolean which is true when the EMDK scanner is available on the device.

Example

if (window.plugins.zebra.scanner.available) {
    console.log("EMDK is available");
);

window.plugins.zebra.scanner.startHardRead

Enables the barcode scanner hardware and the associated trigger, so pressing the hardware trigger will initiate a scan.

window.plugins.zebra.scanner.startHardRead(enableSuccess, enableFailure);

Example

window.plugins.zebra.scanner.startHardRead(
    function (scannedObj) {
        console.log("Scan data: " + scannedObj.data);
        console.log("Scan symbology: "  + scannedObj.type);
        console.log("Scan time: " + scannedObj.timestamp);
    },
    function (status) {
        console.log("Scanner failure: " + status.message);
    }
);

window.plugins.zebra.scanner.startSoftRead

Enables the barcode scanner hardware and the associated trigger, it will start scanning immediately without the need of a hardware trigger.

window.plugins.zebra.scanner.startSoftRead(enableSuccess, enableFailure);

Example

window.plugins.zebra.scanner.startSoftRead(
    function (scannedObj) {
        console.log("Scan data: " + scannedObj.data);
        console.log("Scan symbology: "  + scannedObj.type);
        console.log("Scan time: " + scannedObj.timestamp);
    },
    function (status) {
        console.log("Scanner failure: " + status.message);
    }
);

window.plugins.zebra.scanner.stopReading

Stops the currently active scan.

window.plugins.zebra.scanner.stopReading();

Package Sidebar

Install

npm i cordova-plugin-zebra-scanner-spectrum-2.0

Weekly Downloads

0

Version

1.0.12

License

MIT

Unpacked Size

228 kB

Total Files

8

Last publish

Collaborators

  • marius.siminescu