barcode-speech-scanner

This scanner takes a list of vehicles by year, make, and model and VINs and return a list of scanned VIN scanned by CODE_39, CODE_128, QR_CODE, or DATA_MATRIX barcodes and returns back a list of scanned VINs.


Keywords
ecosystem:cordova, ecosystem:phonegap, cordova-ios, cordova-android, cordova-windows, cordova-browser, cordova:plugin
License
MIT
Install
npm install barcode-speech-scanner@7.1.17

Documentation

Barcode Speech Scanner. This is a dual plugin to scan a list of barcodes, or last 6 characters of speech recording, or manual input for VINs only. It returns a list of successfully scanned VINs and the method used of reach: BARCODE, SPEECH, MANUAL_INPUT

#***iOS VERSION NOT WORKING FOR VERSIONS: 7.1.11, 7.1.12, 7.1.13, 7.1.14

Latest version: 7.1.14

New input of comma separated list of VINS: "vin1,vin2,vin3..." and comma separated list of vehicle info: "Year1 Make1 Model1, Year2 Make2 Model2, Year3 Make3 Model3, ...". It returns a list of successful VINs scanned. These can me matched to the ones to be scanned and removed from the list to be used for the next scan.

Version 7.1.9

Returns the scanned barcode text or an array of speech recognition responses.(VINs and vehicles are not options.)

Build Status

Cross-platform BarcodeScanner for Cordova / PhoneGap.

Follows the Cordova Plugin spec, so that it works with Plugman.

Installation

This requires phonegap 7.1.0+ ( current stable v8.0.0 )

phonegap/cordvoa plugin add barcode-speech-scanner

It is also possible to install via repo url directly ( unstable )

phonegap/cordvoa plugin add https://github.com/kharryman/barcode-speech-scanner.git

Optional variables: This plugin requires the Android support library v4. The minimum version is 24.1.0. Default value is 27.+. Check out the latest version here.

phonegap/cordova plugin add barcode-speech-scanner --variable ANDROID_SUPPORT_V4_VERSION="27.1.1"

Supported Platforms

  • Android
  • iOS

Note: the Android source for this project includes an Android Library Project. plugman currently doesn't support Library Project refs, so its been prebuilt as a jar library. Any updates to the Library Project should be committed with an updated jar.

Note: Windows 10 applications can not be build for AnyCPU architecture, which is default for Windows platform. If you want to build/run Windows 10 app, you should specify target architecture explicitly, for example (Cordova CLI):

cordova run windows -- --archs=x86

PhoneGap Build Usage

Add the following to your config.xml:

<!-- add a version here, otherwise PGB will use whatever the latest version of the package on npm is -->
<plugin name="phonegap-plugin-barcodescanner" />

On PhoneGap Build if you're using a version of cordova-android of 4 or less, ensure you're building with gradle:

<preference name="android-build-tool" value="gradle" />

Using the plugin

The plugin creates the object cordova.plugins.barcodeScanner with the methods:

  1. scan(success, fail).
  2. requestPermission(success, fail) FOR iOS only, Android camera/speech permissions is automatic.
  3. isRecognitionAvailable(success, fail)

The only barcode type supported is for CODE_39, or VINs of automobiles:

Barcode Type Android iOS Windows
CODE_39
CODE_128
DATA_MATRIX
QR_CODE

success and fail are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.

**NOTE: isSpeechRecognitionAvailable must be passed in options, meaning cordova.plugin.barcodeScanner.isRecognitionAvailable must called first: A full example could be:

   cordova.plugins.barcodeScanner.scan(
      function (result) {      
          var vinsScanned = JSON.parse(result.text);
          alert("VINs scanned:\n" + vinsScanned.join('\n'));
      },
      function (error) {
          alert("Scanning failed: " + error);
      },
      {
          VINs: "VIN1,VIN2,VIN3",
          vehicles: "Year1 Make1 Model1, Year2 Make2 Model2, Year3 Make3 Model3",
          isSpeechRecognitionAvailable: canSpeak,
          preferFrontCamera : true, // iOS and Android
          showFlipCameraButton : true, // iOS and Android
          showTorchButton : true, // iOS and Android
          torchOn: true, // Android, launch with the torch switched on (if available)
          saveHistory: true, // Android, save scan history (default false)
          prompt : "Place a barcode inside the scan area", // Android
          resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
          formats : "QR_CODE,CODE_39, CODE_128, DATA_MATRIX",
          orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device
          disableAnimations : true, // iOS
          disableSuccessBeep: false // iOS and Android
      }
   );

iOS quirks

Since iOS 10 it's mandatory to add a NSCameraUsageDescription in the Info.plist, also speech recognition only available on iOS 10+.

NSCameraUsageDescription describes the reason that the app accesses the user's camera. When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.

To add this entry you can use the edit-config tag in the config.xml like this:

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>To scan barcodes</string>
</edit-config>

Thanks on Github

So many -- check out the original iOS, Android and BlackBerry 10 repos.

Licence

The MIT License

Copyright (c) 2010 Matt Kane

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.