From ac26d55224308622d179ee76cbf7ba88521ce906 Mon Sep 17 00:00:00 2001 From: Leor Bleier Date: Tue, 21 Apr 2020 09:36:25 -0400 Subject: [PATCH] WIP Fix #72 - Upgrade to PyQt5 and fix/update/clean as needed --- Subsystems/tlmGUI/EventMessage.py | 113 +++--- Subsystems/tlmGUI/GenericTelemetry.py | 273 ++++++------- Subsystems/tlmGUI/TelemetrySystem.py | 547 +++++++++++++------------- 3 files changed, 451 insertions(+), 482 deletions(-) diff --git a/Subsystems/tlmGUI/EventMessage.py b/Subsystems/tlmGUI/EventMessage.py index 13ed50e..02ead53 100644 --- a/Subsystems/tlmGUI/EventMessage.py +++ b/Subsystems/tlmGUI/EventMessage.py @@ -20,16 +20,16 @@ #!/usr/bin/env python # # EVS Events page -# +# # The EVS Event Message has the following format -# +# # # ES HK format: # # Packet Header -# uint16 StreamId; 0 +# uint16 StreamId; 0 # uint16 Sequence; 2 -# uint16 Length; 4 +# uint16 Length; 4 # Tlm Secondary Header # uint32 seconds 6 @@ -40,126 +40,130 @@ # Event format: # # Packet Header -# uint16 StreamId; -# uint16 Sequence; -# uint16 Length; +# uint16 StreamId; +# uint16 Sequence; +# uint16 Length; # Tlm Secondary Header # uint32 seconds # uint16 subseconds # Packet ID -# char AppName[20] -# uint16 EventID; -# uint16 EventType; -# uint32 SpacecraftID; +# char AppName[20] +# uint16 EventID; +# uint16 EventType; +# uint32 SpacecraftID; # uint32 ProcessorID; # Message -# char Message[122]; -# uint8 Spare1; -# uint8 Spare2; +# char Message[122]; +# uint8 Spare1; +# uint8 Spare2; import sys import getopt import zmq -from PyQt4 import QtGui, QtCore +from PyQt5.QtWidgets import QDialog, QApplication +from PyQt5.QtCore import QThread, pyqtSignal from EventMessageDialog import Ui_EventMessageDialog -from struct import * +# from struct import * + -class EventMessageTelemetry(QtGui.QDialog): +class EventMessageTelemetry(QDialog, Ui_EventMessageDialog): pktCount = 0 def __init__(self, appId): - QtGui.QDialog.__init__(self) + super().__init__() self.appId = appId - self.ui = Ui_EventMessageDialog() - self.ui.setupUi(self) - + self.setupUi(self) + def initTlmReceiver(self, subscription): - self.setWindowTitle(pageTitle + ' for: ' + subscription) + self.setWindowTitle(f'{pageTitle} for: {subscription}') self.thread = TlmReceiver(self, subscription, self.appId) - self.connect(self.thread, self.thread.signalTlmDatagram, self.processPendingDatagrams) + self.connect(self.thread, self.thread.signalTlmDatagram, + self.processPendingDatagrams) self.thread.start() # This method processes packets. Called when the TelemetryReceiver receives a message/packet def processPendingDatagrams(self, datagram): - + self.pktCount += 1 # Packet Header - # uint16 StreamId; 0 + # uint16 StreamId; 0 # uint16 Sequence; 2 - # uint16 Length; 4 + # uint16 Length; 4 # PktSequence = unpack(" --port= --appid= --endian=") - print (" example: --title=Executive Services --port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L") - print (" (quotes are not on the title string in this example)") + print(("Must specify --title=\"\" --port= " + "--appid= --endian=\n\nexample: --title=\"Executive Services\" " + "--port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L")) - -if __name__ == '__main__': +if __name__ == '__main__': # # Set defaults for the arguments # pageTitle = "Event Messages" - udpPort = 10000 + udpPort = 10000 appId = 999 tlmDefFile = "not-needed.txt" endian = "L" subscription = "" # - # process cmd line args + # process cmd line args # try: - opts, args = getopt.getopt(sys.argv[1:], "htpafl", ["help", "title=", "port=", "appid=","file=", "endian=", "sub="]) + opts, args = getopt.getopt( + sys.argv[1:], "htpafl", + ["help", "title=", "port=", "appid=", "file=", "endian=", "sub="]) except getopt.GetoptError: usage() sys.exit(2) @@ -188,17 +192,14 @@ def usage(): if len(arr) < 3: subscription = 'GroundSystem' - print ('Event Messages Page started. Subscribed to ' + subscription) + print('Event Messages Page started. Subscribed to', subscription) - if endian == 'L': - py_endian = '<' - else: - py_endian = '>' + py_endian = '<' if endian == 'L' else '>' # # Init the QT application and the Event Message class # - app = QtGui.QApplication(sys.argv) + app = QApplication(sys.argv) Telem = EventMessageTelemetry(appId) # Display the page diff --git a/Subsystems/tlmGUI/GenericTelemetry.py b/Subsystems/tlmGUI/GenericTelemetry.py index cb2cf57..c32e6f7 100644 --- a/Subsystems/tlmGUI/GenericTelemetry.py +++ b/Subsystems/tlmGUI/GenericTelemetry.py @@ -17,20 +17,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -#!/usr/bin/env python -# +#!/usr/bin/env python3 +# import sys import csv -import getopt +import getopt import pdb import zmq -from PyQt4 import QtGui, QtCore +from PyQt5.QtWidgets import QDialog, QApplication +from PyQt5.QtCore import QThread, pyqtSignal from GenericTelemetryDialog import Ui_GenericTelemetryDialog -from struct import * +from struct import unpack + -class SubsystemTelemetry(QtGui.QDialog): +class SubsystemTelemetry(QDialog, Ui_GenericTelemetryDialog): pktCount = 0 @@ -38,37 +40,38 @@ class SubsystemTelemetry(QtGui.QDialog): # Init the class # def __init__(self): - QtGui.QDialog.__init__(self) - self.ui = Ui_GenericTelemetryDialog() - self.ui.setupUi(self) + super().__init__() + self.setupUi(self) - # - # This method Decodes a telemetry item from the packet and displays it # - def displayTelemetryItem(self, datagram, tlmIndex, labelField, valueField): - if tlmItemIsValid[tlmIndex] == True: - TlmField1 = tlmItemFormat[tlmIndex] - if TlmField1[:1] == "<": - TlmField1 = TlmField1[1:] - TlmField2 = datagram[int(tlmItemStart[tlmIndex]):(int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))] - TlmField = unpack( TlmField1, TlmField2) - if tlmItemDisplayType[tlmIndex] == 'Dec': - valueField.setText(str(TlmField[0])) - elif tlmItemDisplayType[tlmIndex] == 'Hex': - valueField.setText(hex(TlmField[0])) - elif tlmItemDisplayType[tlmIndex] == 'Enm': - valueField.setText(tlmItemEnum[tlmIndex][int(TlmField[0])]) - elif tlmItemDisplayType[tlmIndex] == 'Str': - valueField.setText(TlmField[0].decode('utf-8','ignore')) - labelField.setText(tlmItemDesc[tlmIndex]) - else: - labelField.setText("(unused)") + # This method Decodes a telemetry item from the packet and displays it + # + @staticmethod + def displayTelemetryItem(datagram, tlmIndex, labelField, valueField): + if tlmItemIsValid[tlmIndex]: + TlmField1 = tlmItemFormat[tlmIndex] + if TlmField1[0] == "<": + TlmField1 = TlmField1[1:] + TlmField2 = datagram[int(tlmItemStart[tlmIndex]):( + int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))] + TlmField = unpack(TlmField1, TlmField2) + if tlmItemDisplayType[tlmIndex] == 'Dec': + valueField.setText(str(TlmField[0])) + elif tlmItemDisplayType[tlmIndex] == 'Hex': + valueField.setText(hex(TlmField[0])) + elif tlmItemDisplayType[tlmIndex] == 'Enm': + valueField.setText(tlmItemEnum[tlmIndex][int(TlmField[0])]) + elif tlmItemDisplayType[tlmIndex] == 'Str': + valueField.setText(TlmField[0].decode('utf-8', 'ignore')) + labelField.setText(tlmItemDesc[tlmIndex]) + else: + labelField.setText("(unused)") # Start the telemetry receiver (see TlmReceiver class) def initTlmReceiver(self, subscription): - self.setWindowTitle(pageTitle + ' for: ' + subscription) + self.setWindowTitle(f"{pageTitle} for: {subscription}") self.thread = TlmReceiver(self, subscription) - self.connect(self.thread, self.thread.signalTlmDatagram, self.processPendingDatagrams) + self.thread.signalTlmDatagram.connect(self.processPendingDatagrams) self.thread.start() # @@ -79,190 +82,150 @@ def processPendingDatagrams(self, datagram): # Show number of packets received # self.pktCount += 1 - self.ui.sequenceCount.setText(str(self.pktCount)) + self.sequenceCount.setText(str(self.pktCount)) # # Decode and display all packet elements # - self.displayTelemetryItem(datagram, 0, self.ui.itemLabelTextBrowser_1, self.ui.itemValueTextBrowser_1) - self.displayTelemetryItem(datagram, 1, self.ui.itemLabelTextBrowser_2, self.ui.itemValueTextBrowser_2) - self.displayTelemetryItem(datagram, 2, self.ui.itemLabelTextBrowser_3, self.ui.itemValueTextBrowser_3) - self.displayTelemetryItem(datagram, 3, self.ui.itemLabelTextBrowser_4, self.ui.itemValueTextBrowser_4) - self.displayTelemetryItem(datagram, 4, self.ui.itemLabelTextBrowser_5, self.ui.itemValueTextBrowser_5) - self.displayTelemetryItem(datagram, 5, self.ui.itemLabelTextBrowser_6, self.ui.itemValueTextBrowser_6) - self.displayTelemetryItem(datagram, 6, self.ui.itemLabelTextBrowser_7, self.ui.itemValueTextBrowser_7) - self.displayTelemetryItem(datagram, 7, self.ui.itemLabelTextBrowser_8, self.ui.itemValueTextBrowser_8) - self.displayTelemetryItem(datagram, 8, self.ui.itemLabelTextBrowser_9, self.ui.itemValueTextBrowser_9) - self.displayTelemetryItem(datagram, 9, self.ui.itemLabelTextBrowser_10, self.ui.itemValueTextBrowser_10) - self.displayTelemetryItem(datagram, 10, self.ui.itemLabelTextBrowser_11, self.ui.itemValueTextBrowser_11) - self.displayTelemetryItem(datagram, 11, self.ui.itemLabelTextBrowser_12, self.ui.itemValueTextBrowser_12) - self.displayTelemetryItem(datagram, 12, self.ui.itemLabelTextBrowser_13, self.ui.itemValueTextBrowser_13) - self.displayTelemetryItem(datagram, 13, self.ui.itemLabelTextBrowser_14, self.ui.itemValueTextBrowser_14) - self.displayTelemetryItem(datagram, 14, self.ui.itemLabelTextBrowser_15, self.ui.itemValueTextBrowser_15) - self.displayTelemetryItem(datagram, 15, self.ui.itemLabelTextBrowser_16, self.ui.itemValueTextBrowser_16) - self.displayTelemetryItem(datagram, 16, self.ui.itemLabelTextBrowser_17, self.ui.itemValueTextBrowser_17) - self.displayTelemetryItem(datagram, 17, self.ui.itemLabelTextBrowser_18, self.ui.itemValueTextBrowser_18) - self.displayTelemetryItem(datagram, 18, self.ui.itemLabelTextBrowser_19, self.ui.itemValueTextBrowser_19) - self.displayTelemetryItem(datagram, 19, self.ui.itemLabelTextBrowser_20, self.ui.itemValueTextBrowser_20) - self.displayTelemetryItem(datagram, 20, self.ui.itemLabelTextBrowser_21, self.ui.itemValueTextBrowser_21) - self.displayTelemetryItem(datagram, 21, self.ui.itemLabelTextBrowser_22, self.ui.itemValueTextBrowser_22) - self.displayTelemetryItem(datagram, 22, self.ui.itemLabelTextBrowser_23, self.ui.itemValueTextBrowser_23) - self.displayTelemetryItem(datagram, 23, self.ui.itemLabelTextBrowser_24, self.ui.itemValueTextBrowser_24) - self.displayTelemetryItem(datagram, 24, self.ui.itemLabelTextBrowser_25, self.ui.itemValueTextBrowser_25) - self.displayTelemetryItem(datagram, 25, self.ui.itemLabelTextBrowser_26, self.ui.itemValueTextBrowser_26) - self.displayTelemetryItem(datagram, 26, self.ui.itemLabelTextBrowser_27, self.ui.itemValueTextBrowser_27) - self.displayTelemetryItem(datagram, 27, self.ui.itemLabelTextBrowser_28, self.ui.itemValueTextBrowser_28) - self.displayTelemetryItem(datagram, 28, self.ui.itemLabelTextBrowser_29, self.ui.itemValueTextBrowser_29) - self.displayTelemetryItem(datagram, 29, self.ui.itemLabelTextBrowser_30, self.ui.itemValueTextBrowser_30) - self.displayTelemetryItem(datagram, 30, self.ui.itemLabelTextBrowser_31, self.ui.itemValueTextBrowser_31) - self.displayTelemetryItem(datagram, 31, self.ui.itemLabelTextBrowser_32, self.ui.itemValueTextBrowser_32) - self.displayTelemetryItem(datagram, 32, self.ui.itemLabelTextBrowser_33, self.ui.itemValueTextBrowser_33) - self.displayTelemetryItem(datagram, 33, self.ui.itemLabelTextBrowser_34, self.ui.itemValueTextBrowser_34) - self.displayTelemetryItem(datagram, 34, self.ui.itemLabelTextBrowser_35, self.ui.itemValueTextBrowser_35) - self.displayTelemetryItem(datagram, 35, self.ui.itemLabelTextBrowser_36, self.ui.itemValueTextBrowser_36) - self.displayTelemetryItem(datagram, 36, self.ui.itemLabelTextBrowser_37, self.ui.itemValueTextBrowser_37) - self.displayTelemetryItem(datagram, 37, self.ui.itemLabelTextBrowser_38, self.ui.itemValueTextBrowser_38) - self.displayTelemetryItem(datagram, 38, self.ui.itemLabelTextBrowser_39, self.ui.itemValueTextBrowser_39) - self.displayTelemetryItem(datagram, 39, self.ui.itemLabelTextBrowser_40, self.ui.itemValueTextBrowser_40) + for k in range(40): + itemLabelTextBrowser = getattr(self, f"itemLabelTextBrowser_{k+1}") + itemValueTextBrowser = getattr(self, f"itemValueTextBrowser_{k+1}") + self.displayTelemetryItem(datagram, k, itemLabelTextBrowser, + itemValueTextBrowser) # Subscribes and receives zeroMQ messages -class TlmReceiver(QtCore.QThread): - +class TlmReceiver(QThread): + # Setup signal to communicate with front-end GUI + signalTlmDatagram = pyqtSignal(object, name="TlmDatagram") + def __init__(self, mainWindow, subscription): - QtCore.QThread.__init__(self) + super().__init__() - # Setup signal to communicate with front-end GUI - self.signalTlmDatagram = QtCore.SIGNAL("TlmDatagram") - # Init zeroMQ - self.context = zmq.Context() + self.context = zmq.Context() self.subscriber = self.context.socket(zmq.SUB) self.subscriber.connect("ipc:///tmp/GroundSystem") - myTlmPgAPID = subscription.split(".",1) - mySubscription = "GroundSystem.Spacecraft1.TelemetryPackets." + str(myTlmPgAPID[1]) + myTlmPgAPID = subscription.split(".", 1) + mySubscription = f"GroundSystem.Spacecraft1.TelemetryPackets.{myTlmPgAPID[1]}" self.subscriber.setsockopt_string(zmq.SUBSCRIBE, mySubscription) - + def run(self): while True: # Read envelope with address - [address, datagram] = self.subscriber.recv_multipart() + address, datagram = self.subscriber.recv_multipart() # Send signal with received packet to front-end/GUI - self.emit(self.signalTlmDatagram, datagram) + self.signalTlmDatagram.emit(datagram) # # Display usage # def usage(): - print ("Must specify --title= --port= --appid= --endian= --sub=") - print (" example: --title=Executive Services --port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L --sub=GroundSystem.Spacecraft1.0x886") - print (" (quotes are not on the title string in this example)") + print(("Must specify --title=\"\" --port= " + "--appid= --endian=\n\nexample: --title=\"Executive Services\" " + "--port=10800 --appid=800 --file=cfe-es-hk-table.txt --endian=L")) + # -# Main +# Main # if __name__ == '__main__': # # Set defaults for the arguments # - pageTitle = "Telemetry Page" - udpPort = 10000 - appId = 999 + pageTitle = "Telemetry Page" + udpPort = 10000 + appId = 999 tlmDefFile = "telemetry_def.txt" endian = "L" subscription = "" - + # - # process cmd line args + # process cmd line args # - try: - opts, args = getopt.getopt(sys.argv[1:], "htpafl", ["help", "title=", "port=", "appid=","file=", "endian=", "sub="]) - except getopt.GetoptError: - usage() - sys.exit(2) - - for opt, arg in opts: - if opt in ("-h", "--help"): - usage() - sys.exit() - elif opt in ("-p", "--port"): - udpPort = arg - elif opt in ("-t", "--title"): - pageTitle = arg - elif opt in ("-f", "--file"): - tlmDefFile = arg - elif opt in ("-t", "--appid"): - appId = arg - elif opt in ("-e", "--endian"): - endian = arg + try: + opts, args = getopt.getopt( + sys.argv[1:], "htpafl", + ["help", "title=", "port=", "appid=", "file=", "endian=", "sub="]) + except getopt.GetoptError: + usage() + sys.exit(2) + + for opt, arg in opts: + if opt in ("-h", "--help"): + usage() + sys.exit() + elif opt in ("-p", "--port"): + udpPort = arg + elif opt in ("-t", "--title"): + pageTitle = arg + elif opt in ("-f", "--file"): + tlmDefFile = arg + elif opt in ("-t", "--appid"): + appId = arg + elif opt in ("-e", "--endian"): + endian = arg elif opt in ("-s", "--sub"): subscription = arg if len(subscription) == 0: subscription = "GroundSystem" - print ('Generic Telemetry Page started. Subscribed to ' + subscription) + print('Generic Telemetry Page started. Subscribed to', subscription) - if endian == 'L': - py_endian = '<' - else: - py_endian = '>' + py_endian = '<' if endian == 'L' else '>' # # Init the QT application and the telemetry class # - app = QtGui.QApplication(sys.argv) + app = QApplication(sys.argv) Telem = SubsystemTelemetry() - Telem.ui.subSystemTextBrowser.setText(pageTitle) - Telem.ui.packetId.display(appId) + Telem.subSystemTextBrowser.setText(pageTitle) + Telem.packetId.display(appId) # # Read in the contents of the telemetry packet defintion # - tlmItemIsValid = [] - tlmItemDesc = [] - tlmItemStart = [] - tlmItemSize = [] - tlmItemDisplayType = [] - tlmItemFormat = [] - tlmItemEnum = [[] for i in range(40)] + tlmItemIsValid, tlmItemDesc, tlmItemStart, tlmItemSize, tlmItemDisplayType, tlmItemFormat = ( + [] for _ in range(6)) + tlmItemEnum = [[]] * 40 i = 0 - with open(tlmDefFile, 'r') as tlmfile: - reader = csv.reader(tlmfile, skipinitialspace = True) - for row in reader: - if row[0][0] != '#': - tlmItemIsValid.append(True) - tlmItemDesc.append(row[0]) - tlmItemStart.append(row[1]) - tlmItemSize.append(row[2]) - if row[3] == 's': - tlmItemFormat.append(row[2]+row[3]) - else: - tlmItemFormat.append(py_endian + row[3]) - - tlmItemDisplayType.append(row[4]) - if row[4] == 'Enm': - tlmItemEnum[i].append(row[5]) - tlmItemEnum[i].append(row[6]) - tlmItemEnum[i].append(row[7]) - tlmItemEnum[i].append(row[8]) - i = i + 1 - - # + with open(tlmDefFile) as tlmfile: + reader = csv.reader(tlmfile, skipinitialspace=True) + for row in reader: + if row[0][0] != '#': + tlmItemIsValid.append(True) + tlmItemDesc.append(row[0]) + tlmItemStart.append(row[1]) + tlmItemSize.append(row[2]) + if row[3] == 's': + tlmItemFormat.append(row[2] + row[3]) + else: + tlmItemFormat.append(py_endian + row[3]) + + tlmItemDisplayType.append(row[4]) + if row[4] == 'Enm': + tlmItemEnum[i].append(row[5]) + tlmItemEnum[i].append(row[6]) + tlmItemEnum[i].append(row[7]) + tlmItemEnum[i].append(row[8]) + i += 1 + + # # Mark the remaining values as invalid # - for j in range (i, 40): - tlmItemIsValid.append(False) + for j in range(i, 40): + tlmItemIsValid.append(False) - # - # Display the page + # + # Display the page # Telem.show() Telem.raise_() Telem.initTlmReceiver(subscription) sys.exit(app.exec_()) - diff --git a/Subsystems/tlmGUI/TelemetrySystem.py b/Subsystems/tlmGUI/TelemetrySystem.py index 8504acd..399b7c9 100644 --- a/Subsystems/tlmGUI/TelemetrySystem.py +++ b/Subsystems/tlmGUI/TelemetrySystem.py @@ -18,7 +18,7 @@ # limitations under the License. # #!/usr/bin/env python -# +# import sys import csv import subprocess @@ -26,11 +26,13 @@ import shlex import zmq -from PyQt4 import QtGui, QtCore +from PyQt5.QtWidgets import QDialog, QApplication +from PyQt5.QtCore import QThread from TelemetrySystemDialog import Ui_TelemetrySystemDialog -from struct import * +from struct import unpack + -class TelemetrySystem(QtGui.QDialog): +class TelemetrySystem(QDialog, Ui_TelemetrySystemDialog): pktCount = 0 @@ -38,213 +40,220 @@ class TelemetrySystem(QtGui.QDialog): # Init the class # def __init__(self): - QtGui.QDialog.__init__(self) - self.ui = Ui_TelemetrySystemDialog() - self.ui.setupUi(self) + super().__init__() + self.setupUi(self) self.setWindowTitle('Telemetry System Main Page') - self.move(0,100) - - self.ui.pushButton_0.clicked.connect(self.ProcessButton_0) - self.ui.pushButton_1.clicked.connect(self.ProcessButton_1) - self.ui.pushButton_2.clicked.connect(self.ProcessButton_2) - self.ui.pushButton_3.clicked.connect(self.ProcessButton_3) - self.ui.pushButton_4.clicked.connect(self.ProcessButton_4) - self.ui.pushButton_5.clicked.connect(self.ProcessButton_5) - self.ui.pushButton_6.clicked.connect(self.ProcessButton_6) - self.ui.pushButton_7.clicked.connect(self.ProcessButton_7) - self.ui.pushButton_8.clicked.connect(self.ProcessButton_8) - self.ui.pushButton_9.clicked.connect(self.ProcessButton_9) - self.ui.pushButton_10.clicked.connect(self.ProcessButton_10) - self.ui.pushButton_11.clicked.connect(self.ProcessButton_11) - self.ui.pushButton_12.clicked.connect(self.ProcessButton_12) - self.ui.pushButton_13.clicked.connect(self.ProcessButton_13) - self.ui.pushButton_14.clicked.connect(self.ProcessButton_14) - self.ui.pushButton_15.clicked.connect(self.ProcessButton_15) - self.ui.pushButton_16.clicked.connect(self.ProcessButton_16) - self.ui.pushButton_17.clicked.connect(self.ProcessButton_17) - self.ui.pushButton_18.clicked.connect(self.ProcessButton_18) - self.ui.pushButton_19.clicked.connect(self.ProcessButton_19) - self.ui.pushButton_20.clicked.connect(self.ProcessButton_20) + self.move(0, 100) + + for k in range(21): + pushButton = getattr(self, f"pushButton_{i}") + pushButton.clicked.connect(lambda: self.ProcessButtonGeneric(k)) + # - # convert a string of binary bytes to ascii hex + # convert a string of binary bytes to ascii hex # + @staticmethod def strToHex(aString): hexStr = "" for x in aString: - hexStr = hexStr + "%02X " % ord(x) + hexStr += f'{ord(x):02X} ' return hexStr # - # Dump the telemetry packet + # Dump the telemetry packet # - def dumpPacket(packetData): - appIdString = "%02X" % ord(packetData[0]) - appIdString = appIdString + "%02X" % ord(packetData[1]) - appId = (ord(packetData[0]) << 8) + (ord(packetData[1])) - print ("\n-----------------------------------------------") - print ("\nPacket: App ID = ", hex(appId)) - print ("\nPacket Data: ", strToHex(packetData)) + def dumpPacket(self, packetData): + appIdString = f"{ord(packetData[0]):02X}" + appIdString += f"{ord(packetData[1]):02X}" + appId = (ord(packetData[0]) << 8) + (ord(packetData[1])) + print("\n-----------------------------------------------") + print("\nPacket: App ID = ", hex(appId)) + print("\nPacket Data: ", self.strToHex(packetData)) # # Button press methods - # - def ProcessButton_0(self): - self.ProcessButtonGeneric(0) - def ProcessButton_1(self): - self.ProcessButtonGeneric(1) - def ProcessButton_2(self): - self.ProcessButtonGeneric(2) - def ProcessButton_3(self): - self.ProcessButtonGeneric(3) - def ProcessButton_4(self): - self.ProcessButtonGeneric(4) - def ProcessButton_5(self): - self.ProcessButtonGeneric(5) - def ProcessButton_6(self): - self.ProcessButtonGeneric(6) - def ProcessButton_7(self): - self.ProcessButtonGeneric(7) - def ProcessButton_8(self): - self.ProcessButtonGeneric(8) - def ProcessButton_9(self): - self.ProcessButtonGeneric(9) - def ProcessButton_10(self): - self.ProcessButtonGeneric(10) - def ProcessButton_11(self): - self.ProcessButtonGeneric(11) - def ProcessButton_12(self): - self.ProcessButtonGeneric(12) - def ProcessButton_13(self): - self.ProcessButtonGeneric(13) - def ProcessButton_14(self): - self.ProcessButtonGeneric(14) - def ProcessButton_15(self): - self.ProcessButtonGeneric(15) - def ProcessButton_16(self): - self.ProcessButtonGeneric(16) - def ProcessButton_17(self): - self.ProcessButtonGeneric(17) - def ProcessButton_18(self): - self.ProcessButtonGeneric(18) - def ProcessButton_19(self): - self.ProcessButtonGeneric(19) - def ProcessButton_20(self): - self.ProcessButtonGeneric(20) + # + # def ProcessButton_0(self): + # self.ProcessButtonGeneric(0) + + # def ProcessButton_1(self): + # self.ProcessButtonGeneric(1) + + # def ProcessButton_2(self): + # self.ProcessButtonGeneric(2) + + # def ProcessButton_3(self): + # self.ProcessButtonGeneric(3) + + # def ProcessButton_4(self): + # self.ProcessButtonGeneric(4) + + # def ProcessButton_5(self): + # self.ProcessButtonGeneric(5) + + # def ProcessButton_6(self): + # self.ProcessButtonGeneric(6) + + # def ProcessButton_7(self): + # self.ProcessButtonGeneric(7) + + # def ProcessButton_8(self): + # self.ProcessButtonGeneric(8) + + # def ProcessButton_9(self): + # self.ProcessButtonGeneric(9) + + # def ProcessButton_10(self): + # self.ProcessButtonGeneric(10) + + # def ProcessButton_11(self): + # self.ProcessButtonGeneric(11) + + # def ProcessButton_12(self): + # self.ProcessButtonGeneric(12) + + # def ProcessButton_13(self): + # self.ProcessButtonGeneric(13) + + # def ProcessButton_14(self): + # self.ProcessButtonGeneric(14) + + # def ProcessButton_15(self): + # self.ProcessButtonGeneric(15) + + # def ProcessButton_16(self): + # self.ProcessButtonGeneric(16) + + # def ProcessButton_17(self): + # self.ProcessButtonGeneric(17) + + # def ProcessButton_18(self): + # self.ProcessButtonGeneric(18) + + # def ProcessButton_19(self): + # self.ProcessButtonGeneric(19) + + # def ProcessButton_20(self): + # self.ProcessButtonGeneric(20) def ProcessButtonGeneric(self, idx): - tempSub = self.subscription + '.' + hex(tlmPageAppid[idx]) - if tlmPageIsValid[idx] == True: - # need to extract data from fields, then start page with right params - launch_string = 'python3 ' + tlmClass[idx] + ' --title=\"' + tlmPageDesc[idx] + '\" --appid=' + hex(tlmPageAppid[idx]) + ' --port=' + str(tlmPagePort[idx]) + ' --file=' + tlmPageDefFile[idx] + ' --endian=' + endian + ' --sub=' + tempSub - cmd_args = shlex.split(launch_string) - subprocess.Popen(cmd_args) - + tempSub = f"{self.subscription}.{hex(tlmPageAppid[idx])}" + if tlmPageIsValid[idx]: + # need to extract data from fields, then start page with right params + launch_string = 'python3 ' + tlmClass[ + idx] + ' --title=\"' + tlmPageDesc[idx] + '\" --appid=' + hex( + tlmPageAppid[idx]) + ' --port=' + str( + tlmPagePort[idx]) + ' --file=' + tlmPageDefFile[ + idx] + ' --endian=' + endian + ' --sub=' + tempSub + cmd_args = shlex.split(launch_string) + subprocess.Popen(cmd_args) + # Start the telemetry receiver (see TlmReceiver class) def initTlmReceiver(self, subscription): self.setWindowTitle('Telemetry System page for: ' + subscription) self.subscription = subscription self.thread = TlmReceiver(self, subscription) - self.connect(self.thread, self.thread.signalTlmDatagram, self.processPendingDatagrams) + self.connect(self.thread, self.thread.signalTlmDatagram, + self.processPendingDatagrams) self.thread.start() # # This method processes packets. Called when the TelemetryReceiver receives a message/packet # def processPendingDatagrams(self, datagram): - + # - # convert a string of binary bytes to ascii hex + # convert a string of binary bytes to ascii hex # def strToHex(aString): - hexStr = "" - for x in aString: - hexStr = hexStr + "%02X " % ord(x) - return hexStr + hexStr = "" + for x in aString: + hexStr = hexStr + "%02X " % ord(x) + return hexStr # - # Dump the telemetry packet + # Dump the telemetry packet # def dumpPacket(packetData): appIdString = "%02X" % ord(packetData[0]) appIdString = appIdString + "%02X" % ord(packetData[1]) appId = (ord(packetData[0]) << 8) + (ord(packetData[1])) - print ("\nPacket: App ID = ", hex(appId)) - print ("\nPacket Data: ", strToHex(packetData)) - print ("\n-----------------------------------------------") + print("\nPacket: App ID = ", hex(appId)) + print("\nPacket Data: ", strToHex(packetData)) + print("\n-----------------------------------------------") # # Show number of packets received - # + # self.pktCount += 1 - self.ui.sequenceCount.setText(str(self.pktCount)) + self.sequenceCount.setText(str(self.pktCount)) # - # Decode the packet and forward it to the correct port (if there is one) + # Decode the packet and forward it to the correct port (if there is one) # - streamId,Sequence,Length = unpack(">HHH",datagram[:6]) + streamId, Sequence, Length = unpack(">HHH", datagram[:6]) # Uncomment the next two lines to debug # print "Packet ID = " , hex(streamId) # dumpPacket(datagram) - for i in range ( 0, 21 ): - if streamId == tlmPageAppid[i]: - send_host = "127.0.0.1" - send_port = tlmPagePort[i] -# sendSocket = socket(AF_INET,SOCK_DGRAM) -# sendSocket.sendto(datagram, (send_host,send_port)) - - tlmPageCount[i] = tlmPageCount[i] + 1 - # - # I wish I knew a better way to update the count field in the GUI - # Maybe store a pointer to the field in the gui - # - if i == 0: - self.ui.countBrowser_0.setText(str(tlmPageCount[0])) - elif i == 1: - self.ui.countBrowser_1.setText(str(tlmPageCount[1])) - elif i == 2: - self.ui.countBrowser_2.setText(str(tlmPageCount[2])) - elif i == 3: - self.ui.countBrowser_3.setText(str(tlmPageCount[3])) - elif i == 4: - self.ui.countBrowser_4.setText(str(tlmPageCount[4])) - elif i == 5: - self.ui.countBrowser_5.setText(str(tlmPageCount[5])) - elif i == 6: - self.ui.countBrowser_6.setText(str(tlmPageCount[6])) - elif i == 7: - self.ui.countBrowser_7.setText(str(tlmPageCount[7])) - elif i == 8: - self.ui.countBrowser_8.setText(str(tlmPageCount[8])) - elif i == 9: - self.ui.countBrowser_9.setText(str(tlmPageCount[9])) - elif i == 10: - self.ui.countBrowser_10.setText(str(tlmPageCount[10])) - elif i == 11: - self.ui.countBrowser_11.setText(str(tlmPageCount[11])) - elif i == 12: - self.ui.countBrowser_12.setText(str(tlmPageCount[12])) - elif i == 13: - self.ui.countBrowser_13.setText(str(tlmPageCount[13])) - elif i == 14: - self.ui.countBrowser_14.setText(str(tlmPageCount[14])) - elif i == 15: - self.ui.countBrowser_16.setText(str(tlmPageCount[15])) - elif i == 16: - self.ui.countBrowser_17.setText(str(tlmPageCount[16])) - elif i == 17: - self.ui.countBrowser_18.setText(str(tlmPageCount[17])) - elif i == 18: - self.ui.countBrowser_19.setText(str(tlmPageCount[18])) - elif i == 19: - self.ui.countBrowser_20.setText(str(tlmPageCount[19])) - elif i == 20: - self.ui.countBrowser_21.setText(str(tlmPageCount[20])) + for i in range(0, 21): + if streamId == tlmPageAppid[i]: + send_host = "127.0.0.1" + send_port = tlmPagePort[i] + # sendSocket = socket(AF_INET,SOCK_DGRAM) + # sendSocket.sendto(datagram, (send_host,send_port)) + + tlmPageCount[i] = tlmPageCount[i] + 1 + # + # I wish I knew a better way to update the count field in the GUI + # Maybe store a pointer to the field in the gui + # + if i == 0: + self.countBrowser_0.setText(str(tlmPageCount[0])) + elif i == 1: + self.countBrowser_1.setText(str(tlmPageCount[1])) + elif i == 2: + self.countBrowser_2.setText(str(tlmPageCount[2])) + elif i == 3: + self.countBrowser_3.setText(str(tlmPageCount[3])) + elif i == 4: + self.countBrowser_4.setText(str(tlmPageCount[4])) + elif i == 5: + self.countBrowser_5.setText(str(tlmPageCount[5])) + elif i == 6: + self.countBrowser_6.setText(str(tlmPageCount[6])) + elif i == 7: + self.countBrowser_7.setText(str(tlmPageCount[7])) + elif i == 8: + self.countBrowser_8.setText(str(tlmPageCount[8])) + elif i == 9: + self.countBrowser_9.setText(str(tlmPageCount[9])) + elif i == 10: + self.countBrowser_10.setText(str(tlmPageCount[10])) + elif i == 11: + self.countBrowser_11.setText(str(tlmPageCount[11])) + elif i == 12: + self.countBrowser_12.setText(str(tlmPageCount[12])) + elif i == 13: + self.countBrowser_13.setText(str(tlmPageCount[13])) + elif i == 14: + self.countBrowser_14.setText(str(tlmPageCount[14])) + elif i == 15: + self.countBrowser_16.setText(str(tlmPageCount[15])) + elif i == 16: + self.countBrowser_17.setText(str(tlmPageCount[16])) + elif i == 17: + self.countBrowser_18.setText(str(tlmPageCount[17])) + elif i == 18: + self.countBrowser_19.setText(str(tlmPageCount[18])) + elif i == 19: + self.countBrowser_20.setText(str(tlmPageCount[19])) + elif i == 20: + self.countBrowser_21.setText(str(tlmPageCount[20])) # Subscribes and receives zeroMQ messages class TlmReceiver(QtCore.QThread): - def __init__(self, mainWindow, subscription): QtCore.QThread.__init__(self) @@ -252,11 +261,11 @@ def __init__(self, mainWindow, subscription): self.signalTlmDatagram = QtCore.SIGNAL("TlmDatagram") # Init zeroMQ - self.context = zmq.Context() + self.context = zmq.Context() self.subscriber = self.context.socket(zmq.SUB) self.subscriber.connect("ipc:///tmp/GroundSystem") self.subscriber.setsockopt_string(zmq.SUBSCRIBE, subscription) - + def run(self): while True: # Receive and read envelope with address @@ -264,26 +273,25 @@ def run(self): # Send signal with received packet to front-end/GUI self.emit(self.signalTlmDatagram, datagram) + # # Main # if __name__ == '__main__': - # # Init the QT application and the telemetry dialog class # app = QtGui.QApplication(sys.argv) Telem = TelemetrySystem() - # # Set defaults for the arguments # tlmDefFile = "telemetry-pages.txt" endian = "L" subscription = "" - + # # process cmd line args # @@ -291,7 +299,7 @@ def run(self): opts, args = getopt.getopt(sys.argv[1:], "htpafl", ["sub="]) except getopt.GetoptError: sys.exit(2) - + for opt, arg in opts: if opt in ("-s", "--sub"): subscription = arg @@ -299,7 +307,7 @@ def run(self): if len(subscription) == 0: subscription = "GroundSystem" - print ('Telemetry System started. Subscribed to ' + subscription) + print('Telemetry System started. Subscribed to ' + subscription) # # Read in the contents of the telemetry packet defintion # @@ -313,181 +321,178 @@ def run(self): i = 0 with open(tlmDefFile, 'r') as tlmfile: - reader = csv.reader(tlmfile, skipinitialspace = True) - for row in reader: - if row[0][0] != '#': - tlmPageIsValid.append(True) - tlmPageDesc.append(row[0]) - tlmClass.append(row[1]) - tlmPagePort.append(int(row[2],16) + 10000) - tlmPageAppid.append(int(row[2],16)) - tlmPageDefFile.append(row[3]) - tlmPageCount.append(0) - i = i + 1 - # + reader = csv.reader(tlmfile, skipinitialspace=True) + for row in reader: + if row[0][0] != '#': + tlmPageIsValid.append(True) + tlmPageDesc.append(row[0]) + tlmClass.append(row[1]) + tlmPagePort.append(int(row[2], 16) + 10000) + tlmPageAppid.append(int(row[2], 16)) + tlmPageDefFile.append(row[3]) + tlmPageCount.append(0) + i = i + 1 + # # Mark the remaining values ad invalid # - for j in range (i, 21): - tlmPageAppid.append(0) - tlmPageIsValid.append(False) + for j in range(i, 21): + tlmPageAppid.append(0) + tlmPageIsValid.append(False) # # fill the data fields on the page # if tlmPageIsValid[0] == True: - Telem.ui.SubsysBrowser_0.setText(tlmPageDesc[0]) - Telem.ui.pktidBrowser_0.setText(hex(tlmPageAppid[0])) - Telem.ui.countBrowser_0.setText(str(tlmPageCount[0])) + Telem.ui.SubsysBrowser_0.setText(tlmPageDesc[0]) + Telem.ui.pktidBrowser_0.setText(hex(tlmPageAppid[0])) + Telem.ui.countBrowser_0.setText(str(tlmPageCount[0])) else: - Telem.ui.SubsysBrowser_0.setText("(unused)") + Telem.ui.SubsysBrowser_0.setText("(unused)") if tlmPageIsValid[1] == True: - Telem.ui.SubsysBrowser_1.setText(tlmPageDesc[1]) - Telem.ui.pktidBrowser_1.setText(hex(tlmPageAppid[1])) - Telem.ui.countBrowser_1.setText(str(tlmPageCount[1])) + Telem.ui.SubsysBrowser_1.setText(tlmPageDesc[1]) + Telem.ui.pktidBrowser_1.setText(hex(tlmPageAppid[1])) + Telem.ui.countBrowser_1.setText(str(tlmPageCount[1])) else: - Telem.ui.SubsysBrowser_1.setText("(unused)") + Telem.ui.SubsysBrowser_1.setText("(unused)") if tlmPageIsValid[2] == True: - Telem.ui.SubsysBrowser_2.setText(tlmPageDesc[2]) - Telem.ui.pktidBrowser_2.setText(hex(tlmPageAppid[2])) - Telem.ui.countBrowser_2.setText(str(tlmPageCount[2])) + Telem.ui.SubsysBrowser_2.setText(tlmPageDesc[2]) + Telem.ui.pktidBrowser_2.setText(hex(tlmPageAppid[2])) + Telem.ui.countBrowser_2.setText(str(tlmPageCount[2])) else: - Telem.ui.SubsysBrowser_2.setText("(unused)") + Telem.ui.SubsysBrowser_2.setText("(unused)") if tlmPageIsValid[3] == True: - Telem.ui.SubsysBrowser_3.setText(tlmPageDesc[3]) - Telem.ui.pktidBrowser_3.setText(hex(tlmPageAppid[3])) - Telem.ui.countBrowser_3.setText(str(tlmPageCount[3])) + Telem.ui.SubsysBrowser_3.setText(tlmPageDesc[3]) + Telem.ui.pktidBrowser_3.setText(hex(tlmPageAppid[3])) + Telem.ui.countBrowser_3.setText(str(tlmPageCount[3])) else: - Telem.ui.SubsysBrowser_3.setText("(unused)") + Telem.ui.SubsysBrowser_3.setText("(unused)") if tlmPageIsValid[4] == True: - Telem.ui.SubsysBrowser_4.setText(tlmPageDesc[4]) - Telem.ui.pktidBrowser_4.setText(hex(tlmPageAppid[4])) - Telem.ui.countBrowser_4.setText(str(tlmPageCount[4])) + Telem.ui.SubsysBrowser_4.setText(tlmPageDesc[4]) + Telem.ui.pktidBrowser_4.setText(hex(tlmPageAppid[4])) + Telem.ui.countBrowser_4.setText(str(tlmPageCount[4])) else: - Telem.ui.SubsysBrowser_4.setText("(unused)") + Telem.ui.SubsysBrowser_4.setText("(unused)") if tlmPageIsValid[5] == True: - Telem.ui.SubsysBrowser_5.setText(tlmPageDesc[5]) - Telem.ui.pktidBrowser_5.setText(hex(tlmPageAppid[5])) - Telem.ui.countBrowser_5.setText(str(tlmPageCount[5])) + Telem.ui.SubsysBrowser_5.setText(tlmPageDesc[5]) + Telem.ui.pktidBrowser_5.setText(hex(tlmPageAppid[5])) + Telem.ui.countBrowser_5.setText(str(tlmPageCount[5])) else: - Telem.ui.SubsysBrowser_5.setText("(unused)") + Telem.ui.SubsysBrowser_5.setText("(unused)") if tlmPageIsValid[6] == True: - Telem.ui.SubsysBrowser_6.setText(tlmPageDesc[6]) - Telem.ui.pktidBrowser_6.setText(hex(tlmPageAppid[6])) - Telem.ui.countBrowser_6.setText(str(tlmPageCount[6])) + Telem.ui.SubsysBrowser_6.setText(tlmPageDesc[6]) + Telem.ui.pktidBrowser_6.setText(hex(tlmPageAppid[6])) + Telem.ui.countBrowser_6.setText(str(tlmPageCount[6])) else: - Telem.ui.SubsysBrowser_6.setText("(unused)") + Telem.ui.SubsysBrowser_6.setText("(unused)") if tlmPageIsValid[7] == True: - Telem.ui.SubsysBrowser_7.setText(tlmPageDesc[7]) - Telem.ui.pktidBrowser_7.setText(hex(tlmPageAppid[7])) - Telem.ui.countBrowser_7.setText(str(tlmPageCount[7])) + Telem.ui.SubsysBrowser_7.setText(tlmPageDesc[7]) + Telem.ui.pktidBrowser_7.setText(hex(tlmPageAppid[7])) + Telem.ui.countBrowser_7.setText(str(tlmPageCount[7])) else: - Telem.ui.SubsysBrowser_7.setText("(unused)") + Telem.ui.SubsysBrowser_7.setText("(unused)") if tlmPageIsValid[8] == True: - Telem.ui.SubsysBrowser_8.setText(tlmPageDesc[8]) - Telem.ui.pktidBrowser_8.setText(hex(tlmPageAppid[8])) - Telem.ui.countBrowser_8.setText(str(tlmPageCount[8])) + Telem.ui.SubsysBrowser_8.setText(tlmPageDesc[8]) + Telem.ui.pktidBrowser_8.setText(hex(tlmPageAppid[8])) + Telem.ui.countBrowser_8.setText(str(tlmPageCount[8])) else: - Telem.ui.SubsysBrowser_8.setText("(unused)") + Telem.ui.SubsysBrowser_8.setText("(unused)") if tlmPageIsValid[9] == True: - Telem.ui.SubsysBrowser_9.setText(tlmPageDesc[9]) - Telem.ui.pktidBrowser_9.setText(hex(tlmPageAppid[9])) - Telem.ui.countBrowser_9.setText(str(tlmPageCount[9])) + Telem.ui.SubsysBrowser_9.setText(tlmPageDesc[9]) + Telem.ui.pktidBrowser_9.setText(hex(tlmPageAppid[9])) + Telem.ui.countBrowser_9.setText(str(tlmPageCount[9])) else: - Telem.ui.SubsysBrowser_9.setText("(unused)") + Telem.ui.SubsysBrowser_9.setText("(unused)") if tlmPageIsValid[10] == True: - Telem.ui.SubsysBrowser_10.setText(tlmPageDesc[10]) - Telem.ui.pktidBrowser_10.setText(hex(tlmPageAppid[10])) - Telem.ui.countBrowser_10.setText(str(tlmPageCount[10])) + Telem.ui.SubsysBrowser_10.setText(tlmPageDesc[10]) + Telem.ui.pktidBrowser_10.setText(hex(tlmPageAppid[10])) + Telem.ui.countBrowser_10.setText(str(tlmPageCount[10])) else: - Telem.ui.SubsysBrowser_10.setText("(unused)") + Telem.ui.SubsysBrowser_10.setText("(unused)") if tlmPageIsValid[11] == True: - Telem.ui.SubsysBrowser_11.setText(tlmPageDesc[11]) - Telem.ui.pktidBrowser_11.setText(hex(tlmPageAppid[11])) - Telem.ui.countBrowser_11.setText(str(tlmPageCount[11])) + Telem.ui.SubsysBrowser_11.setText(tlmPageDesc[11]) + Telem.ui.pktidBrowser_11.setText(hex(tlmPageAppid[11])) + Telem.ui.countBrowser_11.setText(str(tlmPageCount[11])) else: - Telem.ui.SubsysBrowser_11.setText("(unused)") + Telem.ui.SubsysBrowser_11.setText("(unused)") if tlmPageIsValid[12] == True: - Telem.ui.SubsysBrowser_12.setText(tlmPageDesc[12]) - Telem.ui.pktidBrowser_12.setText(hex(tlmPageAppid[12])) - Telem.ui.countBrowser_12.setText(str(tlmPageCount[12])) + Telem.ui.SubsysBrowser_12.setText(tlmPageDesc[12]) + Telem.ui.pktidBrowser_12.setText(hex(tlmPageAppid[12])) + Telem.ui.countBrowser_12.setText(str(tlmPageCount[12])) else: - Telem.ui.SubsysBrowser_12.setText("(unused)") + Telem.ui.SubsysBrowser_12.setText("(unused)") if tlmPageIsValid[13] == True: - Telem.ui.SubsysBrowser_13.setText(tlmPageDesc[13]) - Telem.ui.pktidBrowser_13.setText(hex(tlmPageAppid[13])) - Telem.ui.countBrowser_13.setText(str(tlmPageCount[13])) + Telem.ui.SubsysBrowser_13.setText(tlmPageDesc[13]) + Telem.ui.pktidBrowser_13.setText(hex(tlmPageAppid[13])) + Telem.ui.countBrowser_13.setText(str(tlmPageCount[13])) else: - Telem.ui.SubsysBrowser_13.setText("(unused)") + Telem.ui.SubsysBrowser_13.setText("(unused)") if tlmPageIsValid[14] == True: - Telem.ui.SubsysBrowser_14.setText(tlmPageDesc[14]) - Telem.ui.pktidBrowser_14.setText(hex(tlmPageAppid[14])) - Telem.ui.countBrowser_14.setText(str(tlmPageCount[14])) + Telem.ui.SubsysBrowser_14.setText(tlmPageDesc[14]) + Telem.ui.pktidBrowser_14.setText(hex(tlmPageAppid[14])) + Telem.ui.countBrowser_14.setText(str(tlmPageCount[14])) else: - Telem.ui.SubsysBrowser_14.setText("(unused)") + Telem.ui.SubsysBrowser_14.setText("(unused)") if tlmPageIsValid[15] == True: - Telem.ui.SubsysBrowser_15.setText(tlmPageDesc[15]) - Telem.ui.pktidBrowser_15.setText(hex(tlmPageAppid[15])) - Telem.ui.countBrowser_15.setText(str(tlmPageCount[15])) + Telem.ui.SubsysBrowser_15.setText(tlmPageDesc[15]) + Telem.ui.pktidBrowser_15.setText(hex(tlmPageAppid[15])) + Telem.ui.countBrowser_15.setText(str(tlmPageCount[15])) else: - Telem.ui.SubsysBrowser_15.setText("(unused)") + Telem.ui.SubsysBrowser_15.setText("(unused)") if tlmPageIsValid[16] == True: - Telem.ui.SubsysBrowser_16.setText(tlmPageDesc[16]) - Telem.ui.pktidBrowser_16.setText(hex(tlmPageAppid[16])) - Telem.ui.countBrowser_16.setText(str(tlmPageCount[16])) + Telem.ui.SubsysBrowser_16.setText(tlmPageDesc[16]) + Telem.ui.pktidBrowser_16.setText(hex(tlmPageAppid[16])) + Telem.ui.countBrowser_16.setText(str(tlmPageCount[16])) else: - Telem.ui.SubsysBrowser_16.setText("(unused)") + Telem.ui.SubsysBrowser_16.setText("(unused)") if tlmPageIsValid[17] == True: - Telem.ui.SubsysBrowser_17.setText(tlmPageDesc[17]) - Telem.ui.pktidBrowser_17.setText(hex(tlmPageAppid[17])) - Telem.ui.countBrowser_17.setText(str(tlmPageCount[17])) + Telem.ui.SubsysBrowser_17.setText(tlmPageDesc[17]) + Telem.ui.pktidBrowser_17.setText(hex(tlmPageAppid[17])) + Telem.ui.countBrowser_17.setText(str(tlmPageCount[17])) else: - Telem.ui.SubsysBrowser_17.setText("(unused)") + Telem.ui.SubsysBrowser_17.setText("(unused)") if tlmPageIsValid[18] == True: - Telem.ui.SubsysBrowser_18.setText(tlmPageDesc[18]) - Telem.ui.pktidBrowser_18.setText(hex(tlmPageAppid[18])) - Telem.ui.countBrowser_18.setText(str(tlmPageCount[18])) + Telem.ui.SubsysBrowser_18.setText(tlmPageDesc[18]) + Telem.ui.pktidBrowser_18.setText(hex(tlmPageAppid[18])) + Telem.ui.countBrowser_18.setText(str(tlmPageCount[18])) else: - Telem.ui.SubsysBrowser_18.setText("(unused)") + Telem.ui.SubsysBrowser_18.setText("(unused)") if tlmPageIsValid[19] == True: - Telem.ui.SubsysBrowser_19.setText(tlmPageDesc[19]) - Telem.ui.pktidBrowser_19.setText(hex(tlmPageAppid[19])) - Telem.ui.countBrowser_19.setText(str(tlmPageCount[19])) + Telem.ui.SubsysBrowser_19.setText(tlmPageDesc[19]) + Telem.ui.pktidBrowser_19.setText(hex(tlmPageAppid[19])) + Telem.ui.countBrowser_19.setText(str(tlmPageCount[19])) else: - Telem.ui.SubsysBrowser_19.setText("(unused)") + Telem.ui.SubsysBrowser_19.setText("(unused)") if tlmPageIsValid[20] == True: - Telem.ui.SubsysBrowser_20.setText(tlmPageDesc[20]) - Telem.ui.pktidBrowser_20.setText(hex(tlmPageAppid[20])) - Telem.ui.countBrowser_20.setText(str(tlmPageCount[20])) + Telem.ui.SubsysBrowser_20.setText(tlmPageDesc[20]) + Telem.ui.pktidBrowser_20.setText(hex(tlmPageAppid[20])) + Telem.ui.countBrowser_20.setText(str(tlmPageCount[20])) else: - Telem.ui.SubsysBrowser_20.setText("(unused)") + Telem.ui.SubsysBrowser_20.setText("(unused)") - - - # - # Display the page + # + # Display the page # Telem.show() Telem.raise_() Telem.initTlmReceiver(subscription) sys.exit(app.exec_()) -