Commit cd9e2c0b by Oscar Fuentes

Added support for honeywell

parent ee4bd87a
......@@ -57,6 +57,7 @@
<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/libSDL.so" target-dir="libs/armeabi-v7a" />
<source-file src="src/libs/DataCollection.jar" target-dir="libs" />
</platform>
</plugin>
package com.cocodin.barcodescan.plugin;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import com.zebra.adc.decoder.Barcode2DWithSoft;
......@@ -15,12 +17,16 @@ import org.json.JSONObject;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import com.honeywell.aidc.AidcManager.CreatedCallback;
import com.phonegap.plugins.barcodescanner.BarcodeScanner;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.util.Log;
import android.widget.ListView;
import android.widget.Toast;
import com.honeywell.aidc.*;
public class PluginHelper {
......@@ -30,10 +36,12 @@ public class PluginHelper {
private static Barcode2DWithSoft mInstance;
private static boolean MQuireOn = false;
private static BroadcastReceiver barcodeScannerBroadcastReceiver;
private static JSONArray Devices = new JSONArray().put("camera").put("c4050").put("NQuire300");
private static JSONArray Devices = new JSONArray().put("camera").put("c4050").put("NQuire300").put("EDA50K");
private static CallbackContext cbContext;
private static BarcodeReader barcodeReader;
private static AidcManager manager;
public static void scan(CordovaInterface cordova, CordovaWebView webView, JSONArray args,
public static void scan(final CordovaInterface cordova, CordovaWebView webView, JSONArray args,
final CallbackContext callbackContext) {
String device = "";
try {
......@@ -81,9 +89,85 @@ public class PluginHelper {
} else if (device.equalsIgnoreCase(Devices.getString(2))) {
Context context = cordova.getActivity();
cbContext = callbackContext;
if(!MQuireOn) {
if (!MQuireOn) {
initMquire(context);
}
} else if (device.equalsIgnoreCase(Devices.getString(3))) {
final Context context = cordova.getActivity();
AidcManager.create(context, new CreatedCallback() {
@Override
public void onCreated(AidcManager aidcManager) {
manager = aidcManager;
barcodeReader = manager.createBarcodeReader();
if (barcodeReader != null) {
// register bar code event listener
barcodeReader.addBarcodeListener(new BarcodeReader.BarcodeListener() {
@Override
public void onBarcodeEvent(BarcodeReadEvent barcodeReadEvent) {
callbackContext.sendPluginResult(
new PluginResult(Status.OK, barcodeReadEvent.getBarcodeData()));
}
@Override
public void onFailureEvent(BarcodeFailureEvent barcodeFailureEvent) {
callbackContext.sendPluginResult(
new PluginResult(Status.ERROR, barcodeFailureEvent.toString()));
}
});
// set the trigger mode to client control
try {
barcodeReader.setProperty(BarcodeReader.PROPERTY_TRIGGER_CONTROL_MODE,
BarcodeReader.TRIGGER_CONTROL_MODE_CLIENT_CONTROL);
} catch (UnsupportedPropertyException e) {
callbackContext
.sendPluginResult(new PluginResult(Status.ERROR, "Failed to apply properties"));
}
// register trigger state change listener
barcodeReader.addTriggerListener(new BarcodeReader.TriggerListener() {
@Override
public void onTriggerEvent(TriggerStateChangeEvent event) {
try {
// only handle trigger presses
// turn on/off aimer, illumination and decoding
barcodeReader.aim(event.getState());
barcodeReader.light(event.getState());
barcodeReader.decode(event.getState());
} catch (ScannerNotClaimedException e) {
e.printStackTrace();
} catch (ScannerUnavailableException e) {
e.printStackTrace();
}
}
});
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, false);
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, 10);
// 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);
// Apply the settings
barcodeReader.setProperties(properties);
}
}
});
}
} catch (JSONException e) {
e.printStackTrace();
......
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