Automation Connect IQ SDK

Introducing the convenience class Checker that builds and starts the simulator.

A function that processes all devices registered in the project.

using namespace AutomationConnectIQ.Lib;

$check = New-Object Checker -Property @{
	Key = "developer_key"
	Project = "monkey.jungle"

$outputDir = "output"
function Capture {
	Start-sleep -Milliseconds 500

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

# Perform build check process on all devices
	#Receive device name and simulator object as parameters
	Param($device, $sim)

	$sim.SetGPSPosition(35.685233, 139.752485)

	$time = $sim.CreateTime()
	$time.Time = Get-Date "2019-12-31 13:59:59"

	return $true
	# pre process
	$sim.SetBatteryStatus(50, $false)
	# post process

The first half up to the 17th line is the same as AutomationConnectIQ-Sample8.

  • Line 20:
    The function that checks all the devices registered in the project uses four arguments.
    The first argument specifies whether to cancel the check process when the return value of the simulation operation function specified in the second argument is false. However, there is a problem that the return value from the PowerShell script block is not transmitted well to the C # side, or the process continues even if it returns with $ false.
    So it doesn’t seem to matter whether this first argument is $ true or $ false.
    The second argument has the same content as last time, so it is omitted here.
    The 3rd and 4th arguments are the part that describes the script block for pre-processing and post-processing. In C #, have the delegate described by delegate void PrePostAction(Simulator sim) described in the script block. become. It is also possible to specify $ null and not process it.

By running the above script, you can get the watch face capture screen in the output folder like this.

If you arrange it like this, you can check at a glance whether there is a problem with the screen configuration.

This is the end of the Ver0.2-based sample.


Copied title and URL