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 | f488c7e | 2020-05-27 09:12:13 -0700 | [diff] [blame] | 21 | #include "VhalHandler.h" |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 22 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 23 | #include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h> |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 24 | #include <android/hardware/automotive/sv/1.0/types.h> |
| 25 | #include <android/hardware/automotive/sv/1.0/ISurroundViewService.h> |
| 26 | #include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h> |
| 27 | #include <android/hardware/automotive/sv/1.0/ISurroundView2dSession.h> |
| 28 | #include <android/hardware/automotive/sv/1.0/ISurroundView3dSession.h> |
| 29 | #include <hidl/MQDescriptor.h> |
| 30 | #include <hidl/Status.h> |
| 31 | |
| 32 | #include <thread> |
| 33 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 34 | using namespace ::android::hardware::automotive::evs::V1_1; |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 35 | using namespace ::android::hardware::automotive::sv::V1_0; |
| 36 | using ::android::hardware::Return; |
| 37 | using ::android::sp; |
| 38 | |
| 39 | namespace android { |
| 40 | namespace hardware { |
| 41 | namespace automotive { |
| 42 | namespace sv { |
| 43 | namespace V1_0 { |
| 44 | namespace implementation { |
| 45 | |
| 46 | class SurroundViewService : public ISurroundViewService { |
| 47 | public: |
| 48 | // Methods from ::android::hardware::automotive::sv::V1_0::ISurroundViewService follow. |
| 49 | Return<void> getCameraIds(getCameraIds_cb _hidl_cb) override; |
| 50 | Return<void> start2dSession(start2dSession_cb _hidl_cb) override; |
| 51 | Return<SvResult> stop2dSession( |
| 52 | const sp<ISurroundView2dSession>& sv2dSession) override; |
| 53 | |
| 54 | Return<void> start3dSession(start3dSession_cb _hidl_cb) override; |
| 55 | Return<SvResult> stop3dSession( |
| 56 | const sp<ISurroundView3dSession>& sv3dSession) override; |
| 57 | |
| 58 | static sp<SurroundViewService> getInstance(); |
| 59 | private: |
Haoxiang Li | f488c7e | 2020-05-27 09:12:13 -0700 | [diff] [blame] | 60 | SurroundViewService(); |
| 61 | ~SurroundViewService(); |
| 62 | |
| 63 | VhalHandler* mVhalHandler; |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 64 | |
Haoxiang Li | 070f17d | 2020-05-28 14:06:25 -0700 | [diff] [blame] | 65 | bool initialize(); |
| 66 | sp<IEvsEnumerator> mEvs; |
| 67 | |
Haoxiang Li | 35d2a70 | 2020-04-10 01:19:32 +0000 | [diff] [blame] | 68 | static std::mutex sLock; |
| 69 | static sp<SurroundViewService> sService GUARDED_BY(sLock); |
| 70 | |
| 71 | static sp<SurroundView2dSession> sSurroundView2dSession GUARDED_BY(sLock); |
| 72 | static sp<SurroundView3dSession> sSurroundView3dSession GUARDED_BY(sLock); |
| 73 | }; |
| 74 | |
| 75 | } // namespace implementation |
| 76 | } // namespace V1_0 |
| 77 | } // namespace sv |
| 78 | } // namespace automotive |
| 79 | } // namespace hardware |
| 80 | } // namespace android |