Files
Cognitive_Agent/apps/ir-toy-console/run-native-can-gateway.ps1
T

33 lines
890 B
PowerShell

param(
[string]$HostAddress = "127.0.0.1",
[int]$Port = 8765,
[ValidateSet(0, 1)]
[int]$Channel = 0,
[switch]$Control
)
$python = "C:\Program Files (x86)\ZCANPRO\python38\python.exe"
$dll = "C:\Program Files (x86)\ZCANPRO\zlgcan.dll"
if (-not (Test-Path -LiteralPath $python)) {
throw "ZCANPRO 32-bit Python was not found: $python"
}
if (-not (Test-Path -LiteralPath $dll)) {
throw "ZLG CAN driver was not found: $dll"
}
if ($Control -and [string]::IsNullOrWhiteSpace($env:COGNITIVE_AGENT_NATIVE_CAN_APPROVAL_TOKEN)) {
throw "Control mode requires COGNITIVE_AGENT_NATIVE_CAN_APPROVAL_TOKEN."
}
$arguments = @(
(Join-Path $PSScriptRoot "zlg_vehicle_gateway.py"),
"--dll", $dll,
"--device-type", "41",
"--device-index", "0",
"--channel", "$Channel",
"--host", $HostAddress,
"--port", "$Port"
)
if ($Control) { $arguments += "--control" }
& $python @arguments