blob: 0e719bd31691652793f9f461e862870839aade46 [file] [log] [blame]
Scott Randolph5c99d852016-11-15 17:01:23 -08001/*
2 * Copyright (C) 2016 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_HARDWARE_EVS_V1_0_EVSCAMERAENUMERATOR_H
18#define ANDROID_HARDWARE_EVS_V1_0_EVSCAMERAENUMERATOR_H
19
20#include <android/hardware/evs/1.0/IEvsEnumerator.h>
21#include <android/hardware/evs/1.0/IEvsCamera.h>
22
23#include <list>
24
25#include "EvsCamera.h"
26
27namespace android {
28namespace hardware {
29namespace evs {
30namespace V1_0 {
31namespace implementation {
32
33class EvsEnumerator : public IEvsEnumerator {
34public:
35 // Methods from ::android::hardware::evs::V1_0::IEvsEnumerator follow.
36 Return<void> getCameraList(getCameraList_cb _hidl_cb) override;
Martijn Coenen527924a2017-01-04 12:59:48 +010037 Return<sp<IEvsCamera>> openCamera(const hidl_string& cameraId) override;
Scott Randolph5c99d852016-11-15 17:01:23 -080038 Return<void> closeCamera(const ::android::sp<IEvsCamera>& carCamera) override;
Martijn Coenen527924a2017-01-04 12:59:48 +010039 Return<sp<IEvsDisplay>> openDisplay() override;
Scott Randolph5c99d852016-11-15 17:01:23 -080040 Return<void> closeDisplay(const ::android::sp<IEvsDisplay>& display) override;
Scott Randolphdb5a5982017-01-23 12:35:05 -080041 Return<DisplayState> getDisplayState() override;
Scott Randolph5c99d852016-11-15 17:01:23 -080042
43 // Implementation details
44 EvsEnumerator();
45
46private:
47 struct CameraRecord {
48 sp<EvsCamera> pCamera;
49 bool inUse;
50 CameraRecord(EvsCamera* p, bool b) : pCamera(p), inUse(b) {}
51 };
52 std::list<CameraRecord> mCameraList;
53
Scott Randolphdb5a5982017-01-23 12:35:05 -080054 wp<IEvsDisplay> mActiveDisplay; // Weak pointer -> object destructs if client dies
Scott Randolph5c99d852016-11-15 17:01:23 -080055};
56
57} // namespace implementation
58} // namespace V1_0
59} // namespace evs
60} // namespace hardware
61} // namespace android
62
63#endif // ANDROID_HARDWARE_EVS_V1_0_EVSCAMERAENUMERATOR_H