def get_serial_ports_tuple() -> List[tuple]: result = [] for port in serial_port.get_serial_ports(): result.append((port, port)) return result
def comm_port_list(self): """ Ste the serial ports to the list. :return: """ # Add all the found serial ports return adcp_serial.get_serial_ports()
def update_serial_list(self): """ Ste the serial ports to the list. :return: """ # Clear the current list self.serialPortComboBox.clear() # Add all the found serial ports for port in adcp_serial.get_serial_ports(): self.serialPortComboBox.addItem(port)
def init_display(self): """ Initialize the display. :return: """ self.recordPushButton.setStyleSheet("background: #893624") self.sendCmdPushButton.setShortcut("Return") # Set the serial port list and baud list self.update_serial_list() self.serialPortComboBox.setToolTip( "If no serial ports are list, make sure it is available and click the scan button to update the serial port list." ) self.scanSerialPushButton.setToolTip( "Scan for any available serial ports. If nothing is listed, then there are no available serial ports. Close any applications using a serial port." ) if self.rti_config.config['Comm'][ 'Port'] in adcp_serial.get_serial_ports(): self.serialPortComboBox.setCurrentText( self.rti_config.config['Comm']['Port']) self.update_baud_rate_list() self.baudComboBox.setCurrentText( self.rti_config.config['Comm']['Baud']) self.baudComboBox.setToolTip("The default baud rate is 115200.") #self.serialTextBrowser.ensureCursorVisible() self.serialTextBrowser.textChanged.connect( self.serial_txt_changed_sig.emit) # Setup buttons self.scanSerialPushButton.clicked.connect( self.scan_serial_port_btn_sig.emit) self.serialConnectPushButton.clicked.connect( self.connect_serial_btn_sig.emit) self.serialDisconnectPushButton.clicked.connect( self.disconnect_serial_btn_sig.emit) self.sendCmdPushButton.clicked.connect(self.send_cmd_btn_sig.emit) self.breakPushButton.clicked.connect(self.send_break_btn_sig.emit) self.startPingPushButton.clicked.connect(self.start_ping_btn_sig.emit) self.stopPingPushButton.clicked.connect(self.stop_ping_btn_sig.emit) self.recordPushButton.clicked.connect(self.record_btn_sig.emit) self.clearConsolePushButton.clicked.connect( self.clear_console_btn_sig.emit) self.clearBulkCmdPushButton.clicked.connect( self.clear_bulk_btn_sig.emit) self.sendBulkCmdPushButton.clicked.connect(self.send_bulk_btn_sig.emit)
def init_terminal_config(self): """ Default configuration for the terminal. Call this to add the terminal sections to the config. You can later add more to this section here or in your own code. :return: """ ports = adcp_serial.get_serial_ports() # Verify the section exist if 'Comm' not in self.config: self.config['Comm'] = {} if ports: self.config['Comm']['Port'] = ports[0] else: self.config['Comm']['Port'] = '' self.config['Comm']['Baud'] = '115200' self.config['Comm']['output_dir'] = os.path.expanduser('~') self.write() # Verify each value exist if not self.config.has_option('Comm', 'Port'): if ports: self.config['Comm']['Port'] = ports[0] else: self.config['Comm']['Port'] = '' self.write() if not self.config.has_option('Comm', 'Baud'): self.config['Comm']['Baud'] = '115200' self.write() if not self.config.has_option('Comm', 'output_dir'): self.config['Comm']['output_dir'] = os.path.expanduser('~') self.write()
def get_serial_ports(self): return serial_port.get_serial_ports()
def get_serial_ports() -> List[str]: return serial_port.get_serial_ports()