blob: edff4df3a9f1882919e60b65fa3992d5399c864c [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 Li35d2a702020-04-10 01:19:32 +000022
Haoxiang Li070f17d2020-05-28 14:06:25 -070023#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
Haoxiang Li35d2a702020-04-10 01:19:32 +000024#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 Li070f17d2020-05-28 14:06:25 -070034using namespace ::android::hardware::automotive::evs::V1_1;
Haoxiang Li35d2a702020-04-10 01:19:32 +000035using namespace ::android::hardware::automotive::sv::V1_0;
36using ::android::hardware::Return;
37using ::android::sp;
38
39namespace android {
40namespace hardware {
41namespace automotive {
42namespace sv {
43namespace V1_0 {
44namespace implementation {
45
46class SurroundViewService : public ISurroundViewService {
47public:
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();
59private:
Haoxiang Lif488c7e2020-05-27 09:12:13 -070060 SurroundViewService();
61 ~SurroundViewService();
62
63 VhalHandler* mVhalHandler;
Haoxiang Li35d2a702020-04-10 01:19:32 +000064
Haoxiang Li070f17d2020-05-28 14:06:25 -070065 bool initialize();
66 sp<IEvsEnumerator> mEvs;
67
Haoxiang Li35d2a702020-04-10 01:19:32 +000068 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