1 /*
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_AUTOMOTIVE_EVS_V1_0_DISPLAYPROXY_H
18 #define ANDROID_AUTOMOTIVE_EVS_V1_0_DISPLAYPROXY_H
19 
20 #include <android/hardware/automotive/evs/1.0/types.h>
21 #include <android/hardware/automotive/evs/1.0/IEvsDisplay.h>
22 
23 using namespace ::android::hardware::automotive::evs::V1_0;
24 using ::android::hardware::Return;
25 using ::android::hardware::Void;
26 using ::android::hardware::hidl_handle;
27 
28 namespace android {
29 namespace automotive {
30 namespace evs {
31 namespace V1_0 {
32 namespace implementation {
33 
34 // TODO: This class has been defined to wrap the IEvsDisplay object the driver
35 // returns because of b/129284474 and represents an EVS display to the client
36 // application.  With a proper bug fix, we may remove this class and update the
37 // manager directly to use the IEvsDisplay object the driver provides.
38 class HalDisplay : public IEvsDisplay {
39 public:
40     explicit HalDisplay(sp<IEvsDisplay>& display);
41     virtual ~HalDisplay() override;
42 
43     inline void         shutdown();
44     sp<IEvsDisplay>     getHwDisplay();
45 
46     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
47     Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb)  override;
48     Return<EvsResult> setDisplayState(DisplayState state)  override;
49     Return<DisplayState> getDisplayState()  override;
50     Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb)  override;
51     Return<EvsResult> returnTargetBufferForDisplay(const BufferDesc& buffer)  override;
52 
53 private:
54     sp<IEvsDisplay>      mHwDisplay;     // The low level display interface that backs this proxy
55 };
56 
57 } // namespace implementation
58 } // namespace V1_0
59 } // namespace evs
60 } // namespace automotive
61 } // namespace android
62 
63 #endif  // ANDROID_AUTOMOTIVE_EVS_V1_0_DISPLAYPROXY_H
64