Modify legacy drivers so that they can be called by sct wrappers and define wrapper templates.
This commit is contained in:
@@ -411,7 +411,6 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\
|
||||
set catch_status [ catch {
|
||||
set ns "[namespace current]"
|
||||
|
||||
MakeSICSObj $tempobj SCT_OBJECT
|
||||
sicslist setatt $tempobj klass $klass
|
||||
sicslist setatt $tempobj long_name $tempobj
|
||||
|
||||
@@ -570,87 +569,4 @@ set fd [open "../log/watlow_rm.log" w]
|
||||
puts $fd "file evaluation of sct_watlow_rm.tcl"
|
||||
close $fd
|
||||
|
||||
namespace eval ::scobj::watlow_rm {
|
||||
set debug_threshold 5
|
||||
}
|
||||
proc ::scobj::watlow_rm::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::watlow_rm::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::watlow_rm::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_watlow_rm.tcl"
|
||||
::scobj::watlow_rm::sics_log 9 "file evaluation of sct_watlow_rm.tcl"
|
||||
|
||||
proc ::scobj::watlow_rm::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::watlow_rm"
|
||||
dict for {k v} $::config_dict {
|
||||
if { [dict exists $v "implementation"] } {
|
||||
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $v name]
|
||||
set enabled [string tolower [dict get $v "enabled"]]
|
||||
set implementation [dict get $v "implementation"]
|
||||
if { !([dict exists $::config_dict $implementation]) } {
|
||||
continue
|
||||
}
|
||||
set v [dict get $::config_dict $implementation]
|
||||
if { !([dict exists $v "driver"]) } {
|
||||
continue
|
||||
}
|
||||
if { [string equal -nocase [dict get $v "driver"] "watlow_rm"] } {
|
||||
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
|
||||
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"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
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"]"
|
||||
}
|
||||
}
|
||||
set arg_list [list]
|
||||
foreach arg {devid tol id type} {
|
||||
if {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
error "Missing configuration value $arg"
|
||||
}
|
||||
}
|
||||
add_watlow_rm ${name} "aqadapter" ${asyncqueue} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::watlow_rm::read_config
|
||||
} else {
|
||||
::scobj::watlow_rm::sics_log 5 "No config dict"
|
||||
}
|
||||
|
||||
namespace import ::scobj::watlow_rm::*
|
||||
|
||||
Reference in New Issue
Block a user