From 1d1360d91003c2604d0b61a018f83ac21620ee8e Mon Sep 17 00:00:00 2001 From: dmknutsen Date: Fri, 1 May 2020 09:53:21 -0400 Subject: [PATCH] Fix #83, Add event type and ID to message --- Subsystems/tlmGUI/EventMessage.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Subsystems/tlmGUI/EventMessage.py b/Subsystems/tlmGUI/EventMessage.py index 13ed50e..e264f36 100644 --- a/Subsystems/tlmGUI/EventMessage.py +++ b/Subsystems/tlmGUI/EventMessage.py @@ -97,15 +97,30 @@ def processPendingDatagrams(self, datagram): self.ui.sequenceCount.setText(str(self.pktCount)) # - # Not accounting for endian right now! + # Get App Name, Event ID, Type and Event Text! # - appName = datagram[12:32].decode('utf-8','ignore') - eventText = datagram[44:].decode('utf-8','ignore') + appName = datagram[16:36].decode('utf-8','ignore') + EventID = int.from_bytes(datagram[36:38], byteorder='little') + EventType = int.from_bytes(datagram[38:40], byteorder='little') + eventText = datagram[48:].decode('utf-8','ignore') + EventID = str(EventID) + EventType = str(EventType) appName = appName.split("\0")[0] eventText = eventText.split("\0")[0] - eventString = "EVENT ---> "+ appName + " : " + eventText - self.ui.eventOutput.append(eventString) + if ( EventType == "1" ): + EventType = "DEBUG" + elif ( EventType == "2" ): + EventType = "INFORMATION" + elif ( EventType == "3" ): + EventType = "ERROR" + elif ( EventType == "4" ): + EventType = "CRITICAL" + else: + EventType = "Invalid Event Type" + + eventString = "EVENT --> "+ appName + "-" + EventType + " Event ID: " + EventID + " : " + eventText + self.ui.eventOutput.append(eventString) # Subscribes and receives zeroMQ messages class TlmReceiver(QtCore.QThread):