# Defines hashes which map SICS device object names to hipadaba paths InstallHdb #Usage: xhmake /a/b spy none {type part} proc xhmake {path priv dtype pKey pVal} { global pathlist; if {[info exists pathlist($path)] == 0} { set basepath ""; foreach p [split [string trimleft $path / ] / ] { if {[info exists pathlist($basepath/$p)] == 1} { append basepath /$p; continue; } hmake $basepath/$p $priv $dtype; hsetprop $basepath/$p $pKey $pVal; set pathlist($basepath/$p) 1; append basepath /$p; } } } hmake /commands spy none set pathlist(/commands) 1 hsetprop /commands type commandset hmake /graphics spy none set pathlist(/graphics) 1 hsetprop /graphics type graphset hsetprop /commands type commandset #TODO change this to hparts.tcl source $cfPath(hipadaba)/hpaths.tcl set instrument [string tolower [SplitReply [Instrument]] ] hmake /$instrument spy none hsetprop /$instrument type instrument set pathlist(/$instrument) 1 hmake /$instrument/status spy none set pathlist(/$instrument/status) 1 hsetprop /$instrument/status type part # Generate hipadaba nodes for the paths in the hpaths file foreach hp $hpaths { hmake /$instrument/$hp spy none; hsetprop /$instrument/$hp type part; set pathlist(/$instrument/$hp) 1; } #--- admin hmake /experiment user none set pathlist(/experiment) 1 hattach /experiment title title hattach /experiment sample description hmake /experiment/user spy none hsetprop /experiment/user type part set pathlist(/experiment/user) 1 hattach /experiment/user user name hattach /experiment/user email email hattach /experiment/user phone phone hattach /experiment dataFileName datafile #--- Motors foreach {type path} $motor_hpath { if {[info exists pathlist(/$instrument/$path)] == 0} { hmake /$instrument/$path spy none; hsetprop /$instrument/$path type part; set pathlist(/$instrument/$path) 1; } } array set mot_Pdic $motor_hpath; foreach motor [sicslist type motor] { if {$motor == "motor"} {continue} set mpart [SplitReply [$motor part]]; foreach {type group} [split $mpart .] {}; set path $mot_Pdic($type); if {$group != ""} { append path /$group; } xhmake /$instrument/$path spy none type part; hattach /$instrument/$path $motor [SplitReply [$motor long_name]]; } #--- Configurable Virtual Motors foreach {obj name part master_obj} $cvirtmotor_hpath { set path /$instrument/$part hattach $path $obj $name foreach m $master_obj { hchain $path/$name $path/$m } #FIXME polling causes scans to abort #sicspoll add $path/$name hdb 2 } #------------- scan command ::scancommand::commands_hpath_setup /commands ::scancommand::graphics_hpath_setup /graphics ::scancommand::init #------------- plc controller ::plc::status_hpath_setup /$instrument/status unset pathlist;