Aggiunto supporto ad Honeywell EDA51
This commit is contained in:
@@ -17,7 +17,9 @@ import com.honeywell.aidc.InvalidScannerNameException;
|
||||
import com.honeywell.aidc.ScannerUnavailableException;
|
||||
import com.honeywell.aidc.UnsupportedPropertyException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import it.integry.plugins.barcode_base_library.exception.BarcodeAdapterNotFoundException;
|
||||
@@ -43,7 +45,11 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
@Override
|
||||
public boolean isRightAdapter() {
|
||||
String model = Build.MODEL;
|
||||
if(model.equalsIgnoreCase("EDA50")) {
|
||||
List<String> compatibleModels = new ArrayList<String>();
|
||||
compatibleModels.add("EDA50");
|
||||
compatibleModels.add("EDA51");
|
||||
|
||||
if(compatibleModels.contains(model)) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
@@ -52,27 +58,23 @@ public class HoneyWellBarcodeReader implements BarcodeReaderInterface {
|
||||
public void init(final Runnable onDeviceReady) throws BarcodeAdapterNotFoundException {
|
||||
if(isRightAdapter()) {
|
||||
|
||||
AidcManager.create(mContext, new AidcManager.CreatedCallback() {
|
||||
AidcManager.create(mContext, aidcManager -> {
|
||||
|
||||
@Override
|
||||
public void onCreated(AidcManager aidcManager) {
|
||||
manager = aidcManager;
|
||||
|
||||
manager = aidcManager;
|
||||
|
||||
try{
|
||||
barcodeReader = manager.createBarcodeReader();
|
||||
registerListenersInternal();
|
||||
}
|
||||
catch (InvalidScannerNameException e){
|
||||
Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
catch (Exception e){
|
||||
Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
onDeviceReady.run();
|
||||
try{
|
||||
barcodeReader = manager.createBarcodeReader();
|
||||
registerListenersInternal();
|
||||
}
|
||||
catch (InvalidScannerNameException e){
|
||||
Toast.makeText(mContext, "Invalid Scanner Name Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
catch (Exception e){
|
||||
Toast.makeText(mContext, "Exception: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
onDeviceReady.run();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user