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 package android.car; 17 18 import android.annotation.IntDef; 19 import android.annotation.SystemApi; 20 21 import java.lang.annotation.Retention; 22 import java.lang.annotation.RetentionPolicy; 23 24 /** 25 * Units used for int or float {@link VehiclePropertyIds} with no attached enum types. 26 */ 27 public final class VehicleUnit { 28 /** 29 * @hide 30 */ 31 @SystemApi 32 public static final int SHOULD_NOT_USE = 0x000; 33 34 /** 35 * @hide 36 */ 37 @SystemApi 38 public static final int RPM = 0x02; 39 40 /** 41 * @hide 42 */ 43 @SystemApi 44 public static final int HERTZ = 0x03; 45 46 /** 47 * @hide 48 */ 49 @SystemApi 50 public static final int PERCENTILE = 0x10; 51 52 /** 53 * @hide 54 */ 55 @SystemApi 56 public static final int NANO_SECS = 0x50; 57 58 /** 59 * @hide 60 */ 61 @SystemApi 62 public static final int MILLI_SECS = 0x51; 63 64 /** 65 * @hide 66 */ 67 @SystemApi 68 public static final int SECS = 0x53; 69 70 /** 71 * @hide 72 */ 73 @SystemApi 74 public static final int YEAR = 0x59; 75 76 /** 77 * @hide 78 */ 79 @SystemApi 80 public static final int MILLIAMPERE = 0x61; 81 82 /** 83 * @hide 84 */ 85 @SystemApi 86 public static final int MILLIVOLT = 0x62; 87 88 /** 89 * @hide 90 */ 91 @SystemApi 92 public static final int MILLIWATTS = 0x63; 93 94 /** 95 * @hide 96 */ 97 @SystemApi 98 public static final int DEGREES = 0x80; 99 100 /** 101 * Units used by {@link VehiclePropertyIds#DISTANCE_DISPLAY_UNITS}. 102 */ 103 public static final int MILLIMETER = 0x20; 104 public static final int METER = 0x21; 105 public static final int KILOMETER = 0x23; 106 public static final int MILE = 0x24; 107 108 /** 109 * Units used by {@link VehiclePropertyIds#HVAC_TEMPERATURE_VALUE_SUGGESTION} and {@link 110 * VehiclePropertyIds#HVAC_TEMPERATURE_DISPLAY_UNITS}. 111 */ 112 public static final int CELSIUS = 0x30; 113 public static final int FAHRENHEIT = 0x31; 114 public static final int KELVIN = 0x32; 115 116 /** 117 * Units used by {@link VehiclePropertyIds#FUEL_VOLUME_DISPLAY_UNITS}. 118 */ 119 public static final int MILLILITER = 0x40; 120 public static final int LITER = 0x41; 121 public static final int US_GALLON = 0x42; 122 public static final int IMPERIAL_GALLON = 0x43; 123 124 /** 125 * Units used by {@link VehiclePropertyIds#EV_BATTERY_DISPLAY_UNITS}. 126 */ 127 public static final int WATT_HOUR = 0x60; 128 public static final int AMPERE_HOURS = 0x64; 129 public static final int KILOWATT_HOUR = 0x65; 130 131 /** 132 * Units used by {@link VehiclePropertyIds#TIRE_PRESSURE_DISPLAY_UNITS}. 133 */ 134 public static final int KILOPASCAL = 0x70; 135 public static final int PSI = 0x71; 136 public static final int BAR = 0x72; 137 138 /** 139 * Units used by {@link VehiclePropertyIds#VEHICLE_SPEED_DISPLAY_UNITS}. 140 */ 141 public static final int METER_PER_SEC = 0x01; 142 public static final int MILES_PER_HOUR = 0x90; 143 public static final int KILOMETERS_PER_HOUR = 0x91; 144 VehicleUnit()145 private VehicleUnit() { 146 } 147 148 /** @hide */ 149 @Retention(RetentionPolicy.SOURCE) 150 @IntDef({ 151 SHOULD_NOT_USE, 152 METER_PER_SEC, 153 RPM, 154 HERTZ, 155 PERCENTILE, 156 MILLIMETER, 157 METER, 158 KILOMETER, 159 MILE, 160 CELSIUS, 161 FAHRENHEIT, 162 KELVIN, 163 MILLILITER, 164 LITER, 165 US_GALLON, 166 IMPERIAL_GALLON, 167 NANO_SECS, 168 MILLI_SECS, 169 SECS, 170 YEAR, 171 KILOPASCAL, 172 WATT_HOUR, 173 MILLIAMPERE, 174 MILLIVOLT, 175 MILLIWATTS, 176 AMPERE_HOURS, 177 KILOWATT_HOUR, 178 PSI, 179 BAR, 180 DEGREES, 181 MILES_PER_HOUR, 182 KILOMETERS_PER_HOUR 183 }) 184 public @interface Enum { 185 } 186 } 187