1 /* 2 * Copyright (C) 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 #ifndef ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H 18 #define ANDROID_SERVERS_CAMERA_CAMERAOFFLINESESSIONBASE_H 19 20 #include <utils/RefBase.h> 21 #include <utils/String8.h> 22 #include <utils/Timers.h> 23 24 #include "camera/CaptureResult.h" 25 #include "FrameProducer.h" 26 27 namespace android { 28 29 /** 30 * Abstract class for HAL notification listeners 31 */ 32 class NotificationListener : public virtual RefBase { 33 public: 34 // The set of notifications is a merge of the notifications required for 35 // API1 and API2. 36 37 // Required for API 1 and 2 38 virtual void notifyError(int32_t errorCode, 39 const CaptureResultExtras &resultExtras) = 0; 40 41 // Required only for API2 42 virtual void notifyIdle() = 0; 43 virtual void notifyShutter(const CaptureResultExtras &resultExtras, 44 nsecs_t timestamp) = 0; 45 virtual void notifyPrepared(int streamId) = 0; 46 virtual void notifyRequestQueueEmpty() = 0; 47 48 // Required only for API1 49 virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0; 50 virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0; 51 virtual void notifyAutoWhitebalance(uint8_t newState, 52 int triggerId) = 0; 53 virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0; 54 protected: ~NotificationListener()55 virtual ~NotificationListener() {} 56 }; 57 58 class CameraOfflineSessionBase : public virtual FrameProducer { 59 public: 60 virtual ~CameraOfflineSessionBase(); 61 62 virtual status_t initialize( 63 wp<NotificationListener> listener) = 0; 64 65 virtual status_t disconnect() = 0; 66 67 virtual status_t dump(int fd) = 0; 68 69 // TODO: notification passing path 70 }; // class CameraOfflineSessionBase 71 72 } // namespace android 73 74 #endif 75