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      * Called when the temperature display unit (Celsius or Fahrenheit) is changed.
35      */
onHvacTemperatureUnitChanged(boolean usesFahrenheit)36     void onHvacTemperatureUnitChanged(boolean usesFahrenheit);
37 
38     /**
39      * Called when the subscribed CarPropertyValue is changed.
40      */
onPropertyChanged(CarPropertyValue value)41     void onPropertyChanged(CarPropertyValue value);
42 
43     /**
44      * Returns the HvacProperty ID to subscribe to.
45      */
getHvacPropertyToView()46     @HvacController.HvacProperty Integer getHvacPropertyToView();
47 
48     /**
49      * Returns the area ID to subscribe to.
50      * <p>
51      * NOTE: Which area ID's are supported by a certain property depends on the VHAL implementation.
52      * For example, DefaultConfig.h file found in vhal_v2_0 documents the area ID's associated with
53      * each property. Calling {@link CarPropertyConfig#getAreaIds} also returns an array of all
54      * supported area ID's for the given property.
55      */
getAreaId()56     @HvacController.AreaId Integer getAreaId();
57 
58     /**
59      * Performs any action needed when locale is changed.
60      */
onLocaleListChanged()61     default void onLocaleListChanged() {}
62 
63 }
64