Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 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 | |
Shuzhen Wang | 316781a | 2020-08-18 18:11:01 -0700 | [diff] [blame] | 20 | #include <vector> |
| 21 | |
Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 22 | #include <utils/RefBase.h> |
| 23 | #include <utils/String8.h> |
| 24 | #include <utils/Timers.h> |
| 25 | |
| 26 | #include "camera/CaptureResult.h" |
Shuzhen Wang | 316781a | 2020-08-18 18:11:01 -0700 | [diff] [blame] | 27 | #include "camera/CameraSessionStats.h" |
Emilian Peev | faa4bde | 2020-01-23 12:19:37 -0800 | [diff] [blame] | 28 | #include "FrameProducer.h" |
Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 29 | |
| 30 | namespace android { |
| 31 | |
Yin-Chia Yeh | 5fd603e | 2019-11-20 11:22:27 -0800 | [diff] [blame] | 32 | /** |
| 33 | * Abstract class for HAL notification listeners |
| 34 | */ |
| 35 | class NotificationListener : public virtual RefBase { |
| 36 | public: |
| 37 | // The set of notifications is a merge of the notifications required for |
| 38 | // API1 and API2. |
| 39 | |
| 40 | // Required for API 1 and 2 |
| 41 | virtual void notifyError(int32_t errorCode, |
| 42 | const CaptureResultExtras &resultExtras) = 0; |
| 43 | |
| 44 | // Required only for API2 |
Shuzhen Wang | 316781a | 2020-08-18 18:11:01 -0700 | [diff] [blame] | 45 | virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError, |
| 46 | const std::vector<hardware::CameraStreamStats>& streamStats) = 0; |
Yin-Chia Yeh | 5fd603e | 2019-11-20 11:22:27 -0800 | [diff] [blame] | 47 | virtual void notifyShutter(const CaptureResultExtras &resultExtras, |
| 48 | nsecs_t timestamp) = 0; |
| 49 | virtual void notifyPrepared(int streamId) = 0; |
| 50 | virtual void notifyRequestQueueEmpty() = 0; |
| 51 | |
| 52 | // Required only for API1 |
| 53 | virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0; |
| 54 | virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0; |
| 55 | virtual void notifyAutoWhitebalance(uint8_t newState, |
| 56 | int triggerId) = 0; |
| 57 | virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0; |
| 58 | protected: |
| 59 | virtual ~NotificationListener() {} |
| 60 | }; |
| 61 | |
Emilian Peev | faa4bde | 2020-01-23 12:19:37 -0800 | [diff] [blame] | 62 | class CameraOfflineSessionBase : public virtual FrameProducer { |
Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 63 | public: |
| 64 | virtual ~CameraOfflineSessionBase(); |
| 65 | |
Yin-Chia Yeh | 5fd603e | 2019-11-20 11:22:27 -0800 | [diff] [blame] | 66 | virtual status_t initialize( |
| 67 | wp<NotificationListener> listener) = 0; |
| 68 | |
Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 69 | virtual status_t disconnect() = 0; |
| 70 | |
| 71 | virtual status_t dump(int fd) = 0; |
| 72 | |
Yin-Chia Yeh | b978c38 | 2019-10-30 00:22:37 -0700 | [diff] [blame] | 73 | // TODO: notification passing path |
| 74 | }; // class CameraOfflineSessionBase |
| 75 | |
| 76 | } // namespace android |
| 77 | |
| 78 | #endif |