From 7fde24bbdc2208dca6c2436f62ee1cb5eb9eb7b0 Mon Sep 17 00:00:00 2001
From: Janis Streib <me@janis-streib.de>
Date: Fr., 19 Mai 2023 17:25:10 +0200
Subject: [PATCH] ADD: digio support

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

diff --git a/src/G4Export.cpp b/src/G4Export.cpp
index 97016fe..40cf212 100644
--- a/src/G4Export.cpp
+++ b/src/G4Export.cpp
@@ -56,6 +56,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)){
@@ -81,13 +91,13 @@
 		// usleep(8000);
 	}
 
+	g4_close_tracker();
 	return NULL;
 }
 
 void sighandler(int s){
 	printf("Caught signal %d\n",s);
-	// FIXME: Do something gracefully
-	exit(1);
+	RunCollect=0;
 }
 
 int main(int argc,char* argv[]){
@@ -149,9 +159,6 @@
   sigaction(SIGINT, &sigIntHandler, NULL);
 
   Collect(&rs);
-
-  delete[] rs.srcList;
-  delete[] rs.hubList;
 
   return 0;
 }

--
Gitblit v1.9.1