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_INCLUDE_HALDISPLAY_H
18 #define CPP_EVS_MANAGER_AIDL_INCLUDE_HALDISPLAY_H
19 
20 #include "Constants.h"
21 
22 #include <aidl/android/hardware/automotive/evs/BnEvsDisplay.h>
23 #include <aidl/android/hardware/automotive/evs/BufferDesc.h>
24 #include <aidl/android/hardware/automotive/evs/DisplayDesc.h>
25 #include <aidl/android/hardware/automotive/evs/DisplayState.h>
26 
27 namespace aidl::android::automotive::evs::implementation {
28 
29 namespace aidlevs = ::aidl::android::hardware::automotive::evs;
30 
31 class HalDisplay : public ::aidl::android::hardware::automotive::evs::BnEvsDisplay {
32 public:
33     // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay follow.
34     ::ndk::ScopedAStatus getDisplayInfo(aidlevs::DisplayDesc* _aidl_return) override;
35     ::ndk::ScopedAStatus getDisplayState(aidlevs::DisplayState* _aidl_return) override;
36     ::ndk::ScopedAStatus getTargetBuffer(aidlevs::BufferDesc* _aidl_return) override;
37     ::ndk::ScopedAStatus returnTargetBufferForDisplay(const aidlevs::BufferDesc& buffer) override;
38     ::ndk::ScopedAStatus setDisplayState(aidlevs::DisplayState state) override;
39 
40     explicit HalDisplay(std::shared_ptr<aidlevs::IEvsDisplay> display,
41                         int32_t port = kDisplayIdUnavailable);
42     virtual ~HalDisplay();
43 
44     inline void shutdown();
45     std::shared_ptr<aidlevs::IEvsDisplay> getHwDisplay();
46 
47     // Returns a string showing the current status
48     std::string toString(const char* indent = "");
49 
50 private:
51     // The low level display interface that backs this proxy
52     std::shared_ptr<aidlevs::IEvsDisplay> mHwDisplay;
53     int32_t mId;  // Display identifier
54 };
55 
56 }  // namespace aidl::android::automotive::evs::implementation
57 
58 #endif  // CPP_EVS_MANAGER_AIDL_INCLUDE_HALDISPLAY_H
59