53 lines
1.0 KiB
Tcl
53 lines
1.0 KiB
Tcl
namespace eval luft {} {
|
|
}
|
|
|
|
proc stdConfig::luft {label} {
|
|
controller syncedprot
|
|
|
|
pollperiod 10 10
|
|
|
|
obj LUFT upd
|
|
kids "luft monitor $label" {
|
|
node confirm wr -text -spy
|
|
prop write luft::writeCf
|
|
prop read luft::readCf
|
|
prop timeout [expr [clock seconds] + 600]
|
|
}
|
|
}
|
|
|
|
proc luft::set_error {errtxt} {
|
|
updateval [sct parent]/status $errtxt
|
|
if {$errtxt eq ""} {
|
|
catch {hdelprop [sct parent] geterror}
|
|
catch {hdelprop [sct] geterror}
|
|
} else {
|
|
updateerror [sct parent]/status $errtxt 1
|
|
}
|
|
}
|
|
|
|
proc luft::readCf {} {
|
|
if {[clock seconds] > [sct timeout]} {
|
|
luft::set_error "luft monitor off"
|
|
}
|
|
return idle
|
|
}
|
|
|
|
proc luft::writeCf {} {
|
|
sct cnt 0
|
|
set errtxt [lassign [sct target] timeout val]
|
|
if {[silent 0 sct verbose]} {
|
|
clientput [sct target]
|
|
}
|
|
if {$errtxt eq ""} {
|
|
updateval [sct parent] $val
|
|
# sct print [sct]=$val
|
|
luft::set_error ""
|
|
} else {
|
|
luft::set_error "epics error: $val $errtxt"
|
|
}
|
|
catch {
|
|
sct timeout [expr [clock seconds] + $timeout + 10]
|
|
}
|
|
return idle
|
|
}
|