Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 1 | /* |
| 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 Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H |
| 18 | #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 19 | |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 20 | #include <android/hardware/automotive/evs/1.0/IEvsEnumerator.h> |
| 21 | #include <android/hardware/automotive/evs/1.0/IEvsCamera.h> |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 22 | |
| 23 | #include <list> |
| 24 | |
| 25 | #include "EvsCamera.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace hardware { |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 29 | namespace automotive { |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 30 | namespace evs { |
| 31 | namespace V1_0 { |
| 32 | namespace implementation { |
| 33 | |
| 34 | class EvsEnumerator : public IEvsEnumerator { |
| 35 | public: |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 36 | // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow. |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 37 | Return<void> getCameraList(getCameraList_cb _hidl_cb) override; |
Martijn Coenen | 527924a | 2017-01-04 12:59:48 +0100 | [diff] [blame] | 38 | Return<sp<IEvsCamera>> openCamera(const hidl_string& cameraId) override; |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 39 | Return<void> closeCamera(const ::android::sp<IEvsCamera>& carCamera) override; |
Martijn Coenen | 527924a | 2017-01-04 12:59:48 +0100 | [diff] [blame] | 40 | Return<sp<IEvsDisplay>> openDisplay() override; |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 41 | Return<void> closeDisplay(const ::android::sp<IEvsDisplay>& display) override; |
Scott Randolph | db5a598 | 2017-01-23 12:35:05 -0800 | [diff] [blame] | 42 | Return<DisplayState> getDisplayState() override; |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 43 | |
| 44 | // Implementation details |
| 45 | EvsEnumerator(); |
| 46 | |
| 47 | private: |
| 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 Randolph | db5a598 | 2017-01-23 12:35:05 -0800 | [diff] [blame] | 55 | wp<IEvsDisplay> mActiveDisplay; // Weak pointer -> object destructs if client dies |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace implementation |
| 59 | } // namespace V1_0 |
| 60 | } // namespace evs |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 61 | } // namespace automotive |
Scott Randolph | 5c99d85 | 2016-11-15 17:01:23 -0800 | [diff] [blame] | 62 | } // namespace hardware |
| 63 | } // namespace android |
| 64 | |
Scott Randolph | 8342279 | 2017-03-01 20:32:59 -0800 | [diff] [blame] | 65 | #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_0_EVSCAMERAENUMERATOR_H |