1 /* 2 * Copyright (C) 2021 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 package com.android.systemui.car.hvac; 18 19 20 import android.car.hardware.CarPropertyConfig; 21 import android.car.hardware.CarPropertyValue; 22 23 /** 24 * Views implementing this interface can subscribe to HVAC Property by property ID and area ID and 25 * gain access to {@link HvacPropertySetter} with API's to write new values for HVAC Properties. 26 */ 27 public interface HvacView { 28 /** 29 * Grants HvacView access to {@link HvacPropertySetter}. 30 */ setHvacPropertySetter(HvacPropertySetter hvacPropertySetter)31 void setHvacPropertySetter(HvacPropertySetter hvacPropertySetter); 32 33 /** 34 * Set config information using the CarPropertyConfig for this property. This can be min/max 35 * values, config array values, etc. 36 */ setConfigInfo(CarPropertyConfig<?> carPropertyConfig)37 default void setConfigInfo(CarPropertyConfig<?> carPropertyConfig) {} 38 39 /** 40 * Set whether the HvacView is dependent on the HVAC being powered on. 41 */ setDisableViewIfPowerOff(boolean disableViewIfPowerOff)42 default void setDisableViewIfPowerOff(boolean disableViewIfPowerOff) {} 43 44 /** 45 * Called when the temperature display unit (Celsius or Fahrenheit) is changed. 46 */ onHvacTemperatureUnitChanged(boolean usesFahrenheit)47 default void onHvacTemperatureUnitChanged(boolean usesFahrenheit) {} 48 49 /** 50 * Called when the subscribed CarPropertyValue is changed. 51 */ onPropertyChanged(CarPropertyValue value)52 void onPropertyChanged(CarPropertyValue value); 53 54 /** 55 * Returns the HvacProperty ID to subscribe to. 56 */ getHvacPropertyToView()57 @HvacController.HvacProperty Integer getHvacPropertyToView(); 58 59 /** 60 * Returns the area ID to subscribe to. 61 * <p> 62 * NOTE: Which area ID's are supported by a certain property depends on the VHAL implementation. 63 * For example, DefaultConfig.h file found in vhal_v2_0 documents the area ID's associated with 64 * each property. Calling {@link CarPropertyConfig#getAreaIds} also returns an array of all 65 * supported area ID's for the given property. 66 */ getAreaId()67 @HvacController.AreaId Integer getAreaId(); 68 69 /** 70 * Performs any action needed when locale is changed. 71 */ onLocaleListChanged()72 default void onLocaleListChanged() {} 73 }