• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 android.car.hardware.property;
18 
19 import android.annotation.IntDef;
20 import android.annotation.NonNull;
21 import android.annotation.SystemApi;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Used to enumerate the current level of {@link android.car.VehiclePropertyIds#ENGINE_OIL_LEVEL}.
28  *
29  * @hide
30  */
31 @SystemApi
32 public final class VehicleOilLevel {
33 
34     /**
35      * The oil level of the engine is critically low, so the vehicle may be unsafe to drive.
36      */
37     public static final int LEVEL_CRITICALLY_LOW = 0;
38 
39     /**
40      * The oil level of the engine is low and needs to be replaced.
41      */
42     public static final int LEVEL_LOW = 1;
43 
44     /**
45      * The oil level of the engine is normal for the vehicle.
46      */
47     public static final int LEVEL_NORMAL = 2;
48 
49     /**
50      * The oil level of the engine is high, so the vehicle may be unsafe to drive.
51      */
52     public static final int LEVEL_HIGH = 3;
53 
54     /**
55      * This value represents an error when retrieving the oil level of the engine.
56      */
57     public static final int LEVEL_ERROR = 4;
58 
VehicleOilLevel()59     private VehicleOilLevel() {}
60 
61     /**
62      * Returns a user-friendly representation of a {@code VehicleOilLevel}.
63      */
64     @NonNull
toString( @ehicleOilLevelInt int vehicleOilLevel)65     public static String toString(
66             @VehicleOilLevelInt int vehicleOilLevel) {
67         switch (vehicleOilLevel) {
68             case LEVEL_CRITICALLY_LOW:
69                 return "LEVEL_CRITICALLY_LOW";
70             case LEVEL_LOW:
71                 return "LEVEL_LOW";
72             case LEVEL_NORMAL:
73                 return "LEVEL_NORMAL";
74             case LEVEL_HIGH:
75                 return "LEVEL_HIGH";
76             case LEVEL_ERROR:
77                 return "LEVEL_ERROR";
78             default:
79                 return "0x" + Integer.toHexString(vehicleOilLevel);
80         }
81     }
82 
83     /** @hide */
84     @IntDef({LEVEL_CRITICALLY_LOW, LEVEL_LOW, LEVEL_NORMAL, LEVEL_HIGH, LEVEL_ERROR})
85     @Retention(RetentionPolicy.SOURCE)
86     public @interface VehicleOilLevelInt {}
87 }
88 
89