Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 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" |
Haoxiang Li | d564aaf | 2020-06-10 22:26:37 -0700 | [diff] [blame] | 21 | #include "AnimationModule.h" |
Haoxiang Li | f7120b4 | 2020-06-12 12:45:36 -0700 | [diff] [blame] | 22 | #include "IOModule.h" |
| 23 | #include "VhalHandler.h" |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 24 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 25 | #include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h> |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 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 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 36 | using namespace ::android::hardware::automotive::evs::V1_1; |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 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: |
Haoxiang Li | f488c7e | 2020-05-27 09:12:13 -0700 | [diff] [blame] | 62 | SurroundViewService(); |
| 63 | ~SurroundViewService(); |
| 64 | |
| 65 | VhalHandler* mVhalHandler; |
Haoxiang Li | d564aaf | 2020-06-10 22:26:37 -0700 | [diff] [blame] | 66 | AnimationModule* mAnimationModule; |
Haoxiang Li | f7120b4 | 2020-06-12 12:45:36 -0700 | [diff] [blame] | 67 | IOModule* mIOModule; |
| 68 | IOModuleConfig mConfig; |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 69 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 70 | bool initialize(); |
| 71 | sp<IEvsEnumerator> mEvs; |
| 72 | |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 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 |