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): ...@@ -62,8 +62,26 @@ class DG_PY_FOFBTool(Device):
- Type:'DevString' - Type:'DevString'
tangopath_centraltiming tangopath_centraltiming
- Type:'DevString' - Type:'DevString'
tangopath_centralnode
- Type:'DevString'
""" """
# PROTECTED REGION ID(DG_PY_FOFBTool.class_variable) ENABLED START # # 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 # PROTECTED REGION END # // DG_PY_FOFBTool.class_variable
# ----------------- # -----------------
...@@ -114,6 +132,11 @@ class DG_PY_FOFBTool(Device): ...@@ -114,6 +132,11 @@ class DG_PY_FOFBTool(Device):
dtype='DevString', dtype='DevString',
) )
tangopath_centralnode = device_property(
dtype='DevString',
mandatory=True
)
# ---------- # ----------
# Attributes # Attributes
# ---------- # ----------
...@@ -148,7 +171,7 @@ class DG_PY_FOFBTool(Device): ...@@ -148,7 +171,7 @@ class DG_PY_FOFBTool(Device):
def always_executed_hook(self): def always_executed_hook(self):
"""Method always executed before any TANGO command is executed.""" """Method always executed before any TANGO command is executed."""
#----- PROTECTED REGION ID(DG_PY_FOFBTool.always_executed_hook) ENABLED START -----# #----- 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 #----- PROTECTED REGION END -----# // DG_PY_FOFBTool.always_executed_hook
def delete_device(self): def delete_device(self):
...@@ -182,6 +205,7 @@ class DG_PY_FOFBTool(Device): ...@@ -182,6 +205,7 @@ class DG_PY_FOFBTool(Device):
# -------- # --------
@command( @command(
dtype_out='DevBoolean',
) )
@DebugIt() @DebugIt()
def configure(self): def configure(self):
...@@ -190,13 +214,43 @@ class DG_PY_FOFBTool(Device): ...@@ -190,13 +214,43 @@ class DG_PY_FOFBTool(Device):
:return:None :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): for cn, bpm in zip(self.tangopath_cellnode, self.combpm_bpmfilter):
bpmid = [int(b) for b in bpm.split()] bpmid = [int(b) for b in bpm.split()]
self.debug_stream("Set {} to {}".format(cn, bpmid)) 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 # PROTECTED REGION END # // DG_PY_FOFBTool.configure
@command( @command(
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
<type xsi:type="pogoDsl:StringType"/> <type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties> </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"> <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"> <argin description="none">
<type xsi:type="pogoDsl:VoidType"/> <type xsi:type="pogoDsl:VoidType"/>
...@@ -64,7 +68,7 @@ ...@@ -64,7 +68,7 @@
<type xsi:type="pogoDsl:VoidType"/> <type xsi:type="pogoDsl:VoidType"/>
</argin> </argin>
<argout description=""> <argout description="">
<type xsi:type="pogoDsl:VoidType"/> <type xsi:type="pogoDsl:BooleanType"/>
</argout> </argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands> </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