Skip to content

Commit

Permalink
decoder_i2of5_convert_to_ean13 is deprecated.
Browse files Browse the repository at this point in the history
If used, the code will throw an exception (this parameter is a copy/paste error)
Use the right parameter instead: decoder_itf14_convert_to_ean13
  • Loading branch information
ltrudu committed Jun 16, 2022
1 parent c3333f8 commit 005c4c4
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 15 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ allprojects {
ext {
compileSdkVersion = 30
buildToolsVersion = '31.0.0'
versionName = '1.4'
versionName = '6.7.9'
}

task clean(type: Delete) {
Expand Down
4 changes: 2 additions & 2 deletions datawedgeprofileintentswrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
versionCode 5
versionName "1.4"
versionCode 6
versionName "6.7.9"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.os.Bundle;
import android.util.Pair;
import android.widget.Toast;

import com.zebra.datawedgeprofileenums.MB_E_CONFIG_MODE;
import com.zebra.datawedgeprofileintents.SettingsPlugins.BaseSettings;
Expand Down Expand Up @@ -85,7 +86,13 @@ private void setProfileConfig(DWProfileSetConfigSettings settings)
ArrayList<Bundle> pluginConfigs = new ArrayList<Bundle>();

// Add barcode plugin config
pluginConfigs.add(settings.ScannerPlugin.getBarcodePluginBundleForSetConfig(true));
try {
pluginConfigs.add(settings.ScannerPlugin.getBarcodePluginBundleForSetConfig(true));
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_LONG);
System.exit(0);
}

// Add keystroke plugin config (disabled in this case)
pluginConfigs.add(settings.KeystrokePlugin.getKeyStrokePluginBundle(true));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.zebra.datawedgeprofileintents;

import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

/**
* Created by laure on 16/04/2018.
Expand All @@ -20,9 +22,21 @@ public void execute(DWProfileSwitchBarcodeParamsSettings settings, onProfileComm
*/
super.execute(settings, callback);

/*
Get the Bundle configuration for parameters switch
*/
Bundle params = null;
try {
params = settings.ScannerPlugin.getBarcodePluginBundleForSwitchParams();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_LONG);
System.exit(0);
}
/*
Execute the profile using only the difference between original and destination settings
*/
sendDataWedgeIntentWithExtraRequestResult(DataWedgeConstants.ACTION_DATAWEDGE_FROM_6_2, DataWedgeConstants.EXTRA_SWITCH_SCANNER_PARAMS, settings.ScannerPlugin.getBarcodePluginBundleForSwitchParams());
if(params != null)
sendDataWedgeIntentWithExtraRequestResult(DataWedgeConstants.ACTION_DATAWEDGE_FROM_6_2, DataWedgeConstants.EXTRA_SWITCH_SCANNER_PARAMS, params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Created by Trudu Laurent on 22/11/2016.
*/
public class DataWedgeConstants {

public static final String TAG = "DWIWrap";
// Let's define some intent strings
// This intent string contains the source of the data as a string
public static final String SOURCE_TAG = "com.motorolasolutions.emdk.datawedge.source";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.zebra.datawedgeprofileintents.SettingsPlugins;

import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.zebra.datawedgeprofileenums.SC_E_1D_MARGINLESS_DECODE_EFFORT_LEVEL;
import com.zebra.datawedgeprofileenums.SC_E_AIM_MODE;
Expand Down Expand Up @@ -30,6 +32,7 @@
import com.zebra.datawedgeprofileenums.SC_E_UPCEAN_SUPPLEMENTAL_MODE;
import com.zebra.datawedgeprofileenums.SC_E_VOLUME_SLIDER_TYPE;
import com.zebra.datawedgeprofileintents.DWProfileSetConfigSettings;
import com.zebra.datawedgeprofileintents.DataWedgeConstants;

import androidx.annotation.RequiresPermission;

Expand Down Expand Up @@ -167,6 +170,7 @@ public class DecodersParams {
public Boolean decoder_i2of5_redundancy = null;
public Boolean decoder_i2of5_report_check_digit = null;
public SC_E_SECURITY_LEVEL decoder_i2of5_security_level = null;
@Deprecated
public Boolean decoder_i2of5_convert_to_ean13 = null;
public Boolean decoder_itf14_convert_to_ean13 = null;

Expand Down Expand Up @@ -294,8 +298,7 @@ public class MarginLess
public Boolean trigger_wakeup = null;


public Bundle getBarcodePluginBundleForSetConfig(boolean resetConfig)
{
public Bundle getBarcodePluginBundleForSetConfig(boolean resetConfig) throws Exception {
// Barcode plugin configuration
Bundle barcodePluginConfig = new Bundle();
barcodePluginConfig.putString("PLUGIN_NAME", "BARCODE");
Expand All @@ -309,8 +312,7 @@ public Bundle getBarcodePluginBundleForSetConfig(boolean resetConfig)
return barcodePluginConfig;
}

private void setupScannerPlugin(Bundle barcodeProps)
{
private void setupScannerPlugin(Bundle barcodeProps) throws Exception {
barcodeProps.putString("scanner_input_enabled", scanner_input_enabled ? "true" : "false");

// Use this for Datawedge < 6.7
Expand Down Expand Up @@ -388,8 +390,7 @@ private void setupDecoders(Bundle barcodeProps) {
if(Decoders.decoder_webcode != null ) barcodeProps.putString( "decoder_webcode" , Decoders.decoder_webcode ? "true":"false");
}

private void setupDecodersParams(Bundle barcodeProps)
{
private void setupDecodersParams(Bundle barcodeProps) throws Exception {
if(DecodersParams.decoder_codabar_clsi_editing != null ) barcodeProps.putString( "decoder_codabar_clsi_editing" , DecodersParams.decoder_codabar_clsi_editing ? "true":"false");
if(DecodersParams.decoder_codabar_length1 != null ) barcodeProps.putString( "decoder_codabar_length1" , DecodersParams.decoder_codabar_length1.toString() );
if(DecodersParams.decoder_codabar_length2 != null ) barcodeProps.putString( "decoder_codabar_length2" , DecodersParams.decoder_codabar_length2.toString() );
Expand Down Expand Up @@ -437,7 +438,13 @@ private void setupDecodersParams(Bundle barcodeProps)
if(DecodersParams.decoder_i2of5_redundancy != null ) barcodeProps.putString( "decoder_i2of5_redundancy" , DecodersParams.decoder_i2of5_redundancy ? "true":"false");
if(DecodersParams.decoder_i2of5_report_check_digit != null ) barcodeProps.putString( "decoder_i2of5_report_check_digit" , DecodersParams.decoder_i2of5_report_check_digit ? "true" : "false" );
if(DecodersParams.decoder_i2of5_security_level != null ) barcodeProps.putString( "decoder_i2of5_security_level" , DecodersParams.decoder_i2of5_security_level.toString() );
if(DecodersParams.decoder_i2of5_convert_to_ean13 != null ) barcodeProps.putString( "decoder_i2of5_convert_to_ean13" , DecodersParams.decoder_i2of5_convert_to_ean13 ? "true":"false");

if(DecodersParams.decoder_i2of5_convert_to_ean13 != null )
{
Log.e(DataWedgeConstants.TAG, "decoder_i2of5_convert_to_ean13 is deprecated. Contact your developer for code update. It has been replaced by decoder_itf14_convert_to_ean13");
throw new Exception("decoder_i2of5_convert_to_ean13 is deprecated. Contact your developer for code update. It has been replaced by decoder_itf14_convert_to_ean13");
}

if(DecodersParams.decoder_itf14_convert_to_ean13 != null ) barcodeProps.putString( "decoder_itf14_convert_to_ean13" , DecodersParams.decoder_itf14_convert_to_ean13 ? "true":"false");
if(DecodersParams.decoder_matrix_2of5_length1 != null ) barcodeProps.putString( "decoder_matrix_2of5_length1" , DecodersParams.decoder_matrix_2of5_length1.toString() );
if(DecodersParams.decoder_matrix_2of5_length2 != null ) barcodeProps.putString( "decoder_matrix_2of5_length2" , DecodersParams.decoder_matrix_2of5_length2.toString() );
Expand Down Expand Up @@ -625,8 +632,7 @@ public Bundle getBarcodePluginBundleForSwitchParams(PluginScanner configToBeComp
* Use this method if you want to force all parameters to be switched
* @return
*/
public Bundle getBarcodePluginBundleForSwitchParams()
{
public Bundle getBarcodePluginBundleForSwitchParams() throws Exception {
// Pass everything to the bundle
Bundle barcodeProps = new Bundle();

Expand Down

0 comments on commit 005c4c4

Please sign in to comment.