#
# $Id: wti.dev 705 2005-07-08 20:43:58Z garlick $
#
# WTI NPS
#
# Tested the following firmware versions: 
#    v3.02
# Assumes: 
# 1. password: "wti" (/g general parms, 1 system passwd)
# 3. command confirmation: off (/g general parms, 8 command confirmation)
# 4. disconnect timeout: set to max (30 min)
# Note: prompt is not returned until device is ready to accept another command
#
specification "wti" {
	timeout 	30  # "/boot *" command takes about 20 sec

	plug name { "1" "2" "3" "4" "5" "6" "7" "8" }

	script login {
		expect "\n"
		expect "word: "
		send "wti\r\n"
		expect "NPS> "
	}
	script logout {
		send "/x\r\n"
	}
	script status_all {
		send "/s\r\n"
		expect "Default"
		expect "\\+\r\n"
		foreachplug {
			expect " ([0-9]+)[^\n]*(ON|OFF)[^\n]*(ON|OFF)[^\n]*\r\n"
			setplugstate $1 $2 off="OFF" on="ON"
		}
		expect "\\+\r\n"
		expect "NPS> "
	}
	script on {
		send "/on %s\r\n"
		expect "NPS> "
	}
	script on_all {
		send "/on *\r\n"
		expect "NPS> "
	}
	script off {
		send "/off %s\r\n"
		expect "NPS> "
	}
	script off_all {
		send "/off *\r\n"
		expect "NPS> "
	}
	script cycle {
		send "/boot %s\r\n"
		expect "NPS> "
	}
	script cycle_all {
		send "/boot *\r\n"
		expect "NPS> "
	}
}
