46 views
in System Integration by

I am using embedded wizard to implement a simulator of the physical keyboard of a device that I am developing. Specifically, it is a tool designed to run only on windows, which Iwill use to control the device from the PC without the need for the integrated keyboard in the device.

I used multiple KeyHandlers to manage inputs from the PC keyboard. 

I set these up to react only to pressing and releasing, and when one of these actions is performed I call two methods, which distinguish which button was pressed and react accordingly. 

The problem is the following :

In the internal simulation of Embedded Wizard everything runs smoothly, in fact if I press and hold a button only one pressing event and one releasing event are launched.

If instead I generate the code and run the application from Visual Studio, by holding down a keyboard button events continue to be generated until I lift my finger.
I attach some screenshots to clarify the situation:

This is how all keyhandlers are set up:

This is what I see in Embedded Wizard's Log window when I press a button, hold it for some time and the release it.

And this is what I see in the output log of Visual Studio:

Here's snippets of the functions that handle key presses and releases

 

I am writing here because I have tried in various ways to solve the problem, both from embedded wizard and from middleware code,but I have not been able to understand what causes it.
Thanks in advance.
 

Best Regards

Dario

1 Answer

0 votes
by

Hello Dario,

I think the reason for this immediate Press and Release behavior is caused by the main loop that provides a key event to the Embedded Wizard GUI application. Please have a look at the function EwProcess(), there you will find the insertion of the key events:

  /* receive keyboard inputs */
  cmd = EwGetKeyCodeConsole();

  if ( cmd != CoreKeyCodeNoKey )
  {
    if ( cmd == CoreKeyCodePower )
      return 0;

    /* feed the application with a 'press' and 'release' event */
    events |= CoreRoot__DriveKeyboardHitting( RootObject, cmd, 0, 1 );
    events |= CoreRoot__DriveKeyboardHitting( RootObject, cmd, 0, 0 );
  }

As you can see, every key hit is inserted as an press and release event. The repetition of the key events is caused by the Windows key repetition.

Does this answer your question?

Best regards,

Manfred.

by
Hello Manfred, Thanks for the answer, I know understand what is happening.

As far as you know, is there a solution to this that would not involve disabling key repetition from the Windows control panel ?

Ideally I would like to manage this behaviour in my middleware code.

Thanks again.

Best Regards,

Dario.
by
Hi Dario,

in this case, you have to detect the key repetition from Windows within the function EwGetKeyCodeConsole() and return only a key code in case it is not a repetition key.

Best regards,

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...