diff options
| author | Keith Packard <keithp@keithp.com> | 2011-04-19 08:43:40 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2011-04-19 08:43:40 -0700 |
| commit | 17f38e045fcd8ca0224095c0b2b7b098df77a8d8 (patch) | |
| tree | 07c49d1151a54d3176f2356b55b6f9f129305b9c /altosui/AltosBTDevice.java | |
| parent | f249e5926f5fd9f86c41e7f0a414193533d4d8b0 (diff) | |
altosui: Use persistent list of bluetooth devices for device dialogs
Store a list of known bluetooth devices as preferences. Always include
those in device dialogs with an option to go browse for more devices
in both the device dialog and the Configure AltosUI dialog.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosBTDevice.java')
| -rw-r--r-- | altosui/AltosBTDevice.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/altosui/AltosBTDevice.java b/altosui/AltosBTDevice.java index ff2be49a..c2721b26 100644 --- a/altosui/AltosBTDevice.java +++ b/altosui/AltosBTDevice.java @@ -86,8 +86,9 @@ public class AltosBTDevice extends altos_bt_device implements AltosDevice { public boolean matchProduct(int want_product) { - if (!isAltusMetrum()) - return false; + System.out.printf("matchProduct %s %d\n", toString(), want_product); +// if (!isAltusMetrum()) +// return false; if (want_product == Altos.product_any) return true; @@ -100,4 +101,23 @@ public class AltosBTDevice extends altos_bt_device implements AltosDevice { return false; } + + public boolean equals(Object o) { + if (!(o instanceof AltosBTDevice)) + return false; + AltosBTDevice other = (AltosBTDevice) o; + System.out.printf("AltosBTDevice equals %s == %s\n", toString(), other.toString()); + return getName().equals(other.getName()) && getAddr().equals(other.getAddr()); + } + + public int hashCode() { + return getName().hashCode() ^ getAddr().hashCode(); + } + + public AltosBTDevice(String name, String addr) { + libaltos.altos_bt_fill_in(name, addr,this); + } + + public AltosBTDevice() { + } }
\ No newline at end of file |
