def serial_updatePortlist(self):
     """Update port list in comboBox_selectPort."""
     availablePorts = getAvailableSerialPorts()
     debugLog('Update ports: ' + str(availablePorts))
     self.ui.comboBox_selectPort.clear()
     for port in availablePorts:
         self.ui.comboBox_selectPort.addItem(port)
Beispiel #2
0
    def ctlHmiTermOpen(self, id, port, baudrate):
        if id is 1:
            target = self.HMI
            isHidden = self.tabHmi_1.isHidden()
        elif id is 2:
            target = self.HMI2
            isHidden = self.tabHmi_2.isHidden()

        if isHidden:
            err = True
            msg = 'Terminal {} is not available now, plz open it at adt tab settings'.format(id)
        elif target.ser.isOpen():
            err = True
            msg = 'Terminal {} has been opened.'.format(id)
        else:
            availablePorts = getAvailableSerialPorts()
            if port in availablePorts:
                err = False
                msg = ''
                target.ui.s_portComboBox.clear()
                for p in availablePorts:
                    target.ui.s_portComboBox.addItem(p)
                target.ui.s_portComboBox.setCurrentIndex(availablePorts.index(port))
                target.ser.baudrate = baudrate
                target.s_portToggle()
            else:
                err = True
                msg = 'port {} is not available.'.format(port)
        res = { 'err' : err, 'msg' : msg }
        self.adtSocketHandler.sendRes(res)
Beispiel #3
0
 def s_updatePortlist(self):
     if self.ser.isOpen():
         pass
     else :
         availablePorts = getAvailableSerialPorts()
         debugLog('Update ports: {}'.format(str(availablePorts)))
         self.ui.s_portComboBox.clear()
         for port in availablePorts:
             self.ui.s_portComboBox.addItem(port)
Beispiel #4
0
 def ctlLoaderStart(self, port, hexfile):
     self.asaLoader.ui.lineEdit_selectFile.setText(hexfile)
     availablePorts = getAvailableSerialPorts()
     if port in availablePorts:
         self.asaLoader.ui.comboBox_selectPort.clear()
         for p in availablePorts:
             self.asaLoader.ui.comboBox_selectPort.addItem(p)
         self.asaLoader.ui.comboBox_selectPort.setCurrentIndex(availablePorts.index(port))
         self.asaLoader.startLoad()
         time.sleep(0.5) # wait loader get total_steps done
         err = False
         msg = ''
         max = self.asaLoader.loaderThread.loader.total_steps
     else:
         err = True
         msg = 'port {} is not available.'.format(port)
         max = 0
     res = {
         'err': err,
         'msg': msg,
         'max': max
     }
     self.adtSocketHandler.sendRes(res)