Can the Simulator

Can the 4.1.5 Simulator

1) simulate vibrate [if enabled in Settings, vibrate]? Any working examples?

2) simulate button press - get a blue triangle when pressing the menu button, but app works on the watch?

3) list what's installed on the simulator?

4) Start any selected app from the list?

5) restart a crashed app or watch face without rebuilding app?

6) can a PRG or IQ file be dropped into the Simulator?

  • 4.1.7 is the current production SDK

    1) See the Attention Sample in the SDK

    2) See the Input Sample in the SDK.  You'll also see things in other samples like the RecordSample, MapSample. etc

    3/4/5/6) The Sim has a temp directory and the prg files you've simed are in the garmin/apps folder there.  To run something there, you want to use run from eclipse/VS Code or monkeydo

  • Thanks, Now using 4.1.7

    1) Vibrate works on the phone, what does one expect on the Sim?

    2) why does click button work on the phone but give a blue triangle in the Sim

    3/4/5/6) Can you point to where to find that directory and in VS code how you start a file in the Sim?

  • This doesn't involve the phone.  You asked about the sim.  In the sim, when a vibrate happend, the image kind of shakes, and with tomes, you hear a beep from the pc/mac.

    Which button are you clicking on, and what is the app type?  By default, the back button terminates a widget or device app in the sim, and then you'll see the blue triangle.

    In VS Code, to start an app in the sim, use Run and then run with or without debugging

    See https://developer.garmin.com/connect-iq/connect-iq-basics/your-first-app/

    .

  • Thanks - that's what I was looking for the image shake for vibrate and as you say the bottom button ends the app, I needed to hold it, rather than click it.

    How do I find which apps are loaded on the Sim, where is the Garmin/Apps directory on a PC?

    Run in VSCode doesn't give you the option to select any loaded app in the Sim only the current one in VSCode and will do a build.

    Only want to select and run an already built and loaded app, other than the current one.

  • How do I find which apps are loaded on the Sim, where is the Garmin/Apps directory on a PC?

    Run in VSCode doesn't give you the option to select any loaded app in the Sim only the current one in VSCode and will do a build.

    Found the directory which contains the loaded apps in the Simulator at: AppData\Local\Temp\com.garmin.connectiq\GARMIN\APPS

    Made a shortcut to the Simulator stored at: AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.1.7-2022-11-21-562b8a195\bin

    Dropping either, one of the PRG files or an IQ file, onto the shortcut opens the Simulator but does not run the selected app.

    The FILE option of the Simulator does not list or give you the option to choose which app loaded in the Simulator device to run either?

    How can you see how any app performs in the Simulator, without necessarily having a debugging terminal?

    How is it possible to switch between apps in the Simulator with an open debugging terminal without a list?

  • An app being in the sim's temp directory doesn't mean you can just run it, as happens on a real device.  If you want to run an app in the sim without rebuilding, use monkeydo (it's in the sdk's bin folder)  Here are the options.  The prg as well as the device you want to simulate

    C:\Users\(me)\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.1.7-2022-11-21-562b8a195\bin>monkeydo
    Pushes and runs a Connect IQ executable on the Connect IQ simulator. The simulator must be running for this command to succeed.
    
    Usage: monkeydo executable device_id [/t | /t test_name]
        executable - A Connect IQ executable to run.
        device_id  - The device to simulate.
        test_name  - When providing the test flag you may specify a one or more test names.

    iq files aren't used by the sim.  They are just a zip file with all target devices your app supports.

    I find just doing a run/run without debugging fine in most cases.

  • Run in VSCode doesn't give you the option to select any loaded app in the Sim only the current one in VSCode and will do a build.

    Only want to select and run an already built and loaded app, other than the current one.

    If this is a common use case for you, you might just want to open all your Monkey C projects in VS Code, using a multi-root workspace.

    If you have multiple projects open, any project-specific commands (such as build or run) should apply to the project for the currently focused editor. In other words, just switch to any file from the project you want to build or run, then execute the build or run command.

    If you're interested in using Monkey C from the command line, this is a good reference:

    [https://developer.garmin.com/connect-iq/reference-guides/monkey-c-command-line-setup/]

  • Thanks all - in the end made a simple BAT file for the device in question in a useful place

    called Venu2PlusRun.bat with the contents below:

    You can either run it.

    It will then ask for the full name of an already loaded app in the Simulator
    or simply drag an already loaded app onto the BAT file.

    If the Simulator isn't running it will start it.

    The advantage is you have a separate DOS Terminal window and it loads super fast.

    Note: If you are using a different SDK you will have to edit the bat file accordingly.
    The relevant file paths are shown in the Bat file

     

    _________________________________________
    @echo off
    set p=%1%

    if not %1%x == x goto run

    SET /P prog=Please enter program name:
    IF "%prog%"=="" goto Error

    set p=%temp%\com.garmin.connectiq\GARMIN\APPS\%prog%
    if not exist %p% goto Error

    :run
    tasklist|find /i "simulator.exe" >NUL
    if %errorlevel%==0  goto Start

    echo Starting Simulator, wait while loading
    start %userprofile%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.1.7-2022-11-21-562b8a195\bin\simulator.exe
    timeout /t 5

    :Start
    echo Starting app, wait while loading
    %userprofile%\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-4.1.7-2022-11-21-562b8a195\bin\monkeydo %p% venu2plus
    Pause
    exit

    :Error
    @ECHO program name not given or doesn't exist
    Pause
    _________________________________________


  • with monkeydo, the prg doesn't need to be in the sim's temp directory.  It will get copied there.

    Also, instead of hard coding the path to the sim, in the same directory as you see the SDK and device folders. you'll see a file called "current-sdk" that has the path of the current SDK in the SDKManager

  • Thanks - also useful tips, here is the revised bat which lists current paths and apps loaded, only change is to enter watch type, instructions at the bottom

    @echo off
    Echo.
    Echo Current config Simulator path
    for /f "delims=" %%i in (%userprofile%\AppData\Roaming\Garmin\ConnectIQ\current-sdk.cfg) do set "config=%%i"
    Echo %config%

    Echo.
    Echo Simulator Apps  directory
    Echo %temp%\com.garmin.connectiq\GARMIN\APPS\%prog%
    Echo.

    Echo Existing Apps
    Echo.
    Dir %temp%\com.garmin.connectiq\GARMIN\APPS\*.prg /B
    Echo.
    Pause

    set p=%1%

    if not %1%x == x goto run

    SET /P prog=Please enter program name:
    IF "%prog%"=="" goto Error

    set p=%temp%\com.garmin.connectiq\GARMIN\APPS\%prog%
    if not exist %p% goto Error

    :run
    tasklist|find /i "simulator.exe" >NUL
    if %errorlevel%==0  goto Start

    echo Starting Simulator, wait while loading
    start %config%\bin\simulator.exe
    timeout /t 5

    :Start
    echo Starting app, wait while loading
    %config%\bin\monkeydo %p% venu2plus
    Pause
    exit

    :Error
    @ECHO program name not given or doesn't exist
    Pause
    exit

    Rem Operating instructions
    Rem change Venu2Plus [a few lines above] to the watch type you are testing on

    Rem Drop any file on the BAT or shortcut to the BAT file
    Rem Run the BAT file and end the name of a loaded app

    Rem Will start the Simulator is not loaded
    Rem Will use the running Simulator is already active
    Rem Will Copy Apps not already loaded to the Simulator and run them