118 lines
4.6 KiB
Tcl
118 lines
4.6 KiB
Tcl
# Generated driver for agilent_33220A
|
|
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
|
#
|
|
|
|
namespace eval ::scobj::agilent_33220A {
|
|
set debug_threshold 5
|
|
}
|
|
|
|
proc ::scobj::agilent_33220A::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 now [clock seconds]
|
|
set ts [clock format ${now} -format "%Y%m%d"]
|
|
set log_file_name "../log/agilent_33220A_[basename ${tc_root}]_${ts}.log"
|
|
set fd [open "${log_file_name}" "a"]
|
|
set ts [clock format ${now} -format "%T"]
|
|
puts ${fd} "${ts} ${debug_string}"
|
|
close ${fd}
|
|
}
|
|
} catch_message ]
|
|
}
|
|
|
|
proc ::scobj::agilent_33220A::sics_log {debug_level debug_string} {
|
|
set catch_status [ catch {
|
|
set debug_threshold ${::scobj::agilent_33220A::debug_threshold}
|
|
if {${debug_level} >= ${debug_threshold}} {
|
|
sicslog "::scobj::agilent_33220A::${debug_string}"
|
|
}
|
|
} catch_message ]
|
|
}
|
|
|
|
proc ::scobj::agilent_33220A::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
|
|
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
set ns "[namespace current]"
|
|
set catch_status [ catch {
|
|
|
|
# mkWrapper hook code starts
|
|
${ns}::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
|
|
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
|
# mkWrapper hook code ends
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
proc ::scobj::agilent_33220A::add_driver {name device_class simulation_flag ip_address tcp_port} {
|
|
set catch_status [ catch {
|
|
::scobj::agilent_33220A::sics_log 9 "::scobj::agilent_33220A::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
|
|
::scobj::agilent_33220A::sics_log 1 "::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
::scobj::agilent_33220A::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
namespace eval ::scobj::agilent_33220A {
|
|
namespace export debug_threshold
|
|
namespace export debug_log
|
|
namespace export sics_log
|
|
namespace export mkDriver
|
|
namespace export add_driver
|
|
}
|
|
|
|
proc add_agilent_33220A {name ip_address tcp_port} {
|
|
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
|
::scobj::agilent_33220A::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port}
|
|
}
|
|
|
|
clientput "file evaluation of sct_agilent_33220A.tcl"
|
|
::scobj::agilent_33220A::sics_log 9 "file evaluation of sct_agilent_33220A.tcl"
|
|
|
|
proc ::scobj::agilent_33220A::read_config {} {
|
|
set catch_status [ catch {
|
|
set ns "::scobj::agilent_33220A"
|
|
dict for {k u} $::config_dict {
|
|
if { [dict exists $u "implementation"] } {
|
|
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
|
set device_class "environment"
|
|
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
|
|
continue
|
|
}
|
|
set enabled [string tolower [dict get $u "enabled"]]
|
|
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
|
|
continue
|
|
}
|
|
if { [dict exists $u "simulation_group"] } {
|
|
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
|
|
}
|
|
if { [dict exists $u "device_class"] } {
|
|
set device_class "[dict get $u "device_class"]"
|
|
}
|
|
set name [dict get $u name]
|
|
set implementation [dict get $u "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"] "agilent_33220A"] } {
|
|
::scobj::agilent_33220A::sics_log 9 "No sctcontroller for agilent_33220A"
|
|
set ip_address [dict get $v ip]
|
|
set tcp_port [dict get $v port]
|
|
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
|
}
|
|
}
|
|
}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
if { [info exists ::config_dict] } {
|
|
::scobj::agilent_33220A::read_config
|
|
} else {
|
|
::scobj::agilent_33220A::sics_log 5 "No config dict"
|
|
}
|