From 750e49640a6b105d01cbcbcf1819c69222081808 Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Wed, 20 Jun 2018 16:37:41 +0200
Subject: [PATCH] correctecd example for latest DeviceAccess changes

---
 example/TimerDummyDevice.cc |  2 ++
 example/demoApp.cc          | 27 ++++++++++++++-------------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/example/TimerDummyDevice.cc b/example/TimerDummyDevice.cc
index c0b1796d..d801d6ac 100644
--- a/example/TimerDummyDevice.cc
+++ b/example/TimerDummyDevice.cc
@@ -75,6 +75,8 @@ class TimerDummyRegisterAccessor : public mtca4u::SyncNDRegisterAccessor<UserTyp
     bool isReadable() const override { return true; }
     bool isWriteable() const override { return false; }
 
+    mtca4u::AccessModeFlags getAccessModeFlags() const override { return {mtca4u::AccessMode::wait_for_new_data}; }
+
     bool mayReplaceOther(const boost::shared_ptr<mtca4u::TransferElement const> &) const override { return false; }
 
     std::vector<boost::shared_ptr<mtca4u::TransferElement> > getHardwareAccessingElements() override { return { this->shared_from_this() }; }
diff --git a/example/demoApp.cc b/example/demoApp.cc
index 597ddc91..720256de 100644
--- a/example/demoApp.cc
+++ b/example/demoApp.cc
@@ -17,7 +17,7 @@ struct Automation : public ctk::ApplicationModule {
     ctk::ScalarPollInput<double> opSP{this, "opSP", "MV", "..."};
     ctk::ScalarOutput<double> curSP{this, "curSP", "MV", "..."};
     ctk::ScalarPushInput<int> trigger{this, "trigger", "", "..."};
-    
+
     void mainLoop() {
       while(true) {
         trigger.read();
@@ -42,14 +42,15 @@ struct TableGeneration : public ctk::ApplicationModule {
       ctk::ScalarPushInput<double> setpoint{this, "setpoint", "MV", "..."};
     };
     TableParameters tableParameters{this, "tableParameters", "..."};
-    
+
     ctk::ArrayOutput<int32_t> setpointTable{this, "setpointTable", "bits", tableLength, "..."};
     ctk::ArrayOutput<int32_t> feedforwardTable{this, "feedforwardTable", "bits", tableLength, "..."};
-    
+
     void mainLoop() {
+      ctk::ReadAnyGroup tableParametersReadGroup = tableParameters.readAnyGroup();
       while(true) {
-        tableParameters.readAny();    // block until the any table parameter is changed
-        
+        tableParametersReadGroup.waitAny();    // block until the any table parameter is changed
+
         for(size_t i = 0; i < tableLength; ++i) {
           if(i < tableParameters.pulseLength * samplingFrequency) {
             setpointTable[i] = tableParameters.setpoint * bitScalingFactor;
@@ -60,7 +61,7 @@ struct TableGeneration : public ctk::ApplicationModule {
             feedforwardTable[i] = 0;
           }
         }
-        
+
         setpointTable.write();
         feedforwardTable.write();
       }
@@ -76,9 +77,9 @@ struct ExampleApp : public ctk::Application {
     ctk::DeviceModule dev{"Device"};
     ctk::DeviceModule timer{"Timer"};
     ctk::ControlSystemModule cs{"MyLocation"};
-    
+
     void defineConnections();
-    
+
 };
 ExampleApp theExampleApp;
 
@@ -88,17 +89,17 @@ void ExampleApp::defineConnections() {
 
     cs("setpoint") >> automation.opSP;
     automation.curSP >> tableGeneration.tableParameters.setpoint >> cs("currentSetpoint");
-    
+
     auto macropulseNr = timer("macropulseNr", typeid(int), 1, ctk::UpdateMode::push);
     macropulseNr >> automation.trigger;
-    
+
     cs("pulseLength") >> tableGeneration.tableParameters.pulseLength;
-    
+
     tableGeneration.setpointTable >> dev("setpointTable");
     tableGeneration.feedforwardTable >> dev("feedforwardTable");
-    
+
     dev("probeSignal", typeid(int), tableLength) [ macropulseNr ] >> cs("probeSignal");
-    
+
     dumpConnections();
 
 }
-- 
GitLab