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_HIDLHWDISPLAY_H
18 #define CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLHWDISPLAY_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 AidlDisplay final : public ::aidl::android::hardware::automotive::evs::BnEvsDisplay {
31 public:
32     // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay follow.
33     ::ndk::ScopedAStatus getDisplayInfo(aidlevs::DisplayDesc* _aidl_return) override;
34     ::ndk::ScopedAStatus getDisplayState(aidlevs::DisplayState* _aidl_return) override;
35     ::ndk::ScopedAStatus getTargetBuffer(aidlevs::BufferDesc* _aidl_return) override;
36     ::ndk::ScopedAStatus returnTargetBufferForDisplay(const aidlevs::BufferDesc& buffer) override;
37     ::ndk::ScopedAStatus setDisplayState(aidlevs::DisplayState state) override;
38 
AidlDisplay(const::android::sp<hidlevs::V1_0::IEvsDisplay> & display)39     explicit AidlDisplay(const ::android::sp<hidlevs::V1_0::IEvsDisplay>& display) :
40           mHidlDisplay(display) {};
41     virtual ~AidlDisplay();
42 
getHidlDisplay()43     const ::android::sp<hidlevs::V1_0::IEvsDisplay> getHidlDisplay() const { return mHidlDisplay; }
44 
45 private:
46     // The low level display interface that backs this proxy
47     ::android::sp<hidlevs::V1_0::IEvsDisplay> mHidlDisplay;
48     hidlevs::V1_0::BufferDesc mHeldBuffer;
49 };
50 
51 }  // namespace aidl::android::automotive::evs::implementation
52 
53 #endif  // CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLHWDISPLAY_H
54