From 8148aa44eb7ba7c2e4afb70b3c55d54852e854d8 Mon Sep 17 00:00:00 2001
From: BENCE Aurelien <aurelien.bence@synchrotron-soleil.fr>
Date: Mon, 20 Jun 2022 17:30:30 +0200
Subject: [PATCH] add check of local synchro device

---
 DG_PY_Kalypso.py  | 11 +++++++++++
 DG_PY_Kalypso.xmi |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/DG_PY_Kalypso.py b/DG_PY_Kalypso.py
index 3098c80..c27cf3c 100644
--- a/DG_PY_Kalypso.py
+++ b/DG_PY_Kalypso.py
@@ -198,6 +198,13 @@ class StateThread(Thread):
                         str_state = 'acquisition in progress...please be patient'
                     else:
                         str_state = 'acquisition in progress...please be patient -to stop acquisition send Stop command'
+                elif self.mother.Local_synchro_attr!="":
+                    loc_syn_attr=tango.AttributeProxy("self.mother.Local_synchro_attr")
+                    loc_syn_attr_state=loc_syn_attr.state()
+                    loc_syn_attr_value=loc_syn_attr.read().value
+                    if loc_syn_attr_value != 3 or loc_syn_attr_state != tango.DevState.ON:
+                        self.mother.set_state(tango.DevState.ALARM)
+                        str_state = 'Please check Local synchro card'
                 elif ps_outut == False:
                     self.mother.set_state(tango.DevState.ALARM)
                     str_state = 'Alarm Power_supply Off'
@@ -739,6 +746,10 @@ class DG_PY_KalypsoClass(PyTango.DeviceClass):
             [PyTango.DevBoolean, 
             "If you dont want to keep files when you are in Star sequence mode",
             [False]],
+        'Local_synchro_attr':
+            [PyTango.DevString, 
+            "check if local synchro was in good state to trig kalypso",
+            [] ],
         }
 
 
diff --git a/DG_PY_Kalypso.xmi b/DG_PY_Kalypso.xmi
index 58535ab..5a4c29b 100644
--- a/DG_PY_Kalypso.xmi
+++ b/DG_PY_Kalypso.xmi
@@ -75,6 +75,10 @@
       <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
       <DefaultPropValue>False</DefaultPropValue>
     </deviceProperties>
+    <deviceProperties name="Local_synchro_attr" description="check if local synchro was in good state to trig kalypso">
+      <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"/>
-- 
GitLab