Skip to content
Snippets Groups Projects
Commit 4bbe1340 authored by BRONES Romain's avatar BRONES Romain
Browse files

Add configuration command, status

parent 6d02f00d
No related branches found
No related tags found
No related merge requests found
......@@ -62,8 +62,26 @@ class DG_PY_FOFBTool(Device):
- Type:'DevString'
tangopath_centraltiming
- Type:'DevString'
tangopath_centralnode
- Type:'DevString'
"""
# PROTECTED REGION ID(DG_PY_FOFBTool.class_variable) ENABLED START #
d_status = {}
"""
def dev_status(self):
return my_status()
"""
def my_status(self):
try:
return "\n\n".join([str(v) for v in self.d_status.values()])+"\n"
except Exception:
self.debug_stream(str(self.d_status))
return "Status failure\n"
# PROTECTED REGION END # // DG_PY_FOFBTool.class_variable
# -----------------
......@@ -114,6 +132,11 @@ class DG_PY_FOFBTool(Device):
dtype='DevString',
)
tangopath_centralnode = device_property(
dtype='DevString',
mandatory=True
)
# ----------
# Attributes
# ----------
......@@ -148,7 +171,7 @@ class DG_PY_FOFBTool(Device):
def always_executed_hook(self):
"""Method always executed before any TANGO command is executed."""
#----- PROTECTED REGION ID(DG_PY_FOFBTool.always_executed_hook) ENABLED START -----#
self.set_status(self.my_status())
#----- PROTECTED REGION END -----# // DG_PY_FOFBTool.always_executed_hook
def delete_device(self):
......@@ -182,6 +205,7 @@ class DG_PY_FOFBTool(Device):
# --------
@command(
dtype_out='DevBoolean',
)
@DebugIt()
def configure(self):
......@@ -190,13 +214,43 @@ class DG_PY_FOFBTool(Device):
:return:None
"""
success=True
self.d_status["configure"]="Configure: pending"
self.debug_stream("Configure COMBPM")
self.info_stream("Configure COMBPM")
for cn, bpm in zip(self.tangopath_cellnode, self.combpm_bpmfilter):
bpmid = [int(b) for b in bpm.split()]
self.debug_stream("Set {} to {}".format(cn, bpmid))
FofbTool.Configuration.cellnode_configure_combpm(cn, bpmid)
s=FofbTool.Configuration.cellnode_configure_combpm(cn, bpmid)
success = success and s
if not s:
self.error_stream("Failed to configure COMBPM on {}".format(cn))
self.info_stream("Configure COMCORR")
for cn, psc in zip(self.tangopath_cellnode, self.comcorr_pscid):
pscid = [int(b) for b in psc.split()]
self.debug_stream("Set {} to {}".format(cn, pscid))
s=FofbTool.Configuration.cellnode_configure_comcorr(cn, pscid, True)
success = success and s
if not s:
self.error_stream("Failed to configure COMCORR on {}".format(cn))
self.info_stream("Configure CCN")
for cn, nbpm in zip(self.tangopath_cellnode, self.ccn_nbpm):
self.debug_stream("Set {} to {} bpm and {} psc".format(cn, nbpm, self.ccn_npsc))
FofbTool.Configuration.cellnode_configure_ccn(cn, nbpm, self.ccn_npsc)
success = success and s
if not s:
self.error_stream("Failed to configure CCN on {}".format(cn))
s=FofbTool.Configuration.centralnode_configure_ccn(self.tangopath_centralnode, self.ccn_nbpm, self.ccn_npsc)
if success:
self.d_status["configure"]="Configure: success"
else:
self.d_status["configure"]="Configure: failed"
return success
# PROTECTED REGION END # // DG_PY_FOFBTool.configure
@command(
......
......@@ -41,6 +41,10 @@
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="tangopath_centralnode" mandatory="true" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
......@@ -64,7 +68,7 @@
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
<type xsi:type="pogoDsl:BooleanType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment