Replies: 2 comments
-
All the EVT and EVT_VIRTUAL are generated solely for LUA. The underlying C++ code directly uses the keys as they are defined at the hardware driver layer.
All the LUA constants are basically listed in one big table, and the pattern most likely comes from the order they are defined in, which varies slightly between radio to radio because of the need to map different hardware keys to the same event, depending on what hardware is actually available on a given radio. I can't tell you why there are EVT_ and EVT_VIRTUAL - but given that all radios seem to have EVT_VIRTUAL, I suspect it was so that regardless of the radio, those events would be accessible. And generally, since they are named, they should be accessed by name, never by constant, then you won't be affected by any radio-to-radio variations in the actual id number. In a nutshell, there is the hardware driver C++ layer, which gets the actual key/trim press, and allocates it to a name. This name is used in the internal code. And then there is the LUA events layer, which then translates that to a bunch of EVT_ and EVT_VIRTUALS so you Lua guys don't need to know about the C++/hardware layer. Unless I got this completely wrong, in which case, I look forward to learning something new ;) |
Beta Was this translation helpful? Give feedback.
-
Oh, btw, to answer another question you had, it's not possible to detect the NV14 power buttons individually - they can only be detected as being pressed when both buttons are pressed - so that is not an option for any hidden UI tricks... not that that is a bad thing... |
Beta Was this translation helpful? Give feedback.
-
Okay made discussion thread to address key events implementation.
I'd like to confirm those things to be on the same page.
Questions:
Example: key_events tested for Xlite radio

a. let's call them Direct - connected with a key name of certain radio like EVT_ENTER_FIRST, EVT_ENTER_LONG, etc
b. Virtual like EVT_VIRTUAL_ENTER for common events across radios. I think is was done to unify events names in case Direct event has different number assigned to identically named key on different radios or if key on radio has different name but it is used for the same OS function. Example: on X12S there is no MENU key but pressing MDL key generates EVT_VIRTUAL_MENU
Questions:
If I understand well there are two layers of let's call it key events API
a. C++ what I mean once Constant is defined like EVT_MENU_FIRST (96) it's strongly advised to use this Constant instead of number when coding new features in C++
b. Some of those C++ Constants are exposed to LUA.
Questions:
There are lot of radios and I think as always there will be different cases for different radio targets.
We don't have to address them all. If we set kind of 'white paper' - how to implement key handling it will be easier
both for C++ and LUA devs.
Beta Was this translation helpful? Give feedback.
All reactions