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 38 int32_t getAreaId() const override; 39 40 int32_t getMinInt32Value() const override; 41 42 int32_t getMaxInt32Value() const override; 43 44 int64_t getMinInt64Value() const override; 45 46 int64_t getMaxInt64Value() const override; 47 48 float getMinFloatValue() const override; 49 50 float getMaxFloatValue() const override; 51 52 private: 53 ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig mAreaConfig; 54 }; 55 56 class AidlHalPropConfig : public IHalPropConfig { 57 public: 58 explicit AidlHalPropConfig( 59 ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig&& config); 60 61 int32_t getPropId() const override; 62 63 int32_t getAccess() const override; 64 65 int32_t getChangeMode() const override; 66 67 const IHalAreaConfig* getAreaConfigs() const override; 68 69 size_t getAreaConfigSize() const override; 70 71 std::vector<int32_t> getConfigArray() const override; 72 73 std::string getConfigString() const override; 74 75 float getMinSampleRate() const override; 76 77 float getMaxSampleRate() const override; 78 79 private: 80 ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig mPropConfig; 81 std::vector<AidlHalAreaConfig> mAreaConfigs; 82 }; 83 84 } // namespace vhal 85 } // namespace automotive 86 } // namespace frameworks 87 } // namespace android 88 89 #endif // CPP_VHAL_CLIENT_INCLUDE_AIDLHALPROPCONFIG_H_ 90