Commit 86c71ecb by Oscar Fuentes

Merge branch 'development'

parents ec9b0861 9b7f8c1f
{ {
"name": "barcode-scan-chainway", "name": "barcode-scan",
"version": "1.0.0", "version": "1.0.0",
"cordova": { "cordova": {
"id": "barcode-scan-chainway", "id": "barcode-scan",
"platforms": [ "platforms": [
"android" "android"
] ]
}, },
"description": "Chainway barcode scan plugin for hybrid apps." "description": "Cordova Barcode Scan plugin for hybrid apps. Some devices supported: honeywell, chainway, nquire..."
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="barcode-scan-chainway" id="barcode-scan"
version="1.0.0"> version="1.0.0">
<name>Barcode Scan Chainway Cordova plugin</name> <name>Cordova Barcode Scan plugin for hybrid apps. Some devices supported: honeywell, chainway, nquire...</name>
<description></description> <description></description>
<license>MIT</license> <license>MIT</license>
<keywords>barcode, barcode scan, chainway</keywords> <keywords>barcode, barcode scan</keywords>
<repo>http://labs.cocodin.com:8888/cocodin-development-team/barcode-scan-chainway.git</repo> <repo>http://labs.cocodin.com:8888/cocodin-development-team/barcode-scan.git</repo>
<engines> <engines>
<engine name="cordova-android" version=">=6.0.0" /> <engine name="cordova-android" version=">=6.0.0" />
...@@ -15,22 +15,27 @@ ...@@ -15,22 +15,27 @@
<!-- android --> <!-- android -->
<platform name="android"> <platform name="android">
<js-module src="www/android/barcode-scan-chainway.js" name="BarcodeScanChainway"> <js-module src="www/android/barcode-scan.js" name="BarcodeScan">
<runs/> <runs/>
<clobbers target="cordova.plugins.BarcodeScanChainway" /> <clobbers target="cordova.plugins.BarcodeScan" />
</js-module> </js-module>
<framework src="src/android/barcode-scan-chainway.gradle" custom="true" type="gradleReference" /> <framework src="src/android/barcode-scan.gradle" custom="true" type="gradleReference" />
<config-file target="res/xml/config.xml" parent="/*"> <config-file target="res/xml/config.xml" parent="/*">
<feature name="BarcodeScanChainway"> <feature name="BarcodeScan">
<param name="android-package" value="com.cocodin.barcodescan.plugin.BarcodeScanChainway" /> <param name="android-package" value="com.cocodin.barcodescan.plugin.BarcodeScan" />
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
</config-file> </config-file>
<source-file src="src/android/com/cocodin/barcodescan/plugin/BarcodeScanChainway.java" target-dir="src/com/cocodin/barcodescan/plugin" /> <source-file src="src/android/com/cocodin/barcodescan/plugin/BarcodeScan.java" target-dir="src/com/cocodin/barcodescan/plugin" />
<source-file src="src/android/com/cocodin/barcodescan/plugin/PluginHelper.java" target-dir="src/com/cocodin/barcodescan/plugin" /> <source-file src="src/android/com/cocodin/barcodescan/plugin/BaseScan.java" target-dir="src/com/cocodin/barcodescan/plugin" />
<source-file src="src/android/com/cocodin/barcodescan/plugin/devices/C4050.java" target-dir="src/com/cocodin/barcodescan/plugin/devices" />
<source-file src="src/android/com/cocodin/barcodescan/plugin/devices/Camera.java" target-dir="src/com/cocodin/barcodescan/plugin/devices" />
<source-file src="src/android/com/cocodin/barcodescan/plugin/devices/EDA50K.java" target-dir="src/com/cocodin/barcodescan/plugin/devices" />
<source-file src="src/android/com/cocodin/barcodescan/plugin/devices/NQuire300.java" target-dir="src/com/cocodin/barcodescan/plugin/devices" />
<source-file src="src/libs/DeviceAPIver20160627.jar" target-dir="libs" /> <source-file src="src/libs/DeviceAPIver20160627.jar" target-dir="libs" />
<source-file src="src/libs/arm64-v8a/libbarcodereader44.so" target-dir="libs/arm64-v8a" /> <source-file src="src/libs/arm64-v8a/libbarcodereader44.so" target-dir="libs/arm64-v8a" />
<source-file src="src/libs/arm64-v8a/libDeviceAPI.so" target-dir="libs/arm64-v8a" /> <source-file src="src/libs/arm64-v8a/libDeviceAPI.so" target-dir="libs/arm64-v8a" />
...@@ -57,6 +62,7 @@ ...@@ -57,6 +62,7 @@
<source-file src="src/libs/armeabi-v7a/libHsmKil.so" target-dir="libs/armeabi-v7a" /> <source-file src="src/libs/armeabi-v7a/libHsmKil.so" target-dir="libs/armeabi-v7a" />
<source-file src="src/libs/armeabi-v7a/libIAL.so" target-dir="libs/armeabi-v7a" /> <source-file src="src/libs/armeabi-v7a/libIAL.so" target-dir="libs/armeabi-v7a" />
<source-file src="src/libs/armeabi-v7a/libSDL.so" target-dir="libs/armeabi-v7a" /> <source-file src="src/libs/armeabi-v7a/libSDL.so" target-dir="libs/armeabi-v7a" />
<source-file src="src/libs/DataCollection.jar" target-dir="libs" />
</platform> </platform>
</plugin> </plugin>
/**
*/
package com.cocodin.barcodescan.plugin;
import android.util.Log;
import com.cocodin.barcodescan.plugin.devices.*;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.apache.cordova.PluginResult.Status;
import org.json.JSONArray;
import java.util.Arrays;
public class BarcodeScan extends CordovaPlugin {
private static final String TAG = "BarcodeScan";
public static final String CAMERA = "camera";
public static final String C4050 = "c4050";
public static final String NQUIRE300 = "NQuire300";
public static final String EDA50K = "EDA50K";
public static JSONArray jaDevices = new JSONArray(Arrays.asList(CAMERA, C4050, NQUIRE300, EDA50K));
private BaseScan mDevice;
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Log.d(TAG, "Initializing BarcodeScan Plugin");
}
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) {
Log.d(TAG, "execute: " + action);
if (action.equalsIgnoreCase("scan")) {
try {
String deviceName = args.get(0).toString();
//ensure device is created and is the correct device (user could change the device in mobile UI)
if (mDevice == null || !mDevice.getDeviceName().equalsIgnoreCase(deviceName)) {
mDevice = selectDevice(deviceName);
}
mDevice.scan(cordova, webView, args, callbackContext);
}
catch (Exception e) {
Log.e(TAG, e.getMessage());
callbackContext.sendPluginResult(new PluginResult(Status.ERROR, e.getMessage()));
}
} else if (action.equalsIgnoreCase("getDevices")) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, jaDevices));
}
return true;
}
public BaseScan selectDevice(String deviceName) {
if (EDA50K.equalsIgnoreCase(deviceName)) {
return new com.cocodin.barcodescan.plugin.devices.EDA50K();
}
else if (C4050.equalsIgnoreCase(deviceName)) {
return new com.cocodin.barcodescan.plugin.devices.C4050();
}
else if (NQUIRE300.equalsIgnoreCase(deviceName)) {
return new com.cocodin.barcodescan.plugin.devices.NQuire300();
}
else {
return new com.cocodin.barcodescan.plugin.devices.Camera();
}
}
@Override
public void onStart() {
if (mDevice != null) {
mDevice.onStart();
}
super.onStart();
}
@Override
public void onStop() {
if (mDevice != null) {
mDevice.onStop();
}
super.onStop();
}
@Override
public void onPause(boolean multiTasking) {
if (mDevice != null) {
mDevice.onPause(multiTasking);
}
super.onPause(multiTasking);
}
@Override
public void onResume(boolean multiTasking) {
if (mDevice != null) {
mDevice.onResume(multiTasking);
}
super.onResume(multiTasking);
}
@Override
public void onDestroy() {
if (mDevice != null) {
mDevice.onDestroy();
}
super.onDestroy();
}
}
/**
*/
package com.cocodin.barcodescan.plugin;
import android.util.Log;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
public class BarcodeScanChainway extends CordovaPlugin {
private static final String TAG = "BarcodeScan";
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
Log.d(TAG, "Initializing BarcodeScan Plugin");
}
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) {
Log.d(TAG, "execute: " + action);
if (action.equalsIgnoreCase("scan")) {
PluginHelper.scan(cordova, webView, args, callbackContext);
} else if (action.equalsIgnoreCase("getDevices")) {
PluginHelper.getDevices(cordova, webView, args, callbackContext);
}
return true;
}
}
package com.cocodin.barcodescan.plugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
/**
* Created by alberto.doval on 21/10/17.
*/
public abstract class BaseScan {
public abstract String getDeviceName();
public abstract void scan(final CordovaInterface cordova, CordovaWebView webView, JSONArray args, final CallbackContext callbackContext);
public abstract void onStart();
public abstract void onStop();
public abstract void onDestroy();
public abstract void onResume(boolean multitasking);
public abstract void onPause(boolean multitasking);
}
package com.cocodin.barcodescan.plugin; package com.cocodin.barcodescan.plugin.devices;
import java.util.concurrent.ExecutorService; import android.content.Context;
import android.util.Log;
import com.cocodin.barcodescan.plugin.BaseScan;
import com.zebra.adc.decoder.Barcode2DWithSoft; import com.zebra.adc.decoder.Barcode2DWithSoft;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface; import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView; import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.PluginResult; import org.apache.cordova.PluginResult;
import org.apache.cordova.PluginResult.Status;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import android.content.BroadcastReceiver; import org.apache.cordova.PluginResult.Status;
import android.content.Intent;
import android.content.IntentFilter;
import com.phonegap.plugins.barcodescanner.BarcodeScanner; /**
* Created by alberto.doval on 22/10/17.
*/
import android.content.Context; public class C4050 extends BaseScan {
import android.util.Log;
public class PluginHelper { private static final String TAG = "C4050";
private static final String TAG = "PluginHelper";
private static boolean threadStop = true;
private static ExecutorService executor;
private static Barcode2DWithSoft mInstance; private static Barcode2DWithSoft mInstance;
private static boolean MQuireOn = false;
private static BroadcastReceiver barcodeScannerBroadcastReceiver; @Override
private static JSONArray Devices = new JSONArray().put("camera").put("c4050").put("NQuire300"); public String getDeviceName() {
private static CallbackContext cbContext; return TAG;
}
public static void scan(CordovaInterface cordova, CordovaWebView webView, JSONArray args,
final CallbackContext callbackContext) { @Override
String device = ""; public void scan(CordovaInterface cordova, CordovaWebView webView, JSONArray args, final CallbackContext callbackContext) {
try {
device = args.get(0).toString();
if (device.equalsIgnoreCase(Devices.getString(1))) {
Context context = cordova.getActivity(); Context context = cordova.getActivity();
try { try {
mInstance = Barcode2DWithSoft.getInstance(); mInstance = Barcode2DWithSoft.getInstance();
...@@ -64,60 +58,38 @@ public class PluginHelper { ...@@ -64,60 +58,38 @@ public class PluginHelper {
try { try {
JSONObject result = new JSONObject().put("text", barCode); JSONObject result = new JSONObject().put("text", barCode);
callbackContext.sendPluginResult(new PluginResult(Status.OK, result)); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
} catch (JSONException e) { } catch (JSONException e) {
callbackContext.sendPluginResult(new PluginResult(Status.ERROR, e.getMessage())); callbackContext.sendPluginResult(new PluginResult(Status.ERROR, e.getMessage()));
} }
} }
}); });
mInstance.scan(); mInstance.scan();
} else if (device.equalsIgnoreCase(Devices.getString(0))) {
BarcodeScanner barcodeScanner = new BarcodeScanner();
barcodeScanner.cordova = cordova;
barcodeScanner.webView = webView;
barcodeScanner.execute("scan", new JSONArray(), callbackContext);
} else if (device.equalsIgnoreCase(Devices.getString(2))) {
Context context = cordova.getActivity();
cbContext = callbackContext;
if(!MQuireOn) {
initMquire(context);
}
}
} catch (JSONException e) {
e.printStackTrace();
callbackContext.sendPluginResult(new PluginResult(Status.ERROR, ""));
}
} }
public static void getDevices(CordovaInterface cordova, CordovaWebView webView, JSONArray args, @Override
final CallbackContext callbackContext) { public void onStart() {
callbackContext.sendPluginResult(new PluginResult(Status.OK, Devices));
} }
public static void initMquire(Context context) {
Intent intent = new Intent("ACTION_BAR_SCANCFG");
intent.putExtra("EXTRA_SCAN_MODE", 3);
intent.putExtra("EXTRA_SCAN_AUTOENT", 0);
intent.putExtra("EXTRA_SCAN_NOTY_LED", 1);
intent.putExtra("EXTRA_SCAN_NOTY_SND", 1);
context.sendBroadcast(intent);
MQuireOn = true;
barcodeScannerBroadcastReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onStop() {
final String scanResult_1 = intent.getStringExtra("SCAN_BARCODE1");
final String scanStatus = intent.getStringExtra("SCAN_STATE");
if (null == scanResult_1 || null == scanStatus || scanResult_1.isEmpty() || scanStatus.isEmpty()) {
return;
} }
if ("ok".equals(scanStatus)) { @Override
cbContext.success(scanResult_1); public void onDestroy() {
} }
@Override
public void onResume(boolean multitasking) {
} }
};
context.registerReceiver(barcodeScannerBroadcastReceiver, new IntentFilter("nlscan.action.SCANNER_RESULT")); @Override
public void onPause(boolean multitasking) {
} }
} }
package com.cocodin.barcodescan.plugin.devices;
import com.cocodin.barcodescan.plugin.BaseScan;
import com.phonegap.plugins.barcodescanner.BarcodeScanner;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
/**
* Created by alberto.doval on 22/10/17.
*/
public class Camera extends BaseScan {
private static final String TAG = "camera";
@Override
public String getDeviceName() {
return TAG;
}
@Override
public void scan(CordovaInterface cordova, CordovaWebView webView, JSONArray args, CallbackContext callbackContext) {
BarcodeScanner barcodeScanner = new BarcodeScanner();
barcodeScanner.cordova = cordova;
barcodeScanner.webView = webView;
barcodeScanner.execute("scan", new JSONArray(), callbackContext);
}
@Override
public void onStart() {
}
@Override
public void onStop() {
}
@Override
public void onDestroy() {
}
@Override
public void onResume(boolean multitasking) {
}
@Override
public void onPause(boolean multitasking) {
}
}
package com.cocodin.barcodescan.plugin.devices;
import android.util.Log;
import android.widget.Toast;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONObject;
import com.cocodin.barcodescan.plugin.BaseScan;
import com.honeywell.aidc.AidcManager;
import com.honeywell.aidc.AidcManager.CreatedCallback;
import com.honeywell.aidc.BarcodeFailureEvent;
import com.honeywell.aidc.BarcodeReadEvent;
import com.honeywell.aidc.BarcodeReader;
import com.honeywell.aidc.BarcodeReader.BarcodeListener;
import com.honeywell.aidc.ScannerUnavailableException;
import com.honeywell.aidc.UnsupportedPropertyException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by alberto.doval on 22/10/17.
*/
public class EDA50K extends BaseScan implements BarcodeListener {
private static String TAG = EDA50K.class.getName();
private BarcodeReader barcodeReader;
private AidcManager manager;
private CallbackContext currentCallbackContext = null;
@Override
public String getDeviceName() {
return TAG;
}
@Override
public void scan(final CordovaInterface cordova, CordovaWebView webView, JSONArray args, final CallbackContext callbackContext) {
if (manager == null) {
AidcManager.create(cordova.getActivity(), new CreatedCallback() {
@Override
public void onCreated(AidcManager aidcManager) {
manager = aidcManager;
barcodeReader = manager.createBarcodeReader("dcs.scanner.ring");
if (barcodeReader != null) {
barcodeReader.addBarcodeListener(EDA50K.this);
// Map<String, Object> asdfsadf =
// barcodeReader.getAllDefaultProperties();
// for (String key : asdfsadf.keySet()) {
// Log.d("chromium", key + "=" + asdfsadf.get(key));
// }
// set the trigger mode to auto control
try {
barcodeReader.setProperty(BarcodeReader.PROPERTY_TRIGGER_CONTROL_MODE, BarcodeReader.TRIGGER_CONTROL_MODE_AUTO_CONTROL);
} catch (UnsupportedPropertyException e) {
Toast.makeText(cordova.getActivity(), "Failed to apply properties", Toast.LENGTH_SHORT).show();
}
Map<String, Object> properties = new HashMap<String, Object>();
// Set Symbologies On/Off
properties.put(BarcodeReader.PROPERTY_CODE_128_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_GS1_128_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_QR_CODE_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_CODE_39_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_DATAMATRIX_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_UPC_A_ENABLE, true);
properties.put(BarcodeReader.PROPERTY_EAN_13_ENABLED, true);
properties.put(BarcodeReader.PROPERTY_AZTEC_ENABLED, false);
properties.put(BarcodeReader.PROPERTY_CODABAR_ENABLED, false);
properties.put(BarcodeReader.PROPERTY_INTERLEAVED_25_ENABLED, false);
properties.put(BarcodeReader.PROPERTY_PDF_417_ENABLED, false);
// Set Max Code 39 barcode length
properties.put(BarcodeReader.PROPERTY_CODE_39_MAXIMUM_LENGTH, 48);
// Turn on center decoding
properties.put(BarcodeReader.PROPERTY_CENTER_DECODE, true);
// Disable bad read response, handle in onFailureEvent
properties.put(BarcodeReader.PROPERTY_NOTIFICATION_BAD_READ_ENABLED, false);
properties.put(BarcodeReader.PROPERTY_DATA_PROCESSOR_LAUNCH_BROWSER, false);
// Apply the settings
barcodeReader.setProperties(properties);
//Perform first read after initialization
readBarcode(callbackContext);
} else {
callbackContext.error("Failed to open barcode reader");
}
}
});
}
else {
readBarcode(callbackContext);
}
}
@Override
public void onStart() {
}
@Override
public void onStop() {
}
@Override
public void onResume(boolean multitasking) {
super.onResume(multitasking);
if (barcodeReader != null) {
try {
barcodeReader.claim();
} catch (ScannerUnavailableException e) {
e.printStackTrace();
NotifyError("Scanner unavailable");
}
}
}
@Override
public void onPause(boolean multitasking) {
super.onPause(multitasking);
if (barcodeReader != null) {
// release the scanner claim so we don't get any scanner
// notifications while paused.
barcodeReader.release();
}
}
private void readBarcode(CallbackContext callbackContext) {
if (barcodeReader != null) {
try {
barcodeReader.claim();
callbackContext.success();
} catch (ScannerUnavailableException e) {
e.printStackTrace();
callbackContext.error("Unable to claim reader");
}
} else {
callbackContext.error("Reader not open");
}
}
@Override
public void onDestroy() {
if (barcodeReader != null) {
// close BarcodeReader to clean up resources.
barcodeReader.close();
barcodeReader = null;
}
if (manager != null) {
// close AidcManager to disconnect from the scanner service.
// once closed, the object can no longer be used.
manager.close();
}
}
@Override
public void onBarcodeEvent(BarcodeReadEvent barcodeReadEvent) {
Log.d(TAG, barcodeReadEvent.getBarcodeData());
if (currentCallbackContext != null) {
try {
JSONObject obj = new JSONObject();
obj.put("success", true);
obj.put("data", barcodeReadEvent.getBarcodeData());
PluginResult result = new PluginResult(PluginResult.Status.OK, obj);
result.setKeepCallback(true);
currentCallbackContext.sendPluginResult(result);
} catch (Exception x) {
Log.e(TAG, x.getMessage());
}
}
}
@Override
public void onFailureEvent(BarcodeFailureEvent barcodeFailureEvent) {
if (currentCallbackContext != null) {
try {
JSONObject obj = new JSONObject();
obj.put("success", false);
PluginResult result = new PluginResult(PluginResult.Status.OK, obj);
result.setKeepCallback(true);
currentCallbackContext.sendPluginResult(result);
} catch (Exception x) {
Log.e(TAG, x.getMessage());
}
}
}
}
package com.cocodin.barcodescan.plugin.devices;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.cocodin.barcodescan.plugin.BaseScan;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
/**
* Created by alberto.doval on 22/10/17.
*/
public class NQuire300 extends BaseScan {
private static final String TAG = "NQuire300";
private boolean MQuireOn = false;
private BroadcastReceiver barcodeScannerBroadcastReceiver;
@Override
public String getDeviceName() {
return TAG;
}
@Override
public void scan(CordovaInterface cordova, CordovaWebView webView, JSONArray args, CallbackContext callbackContext) {
Context context = cordova.getActivity();
//cbContext = callbackContext;
if (!MQuireOn) {
initMquire(context, callbackContext);
}
}
@Override
public void onStart() {
}
@Override
public void onStop() {
}
@Override
public void onDestroy() {
}
@Override
public void onResume(boolean multitasking) {
}
@Override
public void onPause(boolean multitasking) {
}
private void initMquire(Context context, final CallbackContext callbackContext) {
Intent intent = new Intent("ACTION_BAR_SCANCFG");
intent.putExtra("EXTRA_SCAN_MODE", 3);
intent.putExtra("EXTRA_SCAN_AUTOENT", 0);
intent.putExtra("EXTRA_SCAN_NOTY_LED", 1);
intent.putExtra("EXTRA_SCAN_NOTY_SND", 1);
context.sendBroadcast(intent);
MQuireOn = true;
barcodeScannerBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String scanResult_1 = intent.getStringExtra("SCAN_BARCODE1");
final String scanStatus = intent.getStringExtra("SCAN_STATE");
if (null == scanResult_1 || null == scanStatus || scanResult_1.isEmpty() || scanStatus.isEmpty()) {
return;
}
if ("ok".equals(scanStatus)) {
callbackContext.success(scanResult_1);
}
}
};
context.registerReceiver(barcodeScannerBroadcastReceiver, new IntentFilter("nlscan.action.SCANNER_RESULT"));
}
}
var exec = require('cordova/exec'); var exec = require('cordova/exec');
var PLUGIN_NAME = 'BarcodeScanChainway'; var PLUGIN_NAME = 'BarcodeScan';
var BarcodeScanChainway = { var BarcodeScan = {
scan: function (device, cb, error) { scan: function (device, cb, error) {
exec(cb, error, PLUGIN_NAME, 'scan', [device]); exec(cb, error, PLUGIN_NAME, 'scan', [device]);
}, },
...@@ -10,4 +10,4 @@ ...@@ -10,4 +10,4 @@
exec(cb, error, PLUGIN_NAME, 'getDevices', []); exec(cb, error, PLUGIN_NAME, 'getDevices', []);
} }
}; };
module.exports = BarcodeScanChainway; module.exports = BarcodeScan;
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment