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

cordova-zebra-scanner

v1.0.3

Published

Cordova plugin to interface with Zebra barcode scanners (on Android)

Downloads

23

Readme

Zebra USB Barcode Scanner Plugin for Android

Overview

This plugin provides a (reasonably) easy-to-use interface for the following supported Zebra USB barcode scanners:

• PL3307
• DS457 (Tested)
• DS4308
• LS2208
• DS6878 and Presentation Cradle
• MP6210 (CSS + Scale) + EAS (Sensormatic).

Bluetooth support is possible, but not implemented. Theoretically, that would add support for the following models:

• CS4070 (in Bluetooth SSI Profile mode)
• LI4278 (in SSI Host Server mode or Cradle Host mode by scanning pairing bar code)
• DS6878 (in SSI Host Server mode or Cradle Host mode by scanning pairing bar code)
• RFD8500 (in default mode)
• DS3678 (In SSI BT Classic mode)
• LI3678 (In SSI BT Classic mode).

A sample Ionic implementation of this plugin can be found here.
This plugin is implemented in /src/pages/home/

Setup

Cordova CLI

  • From your project directory, run cordova plugin add cordova-zebra-scanner.

Manual

  • Copy the plugin to /plugins/com.michaelmay.cordova.plugin.barcodescanner in your Cordova-based project.
  • (If necessary) Remove and re-add the Android platform to add the plugin to your project.

Implementation

The plugin provides only two methods for you to interface with.

  • cordova.plugins.barcodescanner.attachHandlers
  • cordova.plugins.barcodescanner.connectToScanner

Method: attachHandlers(cb): Object

Used to listen and react to scanner events. Provide a callback function that will handle the different scanner events you want to react to. An Object is passed to the callback.

This single function is shared in the Java code of the Cordova plugin, so make sure you listen to all the events you want to react to. Subsequent calls to this method will erase previous listeners on the native side.

Object Response:

{
	eventType: 'barcodeEvent' | 'scannerPluggedIn' | 'scannerUnplugged' | 'scannerConnected' | 'scannerDisconnected',
	payload: (barcodeEvent only) {
		{
			scannerId: <number>,
			barcodeType: <string>,
			barcodeData: <string>
		}
	}
}

Example:

cordova.plugins.barcodescanner.attachHandlers((ev) => {
	switch(ev.eventType) {
		case 'barcodeEvent':
			// Got a barcode of some sort
			break;
		case 'scannerPluggedIn':
			// Scanner physically plugged in.
			break;
		case 'scannerUnplugged':
			// Scanner physically unplugged.
			break;
		case 'scannerConnected':
			// Scanner is available for use.
			break;
		case 'scannerDisconnected':
			// Scanner is not available or initialized.
			break;
	}
});

Method: connectToScanner(cb): Object

Used to manage scanner connection state. This must be called to initialize scanning functionality. Provide a callback function to handle the responses from the native side. An Object is passed to the callback.

After calling the function, you will receive one of two responses.

If you receive the following response, you're set to go:

Object Response (Success):

{
	status: 'paired',
	message: <string>
}

If you don't you'll see a response like this:

Object Response (Not Paired):

{
	status: 'pairingRequired',
	connectionBarcode: <base64 encoded jpeg>
}

Display the barcode somewhere on the screen, and scan it with your scanner to pair the device.

Example:

cordova.plugins.barcodescanner.connectToScanner((result) => {
	switch(result.status) {
		case 'pairingRequired':
			// Handle barcode display. Pairing needed before scanning will work.
			break;
		case 'paired':
			// Ready to scan.
			break;
	}
});