projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos]
/
ao-tools
/
altosui
/
AltosDevice.java
diff --git
a/ao-tools/altosui/AltosDevice.java
b/ao-tools/altosui/AltosDevice.java
index d671031dc7d90ab66c1cf7e13ddeb42d4d77f9f1..f0fda57bc0b825c71d4af0dfa08180e4b3d4899e 100644
(file)
--- a/
ao-tools/altosui/AltosDevice.java
+++ b/
ao-tools/altosui/AltosDevice.java
@@
-101,6
+101,15
@@
public class AltosDevice extends altos_device {
getName(), getSerial(), getPath());
}
getName(), getSerial(), getPath());
}
+ public String toShortString() {
+ String name = getName();
+ if (name == null)
+ name = "Altus Metrum";
+ return String.format("%s %d %s",
+ name, getSerial(), getPath());
+
+ }
+
public boolean isAltusMetrum() {
if (getVendor() != vendor_altusmetrum)
return false;
public boolean isAltusMetrum() {
if (getVendor() != vendor_altusmetrum)
return false;
@@
-113,11
+122,6
@@
public class AltosDevice extends altos_device {
public boolean matchProduct(int want_product) {
public boolean matchProduct(int want_product) {
- System.out.printf("vendor %x product %x want %x\n",
- getVendor(), getProduct(), want_product);
- System.out.printf("vendor_altusmetrum: %d\n", vendor_altusmetrum);
- System.out.printf("telemetrum: %d\n", product_telemetrum);
-
if (!isAltusMetrum())
return false;
if (!isAltusMetrum())
return false;
@@
-139,23
+143,19
@@
public class AltosDevice extends altos_device {
}
static AltosDevice[] list(int product) {
}
static AltosDevice[] list(int product) {
- if (!load_library()) {
- System.out.printf("no library\n");
+ if (!load_library())
return null;
return null;
- }
SWIGTYPE_p_altos_list list = libaltos.altos_list_start();
ArrayList<AltosDevice> device_list = new ArrayList<AltosDevice>();
if (list != null) {
SWIGTYPE_p_altos_list list = libaltos.altos_list_start();
ArrayList<AltosDevice> device_list = new ArrayList<AltosDevice>();
if (list != null) {
- System.out.printf("got device list\n");
SWIGTYPE_p_altos_file file;
for (;;) {
AltosDevice device = new AltosDevice();
if (libaltos.altos_list_next(list, device) == 0)
break;
SWIGTYPE_p_altos_file file;
for (;;) {
AltosDevice device = new AltosDevice();
if (libaltos.altos_list_next(list, device) == 0)
break;
- System.out.printf("got device\n");
if (device.matchProduct(product))
device_list.add(device);
}
if (device.matchProduct(product))
device_list.add(device);
}