Update generated driver code

This commit is contained in:
Douglas Clowes
2014-04-14 10:34:43 +10:00
parent ff43028b1a
commit d08f5b6541
5 changed files with 263 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
# Generated driver for isotech_ps
# vim: tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::isotech_ps {
@@ -53,7 +53,9 @@ proc ::scobj::isotech_ps::getValue {tc_root nextState cmd_str} {
set cmd "${cmd_str}"
# hook code goes here
debug_log 1 "getValue sct send ${cmd}"
sct send "${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
@@ -317,10 +319,39 @@ proc add_isotech_ps {name IP port} {
}
${ns}::debug_log 1 "mk_sct_isotech_ps sct_${name} ${name}"
${ns}::mk_sct_isotech_ps sct_${name} ${name}
close ${fd}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
puts stdout "file evaluation of sct_isotech_ps.tcl"
::scobj::isotech_ps::debug_log 1 "file evaluation of sct_isotech_ps.tcl"
proc ::scobj::isotech_ps::read_config {} {
set catch_status [ catch {
set ns "::scobj::isotech_ps"
${ns}::debug_log 1 "Processing Config"
dict for {k v} $::config_dict {
${ns}::debug_log 1 "Inspecting $k:$v"
if { [dict exists $v "driver"] } {
${ns}::debug_log 1 "Has driver [dict get $v driver]"
if { [dict get $v "driver"] == "isotech_ps" } {
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
if { [dict get $v enabled] } {
set IP [dict get $v ip]
set PORT [dict get $v port]
set name [dict get $v name]
MakeAsyncProtocol ${name}_protocol
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
add_isotech_ps ${name} "aqadapter" ${name}_queue
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::isotech_ps::read_config
} else {
::scobj::isotech_ps:debug_log 1 "No config dict"
}