darryncampbell / react-native-datawedge-intents

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

Cannot disable the Keystroke Output by using SET_CONFIG command #7

Closed janowskipio closed 4 years ago

janowskipio commented 4 years ago

First of all, big thanks for this lib as it has made my development a lot faster! Currently, I'm trying to disable the keystrokes output to prevent injecting scanned values when any of the input is focused.

Please also ensure you disable the keyboard output plugin to avoid undesired effects on your application: thread.

The above link doesn't work anymore.

I'm using TC56DJ device with DataWedge v. 7.0.4. I'm trying to disable the keystroke output by using com.symbol.datawedge.api.SET_CONFIG command. I'm using App.js as the code base.

I can successfully change all of the other fields' values like keystroke_action_character, keystroke_delay_control_characters etc., but after using "keystroke_output_enabled": "false" I still have Keystrokes enabled (after playing with SET_CONFIG, I'm testing behavior in the app and checking DataWedge android app profile). Changing it manually to false (unchecked checkbox) in the DataWedge profile and then using "keystroke_output_enabled": "true", doesn't change it to the checked state either, so it seems like this field is just skipped.

I'm sending one, additional SET_CONFIG command:

    const profileConfig3 = {
        "PROFILE_NAME": "customProfileName", // same as in the previous profileConfigs
        "PROFILE_ENABLED": "true",
        "CONFIG_MODE": "UPDATE",
        "PLUGIN_CONFIG": {
            "PLUGIN_NAME": "KEYSTROKE",
            "RESET_CONFIG": "true",
            "PARAM_LIST": {
                "keystroke_output_enabled": "false",
            }
        }
    };
    this.sendCommand("com.symbol.datawedge.api.SET_CONFIG", profileConfig3)

Do you have any clue why the above is not working? Thanks in advance!

darryncampbell commented 4 years ago

Your code looks fine, I am not sure why it would not be working. I will try and take a look but it might not be until next week I'm afraid as I am at Droidcon tomorrow / Friday

lukevp commented 4 years ago

@janowskipio I have noticed a couple issues w/ sending multiple config updates back to back without waiting for the previous config edits to apply. Have you tried sending this last config w/ a long delay before it so they're not all running at once? like do a setTimeout with a long delay. I have a version of the DW libraries that has synchonous config setting, but it's still a WIP. it's part of the hooks/typescript migration I'm doing on the demo app so I'll eventually have a PR for it for this lib and for the demo app. You're welcome to take a look at my in progress rewrite @ https://github.com/lukevp/DataWedgeReactNative/tree/convert-to-library

janowskipio commented 4 years ago

@lukevp It's not a problem with multiple config updates (at least in my case). I've tried with setTimeout 1000ms, still not working. But tbh it can't be connected because changing other values from https://techdocs.zebra.com/datawedge/6-5/guide/api/setconfig/#keystrokeoutputparameters works fine, so the config update is applying. Thanks for your driveby though 👍

darryncampbell commented 4 years ago

I don't really understand what is going on because there doesn't seem to be an issue setting intent_output_enabled and when I copy your code to a Cordova project it works without issue but can you please try changing your code as follows which works for me:

Current: "keystroke_output_enabled": "false"

Modified: "keystroke_output_enabled": "\"false\""

It may be that DataWedge is handling keystroke_output_enabled slightly differently but I don't have access to the underlying source code to check I'm afraid. Hopefully the above workaround will work for you.

janowskipio commented 4 years ago

@darryncampbell Just checked it and it works like a charm! 😌 Thanks a lot!