Regenerate all the SCT drivers with new generator

This commit is contained in:
Douglas Clowes
2014-11-07 09:14:09 +11:00
parent 6c6292bbb2
commit 9909c1412e
42 changed files with 2483 additions and 1186 deletions

View File

@@ -215,6 +215,14 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation
hsetprop ${scobj_hpath}/distance type "part"
hsetprop ${scobj_hpath}/distance nxalias "${name}_distance"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/distance 1
hsetprop ${scobj_hpath}/distance simulated false
} else {
::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc"
hsetprop ${scobj_hpath}/distance simulated true
}
hfactory ${scobj_hpath}/id plain user text
hsetprop ${scobj_hpath}/id read ${ns}::getValue ${scobj_hpath} read_id {0501}
hsetprop ${scobj_hpath}/id read_id ${ns}::read_id ${scobj_hpath}
@@ -228,16 +236,17 @@ proc ::scobj::omron_hldc::mkDriver { sct_controller name device_class simulation
hsetprop ${scobj_hpath}/id type "part"
hsetprop ${scobj_hpath}/id nxalias "${name}_id"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/id 10
hsetprop ${scobj_hpath}/id simulated false
} else {
::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc"
hsetprop ${scobj_hpath}/id simulated true
}
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/distance 1
${sct_controller} poll ${scobj_hpath}/id 10
} else {
::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for omron_hldc"
}
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
@@ -258,7 +267,9 @@ proc ::scobj::omron_hldc::add_driver {name device_class simulation_flag ip_addre
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::omron_hldc::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for omron_hldc"
::scobj::omron_hldc::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for omron_hldc"
::scobj::omron_hldc::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
}
::scobj::omron_hldc::sics_log 1 "::scobj::omron_hldc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::omron_hldc::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
@@ -276,7 +287,7 @@ namespace eval ::scobj::omron_hldc {
proc add_omron_hldc {name ip_address tcp_port} {
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
::scobj::omron_hldc::add_driver ${name} "environment" "${simulation_flag}" ${ip_address} ${tcp_port}
::scobj::omron_hldc::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port}
}
clientput "file evaluation of sct_omron_hldc.tcl"
@@ -315,20 +326,31 @@ proc ::scobj::omron_hldc::read_config {} {
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 "terminator"] } {
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"]"
}
}
@@ -339,12 +361,9 @@ proc ::scobj::omron_hldc::read_config {} {
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
}
}
}