blob: 6950a271d871d418568fb080b4de4b7332f76e82 [file] [log] [blame]
Haoxiang Li35d2a702020-04-10 01:19:32 +00001/*
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 Lid564aaf2020-06-10 22:26:37 -070021#include "AnimationModule.h"
Haoxiang Lif7120b42020-06-12 12:45:36 -070022#include "IOModule.h"
23#include "VhalHandler.h"
Haoxiang Li35d2a702020-04-10 01:19:32 +000024
Haoxiang Li070f17d2020-05-28 14:06:25 -070025#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
Haoxiang Li35d2a702020-04-10 01:19:32 +000026#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 Li070f17d2020-05-28 14:06:25 -070036using namespace ::android::hardware::automotive::evs::V1_1;
Haoxiang Li35d2a702020-04-10 01:19:32 +000037using namespace ::android::hardware::automotive::sv::V1_0;
38using ::android::hardware::Return;
39using ::android::sp;
40
41namespace android {
42namespace hardware {
43namespace automotive {
44namespace sv {
45namespace V1_0 {
46namespace implementation {
47
48class SurroundViewService : public ISurroundViewService {
49public:
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();
61private:
Haoxiang Lif488c7e2020-05-27 09:12:13 -070062 SurroundViewService();
63 ~SurroundViewService();
64
65 VhalHandler* mVhalHandler;
Haoxiang Lid564aaf2020-06-10 22:26:37 -070066 AnimationModule* mAnimationModule;
Haoxiang Lif7120b42020-06-12 12:45:36 -070067 IOModule* mIOModule;
68 IOModuleConfig mConfig;
Haoxiang Li35d2a702020-04-10 01:19:32 +000069
Haoxiang Li070f17d2020-05-28 14:06:25 -070070 bool initialize();
71 sp<IEvsEnumerator> mEvs;
72
Haoxiang Li35d2a702020-04-10 01:19:32 +000073 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