Where is the map from keyboard keys to WatchUi.KEY_*

I just started to develop applications for my vivoactive 4, and it took me a long time to understand that menu button for my watch is the same as back button but with extra hold. I got it from %APPDATA%\Garmin\ConnectIQ\Devices\vivoactive4\simulator.json:

    "keys": [
        {
            "id": "enter",
            "location": {
                "height": 59,
                "width": 35,
                "x": 330,
                "y": 154
            }
        },
        {
            "behavior": "onMenu",
            "id": "menu",
            "isHold": true,
            "location": {
                "height": 59,
                "width": 35,
                "x": 330,
                "y": 334
            }
        },
        {
            "behavior": "onBack",
            "id": "esc",
            "location": {
                "height": 59,
                "width": 35,
                "x": 330,
                "y": 334
            }
        }
    ],

However, what I am interested in is whether I can replicate those events without having to press my mouse at certain locations in the simulator, i.e., are there keyboard keys that send the events corresponding to WatchUi.KEY_*? My understanding is that <Enter> maps to KEY_ENTER and <ESC> maps to KEY_ESC, but what about the others? Is there a file in SDK describing that mapping?

Thanks a lot!

  • I believe that I have found an answer in the Release Notes that one can access at %APPDATA%\Garmin\ConnectIQ\Sdks\<Connect IQ SDK folder>\README.html. If you have an SDK with a later version than v3.0.0.beta1,  you can find the following under simulator changes for v3.0.0.beta1:

    Simulator Changes

    • Add simulator support for firstDayOfWeek setting.
    • Add simulator keyboard mappings for FIND (F), ZOOM_IN (I), ZOOM_OUT (O), PAGE (P) and MENU (M), KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER, and KEY_ESC.
    • Add controls for WiFi connection to the Simulation menu.
    • Fix simulator ANT+ sensor connection issue.
    • Add support for reading HRV/BBI data from FIT files.
    • Simulate HRV/BBI data based on simulated heart rate.
    • Add ability to toggle battery charging flag from simulator.
    • Fix a crash that could happen when attempting to exit the simulator while running code that used the BikePower AntPlus API.
    • Add support to pop up Memory Analyzer window when double clicking the memory usage in the simulator status bar.
    • Runtime errors in onEnterSleep and onExitSleep are no longer ignored in the simulator.

    The relevant changes are in bold and underlined. So for watches, it seems that the only keys available are <M>, <Up>, <Down>, <Left>, <Right>, <Enter>, and <ESC>. Whether they are enabled for the device is specified in %APPDATA%\Garmin\ConnectIQ\Devices\<Device name>\simulator.json.

    A sample project that helped me understand this better is Input under %APPDATA%\Garmin\ConnectIQ\Sdks\<Connect IQ SDK folder>\samples\Input.

    If you think my answer is incomplete, feel free to add comments.

  • The va4 is a touch device, though it has two buttons.  There are things you do by interacting with the screen (swipes, taps. holds).  The input sample will show you this.

  • The va4 is a touch device, though it has two buttons.  There are things you do by interacting with the screen (swipes, taps. holds).  The input sample will show you this.

    Given that the OP stated they own a Vivoactive 4, they probably realize that.