blob: 3d6e264f569aeaa2841caadbe2651752b4876f2e [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
Scott Randolph83422792017-03-01 20:32:59 -080017#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H
18#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H
Scott Randolph5c99d852016-11-15 17:01:23 -080019
Scott Randolph83422792017-03-01 20:32:59 -080020#include <android/hardware/automotive/evs/1.0/IEvsEnumerator.h>
21#include <android/hardware/automotive/evs/1.0/IEvsCamera.h>
Scott Randolph5c99d852016-11-15 17:01:23 -080022
23#include <list>
24
25#include "EvsCamera.h"
26
27namespace android {
28namespace hardware {
Scott Randolph83422792017-03-01 20:32:59 -080029namespace automotive {
Scott Randolph5c99d852016-11-15 17:01:23 -080030namespace evs {
31namespace V1_0 {
32namespace implementation {
33
34class EvsEnumerator : public IEvsEnumerator {
35public:
Scott Randolph83422792017-03-01 20:32:59 -080036 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow.
Scott Randolph5c99d852016-11-15 17:01:23 -080037 Return<void> getCameraList(getCameraList_cb _hidl_cb) override;
Martijn Coenen527924a2017-01-04 12:59:48 +010038 Return<sp<IEvsCamera>> openCamera(const hidl_string& cameraId) override;
Scott Randolph5c99d852016-11-15 17:01:23 -080039 Return<void> closeCamera(const ::android::sp<IEvsCamera>& carCamera) override;
Martijn Coenen527924a2017-01-04 12:59:48 +010040 Return<sp<IEvsDisplay>> openDisplay() override;
Scott Randolph5c99d852016-11-15 17:01:23 -080041 Return<void> closeDisplay(const ::android::sp<IEvsDisplay>& display) override;
Scott Randolphdb5a5982017-01-23 12:35:05 -080042 Return<DisplayState> getDisplayState() override;
Scott Randolph5c99d852016-11-15 17:01:23 -080043
44 // Implementation details
45 EvsEnumerator();
46
47private:
48 struct CameraRecord {
49 sp<EvsCamera> pCamera;
50 bool inUse;
51 CameraRecord(EvsCamera* p, bool b) : pCamera(p), inUse(b) {}
52 };
53 std::list<CameraRecord> mCameraList;
54
Scott Randolphdb5a5982017-01-23 12:35:05 -080055 wp<IEvsDisplay> mActiveDisplay; // Weak pointer -> object destructs if client dies
Scott Randolph5c99d852016-11-15 17:01:23 -080056};
57
58} // namespace implementation
59} // namespace V1_0
60} // namespace evs
Scott Randolph83422792017-03-01 20:32:59 -080061} // namespace automotive
Scott Randolph5c99d852016-11-15 17:01:23 -080062} // namespace hardware
63} // namespace android
64
Scott Randolph83422792017-03-01 20:32:59 -080065#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H