add hdb structure

r3744 | jgn | 2012-09-24 10:05:39 +1000 (Mon, 24 Sep 2012) | 1 line
This commit is contained in:
Jing Chen
2012-09-24 10:05:39 +10:00
committed by Douglas Clowes
parent 5ceb583d26
commit 58b74c6f45

View File

@@ -653,9 +653,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
}
if {$displayable == 1} {
if {2 < [string length $cmdGroup]} {
::scobj::hinitprops $parentnode $cmdGroup/$varName
} else {
::scobj::hinitprops $parentnode $varName
}
}
} message ]} {
@@ -680,15 +678,14 @@ proc ::scobj::ag1010::mkAG {argList} {
}
MakeSICSObj $pa(NAME) SCT_OBJECT
sicslist setatt $pa(NAME) klass instrument
sicslist setatt $pa(NAME) klass environment
sicslist setatt $pa(NAME) long_name $pa(NAME)
# Create a base node for all the state machines of this sics object
#set scobj_hpath /sics/$pa(NAME)
set scobj_hpath /sics
set ns /sics/$pa(NAME)
#makesctcontroller sct_ag1010 rfamp $pa(IP):$pa(PORT)
#makesctcontroller sct_$pa(NAME) std $pa(IP):$pa(PORT)
makesctcontroller sct_$pa(NAME) lfgen $pa(IP):$pa(PORT)
#########################################################################################################
@@ -791,6 +788,39 @@ proc ::scobj::ag1010::mkAG {argList} {
createNode $scobj_hpath sct_$pa(NAME) $cmdGroup $varName $readable $writable $pollEnabled $displayable $dataType $unit $permission $rdPara $rdFunc $wrPara $allowedValues
}
# add HDB structure here
::scobj::set_required_props $ns
foreach {hpath klass control data priv type} {
/sics/ag1010 environment true true spy part
/sics/ag1010/MEAS NXsensor true true user NXsensor
/sics/ag1010/FRE NXsample true true user NXsample
} {
hsetprop $hpath klass $klass
hsetprop $hpath privilege $priv
hsetprop $hpath type $type
hsetprop $hpath control $control
hsetprop $hpath data $data
}
foreach {hpath klass control data nxsave mutable priv alias} {
/sics/ag1010/MEAS/ForwardPower NXsensor true true true true user ag1010_MEAS_ForwardPower
/sics/ag1010/MEAS/ReversePower NXsensor true true true true user ag1010_MEAS_ReversePower
/sics/ag1010/MEAS/Temperature NXsample true true true true user ag1010_MEAS_Temperature
/sics/ag1010/FRE/FREQ NXsample true true true true user ag1010_FRE_FREQ
} {
hsetprop $hpath nxalias $alias
hsetprop $hpath klass $klass
hsetprop $hpath privilege $priv
hsetprop $hpath control $control
hsetprop $hpath data $data
hsetprop $hpath nxsave $nxsave
hsetprop $hpath mutable $mutable
hsetprop $hpath sdsinfo ::nexus::scobj::sdsinfo
}
::scobj::hinitprops $pa(NAME)
} message ]} {
return -code error "Error in ::scobj::ag1010::mkAG $message"
}
@@ -804,14 +834,14 @@ namespace import ::scobj::ag1010::par
proc lf_pagc {{para ""} args} {
if {$para == ""} {
broadcast "[hget /sics/ag1010/AGC/PAGC] dW"
broadcast "[hget /instrument/ag1010/AGC/PAGC] dW"
} else {
set HEAD 0x96
set LEN 4
set CTRL 3
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
set newPara [string trim $para " "]
set data [format %04x $newPara]
@@ -825,14 +855,14 @@ proc lf_pagc {{para ""} args} {
proc lf_pmgc {{para ""} args} {
if {$para == ""} {
broadcast "[hget /sics/ag1010/MGC/PMGC] dW"
broadcast "[hget /instrument/ag1010/MGC/PMGC] dW"
} else {
set HEAD 0x96
set LEN 4
set CTRL 4
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
set newPara [string trim $para " "]
set data [format %04x $newPara]
@@ -846,14 +876,14 @@ proc lf_pmgc {{para ""} args} {
proc lf_freq {{para ""} args} {
if {$para == ""} {
broadcast "[hget /sics/ag1010/FRE/FREQ] Hz"
broadcast "[hget /instrument/ag1010/FRE/FREQ] Hz"
} else {
set HEAD 0x96
set LEN 6
set CTRL 5
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
set newPara [string trim $para " "]
if {$para < 0.02 || $para > 2000000} {
@@ -898,15 +928,15 @@ proc lf_sweep_run {startF stepF scyc {mode 2} args} {
proc lf_limits {args} {
if {$args == ""} {
broadcast "[hget /sics/ag1010/limits/ForwardPower] dW"
broadcast "[hget /sics/ag1010/limits/ReversePower] dW"
broadcast "[hget /instrument/ag1010/limits/ForwardPower] dW"
broadcast "[hget /instrument/ag1010/limits/ReversePower] dW"
} else {
set HEAD 0x96
set LEN 10
set CTRL 2
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
foreach {arg val} $args {
switch $arg {
@@ -941,16 +971,16 @@ proc lf_limits {args} {
proc lf_burst {args} {
if {$args == ""} {
broadcast "[hget /sics/ag1010/BurstPar/BurstMode]"
broadcast "[hget /sics/ag1010/BurstPar/BRepTime] ms"
broadcast "[hget /sics/ag1010/BurstPar/TimeOfPower] us"
broadcast "[hget /instrument/ag1010/BurstPar/BurstMode]"
broadcast "[hget /instrument/ag1010/BurstPar/BRepTime] ms"
broadcast "[hget /instrument/ag1010/BurstPar/TimeOfPower] us"
} else {
set HEAD 0x96
set LEN 7
set CTRL 8
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
set BurstMode 2
set BRepTime [hval $ns/BurstPar/BRepTime]
@@ -994,17 +1024,17 @@ proc lf_burst {args} {
proc lf_sweep {args} {
if {$args == ""} {
broadcast "[hget /sics/ag1010/SweepPar/SweepMode]"
broadcast "[hget /sics/ag1010/SweepPar/StartFreq] Hz"
broadcast "[hget /sics/ag1010/SweepPar/StepFreq] Hz"
broadcast "[hget /sics/ag1010/SweepPar/SCyc]"
broadcast "[hget /instrument/ag1010/SweepPar/SweepMode]"
broadcast "[hget /instrument/ag1010/SweepPar/StartFreq] Hz"
broadcast "[hget /instrument/ag1010/SweepPar/StepFreq] Hz"
broadcast "[hget /instrument/ag1010/SweepPar/SCyc]"
} else {
set HEAD 0x96
set LEN 13
set CTRL 9
set CRC 0
set ns /sics/ag1010
set ns /instrument/ag1010
set SweepMode 2
set SStr [expr [hval $ns/SweepPar/StartFreq] / 1000]
@@ -1057,9 +1087,9 @@ proc lf_sweep {args} {
proc lf_meas {} {
broadcast "[hget /sics/ag1010/MEAS/ForwardPower] dW"
broadcast "[hget /sics/ag1010/MEAS/ReversePower] dW"
broadcast "[hget /sics/ag1010/MEAS/Temperature] Degree"
broadcast "[hget /instrument/ag1010/MEAS/ForwardPower] dW"
broadcast "[hget /instrument/ag1010/MEAS/ReversePower] dW"
broadcast "[hget /instrument/ag1010/MEAS/Temperature] Degree"
}
publish lf_limits user