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