darryncampbell / react-native-datawedge-intents

React Native interface for Zebra's DataWedge Intent API
MIT License
43 stars 46 forks source link

Can't Change the Keystroke Profile Settings (Won't Disable) #17

Closed harrisonhm closed 3 years ago

harrisonhm commented 3 years ago

Hi,

I've been slamming at this all day trying to fix an issue we're having with our app. The Keystroke Output is conflicting with our Intent Output. We don't need Keystroke enabled, so the easiest method for us was to just disable it.

I've been trying to disable it all day but am having absolutely no luck with it. The configBundle I'm trying to pass is:

const profileConfig3 = {
    PROFILE_NAME: 'Profile',
    PROFILE_ENABLED: 'true',
    CONFIG_MODE: 'UPDATE',
    PLUGIN_CONFIG: {
      PLUGIN_NAME: 'KEYSTROKE',
      RESET_CONFIG: 'true',
      PARAM_LIST: {
        EXTRA_DATA: {
          keystroke_output_enabled: 'false',
        },
      },
    },
  };

sendCommand('com.symbol.datawedge.api.SET_CONFIG', profileConfig3);

From what I can tell from the docs, this should work, but it just doesn't. No other settings work either, like setting the Inter Character Delay.

darryncampbell commented 3 years ago

Can you please try specifying keystroke_output_enabled as a String?

harrisonhm commented 3 years ago

That has no effect unfortunately.

const profileConfig3 = {
    PROFILE_NAME: 'Profile',
    PROFILE_ENABLED: 'true',
    CONFIG_MODE: 'UPDATE',
    PLUGIN_CONFIG: {
      PLUGIN_NAME: 'KEYSTROKE',
      RESET_CONFIG: 'true',
      PARAM_LIST: {
        EXTRA_DATA: {
          'keystroke_output_enabled': 'false',           // eslint-disable-line
        },
      },
    },
  };
  sendCommand('com.symbol.datawedge.api.SET_CONFIG', profileConfig3);
darryncampbell commented 3 years ago

Please take a look at https://github.com/darryncampbell/DataWedgeReactNative/blob/master/App.js#L66, I think you need to take out the EXTRA_DATA object. I also notice that your keys are not strings but maybe that is because you are using TypeScript and they are converted automatically.

Edit: Just to clarify, other than those points I don't see anything wrong with your code.

harrisonhm commented 3 years ago

I don't believe the issue is regarding the strings. We have Intent Set Config Commands going through fine. I believe this issue is localised to the KEYSTROKE plugin.

I have tried both with and without the EXTRA_DATA object with no joy. The techdocs specifically mention having an EXTRA_DATA object within the bundle, though interestingly the example doesn't include it, hence why i tried both.

darryncampbell commented 3 years ago

The root cause of the problem was that DataWedge requires 'keystroke_output_enabled' to be a String but the module is automatically detecting 'false' as a Boolean and using putBoolean()... I can't think of a clean way to do this so please excuse the ugly code but it does at least work now. Pushed to npm as 0.1.6

harrisonhm commented 3 years ago

Amazing news, I was about to do some monkey-patching to try and figure it out myself. I'll get the new version downloaded and test it!