Need some suggestion to handle serial inputs.
Hi guys, I need some suggestion to handle the serial input. First I'll explain that the serial is attached to a device that consists of multiple buttons and will send a string representing each button upon pressing and will always send it with some intervals if it is still pressed. But if it was released, it doesn't send anything except only stop sending the string. Now because I needed it to behave similar like a keyboard event (with its key down / up), I need to find a way to handle this. I can only detect the key down event of the button but not the key up obviously. I've an idea actually. I was thinking of using a timeout state for each inputs. So if a button is pressed, I would have to get the time of the action and check whether or not the device is still sending a signal a few secs / milisecs later. But after much thinking, IMHO, that will make the input not as responsive because we need to wait for a few moments before we actually identify it as a key up. And what if the input is delayed because of something and I happen to call the onKeyUp before the input is received. So I'm asking if whether or net there's another way to do it or is it the only way? Thanks a lot in advance.