AutomationConnectIQ-Sample2

Automation Connect IQ SDK

A sample to start the simulator.

# Since the description of AutomationConnectIQ.Lib is troublesome, make the following settings
using namespace AutomationConnectIQ.Lib;

# Creating SDK environment
$sdk = New-Object GarminSDK -Property @{
	Key = "developer_key"
}
# Load project file
$proj = New-Object Jungle("DigiFusemonkey.jungle")

$deviceName = "fr45"

# Build the project # Executable is placed under bin under the project.
$sdk.BuildProgram($proj, $deviceName)

Up to this point, it is the part that was explained in the sample from the previous time.
The difference is that we used variables to specify the device name.

# Launching and waiting to launch the simulator
$sim = New-Object Simulator($sdk)
$sim.WaitForInput()

# Load the program into the simulator and wait for the load to complete
$sdk.StartProgram($proj.DefaultProgramPath, $deviceName)
$sim.WaitForDeviceStart()

# Exit the simulator
$sim.Close()

The above part is the important part about starting the simulator.

  • The second and third lines start the simulator.
    Wait Until Inpupt is ready for input in the simulator.
    There is a similar API on the screen created with Win32 API, and it is created to resemble it.
  • Lines 6 and 7 load the program into the simulator and display it.
    WaitForDeviceStart waits for the program to load in the simulator.
  • DefaultProgramPath represents the path of the program built with $sdk.BuildProgram($proj, $deviceName).
  • The last line is the code to stop and terminate the simulator.
    So, when you run this script, the simulator opens a little and closes immediately.

コメント

Copied title and URL