Not enough feedback types

Hello,

I am trying to track the feedback from Nexus library in order to notify the user on the user interface.
The feedback required is if we are rate limited or not.

The issue that I am facing now is that in case the number of attempts reaches the limit then the feedback from Nexus library will be NXP_KEYCODE_FEEDBACK_TYPE_MESSAGE_INVALID

On that case we will not be able to make the difference with other causes of having that feedback (key code is wrong/message empty/too long/something incorrect while decoding…)

    else if (nx_keycode_is_rate_limited())
    {
        nxp_keycode_feedback_start(NXP_KEYCODE_FEEDBACK_TYPE_MESSAGE_INVALID);
    }

So is it possible to add a new feedback for that one in order to know if we are rate limited (we are reaching the limit of attempts)?
for example NXP_KEYCODE_FEEDBACK_TYPE_RATE_LIMITED

Thank you!

Ayoub,

Is it possible that you can push in a single key at a time (even if your user interface accepts all keys at once from the user, the keys can be input one at a time to Nexus Library from your code). Then you would use nx_keycode_handle_single_key which calls nexus_keycode_mas_bookend_push and if rate-limited, this will result in NXP_KEYCODE_FEEDBACK_TYPE_KEY_REJECTED.

Thanks,

Eric

Dear Eric,

Thanks for your response.

I am using the
nx_keycode_handle_complete_keycode(&nexus_keycode);

So you mean After calling this, I call nx_keycode_handle_single_key, right?
By this way I will have two feedbacks, NXP_KEYCODE_FEEDBACK_TYPE_MESSAGE_INVALID and NXP_KEYCODE_FEEDBACK_TYPE_KEY_REJECTED.
And I assume that The rejected feedback will override the Invalid one.

Ayoub.

Ayoub,

Actually what I meant was to call nx_keycode_handle_single_key instead of nx_keycode_handle_complete_keycode. You would need to call it multiple times (once for each key) and also allow the library to process each key, but this would mean that you have a single feedback response to each key. This will allow you to detect rate-limiting immediately because the first key will be rejected. And once the entire keycode is entered, you will get a feedback pattern to show (applied, valid, rejected, invalid).

As an alternative, you could keep using nx_keycode_handle_complete_keycode, then if you get NXP_KEYCODE_FEEDBACK_TYPE_MESSAGE_INVALID you can call nx_keycode_is_rate_limited which will immediately tell you if it is rate-limited.

What do you think?

Eric,

Thank you for your response.

Yes using single_key processing could be an alternative.

But our solution is currently based on the nx_keycode_handle_complete_keycode. Also I didn’t experiment yet the nx_keycode_handle_single_key approach.

For the second solution you are suggesting, it seems very interesting. Yes when we have INVALID feedback, then I could do a second check on the rate limitation.

One remark about that: Do you think it is a good to use internal library functions like nx_keycode_is_rate_limited and nx_keycode_handle_complete_keycode ?
In my case I will may be add a wrapping function for nx_keycode_is_rate_limited to have something like nxp_keycode_is_rate_limited.

I will test that and let you know.

With regards,
Ayoub.

Ayoub,

Yes, you understand both of my ideas. Hope that one of them works for you.

Also, it is very important to understand that all nx_ prefixed functions are not internal – these are actually the only public functions that you should be calling! Note how they are declared in the include directory of the project.

You should only be calling the functions defined in the nx_ modules in include. You should only be defining the functions in the nxp_ modules in include – these will be called by the Nexus Library. If you are calling any functions in the src folder, then you will likely have some problems. Do not call these functions.

Eric