Files
sics/site_ansto/instrument/hipadaba/hipadaba_support.tcl
Ferdi Franceschini 602a1a5f1b Adding counter support.
r1343 | ffr | 2006-12-04 09:46:43 +1100 (Mon, 04 Dec 2006) | 2 lines
2012-11-15 12:54:49 +11:00

78 lines
2.4 KiB
Tcl

# Defines the makeHdb<device> commands which create hipadaba nodes along
# with their read and write scripts. The makeHdb<device> commands are called
# by sourcing the hipadaba_configuration.tcl script when SICS is launched.
source ParList.tcl
# Common code for making Motor and ConfigurableVirtualMotor hdb scripts.
set hdbMakeAnyMotorScript {
append devPath $hpath "/" $treename
eval hmake $devPath spy none
foreach {ppName ppPriv ppType ppVal} $primaryProperty {
eval hmakescript "$devPath/$ppName" \"$sicsname\" \"run $sicsname\" $ppType;
}
foreach {name priv type value} $parList {
eval hmakescript "$devPath/$name" \"$sicsname $name\" \"$sicsname $name\" $type
}
}
# These commands make a hipadaba script in their devices namespace
proc ::deviceType::Motor::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
global hdbMakeAnyMotorScript;
eval $hdbMakeAnyMotorScript;
}
proc ::deviceType::ConfigurableVirtualMotor::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
global hdbMakeAnyMotorScript;
eval $hdbMakeAnyMotorScript;
}
proc ::deviceType::SingleCounter::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
append devPath $hpath "/" $treename;
eval hmake $devPath spy none;
foreach {ppName ppPriv ppType ppVal} $primaryProperty {
eval hmakescript "$devPath/$ppName" \"$sicsname getcounts\" \"\" $ppType
}
foreach {name priv type value} $parList {
switch $name {
counting {
set cmd ::deviceType::SingleCounter::counting
eval hmakescript "$devPath/$name" \"\" \"$cmd $sicsname\" $type
}
default {
eval hmakescript "$devPath/$name" \"$sicsname $name\" \"$sicsname $name\" $type
}
}
}
}
# These commands will be called when the hipadaba configuration file is sourced
proc makeHdbMotor {hpath treename sicsname} {
::deviceType::Motor::hdbMakeScript $hpath $treename $sicsname;
}
proc makeHdbVirtMotor {hpath treename sicsname} {
::deviceType::ConfigurableVirtualMotor::hdbMakeScript $hpath $treename $sicsname;
}
proc makeHdbCounter {hpath treename sicsname} {
::deviceType::SingleCounter::hdbMakeScript $hpath $treename $sicsname;
}
#FIXME implement makeHdbHM
proc makeHdbHM {hpath treename sicsname} {
}
#------------------------------------------------------------------------
proc hdbReadOnly {} {
error "Parameter is READ ONLY"
}