Improve handling and logging for xxx_simulation case

This commit is contained in:
Douglas Clowes
2014-05-28 12:24:20 +10:00
parent 28ea3befb6
commit 2517f71c67

View File

@ -1266,7 +1266,7 @@ def put_group(MyDriver, MyGroup):
txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])]
if readable_or_writeable:
txt += ['']
txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
for var in sorted(MyGroup['Vars']):
MyVar = MyGroup['Vars'][var]
nodename = groupname + MyVar['name']
@ -1284,6 +1284,8 @@ def put_group(MyDriver, MyGroup):
# Generate <dev>_<group...>_<name> at runtime for driveable
driveable = '${name}_' + make_path(MyVar)
txt += [' ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])]
txt += [' } else {']
txt += [' %s::sics_log 9 "[%s] => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])]
txt += [' }']
for grp in sorted(MyGroup['Groups']):
txt += put_group(MyDriver, MyGroup['Groups'][grp])
@ -1357,7 +1359,7 @@ def put_postamble(MyDriver):
txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port} %s"' % (MyDriver['namespace'], MyDriver['name'], make_args)]
else:
txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port}"' % (MyDriver['namespace'], MyDriver['name'])]
txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {']
txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"' % MyDriver['namespace']]
txt += [' makesctcontroller sct_${name} aqadapter ${port}']
@ -1370,6 +1372,8 @@ def put_postamble(MyDriver):
txt += [' %s::sics_log 9 "makesctcontroller sct_${name} %s ${IP}:${port}"' % (MyDriver['namespace'], MyDriver['protocol'])]
txt += [' makesctcontroller sct_${name} %s ${IP}:${port}' % MyDriver['protocol']]
txt += [' }']
txt += [' } else {']
txt += [' %s::sics_log 9 "[%s] => No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])]
txt += [' }']
if 'make_args' in MyDriver:
make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()])
@ -1399,7 +1403,10 @@ def put_read_config(MyDriver):
txt += [' if { [dict get $v "driver"] == "%s" } {' % MyDriver['name']]
txt += [' if { [dict get $v enabled] } {']
txt += [' set name [dict get $v name]']
txt += [' if { [dict exists $v "asyncqueue"] } {']
txt += [' if { ![string equal -nocase [SplitReply [%s]] "false"] } {' % MyDriver['simulation_group']]
txt += [' set asyncqueue "null"']
txt += [' ${ns}::sics_log 9 "[%s] => using null asyncqueue"' % MyDriver['simulation_group']]
txt += [' } elseif { [dict exists $v "asyncqueue"] } {']
txt += [' set asyncqueue [dict get $v "asyncqueue"]']
txt += [' } else {']
txt += [' if { [dict exists $v "asyncprotocol"] } {']