blob: 05ea7fb2b22d12b34d0d890e908c34fd5efbfabf [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"
25
26namespace android {
27
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080028/**
29 * Abstract class for HAL notification listeners
30 */
31class NotificationListener : public virtual RefBase {
32 public:
33 // The set of notifications is a merge of the notifications required for
34 // API1 and API2.
35
36 // Required for API 1 and 2
37 virtual void notifyError(int32_t errorCode,
38 const CaptureResultExtras &resultExtras) = 0;
39
40 // Required only for API2
41 virtual void notifyIdle() = 0;
42 virtual void notifyShutter(const CaptureResultExtras &resultExtras,
43 nsecs_t timestamp) = 0;
44 virtual void notifyPrepared(int streamId) = 0;
45 virtual void notifyRequestQueueEmpty() = 0;
46
47 // Required only for API1
48 virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0;
49 virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0;
50 virtual void notifyAutoWhitebalance(uint8_t newState,
51 int triggerId) = 0;
52 virtual void notifyRepeatingRequestError(long lastFrameNumber) = 0;
53 protected:
54 virtual ~NotificationListener() {}
55};
56
Yin-Chia Yehb978c382019-10-30 00:22:37 -070057class CameraOfflineSessionBase : public virtual RefBase {
58 public:
59 virtual ~CameraOfflineSessionBase();
60
Yin-Chia Yeh5fd603e2019-11-20 11:22:27 -080061 virtual status_t initialize(
62 wp<NotificationListener> listener) = 0;
63
Yin-Chia Yehb978c382019-10-30 00:22:37 -070064 // The session's original camera ID
65 virtual const String8& getId() const = 0;
66
67 virtual status_t disconnect() = 0;
68
69 virtual status_t dump(int fd) = 0;
70
Yin-Chia Yehb978c382019-10-30 00:22:37 -070071 /**
72 * Capture result passing
73 */
74 virtual status_t waitForNextFrame(nsecs_t timeout) = 0;
75
76 virtual status_t getNextResult(CaptureResult *frame) = 0;
77
78 // TODO: notification passing path
79}; // class CameraOfflineSessionBase
80
81} // namespace android
82
83#endif