15 package com.neuronrobotics.sdk.ui;
17 import java.awt.event.ActionEvent;
18 import java.awt.event.ActionListener;
20 import javax.bluetooth.RemoteDevice;
21 import javax.swing.JButton;
22 import javax.swing.JComboBox;
23 import javax.swing.JLabel;
24 import javax.swing.JProgressBar;
25 import javax.swing.JTextArea;
27 import net.miginfocom.swing.MigLayout;
29 import com.neuronrobotics.sdk.common.Log;
30 import com.neuronrobotics.sdk.util.IMonitorable;
31 import com.neuronrobotics.sdk.util.IProgressMonitorListener;
32 import com.neuronrobotics.sdk.util.ProcessMonitor;
33 import com.neuronrobotics.sdk.wireless.bluetooth.BlueCoveManager;
34 import com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection;
61 private JProgressBar
progress =
new JProgressBar();
78 search =
new JButton(
"Search for Devices");
79 search.addActionListener(
new ActionListener() {
81 public void actionPerformed(ActionEvent arg0) {
86 setLayout(
new MigLayout(
"",
93 add(
new JLabel(
"Connection:"),
"cell 0 0");
111 Log.
info(
"Using device:"+port+
"\n");
112 }
catch(Exception e) {
113 Log.
warning(
"Unable to connect with bluetooth connection");
123 Log.
info(
"Searching for devices over bluetooth...");
132 message.setText(
"Searching...");
140 public void onUpdate(
double value) {
146 public void onComplete() {
169 setName(
"Bowler Platform Bluetooth connection thread");
174 message.setText(
"Searching for bluetooth devices, please wait...");
177 for(String s: devices) {
179 message.setText(
"Adding " + s);
182 if(devices.length == 0) {
183 message.setText(
"No devices found");
185 }
catch(Exception e) {
188 String m =
"BlueCove not installed properly, native library not found or missing dependancy\n\n";
189 JTextArea tx =
new JTextArea();
191 tx.setLineWrap(
true);
192 tx.setWrapStyleWord(
true);
static void info(String message)
static void warning(String message)
ConnectionDialog getConnectionDialog()
ConnectionDialog connectionDialog
static final long serialVersionUID
BluetoothSerialConnection getConnection()
BluetoothSerialConnection connection
BluetoothConnectionPanel(ConnectionDialog connectionDialog)
static ImageIcon getIcon(String path)
void addProcessMonitorListener(IProgressMonitorListener listener)
synchronized RemoteDevice getDevice(String name)
String[] getAvailableSerialDevices(boolean refresh)
synchronized void disconnect()