projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Expose a signed version of the tick count
[fw/altos]
/
altosui
/
AltosUSBDevice.java
diff --git
a/altosui/AltosUSBDevice.java
b/altosui/AltosUSBDevice.java
index 03ddf5a89c1792415bc065f268bc0fdfc70ccf94..ed5f8307d178bba720de462c47b358e3f4f4ddf4 100644
(file)
--- a/
altosui/AltosUSBDevice.java
+++ b/
altosui/AltosUSBDevice.java
@@
-39,11
+39,18
@@
public class AltosUSBDevice extends altos_device implements AltosDevice {
}
}
+ public String getErrorString() {
+ altos_error error = new altos_error();
+
+ libaltos.altos_get_last_error(error);
+ return String.format("%s (%d)", error.getString(), error.getCode());
+ }
+
public SWIGTYPE_p_altos_file open() {
return libaltos.altos_open(this);
}
public SWIGTYPE_p_altos_file open() {
return libaltos.altos_open(this);
}
- p
ublic
boolean isAltusMetrum() {
+ p
rivate
boolean isAltusMetrum() {
if (getVendor() != Altos.vendor_altusmetrum)
return false;
if (getProduct() < Altos.product_altusmetrum_min)
if (getVendor() != Altos.vendor_altusmetrum)
return false;
if (getProduct() < Altos.product_altusmetrum_min)
@@
-64,7
+71,12
@@
public class AltosUSBDevice extends altos_device implements AltosDevice {
if (want_product == Altos.product_basestation)
return matchProduct(Altos.product_teledongle) ||
matchProduct(Altos.product_teleterra) ||
if (want_product == Altos.product_basestation)
return matchProduct(Altos.product_teledongle) ||
matchProduct(Altos.product_teleterra) ||
- matchProduct(Altos.product_telebt);
+ matchProduct(Altos.product_telebt) ||
+ matchProduct(Altos.product_megadongle);
+
+ if (want_product == Altos.product_altimeter)
+ return matchProduct(Altos.product_telemetrum) ||
+ matchProduct(Altos.product_megametrum);
int have_product = getProduct();
int have_product = getProduct();
@@
-77,13
+89,13
@@
public class AltosUSBDevice extends altos_device implements AltosDevice {
return false;
}
return false;
}
- static
AltosUSBDevice[]
list(int product) {
+ static
java.util.List<AltosDevice>
list(int product) {
if (!Altos.load_library())
return null;
SWIGTYPE_p_altos_list list = libaltos.altos_list_start();
if (!Altos.load_library())
return null;
SWIGTYPE_p_altos_list list = libaltos.altos_list_start();
- ArrayList<Altos
USBDevice> device_list = new ArrayList<AltosUSB
Device>();
+ ArrayList<Altos
Device> device_list = new ArrayList<Altos
Device>();
if (list != null) {
for (;;) {
AltosUSBDevice device = new AltosUSBDevice();
if (list != null) {
for (;;) {
AltosUSBDevice device = new AltosUSBDevice();
@@
-95,9
+107,6
@@
public class AltosUSBDevice extends altos_device implements AltosDevice {
libaltos.altos_list_finish(list);
}
libaltos.altos_list_finish(list);
}
- AltosUSBDevice[] devices = new AltosUSBDevice[device_list.size()];
- for (int i = 0; i < device_list.size(); i++)
- devices[i] = device_list.get(i);
- return devices;
+ return device_list;
}
}
\ No newline at end of file
}
}
\ No newline at end of file