blob: 30115ae30a141bed249ba7218bb9bbca67d6ec73 [file] [log] [blame]
keunyoungcc449f72015-08-12 10:46:27 -07001/*
2 * Copyright (C) 2015 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
17package com.android.car.hal;
18
Pavel Maltsev0d07c762016-11-03 16:40:15 -070019
20import android.annotation.Nullable;
21import android.hardware.vehicle.V2_0.VehiclePropConfig;
22import android.hardware.vehicle.V2_0.VehiclePropValue;
keunyoungfe30ba02015-09-17 17:56:35 -070023
keunyoungcc449f72015-08-12 10:46:27 -070024import java.io.PrintWriter;
Pavel Maltsev0d07c762016-11-03 16:40:15 -070025import java.util.Collection;
keunyoungfe30ba02015-09-17 17:56:35 -070026import java.util.LinkedList;
keunyoungcc449f72015-08-12 10:46:27 -070027import java.util.List;
28
29/**
30 * Common interface for all HAL service like sensor HAL.
31 * Each HAL service is connected with XyzService supporting XyzManager,
32 * and will translate HAL data into car api specific format.
33 */
34public abstract class HalServiceBase {
keunyoungfe30ba02015-09-17 17:56:35 -070035 /** For dispatching events. Kept here to avoid alloc every time */
36 private final LinkedList<VehiclePropValue> mDispatchList = new LinkedList<VehiclePropValue>();
37
38 public List<VehiclePropValue> getDispatchList() {
39 return mDispatchList;
40 }
41
keunyoungcc449f72015-08-12 10:46:27 -070042 /** initialize */
43 public abstract void init();
44
45 /** release and stop operation */
46 public abstract void release();
47
48 /**
49 * return supported properties among all properties.
50 * @return null if no properties are supported
51 */
52 /**
53 * Take supported properties from given allProperties and return List of supported properties.
54 * @param allProperties
55 * @return null if no properties are supported.
56 */
Pavel Maltsev0d07c762016-11-03 16:40:15 -070057 @Nullable
58 public Collection<VehiclePropConfig> takeSupportedProperties(
59 Collection<VehiclePropConfig> allProperties) {
60 return null;
61 }
keunyoungcc449f72015-08-12 10:46:27 -070062
keunyoungfe30ba02015-09-17 17:56:35 -070063 public abstract void handleHalEvents(List<VehiclePropValue> values);
keunyoungcc449f72015-08-12 10:46:27 -070064
65 public abstract void dump(PrintWriter writer);
66}