From d31f765e1243e7427d14bebe1e36f7aee82813c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3nal=20Murray?= <donal.murray@cern.ch>
Date: Tue, 28 Apr 2020 22:42:27 +0100
Subject: [PATCH] Fix input file for hevserver

---
 raspberry-dataserver/hevclient.py  | 14 ++++++++------
 raspberry-dataserver/hevfromtxt.py |  9 ++++-----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/raspberry-dataserver/hevclient.py b/raspberry-dataserver/hevclient.py
index f16980f3..04236e90 100755
--- a/raspberry-dataserver/hevclient.py
+++ b/raspberry-dataserver/hevclient.py
@@ -50,15 +50,17 @@ class HEVClient(object):
                 if payload["type"] == "keepalive":
                     #Still alive
                     continue
-                elif payload["type"] == "DATA":
+                elif payload["type"] == "broadcast":
                     with self._lock:
-                        self._values = payload["DATA"]
+                        self._values = payload["sensors"]
                 elif payload["type"] == "READBACK":
-                    with self._lock:
-                        self._readback = payload["READBACK"]
+                    pass
+                    #with self._lock:
+                    #    self._readback = payload["READBACK"]
                 elif payload["type"] == "CYCLE":
-                    with self._lock:
-                        self._cycle = payload["CYCLE"]
+                    pass
+                    #with self._lock:
+                    #    self._cycle = payload["CYCLE"]
                 elif payload["type"] == "THRESHOLDS":
                     with self._lock:
                         self._thresholds = payload["THRESHOLDS"]
diff --git a/raspberry-dataserver/hevfromtxt.py b/raspberry-dataserver/hevfromtxt.py
index c9a56ba4..1f44bb3f 100755
--- a/raspberry-dataserver/hevfromtxt.py
+++ b/raspberry-dataserver/hevfromtxt.py
@@ -38,11 +38,10 @@ class hevfromtxt():
         while True:
             # directly setting private member variables in this edge case
             payload = CommsCommon.DataFormat()
-            payload.version = payload._RPI_VERSION
-            payload.timestamp = time_offset + self._timestamp[self._pos]
-            payload.pressure_buffer = self._pressure[self._pos]
-            payload.pressure_inhale = self._volume[self._pos]
-            payload.temperature_buffer = self._flow[self._pos]
+            payload.timestamp = int(time_offset + self._timestamp[self._pos] * 1000)
+            payload.pressure_buffer = int(self._pressure[self._pos])
+            payload.pressure_inhale = int(self._volume[self._pos])
+            payload.temperature_buffer = int(abs(self._flow[self._pos]))
             self.payloadrecv = payload
 
             if self._pos + self._increment < self._length:
-- 
GitLab