57 lines
1.0 KiB
Tcl
Executable File
57 lines
1.0 KiB
Tcl
Executable File
#!/usr/bin/env tclsh
|
|
source streamtestlib.tcl
|
|
|
|
# Define records, protocol and startup (text goes to files)
|
|
# The asynPort "device" is connected to a network TCP socket
|
|
# Talk to the socket with send/receive/assure
|
|
# Send commands to the ioc shell with ioccmd
|
|
|
|
set records {
|
|
record (longin, "DZ:test1")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (INP, "@test.proto integer device")
|
|
}
|
|
record (ai, "DZ:test2")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (INP, "@test.proto double device")
|
|
}
|
|
}
|
|
|
|
set protocol {
|
|
Terminator = LF;
|
|
integer {out "integer"; in "n: %?d xx"; out "n = %d"; }
|
|
double {out "double"; in "n: %?g xx"; out "n = %.4f"; }
|
|
}
|
|
|
|
set startup {
|
|
}
|
|
|
|
set debug 0
|
|
|
|
startioc
|
|
|
|
process DZ:test1
|
|
assure "integer\n";
|
|
send "n: -12 xx\n";
|
|
assure "n = -12\n";
|
|
|
|
process DZ:test1
|
|
assure "integer\n";
|
|
send "n: xx\n";
|
|
assure "n = 0\n";
|
|
|
|
process DZ:test2
|
|
assure "double\n";
|
|
send "n: 3.1415 xx\n";
|
|
assure "n = 3.1415\n";
|
|
|
|
process DZ:test2
|
|
assure "double\n";
|
|
send "n: xx\n";
|
|
assure "n = 0.0000\n";
|
|
|
|
|
|
finish
|