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 android.hardware.automotive.vehicle.VehicleAreaConfig;
20 
21 /**
22  * AidlHalAreaConfig is a HalAreaConfig with an AIDL backend.
23  */
24 public final class AidlHalAreaConfig extends HalAreaConfig {
25     private final VehicleAreaConfig mConfig;
26 
AidlHalAreaConfig(VehicleAreaConfig config)27     public AidlHalAreaConfig(VehicleAreaConfig config) {
28         mConfig = config;
29     }
30 
31     /**
32      * Get the access mode.
33      */
34     @Override
getAccess()35     public int getAccess() {
36         return mConfig.access;
37     }
38 
39     /**
40      * Get the area ID.
41      */
42     @Override
getAreaId()43     public int getAreaId() {
44         return mConfig.areaId;
45     }
46 
47     /**
48      * Get the min int value.
49      */
50     @Override
getMinInt32Value()51     public int getMinInt32Value() {
52         return mConfig.minInt32Value;
53     }
54 
55     /**
56      * Get the max int value.
57      */
58     @Override
getMaxInt32Value()59     public int getMaxInt32Value() {
60         return mConfig.maxInt32Value;
61     }
62 
63     /**
64      * Get the min long value.
65      */
66     @Override
getMinInt64Value()67     public long getMinInt64Value() {
68         return mConfig.minInt64Value;
69     }
70 
71     /**
72      * Get the max long value.
73      */
74     @Override
getMaxInt64Value()75     public long getMaxInt64Value() {
76         return mConfig.maxInt64Value;
77     }
78 
79     /**
80      * Get the min float value.
81      */
82     @Override
getMinFloatValue()83     public float getMinFloatValue() {
84         return mConfig.minFloatValue;
85     }
86 
87     /**
88      * Get the max float value.
89      */
90     @Override
getMaxFloatValue()91     public float getMaxFloatValue() {
92         return mConfig.maxFloatValue;
93     }
94 
95     /**
96      * Get the supported enum values.
97      */
98     @Override
getSupportedEnumValues()99     public long[] getSupportedEnumValues() {
100         return mConfig.supportedEnumValues == null ? new long[0] : mConfig.supportedEnumValues;
101     }
102 
103     /**
104      * Returns whether variable update rate is supported.
105      */
106     @Override
isVariableUpdateRateSupported()107     public boolean isVariableUpdateRateSupported() {
108         return mConfig.supportVariableUpdateRate;
109     }
110 }
111