Skip to content

syware/cordova-plugin-scanner-u8000s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova Plugin For U8000S Scanner

Cordova plugin to manage the scanner on a U8000S device.

Installation

The plugin can be installed via Cordova-CLI.

Execute from the projects root folder:

$ cordova plugin add https://github.com/syware/cordova-plugin-scanner-u8000s.git

Remove

To remove the plugin

$ cordova plugin remove cordova-plugin-scanner-u8000s

Usage

The plugin creates the object ScanPlugin and is accessible after deviceready has been fired.

document.addEventListener('deviceready', function () {
    // ScanPlugin is now available
}, false);

Enable/Disable the scanner

When the scanner is enable, it allows you to trigger the scan with the hardware key

// Enable
ScanPlugin.openScanner();

// Disable
ScanPlugin.closeScanner();

To catch the barcode you should set a callback with the register function

// Register a callback to manage the scan object
ScanPlugin.register(
  function (barcode) {
    console.log(barcode) // What barcode was scanned
  },
  function (error) {
    console.log(error) // Catch the error
  }
)

When the callback is fired, you have to set it again to catch the next barcode

Trigger manually the scanner

With that function you can trigger the scan by software

// Trigger the scanner manually (by software)
ScanPlugin.startDecode(
  function (barcode) {
   console.log(barcode) // What barcode was scanned
  },
  function (error) {
   console.log(error) // Catch the error
  }
)

// Stop the scanner
ScanPlugin.stopDecode()

License

This software is released under the Apache 2.0 License.

© 2017 Syware Sàrl

About

Cordova Plugin to manage barcode scanner on U8000S

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors