From cbb8e48c2508df64cf6c6ec7b7f6ca2ab50861db Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Fri, 21 Aug 2020 15:53:44 +0200
Subject: [PATCH] [workaround DOOCS bug] set timestamp of all writeable
 properties at start

This is a workaround for the following DOOCS bug:
https://rt-system.desy.de/Ticket/Display.html?id=985653
---
 include/DoocsProcessArray.h  | 3 +++
 include/DoocsProcessScalar.h | 3 +++
 src/DoocsSpectrum.cc         | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/include/DoocsProcessArray.h b/include/DoocsProcessArray.h
index c730c78..a78eeea 100644
--- a/include/DoocsProcessArray.h
+++ b/include/DoocsProcessArray.h
@@ -60,6 +60,9 @@ namespace ChimeraTK {
       // send the current value to the device
       if(_processArray->isWriteable()) {
         sendToDevice();
+        // set DOOCS time stamp, workaround for DOOCS bug (get() always gives current time stamp if no timestamp is set,
+        // which breaks consistency check in ZeroMQ subscriptions after the 4 minutes timeout)
+        DOOCS_T::set_stamp();
       }
     }
 
diff --git a/include/DoocsProcessScalar.h b/include/DoocsProcessScalar.h
index e0e75c5..609b0a0 100644
--- a/include/DoocsProcessScalar.h
+++ b/include/DoocsProcessScalar.h
@@ -143,6 +143,9 @@ namespace ChimeraTK {
       if(_processScalar->isWriteable()) {
         _processScalar->accessData(0) = DOOCS_T::value();
         _processScalar->write();
+        // set DOOCS time stamp, workaround for DOOCS bug (get() always gives current time stamp if no timestamp is set,
+        // which breaks consistency check in ZeroMQ subscriptions after the 4 minutes timeout)
+        DOOCS_T::set_stamp();
       }
     }
 
diff --git a/src/DoocsSpectrum.cc b/src/DoocsSpectrum.cc
index 8776ee9..3e7a8c3 100644
--- a/src/DoocsSpectrum.cc
+++ b/src/DoocsSpectrum.cc
@@ -77,6 +77,9 @@ namespace ChimeraTK {
     modified = false;
     if(_processArray->isWriteable()) {
       sendToDevice();
+      // set DOOCS time stamp, workaround for DOOCS bug (get() always gives current time stamp if no timestamp is set,
+      // which breaks consistency check in ZeroMQ subscriptions after the 4 minutes timeout)
+      D_spectrum::set_stamp();
     }
   }
 
-- 
GitLab