1 /* 2 * Copyright 2020 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 #pragma once 18 19 #include "SurroundView2dSession.h" 20 #include "SurroundView3dSession.h" 21 #include "AnimationModule.h" 22 #include "IOModule.h" 23 #include "VhalHandler.h" 24 25 #include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h> 26 #include <android/hardware/automotive/sv/1.0/types.h> 27 #include <android/hardware/automotive/sv/1.0/ISurroundViewService.h> 28 #include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h> 29 #include <android/hardware/automotive/sv/1.0/ISurroundView2dSession.h> 30 #include <android/hardware/automotive/sv/1.0/ISurroundView3dSession.h> 31 #include <hidl/MQDescriptor.h> 32 #include <hidl/Status.h> 33 34 #include <thread> 35 36 using namespace ::android::hardware::automotive::evs::V1_1; 37 using namespace ::android::hardware::automotive::sv::V1_0; 38 using ::android::hardware::Return; 39 using ::android::sp; 40 41 namespace android { 42 namespace hardware { 43 namespace automotive { 44 namespace sv { 45 namespace V1_0 { 46 namespace implementation { 47 48 class SurroundViewService : public ISurroundViewService { 49 public: 50 // Methods from ::android::hardware::automotive::sv::V1_0::ISurroundViewService follow. 51 Return<void> getCameraIds(getCameraIds_cb _hidl_cb) override; 52 Return<void> start2dSession(start2dSession_cb _hidl_cb) override; 53 Return<SvResult> stop2dSession( 54 const sp<ISurroundView2dSession>& sv2dSession) override; 55 56 Return<void> start3dSession(start3dSession_cb _hidl_cb) override; 57 Return<SvResult> stop3dSession( 58 const sp<ISurroundView3dSession>& sv3dSession) override; 59 60 static sp<SurroundViewService> getInstance(); 61 private: 62 SurroundViewService(); 63 ~SurroundViewService(); 64 65 VhalHandler* mVhalHandler; 66 AnimationModule* mAnimationModule; 67 IOModule* mIOModule; 68 IOModuleConfig mConfig; 69 70 bool initialize(); 71 sp<IEvsEnumerator> mEvs; 72 73 static std::mutex sLock; 74 static sp<SurroundViewService> sService GUARDED_BY(sLock); 75 76 static sp<SurroundView2dSession> sSurroundView2dSession GUARDED_BY(sLock); 77 static sp<SurroundView3dSession> sSurroundView3dSession GUARDED_BY(sLock); 78 }; 79 80 } // namespace implementation 81 } // namespace V1_0 82 } // namespace sv 83 } // namespace automotive 84 } // namespace hardware 85 } // namespace android 86