- Frame frame = JOptionPane.getFrameForComponent(frameComp);
- AltosDevice[] devices;
- devices = AltosDevice.list(product);
-
- if (devices != null && devices.length > 0) {
- value = null;
- dialog = new AltosDeviceDialog(frame, frameComp,
- devices,
- devices[0]);
-
- dialog.setVisible(true);
- return value;
- } else {
- /* check for missing altos JNI library, which
- * will put up its own error dialog
- */
- if (AltosUI.load_library(frame)) {
- JOptionPane.showMessageDialog(frame,
- "No AltOS devices available",
- "No AltOS devices",
- JOptionPane.ERROR_MESSAGE);
- }
- return null;
- }
+ private AltosDevice[] devices() {
+ java.util.List<AltosDevice> usb_devices = AltosUSBDevice.list(product);
+ int num_devices = usb_devices.size();
+ java.util.List<AltosDevice> bt_devices = AltosBTKnown.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);
+ return devices;