001/*
002 * Copyright (C) Photon Vision.
003 *
004 * This program is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
016 */
017
018package org.photonvision.vision.camera;
019
020import java.util.*;
021import org.photonvision.common.configuration.CameraConfiguration;
022import org.photonvision.vision.frame.Frame;
023import org.photonvision.vision.frame.FrameProvider;
024import org.photonvision.vision.frame.FrameThresholdType;
025import org.photonvision.vision.opencv.ImageRotationMode;
026import org.photonvision.vision.pipe.impl.HSVPipe.HSVParams;
027import org.photonvision.vision.processes.VisionSource;
028import org.photonvision.vision.processes.VisionSourceSettables;
029
030/** Dummy class for unit testing the vision source manager */
031public class TestSource extends VisionSource {
032    public TestSource(CameraConfiguration config) {
033        super(config);
034
035        // Disable camera quirk detection using this fun hack
036        getCameraConfiguration().cameraQuirks = QuirkyCamera.getQuirkyCamera(-1, -1, "");
037    }
038
039    @Override
040    public void remakeSettables() {
041        // Nothing to do, settables for this type of VisionSource should never be
042        // remade.
043        return;
044    }
045
046    @Override
047    public FrameProvider getFrameProvider() {
048        return new FrameProvider() {
049            @Override
050            public Frame get() {
051                // TODO Auto-generated method stub
052                throw new UnsupportedOperationException("Unimplemented method 'get'");
053            }
054
055            @Override
056            public String getName() {
057                return cameraConfiguration.uniqueName;
058            }
059
060            @Override
061            public void requestFrameThresholdType(FrameThresholdType type) {
062                // TODO Auto-generated method stub
063                throw new UnsupportedOperationException("Unimplemented method 'requestFrameThresholdType'");
064            }
065
066            @Override
067            public void requestFrameRotation(ImageRotationMode rotationMode) {
068                // TODO Auto-generated method stub
069                throw new UnsupportedOperationException("Unimplemented method 'requestFrameRotation'");
070            }
071
072            @Override
073            public void requestFrameCopies(boolean copyInput, boolean copyOutput) {
074                // TODO Auto-generated method stub
075                throw new UnsupportedOperationException("Unimplemented method 'requestFrameCopies'");
076            }
077
078            @Override
079            public void requestHsvSettings(HSVParams params) {
080                // TODO Auto-generated method stub
081                throw new UnsupportedOperationException("Unimplemented method 'requestHsvSettings'");
082            }
083
084            @Override
085            public void release() {
086                // TODO Auto-generated method stub
087                throw new UnsupportedOperationException("Unimplemented method 'release'");
088            }
089
090            @Override
091            public boolean checkCameraConnected() {
092                return true;
093            }
094
095            @Override
096            public boolean isConnected() {
097                return true;
098            }
099        };
100    }
101
102    @Override
103    public VisionSourceSettables getSettables() {
104        // TODO Auto-generated method stub
105        throw new UnsupportedOperationException("Unimplemented method 'getSettables'");
106    }
107
108    @Override
109    public boolean isVendorCamera() {
110        // TODO Auto-generated method stub
111        throw new UnsupportedOperationException("Unimplemented method 'isVendorCamera'");
112    }
113
114    @Override
115    public boolean hasLEDs() {
116        return false; // Assume USB cameras do not have photonvision-controlled LEDs
117    }
118
119    @Override
120    public void release() {
121        // TODO Auto-generated method stub
122        throw new UnsupportedOperationException("Unimplemented method 'close'");
123    }
124}