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_AIDLHALPROPCONFIG_H_
18 #define CPP_VHAL_CLIENT_INCLUDE_AIDLHALPROPCONFIG_H_
19 
20 #include "IHalPropConfig.h"
21 
22 #include <aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.h>
23 #include <aidl/android/hardware/automotive/vehicle/VehiclePropConfig.h>
24 
25 #include <string>
26 #include <vector>
27 
28 namespace android {
29 namespace frameworks {
30 namespace automotive {
31 namespace vhal {
32 
33 class AidlHalAreaConfig : public IHalAreaConfig {
34 public:
35     explicit AidlHalAreaConfig(
36             ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig&& areaConfig,
37             int32_t access);
38 
39     int32_t getAreaId() const override;
40 
41     int32_t getAccess() const override;
42 
43     int32_t getMinInt32Value() const override;
44 
45     int32_t getMaxInt32Value() const override;
46 
47     int64_t getMinInt64Value() const override;
48 
49     int64_t getMaxInt64Value() const override;
50 
51     float getMinFloatValue() const override;
52 
53     float getMaxFloatValue() const override;
54 
55     bool isVariableUpdateRateSupported() const override;
56 
57 private:
58     ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig mAreaConfig;
59     int32_t mAccess;
60 };
61 
62 class AidlHalPropConfig : public IHalPropConfig {
63 public:
64     explicit AidlHalPropConfig(
65             ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig&& config);
66 
67     int32_t getPropId() const override;
68 
69     int32_t getAccess() const override;
70 
71     int32_t getChangeMode() const override;
72 
73     size_t getAreaConfigSize() const override;
74 
75     std::vector<int32_t> getConfigArray() const override;
76 
77     std::string getConfigString() const override;
78 
79     float getMinSampleRate() const override;
80 
81     float getMaxSampleRate() const override;
82 
83 private:
84     ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig mPropConfig;
85 };
86 
87 }  // namespace vhal
88 }  // namespace automotive
89 }  // namespace frameworks
90 }  // namespace android
91 
92 #endif  // CPP_VHAL_CLIENT_INCLUDE_AIDLHALPROPCONFIG_H_
93