blob: 3a801fda82320b06d85020dc6d9d7c2ffd6a552a [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
keunyoungfe30ba02015-09-17 17:56:35 -070019import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropConfig;
20import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropValue;
21
keunyoungcc449f72015-08-12 10:46:27 -070022import java.io.PrintWriter;
keunyoungfe30ba02015-09-17 17:56:35 -070023import java.util.LinkedList;
keunyoungcc449f72015-08-12 10:46:27 -070024import java.util.List;
25
26/**
27 * Common interface for all HAL service like sensor HAL.
28 * Each HAL service is connected with XyzService supporting XyzManager,
29 * and will translate HAL data into car api specific format.
30 */
31public abstract class HalServiceBase {
keunyoungfe30ba02015-09-17 17:56:35 -070032 /** For dispatching events. Kept here to avoid alloc every time */
33 private final LinkedList<VehiclePropValue> mDispatchList = new LinkedList<VehiclePropValue>();
34
35 public List<VehiclePropValue> getDispatchList() {
36 return mDispatchList;
37 }
38
keunyoungcc449f72015-08-12 10:46:27 -070039 /** initialize */
40 public abstract void init();
41
42 /** release and stop operation */
43 public abstract void release();
44
45 /**
46 * return supported properties among all properties.
47 * @return null if no properties are supported
48 */
49 /**
50 * Take supported properties from given allProperties and return List of supported properties.
51 * @param allProperties
52 * @return null if no properties are supported.
53 */
keunyoungfe30ba02015-09-17 17:56:35 -070054 public abstract List<VehiclePropConfig> takeSupportedProperties(
55 List<VehiclePropConfig> allProperties);
keunyoungcc449f72015-08-12 10:46:27 -070056
keunyoungfe30ba02015-09-17 17:56:35 -070057 public abstract void handleHalEvents(List<VehiclePropValue> values);
keunyoungcc449f72015-08-12 10:46:27 -070058
59 public abstract void dump(PrintWriter writer);
60}