blob: 7518463d11004545c9dbc31c0b884a0abd86e0d4 [file] [log] [blame]
Haoxiang Li830834b2020-03-05 15:54:34 -08001/*
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"
21
22#include <android/hardware/automotive/sv/1.0/types.h>
23#include <android/hardware/automotive/sv/1.0/ISurroundViewService.h>
24#include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h>
25#include <android/hardware/automotive/sv/1.0/ISurroundView2dSession.h>
26#include <android/hardware/automotive/sv/1.0/ISurroundView3dSession.h>
27#include <hidl/MQDescriptor.h>
28#include <hidl/Status.h>
29
30#include <thread>
31
32using namespace ::android::hardware::automotive::sv::V1_0;
33using ::android::hardware::Return;
34using ::android::sp;
35
36namespace android {
37namespace hardware {
38namespace automotive {
39namespace sv {
40namespace V1_0 {
41namespace implementation {
42
43class SurroundViewService : public ISurroundViewService {
44public:
45 // Methods from ::android::hardware::automotive::sv::V1_0::ISurroundViewService follow.
46 Return<void> getCameraIds(getCameraIds_cb _hidl_cb) override;
47 Return<void> start2dSession(start2dSession_cb _hidl_cb) override;
48 Return<SvResult> stop2dSession(
49 const sp<ISurroundView2dSession>& sv2dSession) override;
50
51 Return<void> start3dSession(start3dSession_cb _hidl_cb) override;
52 Return<SvResult> stop3dSession(
53 const sp<ISurroundView3dSession>& sv3dSession) override;
54
55 static sp<SurroundViewService> getInstance();
56private:
57 SurroundViewService() {};
58
59 static std::mutex sLock;
60 static sp<SurroundViewService> sService GUARDED_BY(sLock);
61
62 static sp<SurroundView2dSession> sSurroundView2dSession GUARDED_BY(sLock);
63 static sp<SurroundView3dSession> sSurroundView3dSession GUARDED_BY(sLock);
64};
65
66} // namespace implementation
67} // namespace V1_0
68} // namespace sv
69} // namespace automotive
70} // namespace hardware
71} // namespace android