Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | import android.hardware.vehicle.V2_0.VehiclePropertyGroup; |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Implementation of {@link HalServiceBase} that responsible for custom properties that were defined |
| 23 | * by OEMs. |
| 24 | */ |
Pavel Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 25 | public class VendorExtensionHalService extends PropertyHalServiceBase { |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 26 | |
| 27 | private final static String TAG = VendorExtensionHalService.class.getSimpleName(); |
Vitalii Tomkiv | 1b1247b | 2016-09-30 11:27:19 -0700 | [diff] [blame] | 28 | private final static boolean DEBUG = false; |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 29 | |
| 30 | VendorExtensionHalService(VehicleHal vehicleHal) { |
| 31 | super(vehicleHal, TAG, DEBUG); |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | protected int managerToHalPropId(int managerPropId) { |
Pavel Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 36 | return isVendorProperty(managerPropId) ? managerPropId : NOT_SUPPORTED_PROPERTY; |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | @Override |
| 40 | protected int halToManagerPropId(int halPropId) { |
Pavel Maltsev | 0d07c76 | 2016-11-03 16:40:15 -0700 | [diff] [blame^] | 41 | return isVendorProperty(halPropId) ? halPropId : NOT_SUPPORTED_PROPERTY; |
| 42 | } |
| 43 | |
| 44 | private static boolean isVendorProperty(int property) { |
| 45 | return (property & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR; |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 46 | } |
| 47 | } |