1 /*
2  * Copyright (C) 2021 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 
19 import static com.android.car.internal.common.CommonConstants.EMPTY_LONG_ARRAY;
20 
21 import android.hardware.automotive.vehicle.V2_0.VehicleAreaConfig;
22 
23 /**
24  * HidlHalAreaConfig is a HalAreaConfig with a HIDL backend.
25  */
26 public final class HidlHalAreaConfig extends HalAreaConfig {
27     private final VehicleAreaConfig mConfig;
28     private final int mAccess;
29 
HidlHalAreaConfig(VehicleAreaConfig config, int access)30     public HidlHalAreaConfig(VehicleAreaConfig config, int access) {
31         mConfig = config;
32         mAccess = access;
33     }
34 
35     /**
36      * Get the access mode.
37      */
38     @Override
getAccess()39     public int getAccess() {
40         return mAccess;
41     }
42 
43     /**
44      * Get the area ID.
45      */
46     @Override
getAreaId()47     public int getAreaId() {
48         return mConfig.areaId;
49     }
50 
51     /**
52      * Get the min int value.
53      */
54     @Override
getMinInt32Value()55     public int getMinInt32Value() {
56         return mConfig.minInt32Value;
57     }
58 
59     /**
60      * Get the max int value.
61      */
62     @Override
getMaxInt32Value()63     public int getMaxInt32Value() {
64         return mConfig.maxInt32Value;
65     }
66 
67     /**
68      * Get the min long value.
69      */
70     @Override
getMinInt64Value()71     public long getMinInt64Value() {
72         return mConfig.minInt64Value;
73     }
74 
75     /**
76      * Get the max long value.
77      */
78     @Override
getMaxInt64Value()79     public long getMaxInt64Value() {
80         return mConfig.maxInt64Value;
81     }
82 
83     /**
84      * Get the min float value.
85      */
86     @Override
getMinFloatValue()87     public float getMinFloatValue() {
88         return mConfig.minFloatValue;
89     }
90 
91     /**
92      * Get the max float value.
93      */
94     @Override
getMaxFloatValue()95     public float getMaxFloatValue() {
96         return mConfig.maxFloatValue;
97     }
98 
99     /**
100      * Get the supported enum values.
101      */
102     @Override
getSupportedEnumValues()103     public long[] getSupportedEnumValues() {
104         return EMPTY_LONG_ARRAY;
105     }
106 }
107