1 /*
2  * Copyright (C) 2022 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 CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLDISPLAY_H
18 #define CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLDISPLAY_H
19 
20 #include <aidl/android/hardware/automotive/evs/BnEvsDisplay.h>
21 #include <aidl/android/hardware/automotive/evs/BufferDesc.h>
22 #include <aidl/android/hardware/automotive/evs/DisplayState.h>
23 #include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
24 
25 namespace aidl::android::automotive::evs::implementation {
26 
27 namespace aidlevs = ::aidl::android::hardware::automotive::evs;
28 namespace hidlevs = ::android::hardware::automotive::evs;
29 
30 class HidlDisplay final : public hidlevs::V1_1::IEvsDisplay {
31 public:
32     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
33     ::android::hardware::Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override;
34     ::android::hardware::Return<hidlevs::V1_0::EvsResult> setDisplayState(
35             hidlevs::V1_0::DisplayState state) override;
36     ::android::hardware::Return<hidlevs::V1_0::DisplayState> getDisplayState() override;
37     ::android::hardware::Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override;
38     ::android::hardware::Return<hidlevs::V1_0::EvsResult> returnTargetBufferForDisplay(
39             const hidlevs::V1_0::BufferDesc& buffer) override;
40 
41     // Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow.
42     ::android::hardware::Return<void> getDisplayInfo_1_1(getDisplayInfo_1_1_cb _hidl_cb) override;
43 
HidlDisplay(const std::shared_ptr<aidlevs::IEvsDisplay> & display)44     explicit HidlDisplay(const std::shared_ptr<aidlevs::IEvsDisplay>& display) :
45           mAidlDisplay(display) {};
46     virtual ~HidlDisplay();
47 
getAidlDisplay()48     const std::shared_ptr<aidlevs::IEvsDisplay> getAidlDisplay() const { return mAidlDisplay; }
49 
50 private:
51     // The low level display interface that backs this proxy
52     std::shared_ptr<aidlevs::IEvsDisplay> mAidlDisplay;
53     aidlevs::BufferDesc mHeldBuffer;
54 };
55 
56 }  // namespace aidl::android::automotive::evs::implementation
57 
58 #endif  // CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLDISPLAY_H
59