darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 130 forks source link

Unable to set EXTRA_DATA params to BARCODE plugin #106

Closed nicolomanni closed 4 years ago

nicolomanni commented 4 years ago

Hi Darryn,

i'm trying to set/update EXTRA_DATA params like decoder_code39_convert_to_code32 without success.

This is my configuration that I send to 'com.symbol.datawedge.api.SET_CONFIG':

const profileConfig = { PROFILE_NAME: AppProfileName, PROFILE_ENABLED: 'true', CONFIG_MODE: 'UPDATE', PLUGIN_CONFIG: { PLUGIN_NAME: 'BARCODE', RESET_CONFIG: 'true', PARAM_LIST: { EXTRA_DATA: { decoder_code39: 'true', decoder_code39_convert_to_code32: 'true', }, }, }, APP_LIST: [ { PACKAGE_NAME: AppBuildName, ACTIVITY_LIST: ['*'], }, ], }

DataWedge version 7.0.4 Where am I wrong?

darryncampbell commented 4 years ago

Looks like you have some invalid JSON, please take a look at https://github.com/darryncampbell/DataWedgeCordova/blob/master/www/js/index.js#L68 which is a known working example and build from there.

I usually use http://json.parser.online.fr/ to find any JSON errors

nicolomanni commented 4 years ago

Sorry for the code formatting. The configuration updated is: immagine

The datawedge profile is correctly created as before with decoder_code39 option set to true but without the option decoder_code39_convert_to_code32

I'm following this guide: https://techdocs.zebra.com/datawedge/7-6/guide/api/setconfig/ How can I pass it the EXTRA_DATA decoder Parameters?

darryncampbell commented 4 years ago

That's still not valid JSON though is it? I mean you have trailing commas at the end of your lists. Also, things like PROFILE_NAME should be strings.

nicolomanni commented 4 years ago

That's my typescript object that will be converted to JSON when sent to datawedge API just like the example you given me: https://github.com/darryncampbell/DataWedgeCordova/blob/master/www/js/index.js#L68.

The trailing commas are added automatically from the Prettierjs/TSlint configuration, in no way affects the generation of the JSON.

AppProfileName and AppBuildName are variables that contain the name and the buildName of my application.

darryncampbell commented 4 years ago

:/ I don't know... the next step would be to test with native code to see if it is a bug in DataWedge or something else. I will try to take a look if I get a chance over the next few days - the plan is to just modify https://github.com/ZebraDevs/samples-datawedge/blob/master/DataWedge-API-Exerciser/app/src/main/java/com/zebra/datawedgeexerciser/MainActivity.java#L324 to add the convert_to_code32 attribute and see if that works.

darryncampbell commented 4 years ago

You are passing the correct strings at the correct place, I tested with:

barcodeProps.putString("decoder_code39", "true");
barcodeProps.putString("decoder_code39_convert_to_code32", "true");

in native code as I said in my previous comment and that works. You might want to try specifying

scanner_selection: 'auto'

To ensure you are applying the configuration to the correct scanner

kylebrennan commented 4 years ago

Hi, I'm having trouble with something similar, and I was hoping you could help out. I'm trying to set extra parameters on my barcode scanner profile (ie aim_type, same_barcode_timeout, decode_haptic_feedback, etc), and nothing I'm doing is changing the settings on my profile. I'm confused by this line in the docs:

BARCODE – takes a value from the Scanner Input Parameters table below; specify decoder and other input settings as EXTRA_DATA in the PARAM_LIST nested bundle.

What does it mean EXTRA_DATA? Is that just supposed to be another JSON object? Here is what I have:

const profileConfig: DatawedgeProfileConfig = {
      PROFILE_NAME: 'InventoryManagement',
      PROFILE_ENABLED: 'true',
      CONFIG_MODE: 'OVERWRITE',
      PLUGIN_CONFIG: {
        PLUGIN_NAME: 'BARCODE',
        RESET_CONFIG: 'true',
        PARAM_LIST: {
          configure_all_scanners: 'true',
          scanner_input_enabled: 'true',
          beam_timer: '60000',
          same_barcode_timeout: '5000',
          different_barcode_timeout: '0',
          aim_type: '5',
          upc_enable_marginless_decode: 'true',
          '1d_marginless_decode_effort_level': '3',
          poor_quality_bcdecode_effort_level: '3',
          decode_haptic_feedback: 'true',
          decoding_led_feedback: 'true',
        },
      },
      APP_LIST: [
        {
          PACKAGE_NAME: ApplicationConstants.APP_STRING,
          ACTIVITY_LIST: ['*'],
        },
      ],
    };

I've also tried changing PARAM_LIST to:

PARAM_LIST: {
          configure_all_scanners: 'true',
          scanner_input_enabled: 'true',
          EXTRA_DATA: {
              beam_timer: '60000',
              same_barcode_timeout: '5000',
              different_barcode_timeout: '0',
              aim_type: '5',
              upc_enable_marginless_decode: 'true',
              '1d_marginless_decode_effort_level': '3',
              poor_quality_bcdecode_effort_level: '3',
              decode_haptic_feedback: 'true',
              decoding_led_feedback: 'true',
          }
},

but still no luck. The profile is created when I make the setProfile call, but the extra settings are never updated in either case. Can anyone provide some insight here? Thank you.

darryncampbell commented 4 years ago

Hi @kylebrennan , sorry I just saw your comment - are you still facing issues? There is a demo app that calls the DataWedge API at https://github.com/darryncampbell/DataWedgeCordova.

darryncampbell commented 4 years ago

For the original issue, I have asked the docs team to update the docs & examples to clarify that the scanner must be specified as part of the call to SET_CONFIG: https://techdocs.zebra.com/datawedge/8-0/guide/api/setconfig/ (we had another, very similar issue raised along these same lines)

darryncampbell commented 4 years ago

Techdocs has now been updated.