diff --git a/DG_PY_FOFBTool/DG_PY_FOFBTool.py b/DG_PY_FOFBTool/DG_PY_FOFBTool.py index e2d2eee8b74bfd672780f0abc7c6397d0353ca0f..174757c83e4807975877f7346e63d2171de05fea 100644 --- a/DG_PY_FOFBTool/DG_PY_FOFBTool.py +++ b/DG_PY_FOFBTool/DG_PY_FOFBTool.py @@ -22,6 +22,7 @@ from tango import AttrQuality, DispLevel, DevState from tango import AttrWriteType, PipeWriteType # Additional import #----- PROTECTED REGION ID(DG_PY_FOFBTool.additionnal_import) ENABLED START -----# +import FofbTool import FofbTool.Operation import FofbTool.Configuration import logging @@ -146,6 +147,10 @@ class DG_PY_FOFBTool(Device): access=AttrWriteType.READ_WRITE, ) + FofbToolVersion = attribute( + dtype='DevString', + ) + # --------------- # General methods # --------------- @@ -155,6 +160,8 @@ class DG_PY_FOFBTool(Device): Device.init_device(self) #----- PROTECTED REGION ID(DG_PY_FOFBTool.init_device) ENABLED START -----# + self.info_stream("FofbTool {}".format(FofbTool.__version__)) + logger = logging.getLogger("FofbTool") try: fh=logging.FileHandler(self.logfilepath) @@ -200,6 +207,12 @@ class DG_PY_FOFBTool(Device): pass # PROTECTED REGION END # // DG_PY_FOFBTool.includeLBP_write + def read_FofbToolVersion(self): + # PROTECTED REGION ID(DG_PY_FOFBTool.FofbToolVersion_read) ENABLED START # + """Return the FofbToolVersion attribute.""" + return FofbTool.__version__ + # PROTECTED REGION END # // DG_PY_FOFBTool.FofbToolVersion_read + # -------- # Commands # -------- @@ -277,6 +290,27 @@ class DG_PY_FOFBTool(Device): pass # PROTECTED REGION END # // DG_PY_FOFBTool.start + @command( + ) + @DebugIt() + def sync(self): + # PROTECTED REGION ID(DG_PY_FOFBTool.sync) ENABLED START # + """ + + :return:None + """ + db = tango.Database() + + self.debug_stream("Building list form FREE PROPERTIES") + bpmidlist = [(int(n.split(':')[0]), n.split(':')[2]) for n in db.get_property("FOFB", "bpmlist")['bpmlist'] if 'LIBERA' in n] + tlocal = [n.split(':')[2] for n in db.get_property("FOFB", 'TimingBoardList')['TimingBoardList'] if "LOCAL" in n] + lbpevrx = db.get_property("FOFB", 'LBPEVRX')['LBPEVRX'] + + # This will timeout + FofbTool.Operation.sync_bpm(bpmidlist, lbpevrx, tlocal, self.tangopath_centraltiming) + + # PROTECTED REGION END # // DG_PY_FOFBTool.sync + # ---------- # Run server # ---------- diff --git a/DG_PY_FOFBTool/DG_PY_FOFBTool.xmi b/DG_PY_FOFBTool/DG_PY_FOFBTool.xmi index a73cea77b845b78df1445fcd7ac99c8813875384..5705fe6c633d6250280a1e8b99419018859bd8dd 100644 --- a/DG_PY_FOFBTool/DG_PY_FOFBTool.xmi +++ b/DG_PY_FOFBTool/DG_PY_FOFBTool.xmi @@ -90,6 +90,15 @@ </argout> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </commands> + <commands name="sync" description="" execMethod="sync" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <argin description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argin> + <argout description=""> + <type xsi:type="pogoDsl:VoidType"/> + </argout> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </commands> <attributes name="includeLBP" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:BooleanType"/> <changeEvent fire="false" libCheckCriteria="false"/> @@ -98,6 +107,14 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> + <attributes name="FofbToolVersion" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:StringType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> <preferences docHome="../doc/doc_html" makefileHome="$(TANGO_HOME)"/> </classes> </pogoDsl:PogoSystem>