625 lines
27 KiB
Tcl
625 lines
27 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 2
|
|
}
|
|
|
|
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 fd [open "../log/astrium_chopper_[basename ${tc_root}].log" "a"]
|
|
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
|
puts ${fd} "${line}"
|
|
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]]
|
|
foreach node [list ASPEED RSPEED APHASE RPHASE MASTER] {
|
|
if { [string equal -nocase "${lhs}" "${node}"] } {
|
|
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 } {
|
|
::scobj::astrium_chopper::sics_log 9 "::scobj::astrium_chopper::mkDriver for ${name}"
|
|
set ns "[namespace current]"
|
|
set catch_status [ catch {
|
|
|
|
MakeSICSObj ${name} SCT_OBJECT
|
|
|
|
sicslist setatt ${name} klass NXdisk_chopper
|
|
sicslist setatt ${name} long_name ${name}
|
|
|
|
set scobj_hpath /sics/${name}
|
|
|
|
hfactory ${scobj_hpath}/blade_1 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/blade_1/aphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_1/aphase control true
|
|
hsetprop ${scobj_hpath}/blade_1/aphase data true
|
|
hsetprop ${scobj_hpath}/blade_1/aphase mutable true
|
|
hsetprop ${scobj_hpath}/blade_1/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_1/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/aphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/aphase nxalias "${name}_blade_1_aphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_1/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed control true
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed data true
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/aspeed nxalias "${name}_blade_1_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_1/master plain user text
|
|
hsetprop ${scobj_hpath}/blade_1/master control true
|
|
hsetprop ${scobj_hpath}/blade_1/master data true
|
|
hsetprop ${scobj_hpath}/blade_1/master mutable false
|
|
hsetprop ${scobj_hpath}/blade_1/master nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_1/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/master type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/master nxalias "${name}_blade_1_master"
|
|
|
|
hfactory ${scobj_hpath}/blade_1/rphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_1/rphase control true
|
|
hsetprop ${scobj_hpath}/blade_1/rphase data true
|
|
hsetprop ${scobj_hpath}/blade_1/rphase mutable false
|
|
hsetprop ${scobj_hpath}/blade_1/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_1/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/rphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/rphase nxalias "${name}_blade_1_rphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_1/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed control true
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed data true
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed mutable false
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/rspeed nxalias "${name}_blade_1_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_1/state plain user text
|
|
hsetprop ${scobj_hpath}/blade_1/state read ${ns}::fetchState ${scobj_hpath} readState {1}
|
|
hsetprop ${scobj_hpath}/blade_1/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/blade_1/state control true
|
|
hsetprop ${scobj_hpath}/blade_1/state data true
|
|
hsetprop ${scobj_hpath}/blade_1/state mutable true
|
|
hsetprop ${scobj_hpath}/blade_1/state nxsave true
|
|
hsetprop ${scobj_hpath}/blade_1/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_1/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/blade_1/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_1/state type "part"
|
|
hsetprop ${scobj_hpath}/blade_1/state nxalias "${name}_blade_1_state"
|
|
|
|
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/blade_1/state 1
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper"
|
|
}
|
|
|
|
hfactory ${scobj_hpath}/blade_2 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/blade_2/aphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_2/aphase control true
|
|
hsetprop ${scobj_hpath}/blade_2/aphase data true
|
|
hsetprop ${scobj_hpath}/blade_2/aphase mutable true
|
|
hsetprop ${scobj_hpath}/blade_2/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_2/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/aphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/aphase nxalias "${name}_blade_2_aphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_2/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed control true
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed data true
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/aspeed nxalias "${name}_blade_2_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_2/master plain user text
|
|
hsetprop ${scobj_hpath}/blade_2/master control true
|
|
hsetprop ${scobj_hpath}/blade_2/master data true
|
|
hsetprop ${scobj_hpath}/blade_2/master mutable false
|
|
hsetprop ${scobj_hpath}/blade_2/master nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_2/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/master type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/master nxalias "${name}_blade_2_master"
|
|
|
|
hfactory ${scobj_hpath}/blade_2/rphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_2/rphase control true
|
|
hsetprop ${scobj_hpath}/blade_2/rphase data true
|
|
hsetprop ${scobj_hpath}/blade_2/rphase mutable false
|
|
hsetprop ${scobj_hpath}/blade_2/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_2/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/rphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/rphase nxalias "${name}_blade_2_rphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_2/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed control true
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed data true
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed mutable false
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/rspeed nxalias "${name}_blade_2_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_2/state plain user text
|
|
hsetprop ${scobj_hpath}/blade_2/state read ${ns}::fetchState ${scobj_hpath} readState {2}
|
|
hsetprop ${scobj_hpath}/blade_2/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/blade_2/state control true
|
|
hsetprop ${scobj_hpath}/blade_2/state data true
|
|
hsetprop ${scobj_hpath}/blade_2/state mutable true
|
|
hsetprop ${scobj_hpath}/blade_2/state nxsave true
|
|
hsetprop ${scobj_hpath}/blade_2/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_2/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/blade_2/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_2/state type "part"
|
|
hsetprop ${scobj_hpath}/blade_2/state nxalias "${name}_blade_2_state"
|
|
|
|
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/blade_2/state 1
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper"
|
|
}
|
|
|
|
hfactory ${scobj_hpath}/blade_3 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/blade_3/aphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_3/aphase control true
|
|
hsetprop ${scobj_hpath}/blade_3/aphase data true
|
|
hsetprop ${scobj_hpath}/blade_3/aphase mutable true
|
|
hsetprop ${scobj_hpath}/blade_3/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_3/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/aphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/aphase nxalias "${name}_blade_3_aphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_3/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed control true
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed data true
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/aspeed nxalias "${name}_blade_3_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_3/master plain user text
|
|
hsetprop ${scobj_hpath}/blade_3/master control true
|
|
hsetprop ${scobj_hpath}/blade_3/master data true
|
|
hsetprop ${scobj_hpath}/blade_3/master mutable false
|
|
hsetprop ${scobj_hpath}/blade_3/master nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_3/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/master type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/master nxalias "${name}_blade_3_master"
|
|
|
|
hfactory ${scobj_hpath}/blade_3/rphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_3/rphase control true
|
|
hsetprop ${scobj_hpath}/blade_3/rphase data true
|
|
hsetprop ${scobj_hpath}/blade_3/rphase mutable false
|
|
hsetprop ${scobj_hpath}/blade_3/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_3/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/rphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/rphase nxalias "${name}_blade_3_rphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_3/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed control true
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed data true
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed mutable false
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/rspeed nxalias "${name}_blade_3_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_3/state plain user text
|
|
hsetprop ${scobj_hpath}/blade_3/state read ${ns}::fetchState ${scobj_hpath} readState {3}
|
|
hsetprop ${scobj_hpath}/blade_3/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/blade_3/state control true
|
|
hsetprop ${scobj_hpath}/blade_3/state data true
|
|
hsetprop ${scobj_hpath}/blade_3/state mutable true
|
|
hsetprop ${scobj_hpath}/blade_3/state nxsave true
|
|
hsetprop ${scobj_hpath}/blade_3/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_3/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/blade_3/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_3/state type "part"
|
|
hsetprop ${scobj_hpath}/blade_3/state nxalias "${name}_blade_3_state"
|
|
|
|
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/blade_3/state 1
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper"
|
|
}
|
|
|
|
hfactory ${scobj_hpath}/blade_4 plain spy none
|
|
|
|
hfactory ${scobj_hpath}/blade_4/aphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_4/aphase control true
|
|
hsetprop ${scobj_hpath}/blade_4/aphase data true
|
|
hsetprop ${scobj_hpath}/blade_4/aphase mutable true
|
|
hsetprop ${scobj_hpath}/blade_4/aphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/aphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_4/aphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/aphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/aphase nxalias "${name}_blade_4_aphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_4/aspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed control true
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed data true
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed mutable true
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/aspeed nxalias "${name}_blade_4_aspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_4/master plain user text
|
|
hsetprop ${scobj_hpath}/blade_4/master control true
|
|
hsetprop ${scobj_hpath}/blade_4/master data true
|
|
hsetprop ${scobj_hpath}/blade_4/master mutable false
|
|
hsetprop ${scobj_hpath}/blade_4/master nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/master oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_4/master sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/master type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/master nxalias "${name}_blade_4_master"
|
|
|
|
hfactory ${scobj_hpath}/blade_4/rphase plain user float
|
|
hsetprop ${scobj_hpath}/blade_4/rphase control true
|
|
hsetprop ${scobj_hpath}/blade_4/rphase data true
|
|
hsetprop ${scobj_hpath}/blade_4/rphase mutable false
|
|
hsetprop ${scobj_hpath}/blade_4/rphase nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/rphase oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_4/rphase sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/rphase type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/rphase nxalias "${name}_blade_4_rphase"
|
|
|
|
hfactory ${scobj_hpath}/blade_4/rspeed plain user float
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed control true
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed data true
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed mutable false
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed oldval 0.0
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/rspeed nxalias "${name}_blade_4_rspeed"
|
|
|
|
hfactory ${scobj_hpath}/blade_4/state plain user text
|
|
hsetprop ${scobj_hpath}/blade_4/state read ${ns}::fetchState ${scobj_hpath} readState {4}
|
|
hsetprop ${scobj_hpath}/blade_4/state readState ${ns}::readState ${scobj_hpath}
|
|
hsetprop ${scobj_hpath}/blade_4/state control true
|
|
hsetprop ${scobj_hpath}/blade_4/state data true
|
|
hsetprop ${scobj_hpath}/blade_4/state mutable true
|
|
hsetprop ${scobj_hpath}/blade_4/state nxsave true
|
|
hsetprop ${scobj_hpath}/blade_4/state oldval UNKNOWN
|
|
hsetprop ${scobj_hpath}/blade_4/state my_state "idle"
|
|
hsetprop ${scobj_hpath}/blade_4/state sdsinfo "::nexus::scobj::sdsinfo"
|
|
hsetprop ${scobj_hpath}/blade_4/state type "part"
|
|
hsetprop ${scobj_hpath}/blade_4/state nxalias "${name}_blade_4_state"
|
|
|
|
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
|
|
${sct_controller} poll ${scobj_hpath}/blade_4/state 1
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No poll/write for astrium_chopper"
|
|
}
|
|
hsetprop ${scobj_hpath} klass NXdisk_chopper
|
|
hsetprop ${scobj_hpath} debug_threshold 2
|
|
# mkDriver hook code starts
|
|
hsetprop ${scobj_hpath} debug_threshold 1
|
|
# mkDriver hook code ends
|
|
} 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
|
|
}
|
|
|
|
proc add_astrium_chopper {name IP port} {
|
|
set catch_status [ catch {
|
|
::scobj::astrium_chopper::sics_log 9 "add_astrium_chopper ${name} ${IP} ${port}"
|
|
if {[string equal -nocase [SplitReply [chopper_simulation]] "false"]} {
|
|
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
|
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
|
|
makesctcontroller sct_${name} aqadapter ${port}
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
|
|
makesctcontroller sct_${name} std ${IP}:${port}
|
|
}
|
|
} else {
|
|
::scobj::astrium_chopper::sics_log 9 "[chopper_simulation] => No sctcontroller for astrium_chopper"
|
|
}
|
|
::scobj::astrium_chopper::sics_log 1 "::scobj::astrium_chopper::mkDriver sct_${name} ${name}"
|
|
::scobj::astrium_chopper::mkDriver sct_${name} ${name}
|
|
} catch_message ]
|
|
handle_exception ${catch_status} ${catch_message}
|
|
}
|
|
|
|
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 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"] "astrium_chopper"] } {
|
|
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
|
|
if { ![string equal -nocase [SplitReply [chopper_simulation]] "false"] } {
|
|
set asyncqueue "null"
|
|
${ns}::sics_log 9 "[chopper_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"]"
|
|
}
|
|
}
|
|
add_astrium_chopper ${name} "aqadapter" ${asyncqueue}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} 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"
|
|
}
|