/** * @param beacon the beacon whose fields we should copy to this beacon builder * @return */ public Builder copyBeaconFields(Beacon beacon) { setIdentifiers(beacon.getIdentifiers()); setBeaconTypeCode(beacon.getBeaconTypeCode()); setDataFields(beacon.getDataFields()); setBluetoothAddress(beacon.getBluetoothAddress()); setBluetoothName(beacon.getBluetoothName()); setExtraDataFields(beacon.getExtraDataFields()); setManufacturer(beacon.getManufacturer()); setTxPower(beacon.getTxPower()); setRssi(beacon.getRssi()); setServiceUuid(beacon.getServiceUuid()); return this; }
/** * Two detected beacons are considered equal if they share the same three identifiers, regardless * of their mDistance or RSSI. */ @Override public boolean equals(Object that) { if (!(that instanceof Beacon)) { return false; } Beacon thatBeacon = (Beacon) that; if (this.mIdentifiers.size() != thatBeacon.mIdentifiers.size()) { return false; } // all identifiers must match for (int i = 0; i < this.mIdentifiers.size(); i++) { if (!this.mIdentifiers.get(i).equals(thatBeacon.mIdentifiers.get(i))) { return false; } } return sHardwareEqualityEnforced ? this.getBluetoothAddress().equals(thatBeacon.getBluetoothAddress()) : true; }