Regenerate templated drivers to get changes to logging and simulation tests

This commit is contained in:
Douglas Clowes
2014-06-16 10:37:10 +10:00
parent 18d40f69d9
commit 1010003d6c
13 changed files with 151 additions and 61 deletions

View File

@@ -10,7 +10,7 @@ proc ::scobj::mercury_level::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set fd [open "/tmp/mercury_level_[basename ${tc_root}].log" "a"]
set fd [open "../log/mercury_level_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
close ${fd}
@@ -179,9 +179,11 @@ proc ::scobj::mercury_level::mkDriver { sct_controller name id } {
hsetprop ${scobj_hpath}/Level/Nitrogen type "part"
hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
${sct_controller} poll ${scobj_hpath}/Level/Helium 15
${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15
} else {
::scobj::mercury_level::sics_log 9 "[environment_simulation] => No poll/write for mercury_level"
}
hsetprop ${scobj_hpath} klass environment
hsetprop ${scobj_hpath} debug_threshold 5
@@ -200,7 +202,7 @@ namespace eval ::scobj::mercury_level {
proc add_mercury_level {name IP port {id 99}} {
set catch_status [ catch {
::scobj::mercury_level::sics_log 9 "add_mercury_level ${name} ${IP} ${port} ${id}"
if {[SplitReply [environment_simulation]]=="false"} {
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${IP}"]} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
makesctcontroller sct_${name} aqadapter ${port}
@@ -208,6 +210,8 @@ proc add_mercury_level {name IP port {id 99}} {
::scobj::mercury_level::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
makesctcontroller sct_${name} std ${IP}:${port}
}
} else {
::scobj::mercury_level::sics_log 9 "[environment_simulation] => No sctcontroller for mercury_level"
}
::scobj::mercury_level::sics_log 1 "::scobj::mercury_level::mkDriver sct_${name} ${name} ${id}"
::scobj::mercury_level::mkDriver sct_${name} ${name} ${id}
@@ -225,10 +229,11 @@ proc ::scobj::mercury_level::read_config {} {
if { [dict exists $v "driver"] } {
if { [dict get $v "driver"] == "mercury_level" } {
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
if { [dict exists $v "asyncqueue"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
} else {
if { [dict exists $v "asyncprotocol"] } {
@@ -242,6 +247,8 @@ proc ::scobj::mercury_level::read_config {} {
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"