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 android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ 18 #define android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ 19 20 #include <VehicleHalTypes.h> 21 22 #include <unordered_map> 23 24 namespace android { 25 namespace hardware { 26 namespace automotive { 27 namespace vehicle { 28 29 // ConfigDeclaration represents one property config, its optional initial value and its optional 30 // area configs and initial values for each area. 31 struct ConfigDeclaration { 32 aidl::android::hardware::automotive::vehicle::VehiclePropConfig config; 33 34 // This value will be used as an initial value for the property. If this field is specified for 35 // property that supports multiple areas then it will be used for all areas unless particular 36 // area is overridden in initialAreaValue field. 37 aidl::android::hardware::automotive::vehicle::RawPropValues initialValue; 38 // Use initialAreaValues if it is necessary to specify different values per each area. 39 std::unordered_map<int32_t, aidl::android::hardware::automotive::vehicle::RawPropValues> 40 initialAreaValues; 41 42 inline bool operator==(const ConfigDeclaration& other) const { 43 return (config == other.config && initialValue == other.initialValue && 44 initialAreaValues == other.initialAreaValues); 45 } 46 47 friend std::ostream& operator<<(std::ostream& os, const ConfigDeclaration& c) { 48 return os << "Config Declaration for property: " 49 << aidl::android::hardware::automotive::vehicle::toString( 50 static_cast< 51 aidl::android::hardware::automotive::vehicle::VehicleProperty>( 52 c.config.prop)); 53 } 54 }; 55 56 } // namespace vehicle 57 } // namespace automotive 58 } // namespace hardware 59 } // namespace android 60 61 #endif // android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ 62