blob: 0630baeb8d83c1f4bcb00681a08c4653d7370957 [file] [log] [blame]
Pavel Maltsev634e1ff2016-07-14 15:41:26 -07001/*
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
17package com.android.car.hal;
18
Pavel Maltsev0d07c762016-11-03 16:40:15 -070019import android.hardware.vehicle.V2_0.VehiclePropertyGroup;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070020
21/**
22 * Implementation of {@link HalServiceBase} that responsible for custom properties that were defined
23 * by OEMs.
24 */
Pavel Maltsev0d07c762016-11-03 16:40:15 -070025public class VendorExtensionHalService extends PropertyHalServiceBase {
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070026
27 private final static String TAG = VendorExtensionHalService.class.getSimpleName();
Vitalii Tomkiv1b1247b2016-09-30 11:27:19 -070028 private final static boolean DEBUG = false;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070029
30 VendorExtensionHalService(VehicleHal vehicleHal) {
31 super(vehicleHal, TAG, DEBUG);
32 }
33
34 @Override
35 protected int managerToHalPropId(int managerPropId) {
Pavel Maltsev0d07c762016-11-03 16:40:15 -070036 return isVendorProperty(managerPropId) ? managerPropId : NOT_SUPPORTED_PROPERTY;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070037 }
38
39 @Override
40 protected int halToManagerPropId(int halPropId) {
Pavel Maltsev0d07c762016-11-03 16:40:15 -070041 return isVendorProperty(halPropId) ? halPropId : NOT_SUPPORTED_PROPERTY;
42 }
43
44 private static boolean isVendorProperty(int property) {
45 return (property & VehiclePropertyGroup.MASK) == VehiclePropertyGroup.VENDOR;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070046 }
47}