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

Trouble setting EXTRA_DATA Datawedge v7.0 #109

Closed kylebrennan closed 4 years ago

kylebrennan commented 4 years ago

Hi, I'm having trouble with something, 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

Please take a look at https://github.com/darryncampbell/DataWedgeCordova/blob/master/www/js/index.js#L77, that line sets the ean8 decoder for a particular profile but you would add "aim_type":"5" here for example (note that 5 is a string). I do not have a JSON example of setting scanner properties but this Kotlin code shows the same decoder alongside some properties such as picklist and illumination mode: https://github.com/darryncampbell/DataWedgeKotlin/blob/master/app/src/main/java/com/darryncampbell/datawedgekotlin/DWInterface.kt#L82 Hopefully that gives some context of the structure that SET_CONFIG expects. Also note scanner_selection should be set to auto, https://github.com/darryncampbell/DataWedgeCordova/blob/master/www/js/index.js#L76,

kylebrennan commented 4 years ago

Ah that did it! I needed to add scanner_selection : 'auto'. Thank you!

darryncampbell commented 4 years ago

Glad that resolved it - I have asked the documentation team to highlight the need for scanner_selection as it is a common problem.