blob: 1f835a92ccd22a0a89c69cb160c464bbbd818a60 [file] [log] [blame]
Yin-Chia Yehb978c382019-10-30 00:22:37 -07001/*
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"
Emilian Peevfaa4bde2020-01-23 12:19:37 -080025#include "FrameProducer.h"
Yin-Chia Yehb978c382019-10-30 00:22:37 -070026
27namespace android {
28
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080029/**
30 * Abstract class for HAL notification listeners
31 */
32class 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:
55 virtual ~NotificationListener() {}
56};
57
Emilian Peevfaa4bde2020-01-23 12:19:37 -080058class CameraOfflineSessionBase : public virtual FrameProducer {
Yin-Chia Yehb978c382019-10-30 00:22:37 -070059 public:
60 virtual ~CameraOfflineSessionBase();
61
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080062 virtual status_t initialize(
63 wp<NotificationListener> listener) = 0;
64
Yin-Chia Yehb978c382019-10-30 00:22:37 -070065 virtual status_t disconnect() = 0;
66
67 virtual status_t dump(int fd) = 0;
68
Yin-Chia Yehb978c382019-10-30 00:22:37 -070069 // TODO: notification passing path
70}; // class CameraOfflineSessionBase
71
72} // namespace android
73
74#endif