Skip to content

Commit

Permalink
Fix #83, Add event type and ID to message
Browse files Browse the repository at this point in the history
  • Loading branch information
dmknutsen committed May 6, 2020
1 parent 65aac14 commit 1d1360d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Subsystems/tlmGUI/EventMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1d1360d

Please sign in to comment.