Added evcontroller sdsinfo and save commands

r2141 | mle | 2007-08-23 16:42:40 +1000 (Thu, 23 Aug 2007) | 2 lines
This commit is contained in:
Mark Lesha
2007-08-23 16:42:40 +10:00
committed by Douglas Clowes
parent 88489adc49
commit 943b0c8293

View File

@@ -30,7 +30,7 @@ namespace eval nexus {
global cfPath global cfPath
variable nexusdic variable nexusdic
variable state variable state
variable nxFileOpen; variable nxFileOpen;nxsave=true,
if {$state(file,open) == "true"} { if {$state(file,open) == "true"} {
error_msg "Can't create a new file because the current file is still open" error_msg "Can't create a new file because the current file is still open"
} elseif {$state(file,new) == "false"} { } elseif {$state(file,new) == "false"} {
@@ -470,7 +470,32 @@ namespace eval ::nexus::motor {
} }
} }
} }
namespace eval ::nexus::evcontroller {
# The save commands are called with the sobj name and nxalias
# The sdsinfo commands provide the SDS description for an nxdic
# save sphi alias float [point n]
proc save {evc nxalias data_type args} {
if {[lindex $args 0] == "point"} {
set index [lindex $args 1]
nxscript_data clear;
nxscript_data putfloat 0 [getVal [$evc] ]
nxscript putslab $nxalias [list $index] [list 1] nxscript_data
} else {
nxscript putfloat $nxalias [SplitReply [$evc]]
}
}
proc sdsinfo {evc data_type args} {
array set param $args
array set evc_prop [attlist $evc]
set dtype [::nexus::hdb2nx_type $data_type]
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1} -attr {units,$evc_prop(units)} -attr {long_name,$evc_prop(long_name)}"
} else {
return " -type $dtype -attr {units,$evc_prop(units)} -attr {long_name,$evc_prop(long_name)}"
}
}
}
namespace eval ::nexus { namespace eval ::nexus {
proc hdb2nx_type {dtype} { proc hdb2nx_type {dtype} {
switch $dtype { switch $dtype {
@@ -568,7 +593,7 @@ namespace eval ::nexus::script {
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}] set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]] set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
set tmpstr [string map {"$" ""} {$Revision: 1.26 $}] set tmpstr [string map {"$" ""} {$Revision: 1.27 $}]
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]] set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]