1 /* 2 * Copyright (C) 2014 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 com.android.ex.camera2.portability; 18 19 class CameraActions { 20 // Camera initialization/finalization 21 public static final int OPEN_CAMERA = 1; 22 public static final int RELEASE = 2; 23 public static final int RECONNECT = 3; 24 public static final int UNLOCK = 4; 25 public static final int LOCK = 5; 26 // Preview 27 public static final int SET_PREVIEW_TEXTURE_ASYNC = 101; 28 public static final int START_PREVIEW_ASYNC = 102; 29 public static final int STOP_PREVIEW = 103; 30 public static final int SET_PREVIEW_CALLBACK_WITH_BUFFER = 104; 31 public static final int ADD_CALLBACK_BUFFER = 105; 32 public static final int SET_PREVIEW_DISPLAY_ASYNC = 106; 33 public static final int SET_PREVIEW_CALLBACK = 107; 34 public static final int SET_ONE_SHOT_PREVIEW_CALLBACK = 108; 35 // Parameters 36 public static final int SET_PARAMETERS = 201; 37 public static final int GET_PARAMETERS = 202; 38 public static final int REFRESH_PARAMETERS = 203; 39 public static final int APPLY_SETTINGS = 204; 40 // Focus, Zoom 41 public static final int AUTO_FOCUS = 301; 42 public static final int CANCEL_AUTO_FOCUS = 302; 43 public static final int SET_AUTO_FOCUS_MOVE_CALLBACK = 303; 44 public static final int SET_ZOOM_CHANGE_LISTENER = 304; 45 public static final int CANCEL_AUTO_FOCUS_FINISH = 305; 46 // Face detection 47 public static final int SET_FACE_DETECTION_LISTENER = 461; 48 public static final int START_FACE_DETECTION = 462; 49 public static final int STOP_FACE_DETECTION = 463; 50 // Presentation 51 public static final int ENABLE_SHUTTER_SOUND = 501; 52 public static final int SET_DISPLAY_ORIENTATION = 502; 53 public static final int SET_JPEG_ORIENTATION = 503; 54 // Capture 55 public static final int CAPTURE_PHOTO = 601; 56 57 public static String stringify(int action) { 58 switch (action) { 59 case OPEN_CAMERA: 60 return "OPEN_CAMERA"; 61 case RELEASE: 62 return "RELEASE"; 63 case RECONNECT: 64 return "RECONNECT"; 65 case UNLOCK: 66 return "UNLOCK"; 67 case LOCK: 68 return "LOCK"; 69 case SET_PREVIEW_TEXTURE_ASYNC: 70 return "SET_PREVIEW_TEXTURE_ASYNC"; 71 case START_PREVIEW_ASYNC: 72 return "START_PREVIEW_ASYNC"; 73 case STOP_PREVIEW: 74 return "STOP_PREVIEW"; 75 case SET_PREVIEW_CALLBACK_WITH_BUFFER: 76 return "SET_PREVIEW_CALLBACK_WITH_BUFFER"; 77 case ADD_CALLBACK_BUFFER: 78 return "ADD_CALLBACK_BUFFER"; 79 case SET_PREVIEW_DISPLAY_ASYNC: 80 return "SET_PREVIEW_DISPLAY_ASYNC"; 81 case SET_PREVIEW_CALLBACK: 82 return "SET_PREVIEW_CALLBACK"; 83 case SET_ONE_SHOT_PREVIEW_CALLBACK: 84 return "SET_ONE_SHOT_PREVIEW_CALLBACK"; 85 case SET_PARAMETERS: 86 return "SET_PARAMETERS"; 87 case GET_PARAMETERS: 88 return "GET_PARAMETERS"; 89 case REFRESH_PARAMETERS: 90 return "REFRESH_PARAMETERS"; 91 case APPLY_SETTINGS: 92 return "APPLY_SETTINGS"; 93 case AUTO_FOCUS: 94 return "AUTO_FOCUS"; 95 case CANCEL_AUTO_FOCUS: 96 return "CANCEL_AUTO_FOCUS"; 97 case SET_AUTO_FOCUS_MOVE_CALLBACK: 98 return "SET_AUTO_FOCUS_MOVE_CALLBACK"; 99 case SET_ZOOM_CHANGE_LISTENER: 100 return "SET_ZOOM_CHANGE_LISTENER"; 101 case CANCEL_AUTO_FOCUS_FINISH: 102 return "CANCEL_AUTO_FOCUS_FINISH"; 103 case SET_FACE_DETECTION_LISTENER: 104 return "SET_FACE_DETECTION_LISTENER"; 105 case START_FACE_DETECTION: 106 return "START_FACE_DETECTION"; 107 case STOP_FACE_DETECTION: 108 return "STOP_FACE_DETECTION"; 109 case ENABLE_SHUTTER_SOUND: 110 return "ENABLE_SHUTTER_SOUND"; 111 case SET_DISPLAY_ORIENTATION: 112 return "SET_DISPLAY_ORIENTATION"; 113 case CAPTURE_PHOTO: 114 return "CAPTURE_PHOTO"; 115 default: 116 return "UNKNOWN(" + action + ")"; 117 } 118 } 119 120 private CameraActions() { 121 throw new AssertionError(); 122 } 123 } 124