From b21ff09151ca7e87348f1ea38944decc1f46f5db Mon Sep 17 00:00:00 2001
From: Janis Streib <me@janis-streib.de>
Date: Fr., 19 Mai 2023 18:12:03 +0200
Subject: [PATCH] FIXUP

---
 src/G4Export.cpp |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/G4Export.cpp b/src/G4Export.cpp
index 515caae..18adf0b 100644
--- a/src/G4Export.cpp
+++ b/src/G4Export.cpp
@@ -12,6 +12,8 @@
 #include <osc/OscOutboundPacketStream.h>
 #include <sstream>
 #include <signal.h>
+#include <chrono>
+#include <thread>
 
 using namespace clipp; using std::cout; using std::string;
 
@@ -20,7 +22,7 @@
 int RunCollect=0;
 std::unique_ptr<UdpTransmitSocket> transmitSocket;
 bool use_text = false;
-int pollPeriod = 8;
+int pollPeriod;
 
 
 void* Collect(REND_STRUCT* prs){
@@ -56,6 +58,16 @@
 			if(!use_text) {
 				p << osc::BeginBundleImmediate;
 			}
+			p << osc::BeginMessage( (string("/g4/hub/") + std::to_string(prs->hubList[i].GetId()) + string("/digio")).c_str());
+			std::ostringstream ss;
+			if(use_text) {
+				ss << prs->hubList[i].GetDigIOData();
+				auto res = ss.str();
+				p << res.c_str();
+			} else {
+				p << osc::int64(prs->hubList[i].GetDigIOData());
+			}
+			p << osc::EndMessage;
 			auto dat = prs->hubList[i].GetPnoData();
 			for(int j=0;j<G4_SENSORS_PER_HUB;j++) {
 				if(!prs->hubList[i].IsSenActive(j)){
@@ -77,8 +89,7 @@
 			}
 			transmitSocket->Send( p.Data(), p.Size() );
 		}
-		usleep(pollPeriod*1000);
-		// usleep(8000);
+		std::this_thread::sleep_for(std::chrono::milliseconds(pollPeriod));
 	}
 
 	g4_close_tracker();

--
Gitblit v1.9.1