1 /*
2  * Copyright (c) 2022, 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 #ifndef CPP_VHAL_CLIENT_INCLUDE_IHALPROPCONFIG_H_
18 #define CPP_VHAL_CLIENT_INCLUDE_IHALPROPCONFIG_H_
19 
20 #include <cstdint>
21 #include <vector>
22 
23 namespace android {
24 namespace frameworks {
25 namespace automotive {
26 namespace vhal {
27 
28 class IHalAreaConfig {
29 public:
30     virtual int32_t getAreaId() const = 0;
31 
32     virtual int32_t getAccess() const = 0;
33 
34     virtual int32_t getMinInt32Value() const = 0;
35 
36     virtual int32_t getMaxInt32Value() const = 0;
37 
38     virtual int64_t getMinInt64Value() const = 0;
39 
40     virtual int64_t getMaxInt64Value() const = 0;
41 
42     virtual float getMinFloatValue() const = 0;
43 
44     virtual float getMaxFloatValue() const = 0;
45 
46     virtual ~IHalAreaConfig() = default;
47 
48     virtual bool isVariableUpdateRateSupported() const = 0;
49 };
50 
51 class IHalPropConfig {
52 public:
53     virtual int32_t getPropId() const = 0;
54 
55     virtual int32_t getAccess() const = 0;
56 
57     virtual int32_t getChangeMode() const = 0;
58 
getAreaConfigs()59     const std::vector<std::unique_ptr<IHalAreaConfig>>& getAreaConfigs() const {
60         return mAreaConfigs;
61     }
62 
63     virtual size_t getAreaConfigSize() const = 0;
64 
65     virtual std::vector<int32_t> getConfigArray() const = 0;
66 
67     virtual std::string getConfigString() const = 0;
68 
69     virtual float getMinSampleRate() const = 0;
70 
71     virtual float getMaxSampleRate() const = 0;
72 
73     virtual ~IHalPropConfig() = default;
74 
75 protected:
76     std::vector<std::unique_ptr<IHalAreaConfig>> mAreaConfigs;
77 };
78 
79 }  // namespace vhal
80 }  // namespace automotive
81 }  // namespace frameworks
82 }  // namespace android
83 
84 #endif  // CPP_VHAL_CLIENT_INCLUDE_IHALPROPCONFIG_H_
85