1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.camera.integration.antelope 18 19 /** The different types of tests Antelop can perform */ 20 enum class TestType { 21 /** No test */ 22 NONE, 23 /** Open and close camera only */ 24 INIT, 25 /** Start preview stream */ 26 PREVIEW, 27 /** Capture a single image */ 28 PHOTO, 29 /** Capture multiple photos, closing/opening camera between each capture */ 30 MULTI_PHOTO, 31 /** Capture multiple photos, leave camera open between captures */ 32 MULTI_PHOTO_CHAIN, 33 /** Switch between two cameras one time. Preview stream only, no capture */ 34 SWITCH_CAMERA, 35 /** Switch between two cameras multiple times, Preview only, no capture */ 36 MULTI_SWITCH 37 } 38 39 /** 40 * Configuration and state variables for the current running test. 41 * 42 * Also contains the TestResults object to record the results. 43 */ 44 class TestConfig( 45 /** Name of test */ 46 var testName: String = "", 47 /** Enum type of test */ 48 var currentRunningTest: TestType = TestType.NONE, 49 /** API to use for test (Camera 1, 2, or X) */ 50 var api: CameraAPI = CameraAPI.CAMERA2, 51 /** Size of capture to request */ 52 var imageCaptureSize: ImageCaptureSize = ImageCaptureSize.MAX, 53 /** Auto-focus, Continuous focus, or Fixe-focus */ 54 var focusMode: FocusMode = FocusMode.AUTO, 55 /** Camera ID */ 56 var camera: String = "0", 57 /** Camera array to use for the switch camera test */ 58 var switchTestCameras: Array<String> = arrayOf("0", "1"), 59 /** Convenience variable, currently active camera during switch test */ 60 var switchTestCurrentCamera: String = "0", 61 /** Save the original camera for a switch test */ 62 var switchTestRealCameraId: String = "0", 63 /** Semaphor for first onActive preview state */ 64 var isFirstOnActive: Boolean = true, 65 /** Semaphor for first completed capture */ 66 var isFirstOnCaptureComplete: Boolean = true, 67 /** Semaphor for when the test is completed */ 68 var testFinished: Boolean = false, 69 /** Accumulate test results in this object */ 70 var testResults: TestResults = TestResults() 71 ) { 72 73 /** Set up the TestResults object to reflect the test configuration */ setupTestResultsnull74 fun setupTestResults() { 75 testResults.testName = testName 76 testResults.testType = currentRunningTest 77 testResults.camera = camera 78 testResults.cameraId = camera 79 testResults.cameraAPI = api 80 testResults.imageCaptureSize = imageCaptureSize 81 testResults.focusMode = focusMode 82 } 83 } 84