def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        #
        # connect the method to process a UDP packet
        #
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.udpSocket.bind(int(udpPort))
        self.udpSocket.readyRead.connect(self.processPendingDatagrams)
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        # 
        # connect the method to process a UDP packet
        #
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.udpSocket.bind(int(udpPort))
        self.udpSocket.readyRead.connect(self.processPendingDatagrams)
class SubsystemTelemetry(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        #
        # connect the method to process a UDP packet
        #
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.udpSocket.bind(int(udpPort))
        self.udpSocket.readyRead.connect(self.processPendingDatagrams)

    #
    # This method Decodes a telemetry item from the packet and displays it
    #
    def displayTelemetryItem(self, datagram, tlmIndex, labelField, valueField):
        if tlmItemIsValid[tlmIndex] == True:
            TlmField = unpack(
                tlmItemFormat[tlmIndex], datagram[int(tlmItemStart[tlmIndex]):(
                    int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))])
            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])
            labelField.setText(tlmItemDesc[tlmIndex])
        else:
            labelField.setText("(unused)")

    #
    # This method is a callback for processing UDP packets
    #
    def processPendingDatagrams(self):
        while self.udpSocket.hasPendingDatagrams():
            #
            # Get the UDP packet
            #
            datagram, host, port = self.udpSocket.readDatagram(
                self.udpSocket.pendingDatagramSize())
            print len(datagram)
            #
            # Show number of packets received
            #
            self.pktCount += 1
            self.ui.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)
 def __init__(self):
     QtGui.QDialog.__init__(self)
     self.ui = Ui_GenericTelemetryDialog()
     self.ui.setupUi(self)
class SubsystemTelemetry(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.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:
            TlmField = unpack(
                tlmItemFormat[tlmIndex], datagram[int(tlmItemStart[tlmIndex]):(
                    int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))])
            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])
            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.thread = TlmReceiver(self, subscription)
        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):
        #
        # Show number of packets received
        #
        self.pktCount += 1
        self.ui.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)
class SubsystemTelemetry(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.setupUi(self)
        self.setWindowTitle(pageTitle)

        # 
        # connect the method to process a UDP packet
        #
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.udpSocket.bind(int(udpPort))
        self.udpSocket.readyRead.connect(self.processPendingDatagrams)

    # 
    # This method Decodes a telemetry item from the packet and displays it 
    #
    def displayTelemetryItem(self, datagram, tlmIndex, labelField, valueField):
       if tlmItemIsValid[tlmIndex] == True:
          TlmField =   unpack(tlmItemFormat[tlmIndex], datagram[int(tlmItemStart[tlmIndex]):(int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))])
          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])
          labelField.setText(tlmItemDesc[tlmIndex])
       else:
          labelField.setText("(unused)")

    #
    # This method is a callback for processing UDP packets
    #
    def processPendingDatagrams(self):
        while self.udpSocket.hasPendingDatagrams():
            #
            # Get the UDP packet
            # 
            datagram, host, port = self.udpSocket.readDatagram(self.udpSocket.pendingDatagramSize())
	    print len(datagram)
            #
            # Show number of packets received
            # 
            self.pktCount += 1
            self.ui.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)
 def __init__(self):
     QtGui.QDialog.__init__(self)
     self.ui = Ui_GenericTelemetryDialog()
     self.ui.setupUi(self)
class SubsystemTelemetry(QtGui.QDialog):

    pktCount = 0

    #
    # Init the class
    #
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.ui = Ui_GenericTelemetryDialog()
        self.ui.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:
          TlmField =   unpack(tlmItemFormat[tlmIndex], datagram[int(tlmItemStart[tlmIndex]):(int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))])
          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])
          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.thread = TlmReceiver(self, subscription)
        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):
        #
        # Show number of packets received
        #
        self.pktCount += 1
        self.ui.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)