15 package com.neuronrobotics.sdk.ui;
17 import java.awt.event.ActionEvent;
18 import java.awt.event.ActionListener;
19 import java.util.List;
21 import javax.swing.JButton;
22 import javax.swing.JComboBox;
23 import javax.swing.JLabel;
24 import javax.swing.JOptionPane;
25 import javax.swing.JTextField;
27 import net.miginfocom.swing.MigLayout;
29 import com.neuronrobotics.sdk.common.BowlerAbstractConnection;
30 import com.neuronrobotics.sdk.common.Log;
31 import com.neuronrobotics.sdk.common.MissingNativeLibraryException;
32 import com.neuronrobotics.sdk.serial.SerialConnection;
68 refresh =
new JButton(
"Refresh");
69 refresh.addActionListener(
new ActionListener() {
71 public void actionPerformed(ActionEvent arg0) {
76 setLayout(
new MigLayout(
"",
81 add(
new JLabel(
"Connection:"),
"cell 0 0");
85 add(
new JLabel(
"Baudrate:"),
"cell 0 1");
99 throw new NumberFormatException();
103 Log.
info(
"Using port:"+port+
"\n");
104 }
catch(NumberFormatException e) {
105 JOptionPane.showMessageDialog(
null,
"Invalid baudrate given. Please review the list of valid baudrates.",
"Invalid Baudrate", JOptionPane.ERROR_MESSAGE);
106 }
catch(Exception e) {
119 String m =
"NRSDK not installed properly, native library not found\n\n" +
120 "librxtxSerial.so in Linux\n" +
121 "librxtxSerial.jnilib in OSX\n" +
122 "rxtxSerial.dll in Windows\n\n"+
123 "This must be in your JVM or system library path. See:\n"+
124 "http://neuronrobotics.com/wiki/Installing_The_Native_Serial_Library";
127 for(
int i=0;i<prts.size();i++) {
128 String s = prts.get(i);
129 if(s.contains(
"DyIO")||s.contains(
"Bootloader"))
133 if(!(s.contains(
"ttyS") || s.equals(
"COM1") || s.equals(
"COM2") || s.contains(
"ttyACM")))
141 if((s.contains(
"ttyS") || s.equals(
"COM1") || s.equals(
"COM2") || s.contains(
"ttyACM")))
146 JOptionPane.showMessageDialog(
this, m,
"NRSDK not installed properly", JOptionPane.ERROR_MESSAGE);
148 }
catch (Exception e){
150 JOptionPane.showMessageDialog(
this, m,
"NRSDK not installed properly", JOptionPane.ERROR_MESSAGE);
154 JOptionPane.showMessageDialog(
this, m,
"NRSDK not installed properly", JOptionPane.ERROR_MESSAGE);
static void info(String message)
static List< String > getAvailableSerialPorts()
ConnectionDialog getConnectionDialog()
ConnectionDialog connectionDialog
static ImageIcon getIcon(String path)
SerialConnection connection
SerialConnectionPanel(ConnectionDialog connectionDialog)
BowlerAbstractConnection getConnection()
static final long serialVersionUID