altosui: Use persistent list of bluetooth devices for device dialogs
[fw/altos] / altosui / AltosBTDevice.java
index ff2be49a66279009c6fc0f32ea69dce4d6ad89b7..c2721b262c0df0b83a0a23a9a20900e961d3d80a 100644 (file)
@@ -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