From 41690a681b8a7192fe5e9413709ba7c9b99ccf7c Mon Sep 17 00:00:00 2001 From: koennecke Date: Tue, 17 Feb 2009 08:35:29 +0000 Subject: [PATCH] - Added intValue writing to hdbutil.tcl - Added threshold proecessing to el737dec.tcl --- tcl/el737sec.tcl | 60 ++++++++++++++++++++++++++++++++++++++++++++++-- tcl/hdbutil.tcl | 20 +++++++++++----- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/tcl/el737sec.tcl b/tcl/el737sec.tcl index 18c917d9..785247fe 100644 --- a/tcl/el737sec.tcl +++ b/tcl/el737sec.tcl @@ -10,6 +10,7 @@ # pause,cont, stop: el737sendcmd - el737cmdreply # status: el737readstatus - el737status # values: el737readvalues - el737val +# threshold write: el737threshsend - el737threshrcv - el737cmdreply # # Mark Koennecke, February 2009 #----------------------------------------------------- @@ -192,6 +193,48 @@ proc el737val {} { return idle } #---------------------------------------------- +proc el737threshsend {} { + set val [string trim [sct target]] + set root [sctroot] + set cter [string trim [hval $root/thresholdcounter]] + sct send [format "DL %1.1d %f" $cter $val] + return el737threshrecv +} +#--------------------------------------------- +proc el737threshrecv {} { + set reply [sct result] + set status [catch {el737error $reply} err] + if {$status != 0} { + sct geterror $err + sct print "ERROR: $err" + } + set root [sctroot] + set cter [string trim [hval $root/thresholdcounter]] + sct send [format "DR %1.1d" $cter] + set sctcon [sct controller] + $sctcon queue [sct] progress read + return el737cmdreply +} +#--------------------------------------------- +proc el737threshread {} { + set root [sctroot] + set cter [string trim [hval $root/thresholdcounter]] + sct send [format "DL %1.1d" $cter] + return el737thresh +} +#---------------------------------------------- +proc el737thresh {} { + set reply [sct result] + set status [catch {el737error $reply} err] + if {$status != 0} { + sct geterror $err + sct print "ERROR: $err" + } + stscan $reply "%f" val + sct update $val + return idle +} +#---------------------------------------------- proc el737func {controller path} { $controller queue $path write } @@ -214,11 +257,24 @@ proc MakeSecEL737 {name netaddr} { hsetprop $path el737status el737status hsetprop $path moncount 0 $conname poll $path 60 - $conname debug -1 set path /sics/${name}/control hsetprop $path write el737control hsetprop $path el737cmdreply el737cmdreply $conname write $path - + + hfactory /sics/${name}/thresholdcounter plain mugger int + hseprop /sics/${name}/thresholdcounter __save true + set path /sics/${name}/threshold + hfactory $path plain mugger float + hsetprop $path write el737threshsend + hsetprop $path el737threshrcv el737threshrcv + hsetprop $path el737cmdreply el737cmdreply + $conname write $path + hsetprop $path read el737threshread + hsetprop $path el737thresh el737thresh + $conname poll $path 60 + + $conname debug -1 + } diff --git a/tcl/hdbutil.tcl b/tcl/hdbutil.tcl index 483c7574..88d2e9c3 100644 --- a/tcl/hdbutil.tcl +++ b/tcl/hdbutil.tcl @@ -89,10 +89,10 @@ proc getdataType {path} { } #---------------------------------------------------------------------- proc make_nodes {path result indent} { -set nodename [file tail $path]; -set type [getdataType $path] -set prefix [string repeat " " $indent] -set newIndent [expr $indent + 2] + set nodename [file tail $path]; + set type [getdataType $path] + set prefix [string repeat " " $indent] + set newIndent [expr $indent + 2] #array set prop_list [ string trim [join [split [hlistprop $path] =]] ] set prop_list(control) true set we_have_control [info exists prop_list(control)] @@ -104,6 +104,15 @@ set newIndent [expr $indent + 2] foreach x [hlist $path] { set result [make_nodes [string map {// /} "$path/$x"] $result $newIndent] } + if {[string compare $type none] != 0 && [string compare $type func] != 0} { + set test [catch {hgetprop $path transfer} msg] + set tst [catch {hval $path} val] + if {$test != 0 && $tst == 0} { + append result "$prefix \n" + append result "$prefix $val\n" + append result "$prefix \n" + } + } append result "$prefix\n" } return $result @@ -147,10 +156,9 @@ proc getgumtreexml {path} { if {[string compare $path "/" ] == 0} { foreach n [hlist $path] { - set result [make_nodes $n $result 2] + set result [make_nodes /$n $result 2] } } else { -# set result [make_nodes $path $result 2] foreach n [hlist $path] { set result [make_nodes $path/$n $result 2] }