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