Skip to content

Commit

Permalink
Update Equals Method for USB Camera Source.
Browse files Browse the repository at this point in the history
Cleaner fix to the bug of multiple cameras of the same type aka dual arducam ov9281 uc844 not working. The past equals would result in false positives.
  • Loading branch information
BytingBulldogs3539 committed Nov 29, 2023
1 parent 03d7f4b commit b48cb8a
Showing 1 changed file with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public VisionSourceSettables getSettables() {
}

public class USBCameraSettables extends VisionSourceSettables {

protected USBCameraSettables(CameraConfiguration configuration) {
super(configuration);
getAllVideoModes();
Expand Down Expand Up @@ -343,11 +344,27 @@ public boolean isVendorCamera() {
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
USBCameraSource that = (USBCameraSource) o;
return cameraQuirks.equals(that.cameraQuirks);
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
USBCameraSource other = (USBCameraSource) obj;
if (camera == null) {
if (other.camera != null) return false;
} else if (!camera.equals(other.camera)) return false;
if (usbCameraSettables == null) {
if (other.usbCameraSettables != null) return false;
} else if (!usbCameraSettables.equals(other.usbCameraSettables)) return false;
if (usbFrameProvider == null) {
if (other.usbFrameProvider != null) return false;
} else if (!usbFrameProvider.equals(other.usbFrameProvider)) return false;
if (cvSink == null) {
if (other.cvSink != null) return false;
} else if (!cvSink.equals(other.cvSink)) return false;
if (cameraQuirks == null) {
if (other.cameraQuirks != null) return false;
} else if (!cameraQuirks.equals(other.cameraQuirks)) return false;
return true;
}

@Override
Expand Down

0 comments on commit b48cb8a

Please sign in to comment.