• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 package com.android.car.internal.evs;
18 
19 import android.hardware.HardwareBuffer;
20 
21 /**
22  * Abstracts EVS HAL. This is used as an interface between updatable and builtin.
23  */
24 public abstract class EvsHalWrapper {
25     /** Callback for events from HAL */
26     public interface HalEventCallback {
27         /** EVS stream event handler called after a native handler */
onHalEvent(int eventType)28         void onHalEvent(int eventType);
29 
30         /** EVS frame handler called after a native handler */
onFrameEvent(int id, HardwareBuffer buffer)31         void onFrameEvent(int id, HardwareBuffer buffer);
32 
33         /** EVS service death handler called after a native handler */
onHalDeath()34         void onHalDeath();
35     }
36 
37     /** Initialize HAL */
init()38     public boolean init() {
39         return false;
40     }
41 
42     /** Release HAL */
release()43     public void release() {
44     }
45 
46     /** is connected to HAL */
isConnected()47     public boolean isConnected() {
48         return false;
49     }
50 
51     /** Attempts to connect to the HAL service if it has not done yet */
connectToHalServiceIfNecessary()52     public boolean connectToHalServiceIfNecessary() {
53         return false;
54     }
55 
56     /** Attempts to disconnect from the HAL service */
disconnectFromHalService()57     public void disconnectFromHalService() {
58     }
59 
60     /** Attempts to open a target camera device */
openCamera(String cameraId)61     public boolean openCamera(String cameraId) {
62         return false;
63     }
64 
65     /** Requests to close a target camera device */
closeCamera()66     public void closeCamera() {
67     }
68 
69     /** Requests to start a video stream */
requestToStartVideoStream()70     public boolean requestToStartVideoStream() {
71         return false;
72     }
73 
74     /** Requests to stop a video stream */
requestToStopVideoStream()75     public void requestToStopVideoStream() {
76     }
77 
78     /** Request to return an used buffer */
doneWithFrame(int bufferId)79     public void doneWithFrame(int bufferId) {
80     }
81 }
82