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