Automation Connect IQ SDK

Introducing the convenience class Checker that builds and starts the simulator.
First, about the method to build one device and start the simulator.

using namespace AutomationConnectIQ.Lib;

$outputDir = "output"

function Capture {
	Start-sleep -Milliseconds 500

	$bitmap = $simulator.Capture()
	$bitmap.Save($(Join-Path $outputDir $device".png"))

# Create a check object
# Parameters are developer key and monkey project file
$check = New-Object Checker -Property @{
	Key = "developer_key"
	Project = "monkey.jungle"

# Execute build check process with fr45
# The simulation process is "delegate bool Simulation (string device, Simulator sim)"
# Describe the simulation process with a PowerShell script block accordingly
$check.Check("fr45", {
	#Receive device name and simulator object as parameters
	Param($device, $simulator)

	$simulator.SetGPSPosition(35.685233, 139.752485)
	# Open the time window, change the language to English and then change to the specified time
	$time = $simulator.CreateTime()
	$time.Time = Get-Date "2020-1-1 13:00:00"
	return $true
  • Lines 5-13
    A PowerShell function version of the standard code for opening and capturing the time window shown in AutomationConnectIQ-Sample7.
  • Lines 17-20: Object creation of Checker class
    The key file name and project file name are passed as parameters.
  • 25th line ~
    In the Check method, describe the operations to be performed in build, simulator startup, and simulation in script blocks.
    The first argument is the device name of the program to be generated.
    The second argument describes the process to be executed by the simulator in a script block.
    The parameters passed are the device name and the object for simulator operation.
    The 27th line is the passing of the parameter.
    The return $true on line 38 matches the delegate bool Simulation(string device, Simulator sim) that is the source of this script block. It is unknown whether it is just working.


Copied title and URL