759 lines
34 KiB
Tcl
759 lines
34 KiB
Tcl
# Generated driver for astrium_chopper
|
|
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
|
#
|
|
|
|
namespace eval ::scobj::astrium_chopper {
|
|
set debug_threshold 5
|
|
}
|
|
|
|
proc ::scobj::astrium_chopper::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/astrium_chopper_[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::astrium_chopper::sics_log {debug_level debug_string} {
|
|
set catch_status [ catch {
|
|
set debug_threshold ${::scobj::astrium_chopper::debug_threshold}
|
|
if {${debug_level} >= ${debug_threshold}} {
|
|
sicslog "::scobj::astrium_chopper::${debug_string}"
|
|
}
|
|
} catch_message ]
|
|
}
|
|
|
|
# check function for hset change
|
|
proc ::scobj::astrium_chopper::checkrange {tc_root} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
|
set setpoint [sct target]
|
|
if { [hpropexists [sct] lowerlimit] } {
|
|
set lolimit [sct lowerlimit]
|
|
} else {
|
|
# lowerlimit not set, use target
|
|
set lolimit [sct target]
|
|
}
|
|
if { [hpropexists [sct] upperlimit] } {
|
|
set hilimit [sct upperlimit]
|
|
} else {
|
|
# upperlimit not set, use target
|
|
set hilimit [sct target]
|
|
}
|
|
# checkrange hook code goes here
|
|
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
|
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
|
}
|
|
return OK
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to request the read of a parameter on a device
|
|
proc ::scobj::astrium_chopper::fetchState {tc_root nextState cmd_str} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "fetchState tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
|
if { [hpropexists [sct] geterror] } {
|
|
hdelprop [sct] geterror
|
|
}
|
|
set cmd "${cmd_str}"
|
|
# fetchState hook code starts
|
|
set my_state [sct my_state]
|
|
if { ${my_state} == "user" } {
|
|
set cmd "user:Bilby"
|
|
} elseif { ${my_state} == "password" } {
|
|
set cmd "password:RwN"
|
|
} else {
|
|
set cmd "#SOS#STATE ${cmd_str}"
|
|
}
|
|
# fetchState hook code ends
|
|
if { [hpropexists [sct] geterror] } {
|
|
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
|
error "[sct geterror]"
|
|
}
|
|
debug_log ${tc_root} 1 "fetchState sct send ${cmd}"
|
|
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
|
sct send "${cmd}"
|
|
}
|
|
return ${nextState}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to request the read of a parameter on a device
|
|
proc ::scobj::astrium_chopper::getValue {tc_root nextState cmd_str} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
|
if { [hpropexists [sct] geterror] } {
|
|
hdelprop [sct] geterror
|
|
}
|
|
set cmd "${cmd_str}"
|
|
# getValue hook code goes here
|
|
debug_log ${tc_root} 1 "getValue sct send ${cmd}"
|
|
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
|
sct send "${cmd}"
|
|
}
|
|
return ${nextState}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to check the write parameter on a device
|
|
proc ::scobj::astrium_chopper::noResponse {tc_root} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
|
# noResponse hook code goes here
|
|
return "idle"
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to parse the read of a parameter on a device
|
|
proc ::scobj::astrium_chopper::rdValue {tc_root} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
|
|
if { [hpropexists [sct] geterror] } {
|
|
hdelprop [sct] geterror
|
|
}
|
|
set data [sct result]
|
|
set nextState "idle"
|
|
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
|
# the protocol driver has reported an error
|
|
sct geterror "${data}"
|
|
error "[sct geterror]"
|
|
}
|
|
# rdValue hook code goes here
|
|
if { ${data} != [sct oldval] } {
|
|
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
|
sct oldval ${data}
|
|
sct update ${data}
|
|
sct utime readtime
|
|
}
|
|
return ${nextState}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to parse the read of a parameter on a device
|
|
proc ::scobj::astrium_chopper::readState {tc_root} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "readState tc_root=${tc_root} sct=[sct] result=[sct result]"
|
|
if { [hpropexists [sct] geterror] } {
|
|
hdelprop [sct] geterror
|
|
}
|
|
set data [sct result]
|
|
set nextState "idle"
|
|
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
|
# the protocol driver has reported an error
|
|
sct geterror "${data}"
|
|
error "[sct geterror]"
|
|
}
|
|
# readState hook code starts
|
|
if { [string equal -length 22 ${data} "#SES#Fill in your user"] } {
|
|
sct my_state "user"
|
|
set nextState "read"
|
|
} elseif { [string equal -length 22 ${data} "#SES#Fill in your pass"] } {
|
|
sct my_state "password"
|
|
set nextState "read"
|
|
} elseif { [string equal -length 22 ${data} "#SES#You are not a val"] } {
|
|
sct my_state "user"
|
|
set nextState "read"
|
|
} else {
|
|
sct my_state "idle"
|
|
set nextState "idle"
|
|
if { [string equal -length 12 ${data} "#SOS#ACCEPT "] } {
|
|
set my_status [split [string range ${data} 12 end] "#"]
|
|
foreach field ${my_status} {
|
|
set lst [split ${field} "="]
|
|
if { [llength ${lst}] > 1 } {
|
|
set lhs "[string trim [lindex ${lst} 0]]"
|
|
set rhs "[string trim [lindex ${lst} 1]]"
|
|
sct "attr_${lhs}" "${rhs}"
|
|
set base [pathname [sct]]
|
|
switch [string toupper ${lhs}] {
|
|
"ASPEED" {
|
|
if [string is double "${rhs}"] {
|
|
set freq [expr "${rhs}" / 60.0]
|
|
if { "[hval ${base}/frequency]" != "${freq}" } {
|
|
hset ${base}/frequency ${freq}
|
|
}
|
|
}
|
|
}
|
|
"RSPEED" - "APHASE" - "RPHASE" - "MASTER" {
|
|
if { "[hval ${base}/${node}]" != "${rhs}" } {
|
|
hset ${base}/${node} "${rhs}"
|
|
}
|
|
}
|
|
}
|
|
if { [string equal -nocase ${lhs} "STATE"] } {
|
|
set data "${rhs}"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
sct geterror "${data}"
|
|
}
|
|
}
|
|
# readState hook code ends
|
|
if { [hpropexists [sct] geterror] } {
|
|
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
|
error "[sct geterror]"
|
|
}
|
|
if { ${data} != [sct oldval] } {
|
|
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
|
sct oldval ${data}
|
|
sct update ${data}
|
|
sct utime readtime
|
|
}
|
|
return ${nextState}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
# function to write a parameter value on a device
|
|
proc ::scobj::astrium_chopper::setValue {tc_root nextState cmd_str} {
|
|
set catch_status [ catch {
|
|
debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
|
if { [hpropexists [sct] geterror] } {
|
|
hdelprop [sct] geterror
|
|
}
|
|
set par [sct target]
|
|
set cmd "${cmd_str}${par}"
|
|
# setValue hook code goes here
|
|
if { [hpropexists [sct] driving] } {
|
|
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
|
sct driving 1
|
|
}
|
|
}
|
|
debug_log ${tc_root} 1 "setValue sct send ${cmd}"
|
|
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
|
sct send "${cmd}"
|
|
}
|
|
return ${nextState}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
|
|
::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
set ns "[namespace current]"
|
|
set catch_status [ catch {
|
|
|
|
MakeSICSObj ${name} SCT_OBJECT
|
|
|
|
sicslist setatt ${name} driver astrium_chopper
|
|
sicslist setatt ${name} klass ${device_class}
|
|
sicslist setatt ${name} long_name ${name}
|
|
|
|
set scobj_hpath /sics/${name}
|
|
|
|
hfactory ${scobj_hpath}/disk_1 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/disk_1/aphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_1/aphase control true
|
|
hsetprop ${scobj_hpath}/disk_1/aphase data true
|
|
hsetprop ${scobj_hpath}/disk_1/aphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_1/aphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/aphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/aphase nxalias "${name}_disk_1_aphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed control true
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed data true
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/aspeed nxalias "${name}_disk_1_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/frequency plain user float
|
|
hsetprop ${scobj_hpath}/disk_1/frequency control true
|
|
hsetprop ${scobj_hpath}/disk_1/frequency data true
|
|
hsetprop ${scobj_hpath}/disk_1/frequency mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/frequency nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/frequency oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_1/frequency klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/frequency sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/frequency type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/frequency nxalias "${name}_disk_1_frequency"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/master plain user text
|
|
hsetprop ${scobj_hpath}/disk_1/master control true
|
|
hsetprop ${scobj_hpath}/disk_1/master data true
|
|
hsetprop ${scobj_hpath}/disk_1/master mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/master nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_1/master klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/master type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/master nxalias "${name}_disk_1_master"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/rphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_1/rphase control true
|
|
hsetprop ${scobj_hpath}/disk_1/rphase data true
|
|
hsetprop ${scobj_hpath}/disk_1/rphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_1/rphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/rphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/rphase nxalias "${name}_disk_1_rphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed control true
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed data true
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/rspeed nxalias "${name}_disk_1_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_1/state plain user text
|
|
hsetprop ${scobj_hpath}/disk_1/state read ${ns}::fetchState ${scobj_hpath} readState {1}
|
|
hsetprop ${scobj_hpath}/disk_1/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/disk_1/state control true
|
|
hsetprop ${scobj_hpath}/disk_1/state data true
|
|
hsetprop ${scobj_hpath}/disk_1/state mutable true
|
|
hsetprop ${scobj_hpath}/disk_1/state nxsave true
|
|
hsetprop ${scobj_hpath}/disk_1/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_1/state klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_1/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/disk_1/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_1/state type "part"
|
|
hsetprop ${scobj_hpath}/disk_1/state nxalias "${name}_disk_1_state"
|
|
|
|
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/disk_1/state 1
|
|
hsetprop ${scobj_hpath}/disk_1/state simulated false
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
|
|
hsetprop ${scobj_hpath}/disk_1/state simulated true
|
|
}
|
|
hsetprop ${scobj_hpath}/disk_1 data "true"
|
|
hsetprop ${scobj_hpath}/disk_1 klass "@none"
|
|
hsetprop ${scobj_hpath}/disk_1 type "part"
|
|
|
|
hfactory ${scobj_hpath}/disk_2 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/disk_2/aphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_2/aphase control true
|
|
hsetprop ${scobj_hpath}/disk_2/aphase data true
|
|
hsetprop ${scobj_hpath}/disk_2/aphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_2/aphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/aphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/aphase nxalias "${name}_disk_2_aphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed control true
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed data true
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/aspeed nxalias "${name}_disk_2_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/frequency plain user float
|
|
hsetprop ${scobj_hpath}/disk_2/frequency control true
|
|
hsetprop ${scobj_hpath}/disk_2/frequency data true
|
|
hsetprop ${scobj_hpath}/disk_2/frequency mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/frequency nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/frequency oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_2/frequency klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/frequency sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/frequency type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/frequency nxalias "${name}_disk_2_frequency"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/master plain user text
|
|
hsetprop ${scobj_hpath}/disk_2/master control true
|
|
hsetprop ${scobj_hpath}/disk_2/master data true
|
|
hsetprop ${scobj_hpath}/disk_2/master mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/master nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_2/master klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/master type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/master nxalias "${name}_disk_2_master"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/rphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_2/rphase control true
|
|
hsetprop ${scobj_hpath}/disk_2/rphase data true
|
|
hsetprop ${scobj_hpath}/disk_2/rphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_2/rphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/rphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/rphase nxalias "${name}_disk_2_rphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed control true
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed data true
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/rspeed nxalias "${name}_disk_2_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_2/state plain user text
|
|
hsetprop ${scobj_hpath}/disk_2/state read ${ns}::fetchState ${scobj_hpath} readState {2}
|
|
hsetprop ${scobj_hpath}/disk_2/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/disk_2/state control true
|
|
hsetprop ${scobj_hpath}/disk_2/state data true
|
|
hsetprop ${scobj_hpath}/disk_2/state mutable true
|
|
hsetprop ${scobj_hpath}/disk_2/state nxsave true
|
|
hsetprop ${scobj_hpath}/disk_2/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_2/state klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_2/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/disk_2/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_2/state type "part"
|
|
hsetprop ${scobj_hpath}/disk_2/state nxalias "${name}_disk_2_state"
|
|
|
|
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/disk_2/state 1
|
|
hsetprop ${scobj_hpath}/disk_2/state simulated false
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
|
|
hsetprop ${scobj_hpath}/disk_2/state simulated true
|
|
}
|
|
hsetprop ${scobj_hpath}/disk_2 data "true"
|
|
hsetprop ${scobj_hpath}/disk_2 klass "@none"
|
|
hsetprop ${scobj_hpath}/disk_2 type "part"
|
|
|
|
hfactory ${scobj_hpath}/disk_3 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/disk_3/aphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_3/aphase control true
|
|
hsetprop ${scobj_hpath}/disk_3/aphase data true
|
|
hsetprop ${scobj_hpath}/disk_3/aphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_3/aphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/aphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/aphase nxalias "${name}_disk_3_aphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed control true
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed data true
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/aspeed nxalias "${name}_disk_3_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/frequency plain user float
|
|
hsetprop ${scobj_hpath}/disk_3/frequency control true
|
|
hsetprop ${scobj_hpath}/disk_3/frequency data true
|
|
hsetprop ${scobj_hpath}/disk_3/frequency mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/frequency nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/frequency oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_3/frequency klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/frequency sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/frequency type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/frequency nxalias "${name}_disk_3_frequency"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/master plain user text
|
|
hsetprop ${scobj_hpath}/disk_3/master control true
|
|
hsetprop ${scobj_hpath}/disk_3/master data true
|
|
hsetprop ${scobj_hpath}/disk_3/master mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/master nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_3/master klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/master type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/master nxalias "${name}_disk_3_master"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/rphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_3/rphase control true
|
|
hsetprop ${scobj_hpath}/disk_3/rphase data true
|
|
hsetprop ${scobj_hpath}/disk_3/rphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_3/rphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/rphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/rphase nxalias "${name}_disk_3_rphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed control true
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed data true
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/rspeed nxalias "${name}_disk_3_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_3/state plain user text
|
|
hsetprop ${scobj_hpath}/disk_3/state read ${ns}::fetchState ${scobj_hpath} readState {3}
|
|
hsetprop ${scobj_hpath}/disk_3/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/disk_3/state control true
|
|
hsetprop ${scobj_hpath}/disk_3/state data true
|
|
hsetprop ${scobj_hpath}/disk_3/state mutable true
|
|
hsetprop ${scobj_hpath}/disk_3/state nxsave true
|
|
hsetprop ${scobj_hpath}/disk_3/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_3/state klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_3/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/disk_3/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_3/state type "part"
|
|
hsetprop ${scobj_hpath}/disk_3/state nxalias "${name}_disk_3_state"
|
|
|
|
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/disk_3/state 1
|
|
hsetprop ${scobj_hpath}/disk_3/state simulated false
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
|
|
hsetprop ${scobj_hpath}/disk_3/state simulated true
|
|
}
|
|
hsetprop ${scobj_hpath}/disk_3 data "true"
|
|
hsetprop ${scobj_hpath}/disk_3 klass "@none"
|
|
hsetprop ${scobj_hpath}/disk_3 type "part"
|
|
|
|
hfactory ${scobj_hpath}/disk_4 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/disk_4/aphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_4/aphase control true
|
|
hsetprop ${scobj_hpath}/disk_4/aphase data true
|
|
hsetprop ${scobj_hpath}/disk_4/aphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_4/aphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/aphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/aphase nxalias "${name}_disk_4_aphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed control true
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed data true
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/aspeed nxalias "${name}_disk_4_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/frequency plain user float
|
|
hsetprop ${scobj_hpath}/disk_4/frequency control true
|
|
hsetprop ${scobj_hpath}/disk_4/frequency data true
|
|
hsetprop ${scobj_hpath}/disk_4/frequency mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/frequency nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/frequency oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_4/frequency klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/frequency sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/frequency type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/frequency nxalias "${name}_disk_4_frequency"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/master plain user text
|
|
hsetprop ${scobj_hpath}/disk_4/master control true
|
|
hsetprop ${scobj_hpath}/disk_4/master data true
|
|
hsetprop ${scobj_hpath}/disk_4/master mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/master nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_4/master klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/master type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/master nxalias "${name}_disk_4_master"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/rphase plain user float
|
|
hsetprop ${scobj_hpath}/disk_4/rphase control true
|
|
hsetprop ${scobj_hpath}/disk_4/rphase data true
|
|
hsetprop ${scobj_hpath}/disk_4/rphase mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_4/rphase klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/rphase type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/rphase nxalias "${name}_disk_4_rphase"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed control true
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed data true
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/rspeed nxalias "${name}_disk_4_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/disk_4/state plain user text
|
|
hsetprop ${scobj_hpath}/disk_4/state read ${ns}::fetchState ${scobj_hpath} readState {4}
|
|
hsetprop ${scobj_hpath}/disk_4/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/disk_4/state control true
|
|
hsetprop ${scobj_hpath}/disk_4/state data true
|
|
hsetprop ${scobj_hpath}/disk_4/state mutable true
|
|
hsetprop ${scobj_hpath}/disk_4/state nxsave true
|
|
hsetprop ${scobj_hpath}/disk_4/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/disk_4/state klass "parameter"
|
|
hsetprop ${scobj_hpath}/disk_4/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/disk_4/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/disk_4/state type "part"
|
|
hsetprop ${scobj_hpath}/disk_4/state nxalias "${name}_disk_4_state"
|
|
|
|
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/disk_4/state 1
|
|
hsetprop ${scobj_hpath}/disk_4/state simulated false
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper"
|
|
hsetprop ${scobj_hpath}/disk_4/state simulated true
|
|
}
|
|
hsetprop ${scobj_hpath}/disk_4 data "true"
|
|
hsetprop ${scobj_hpath}/disk_4 klass "@none"
|
|
hsetprop ${scobj_hpath}/disk_4 type "part"
|
|
hsetprop ${scobj_hpath} driver astrium_chopper
|
|
hsetprop ${scobj_hpath} klass ${device_class}
|
|
hsetprop ${scobj_hpath} data true
|
|
hsetprop ${scobj_hpath} debug_threshold 5
|
|
# mkDriver hook code starts
|
|
# mkDriver hook code ends
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
proc ::scobj::astrium_chopper::add_driver {name device_class simulation_flag ip_address tcp_port} {
|
|
set catch_status [ catch {
|
|
::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
|
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
|
|
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
|
|
makesctcontroller sct_${name} aqadapter ${tcp_port}
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
|
|
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
|
}
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for astrium_chopper"
|
|
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
|
makesctcontroller sct_${name} aqadapter NULL
|
|
}
|
|
::scobj::astrium_chopper::sics_log 1 "::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
|
::scobj::astrium_chopper::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
namespace eval ::scobj::astrium_chopper {
|
|
namespace export debug_threshold
|
|
namespace export debug_log
|
|
namespace export sics_log
|
|
namespace export mkDriver
|
|
namespace export add_driver
|
|
}
|
|
|
|
proc add_astrium_chopper {name ip_address tcp_port} {
|
|
set simulation_flag "[string tolower [SplitReply [chopper_simulation]]]"
|
|
::scobj::astrium_chopper::add_driver ${name} "NXdisk_chopper" ${simulation_flag} ${ip_address} ${tcp_port}
|
|
}
|
|
|
|
clientput "file evaluation of sct_astrium_chopper.tcl"
|
|
::scobj::astrium_chopper::sics_log 9 "file evaluation of sct_astrium_chopper.tcl"
|
|
|
|
proc ::scobj::astrium_chopper::read_config {} {
|
|
set catch_status [ catch {
|
|
set ns "::scobj::astrium_chopper"
|
|
dict for {k u} $::config_dict {
|
|
if { [dict exists $u "implementation"] } {
|
|
set simulation_flag "[string tolower [SplitReply [chopper_simulation]]]"
|
|
set device_class "NXdisk_chopper"
|
|
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"] "astrium_chopper"] } {
|
|
if { ![string equal -nocase "${simulation_flag}" "false"] } {
|
|
set asyncqueue "null"
|
|
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
|
|
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
|
makesctcontroller sct_${name} aqadapter NULL
|
|
} elseif { [dict exists $v "asyncqueue"] } {
|
|
set asyncqueue [dict get $v "asyncqueue"]
|
|
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
|
set ip_address [dict get $v ip]
|
|
set tcp_port [dict get $v port]
|
|
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
|
} else {
|
|
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
|
}
|
|
} else {
|
|
if { [dict exists $v "asyncprotocol"] } {
|
|
set asyncprotocol [dict get $v "asyncprotocol"]
|
|
} else {
|
|
set asyncprotocol ${name}_protocol
|
|
MakeAsyncProtocol ${asyncprotocol}
|
|
if { [dict exists $v "sendterminator"] } {
|
|
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
|
|
} elseif { [dict exists $v "terminator"] } {
|
|
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
|
}
|
|
if { [dict exists $v "replyterminator"] } {
|
|
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
|
|
} elseif { [dict exists $v "terminator"] } {
|
|
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
|
}
|
|
}
|
|
set asyncqueue ${name}_queue
|
|
set ip_address [dict get $v ip]
|
|
set tcp_port [dict get $v port]
|
|
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
|
|
if { [dict exists $v "timeout"] } {
|
|
${asyncqueue} timeout "[dict get $v "timeout"]"
|
|
}
|
|
makesctcontroller sct_${name} aqadapter ${asyncqueue}
|
|
}
|
|
${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::astrium_chopper::read_config
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 5 "No config dict"
|
|
}
|