blob: e5fb69c37eafab3884dffc6c5d4fae9cb22985ab [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 Lif488c7e2020-05-27 09:12:13 -070021#include "VhalHandler.h"
Haoxiang Lid564aaf2020-06-10 22:26:37 -070022#include "AnimationModule.h"
Haoxiang Li35d2a702020-04-10 01:19:32 +000023
Haoxiang Li070f17d2020-05-28 14:06:25 -070024#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
Haoxiang Li35d2a702020-04-10 01:19:32 +000025#include <android/hardware/automotive/sv/1.0/types.h>
26#include <android/hardware/automotive/sv/1.0/ISurroundViewService.h>
27#include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h>
28#include <android/hardware/automotive/sv/1.0/ISurroundView2dSession.h>
29#include <android/hardware/automotive/sv/1.0/ISurroundView3dSession.h>
30#include <hidl/MQDescriptor.h>
31#include <hidl/Status.h>
32
33#include <thread>
34
Haoxiang Li070f17d2020-05-28 14:06:25 -070035using namespace ::android::hardware::automotive::evs::V1_1;
Haoxiang Li35d2a702020-04-10 01:19:32 +000036using namespace ::android::hardware::automotive::sv::V1_0;
37using ::android::hardware::Return;
38using ::android::sp;
39
40namespace android {
41namespace hardware {
42namespace automotive {
43namespace sv {
44namespace V1_0 {
45namespace implementation {
46
47class SurroundViewService : public ISurroundViewService {
48public:
49 // Methods from ::android::hardware::automotive::sv::V1_0::ISurroundViewService follow.
50 Return<void> getCameraIds(getCameraIds_cb _hidl_cb) override;
51 Return<void> start2dSession(start2dSession_cb _hidl_cb) override;
52 Return<SvResult> stop2dSession(
53 const sp<ISurroundView2dSession>& sv2dSession) override;
54
55 Return<void> start3dSession(start3dSession_cb _hidl_cb) override;
56 Return<SvResult> stop3dSession(
57 const sp<ISurroundView3dSession>& sv3dSession) override;
58
59 static sp<SurroundViewService> getInstance();
60private:
Haoxiang Lif488c7e2020-05-27 09:12:13 -070061 SurroundViewService();
62 ~SurroundViewService();
63
64 VhalHandler* mVhalHandler;
Haoxiang Lid564aaf2020-06-10 22:26:37 -070065 AnimationModule* mAnimationModule;
Haoxiang Li35d2a702020-04-10 01:19:32 +000066
Haoxiang Li070f17d2020-05-28 14:06:25 -070067 bool initialize();
68 sp<IEvsEnumerator> mEvs;
69
Haoxiang Li35d2a702020-04-10 01:19:32 +000070 static std::mutex sLock;
71 static sp<SurroundViewService> sService GUARDED_BY(sLock);
72
73 static sp<SurroundView2dSession> sSurroundView2dSession GUARDED_BY(sLock);
74 static sp<SurroundView3dSession> sSurroundView3dSession GUARDED_BY(sLock);
75};
76
77} // namespace implementation
78} // namespace V1_0
79} // namespace sv
80} // namespace automotive
81} // namespace hardware
82} // namespace android