1 /*
2  * Copyright (C) 2018 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.statusbar.car.hvac;
18 
19 /**
20  * Interface for Views that display temperature HVAC properties
21  */
22 public interface TemperatureView {
23     /**
24      * Formats the float for display
25      *
26      * @param temp - The current temp in Celsius or NaN
27      */
setTemp(float temp)28     void setTemp(float temp);
29 
30     /**
31      * Render the displayed temperature in Fahrenheit
32      *
33      * @param displayFahrenheit - True if temperature should be displayed in Fahrenheit
34      */
setDisplayInFahrenheit(boolean displayFahrenheit)35     void setDisplayInFahrenheit(boolean displayFahrenheit);
36 
37     /**
38      * Convert the given temperature in Celsius into Fahrenheit
39      *
40      * @param realTemp - The temperature in Celsius
41      * @return Temperature in Fahrenheit.
42      */
convertToFahrenheit(float realTemp)43     default float convertToFahrenheit(float realTemp) {
44         return (realTemp * 9f / 5f) + 32;
45     }
46 
47     /**
48      * @return propertiyId  Example: CarHvacManager.ID_ZONED_TEMP_SETPOINT (16385)
49      */
getPropertyId()50     int getPropertyId();
51 
52     /**
53      * @return hvac AreaId - Example: VehicleSeat.SEAT_ROW_1_LEFT (1)
54      */
getAreaId()55     int getAreaId();
56 }
57