keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.car.hal; |
| 18 | |
Pavel Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 19 | |
| 20 | import android.annotation.Nullable; |
| 21 | import android.hardware.vehicle.V2_0.VehiclePropConfig; |
| 22 | import android.hardware.vehicle.V2_0.VehiclePropValue; |
keunyoung | fe30ba0 | 2015-09-17 17:56:35 -0700 | [diff] [blame] | 23 | |
keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 24 | import java.io.PrintWriter; |
Pavel Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 25 | import java.util.Collection; |
keunyoung | fe30ba0 | 2015-09-17 17:56:35 -0700 | [diff] [blame] | 26 | import java.util.LinkedList; |
keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 27 | import 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 | */ |
| 34 | public abstract class HalServiceBase { |
keunyoung | fe30ba0 | 2015-09-17 17:56:35 -0700 | [diff] [blame] | 35 | /** 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 | |
keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 42 | /** 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 Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 57 | @Nullable |
| 58 | public Collection<VehiclePropConfig> takeSupportedProperties( |
| 59 | Collection<VehiclePropConfig> allProperties) { |
| 60 | return null; |
| 61 | } |
keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 62 | |
keunyoung | fe30ba0 | 2015-09-17 17:56:35 -0700 | [diff] [blame] | 63 | public abstract void handleHalEvents(List<VehiclePropValue> values); |
keunyoung | cc449f7 | 2015-08-12 10:46:27 -0700 | [diff] [blame] | 64 | |
| 65 | public abstract void dump(PrintWriter writer); |
| 66 | } |