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