Added environment controller as a sics object type to the new hdb/nexus code.

r2137 | ffr | 2007-08-21 08:52:25 +1000 (Tue, 21 Aug 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-08-21 08:52:25 +10:00
committed by Douglas Clowes
parent 9d9bf24775
commit c4fd7a4d9f
4 changed files with 58 additions and 30 deletions

View File

@@ -263,17 +263,14 @@ proc sobjadd {hpath sobj args} {
motor - configurablevirtualmotor {
if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)]
hsetprop $hpath type part
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
}
if {[lsearch [hlist $hpath] $sobjatt(long_name)] == -1} {
# hattach $hpath $sobj $sobjatt(long_name)
# hsetprop $hpath/$sobjatt(long_name) units $sobjatt(units)
# hsetprop $hpath/$sobjatt(long_name) long_name $sobjatt(long_name)
set node_path [add_node $hpath node $sobj long_name $sobjatt(long_name) kind $sobjatt(kind)]
hsetprop $node_path savecmd $sobjatt(savecmd)
hsetprop $node_path sdsinfo $sobjatt(sdsinfo)
hsetprop $node_path nxalias $sobjatt(nxalias)
hsetprop $node_path mutable $sobjatt(mutable)
if {[catch {hsetprop $node_path savecmd $sobjatt(savecmd)} err]} {clientput $err error}
if {[catch {hsetprop $node_path sdsinfo $sobjatt(sdsinfo)} err]} {clientput $err error}
if {[catch {hsetprop $node_path nxalias $sobjatt(nxalias)} err]} {clientput $err error}
if {[catch {hsetprop $node_path mutable $sobjatt(mutable)} err]} {clientput $err error}
} else {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
}
@@ -282,7 +279,7 @@ proc sobjadd {hpath sobj args} {
# access attribute = ro,rw
if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)]
hsetprop $hpath type part
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
}
if {[lsearch [hlist $hpath] $sobjatt(long_name)] != -1} {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
@@ -293,16 +290,16 @@ proc sobjadd {hpath sobj args} {
sicsvariable {
if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)]
hsetprop $hpath type part
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
}
if {[lsearch [hlist $hpath] $sobjatt(long_name)] == -1} {
set node_path [add_node $hpath node $sobj long_name $sobjatt(long_name) kind $sobjatt(kind)]
hsetprop $node_path sicsdev $sobj
hsetprop $node_path nxalias $sobj
hsetprop $node_path savecmd $sobjatt(savecmd)
hsetprop $node_path sdsinfo $sobjatt(sdsinfo)
hsetprop $node_path mutable $sobjatt(mutable)
hsetprop $node_path privilege $sobjatt(privilege)
if {[catch {hsetprop $node_path sicsdev $sobj} err]} {clientput $err error}
if {[catch {hsetprop $node_path nxalias $sobj} err]} {clientput $err error}
if {[catch {hsetprop $node_path savecmd $sobjatt(savecmd)} err]} {clientput $err error}
if {[catch {hsetprop $node_path sdsinfo $sobjatt(sdsinfo)} err]} {clientput $err error}
if {[catch {hsetprop $node_path mutable $sobjatt(mutable)} err]} {clientput $err error}
if {[catch {hsetprop $node_path privilege $sobjatt(privilege)} err]} {clientput $err error}
} else {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
}
@@ -314,19 +311,17 @@ proc sobjadd {hpath sobj args} {
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
}
histmem {
# TODO
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)]
hsetprop $hpath type part
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
}
if {[lsearch [hlist $hpath] $sobjatt(long_name)] == -1} {
set node_path [add_node $hpath node $sobj long_name $sobjatt(long_name) kind $sobjatt(kind)]
hsetprop $node_path savecmd $sobjatt(savecmd)
hsetprop $node_path sdsinfo $sobjatt(sdsinfo)
hsetprop $node_path nxalias $sobjatt(nxalias)
hsetprop $node_path mutable $sobjatt(mutable)
hsetprop $node_path sicsdev $sobj
if {[catch {hsetprop $node_path savecmd $sobjatt(savecmd)} err]} {clientput $err error}
if {[catch {hsetprop $node_path sdsinfo $sobjatt(sdsinfo)} err]} {clientput $err error}
if {[catch {hsetprop $node_path nxalias $sobjatt(nxalias)} err]} {clientput $err error}
if {[catch {hsetprop $node_path mutable $sobjatt(mutable)} err]} {clientput $err error}
if {[catch {hsetprop $node_path sicsdev $sobj} err]} {clientput $err error}
} else {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
}
@@ -343,6 +338,21 @@ proc sobjadd {hpath sobj args} {
# TODO
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
}
environment_controller {
if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)]
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
}
if {[lsearch [hlist $hpath] $sobjatt(long_name)] == -1} {
set node_path [add_node $hpath node $sobj long_name $sobjatt(long_name) kind $sobjatt(kind)]
if {[catch { hsetprop $node_path savecmd $sobjatt(savecmd)} err]} {clientput $err error}
if {[catch { hsetprop $node_path sdsinfo $sobjatt(sdsinfo)} err]} {clientput $err error}
if {[catch { hsetprop $node_path nxalias $sobjatt(nxalias)} err]} {clientput $err error}
if {[catch { hsetprop $node_path mutable $sobjatt(mutable)} err]} {clientput $err error}
} else {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
}
}
}
}

View File

@@ -12,7 +12,7 @@ set boolean {true false}
# SICS OBJECTS MUST PROVIDE THE FOLLOWING INFORMATION
set sobj_klass_list {@none aperture attenuator collimator command crystal data detector experiment graphics instrument monitor monochromator plc sample scan user}
set sobj_sicstype_list {sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject}
set sobj_sicstype_list {environment_controller sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject}
# Different kinds of things are added to the hdb in different ways.
# command: This is something a client can run with hset /a/b/c start, it may have parameters and feedback.
# Parameters and feedback should be made available in 'ilists' named after the command.
@@ -76,6 +76,11 @@ set sicsvariable_attlist [subst {
mutable [subst {{$boolean}}]
}]
set environment_controller_attlist [subst {
$sobj_attlist
mutable [subst {{$boolean}}]
}]
# A macro can be attached to an hdb node as a command or a script
set macro_attlist [subst {
$sobj_attlist

View File

@@ -1,7 +1,7 @@
# SICS common configuration
# $Revision: 1.28 $
# $Date: 2007-08-16 04:25:37 $
# $Revision: 1.29 $
# $Date: 2007-08-20 22:52:25 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by $Author: ffr $
@@ -56,7 +56,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]]
sics_release lock
::utility::mkVar sics_revision_num Text internal
set tmpstr [string map {"$" ""} {$Revision: 1.28 $}]
set tmpstr [string map {"$" ""} {$Revision: 1.29 $}]
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
sics_revision_num lock
@@ -102,6 +102,7 @@ proc server_set_sobj_attributes {} {
::utility::set_motor_attributes
::utility::set_histomem_attributes
::utility::set_sobj_attributes
::utility::set_envcontrol_attributes
::plc::set_sobj_attributes
::counter::set_sobj_attributes
::nexus::set_sobj_attributes

View File

@@ -1,7 +1,7 @@
# Some useful functions for SICS configuration.
# $Revision: 1.5 $
# $Date: 2007-08-16 07:13:19 $
# $Revision: 1.6 $
# $Date: 2007-08-20 22:52:25 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by $Author: ffr $
@@ -214,6 +214,18 @@ proc ::utility::set_motor_attributes {} {
sicslist setatt $m mutable true
}
}
proc ::utility::set_envcontrol_attributes {} {
foreach ec [sicslist type environment_controller] {
sicslist setatt $ec kind hobj
sicslist setatt $ec data true
sicslist setatt $ec control true
sicslist setatt $ec nxsave true
sicslist setatt $ec privilege user
sicslist setatt $ec nxalias $ec
sicslist setatt $ec mutable true
sicslist setatt $ec klass sample
}
}
# Retuns plain value of hdb node property
proc ::utility::hgetplainprop {hpath prop} {