summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-08 12:31:48 -0700
committerKeith Packard <keithp@keithp.com>2011-08-08 12:31:48 -0700
commita315b200cd0da1a964f5395cd59660be1b49672b (patch)
treeccc1369313bfee5b8f6d20561c327fa9f939db17
parenta65daf94e8fe3e22f770ef76d9104c3dd11d0330 (diff)
altosui: Pull out BlueTooth support
This leaves the code in place, but commented out so that it isn't used until we've got a bluetooth device ready for use. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/Altos.java2
-rw-r--r--altosui/AltosConfigureUI.java32
-rw-r--r--altosui/AltosDeviceDialog.java38
-rw-r--r--altosui/Makefile.am10
-rw-r--r--altosui/libaltos/cjnitest.c2
-rw-r--r--altosui/libaltos/libaltos.c2
-rw-r--r--altosui/libaltos/libaltos.h6
7 files changed, 58 insertions, 34 deletions
diff --git a/altosui/Altos.java b/altosui/Altos.java
index 1acce949..b257ad7b 100644
--- a/altosui/Altos.java
+++ b/altosui/Altos.java
@@ -408,5 +408,5 @@ public class Altos {
public final static String bt_product_telebt = bt_product_telebt();
- public static AltosBTKnown bt_known = new AltosBTKnown();
+// public static AltosBTKnown bt_known = new AltosBTKnown();
}
diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java
index a8a70ffd..abb54c74 100644
--- a/altosui/AltosConfigureUI.java
+++ b/altosui/AltosConfigureUI.java
@@ -49,7 +49,8 @@ public class AltosConfigureUI
JRadioButton serial_debug;
- JButton manage_bluetooth;
+// BLUETOOTH
+// JButton manage_bluetooth;
JButton manage_frequencies;
/* DocumentListener interface methods */
@@ -202,18 +203,19 @@ public class AltosConfigureUI
c.anchor = GridBagConstraints.WEST;
pane.add(serial_debug, c);
- manage_bluetooth = new JButton("Manage Bluetooth");
- manage_bluetooth.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- AltosBTManage.show(owner, Altos.bt_known);
- }
- });
- c.gridx = 0;
- c.gridy = 6;
- c.gridwidth = 2;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- pane.add(manage_bluetooth, c);
+// BLUETOOTH
+// manage_bluetooth = new JButton("Manage Bluetooth");
+// manage_bluetooth.addActionListener(new ActionListener() {
+// public void actionPerformed(ActionEvent e) {
+// AltosBTManage.show(owner, Altos.bt_known);
+// }
+// });
+// c.gridx = 0;
+// c.gridy = 6;
+// c.gridwidth = 2;
+// c.fill = GridBagConstraints.NONE;
+// c.anchor = GridBagConstraints.WEST;
+// pane.add(manage_bluetooth, c);
manage_frequencies = new JButton("Manage Frequencies");
manage_frequencies.addActionListener(new ActionListener() {
@@ -221,7 +223,9 @@ public class AltosConfigureUI
AltosConfigFreqUI.show(owner);
}
});
- c.gridx = 2;
+// BLUETOOTH
+// c.gridx = 2;
+ c.gridx = 1;
c.gridy = 6;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
diff --git a/altosui/AltosDeviceDialog.java b/altosui/AltosDeviceDialog.java
index e17504e2..fa9587bc 100644
--- a/altosui/AltosDeviceDialog.java
+++ b/altosui/AltosDeviceDialog.java
@@ -30,7 +30,8 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
private JList list;
private JButton cancel_button;
private JButton select_button;
- private JButton manage_bluetooth_button;
+// BLUETOOTH
+// private JButton manage_bluetooth_button;
private Frame frame;
private int product;
@@ -40,14 +41,18 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
private AltosDevice[] devices() {
java.util.List<AltosDevice> usb_devices = AltosUSBDevice.list(product);
- java.util.List<AltosDevice> bt_devices = Altos.bt_known.list(product);
- AltosDevice[] devices = new AltosDevice[usb_devices.size() + bt_devices.size()];
+ int num_devices = usb_devices.size();
+// BLUETOOTH
+// java.util.List<AltosDevice> bt_devices = Altos.bt_known.list(product);
+// num_devices += bt_devices.size();
+ AltosDevice[] devices = new AltosDevice[num_devices];
for (int i = 0; i < usb_devices.size(); i++)
devices[i] = usb_devices.get(i);
- int off = usb_devices.size();
- for (int j = 0; j < bt_devices.size(); j++)
- devices[off + j] = bt_devices.get(j);
+// BLUETOOTH
+// int off = usb_devices.size();
+// for (int j = 0; j < bt_devices.size(); j++)
+// devices[off + j] = bt_devices.get(j);
return devices;
}
@@ -70,9 +75,10 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
cancel_button.setActionCommand("cancel");
cancel_button.addActionListener(this);
- manage_bluetooth_button = new JButton("Manage Bluetooth");
- manage_bluetooth_button.setActionCommand("manage");
- manage_bluetooth_button.addActionListener(this);
+// BLUETOOTH
+// manage_bluetooth_button = new JButton("Manage Bluetooth");
+// manage_bluetooth_button.setActionCommand("manage");
+// manage_bluetooth_button.addActionListener(this);
select_button = new JButton("Select");
select_button.setActionCommand("select");
@@ -146,7 +152,8 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancel_button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
- buttonPane.add(manage_bluetooth_button);
+// BLUETOOTH
+// buttonPane.add(manage_bluetooth_button);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(select_button);
@@ -166,11 +173,12 @@ public class AltosDeviceDialog extends JDialog implements ActionListener {
public void actionPerformed(ActionEvent e) {
if ("select".equals(e.getActionCommand()))
value = (AltosDevice)(list.getSelectedValue());
- if ("manage".equals(e.getActionCommand())) {
- AltosBTManage.show(frame, Altos.bt_known);
- update_devices();
- return;
- }
+// BLUETOOTH
+// if ("manage".equals(e.getActionCommand())) {
+// AltosBTManage.show(frame, Altos.bt_known);
+// update_devices();
+// return;
+// }
setVisible(false);
}
diff --git a/altosui/Makefile.am b/altosui/Makefile.am
index 4bac6df1..713a02f4 100644
--- a/altosui/Makefile.am
+++ b/altosui/Makefile.am
@@ -10,6 +10,12 @@ CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH=".:classes:libaltos:$(FREETTS)/*:/
bin_SCRIPTS=altosui
+altosui_BT = \
+ AltosBTDevice.java \
+ AltosBTDeviceIterator.java \
+ AltosBTManage.java \
+ AltosBTKnown.java
+
altosui_JAVA = \
GrabNDrag.java \
AltosAscent.java \
@@ -28,10 +34,6 @@ altosui_JAVA = \
AltosDeviceDialog.java \
AltosDevice.java \
AltosUSBDevice.java \
- AltosBTDevice.java \
- AltosBTDeviceIterator.java \
- AltosBTManage.java \
- AltosBTKnown.java \
AltosDisplayThread.java \
AltosEepromChunk.java \
AltosEepromDelete.java \
diff --git a/altosui/libaltos/cjnitest.c b/altosui/libaltos/cjnitest.c
index 88e40d73..f0fe78f7 100644
--- a/altosui/libaltos/cjnitest.c
+++ b/altosui/libaltos/cjnitest.c
@@ -41,6 +41,7 @@ main ()
altos_close(file);
}
altos_list_finish(list);
+#if HAS_BLUETOOTH
bt_list = altos_bt_list_start(8);
while (altos_bt_list_next(bt_list, &bt_device)) {
printf ("%s %s\n", bt_device.name, bt_device.addr);
@@ -64,6 +65,7 @@ main ()
}
}
altos_bt_list_finish(bt_list);
+#endif
altos_fini();
return 0;
}
diff --git a/altosui/libaltos/libaltos.c b/altosui/libaltos/libaltos.c
index 5e507cdf..b00a7704 100644
--- a/altosui/libaltos/libaltos.c
+++ b/altosui/libaltos/libaltos.c
@@ -582,6 +582,7 @@ altos_list_finish(struct altos_list *usbdevs)
free(usbdevs);
}
+#if HAS_BLUETOOTH
struct altos_bt_list {
inquiry_info *ii;
int sock;
@@ -713,6 +714,7 @@ no_sock:
no_file:
return NULL;
}
+#endif /* HAS_BLUETOOTH */
#endif
diff --git a/altosui/libaltos/libaltos.h b/altosui/libaltos/libaltos.h
index f710919c..dd091e51 100644
--- a/altosui/libaltos/libaltos.h
+++ b/altosui/libaltos/libaltos.h
@@ -34,6 +34,8 @@
# define PUBLIC
#endif
+#define HAS_BLUETOOTH 0
+
#define USB_VENDOR_FSF 0xfffe
#define USB_VENDOR_ALTUSMETRUM USB_VENDOR_FSF
#define USB_PRODUCT_ALTUSMETRUM 0x000a
@@ -109,6 +111,8 @@ altos_flush(struct altos_file *file);
PUBLIC int
altos_getchar(struct altos_file *file, int timeout);
+#if HAS_BLUETOOTH
+
PUBLIC struct altos_bt_list *
altos_bt_list_start(int inquiry_time);
@@ -124,4 +128,6 @@ altos_bt_fill_in(char *name, char *addr, struct altos_bt_device *device);
PUBLIC struct altos_file *
altos_bt_open(struct altos_bt_device *device);
+#endif
+
#endif /* _LIBALTOS_H_ */