• 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 import android.car.annotation.ApiRequirements;
23 
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 
27 /**
28  * Used to enumerate the current state of {@link
29  * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_STATE}.
30  *
31  * <p>This list of states may be extended in future releases to include additional states.
32  * @hide
33  */
34 @SystemApi
35 public final class WindshieldWipersState {
36     /**
37      * This state is used as an alternative for any {@code WindshieldWipersState} value that is not
38      * defined in the platform. Ideally, implementations of {@link
39      * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_STATE} should not use this state. The
40      * framework can use this field to remain backwards compatible if {@code WindshieldWipersState}
41      * is extended to include additional states.
42      */
43     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
44             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
45     public static final int OTHER = 0;
46 
47     /**
48      * This state indicates windshield wipers are currently off. If {@link
49      * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_SWITCH} is implemented, then it may be set
50      * to any of the following modes: {@link WindshieldWipersSwitch#OFF} or {@link
51      * WindshieldWipersSwitch#AUTO}.
52      */
53     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
54             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
55     public static final int OFF = 1;
56 
57     /**
58      * This state indicates windshield wipers are currently on. If {@link
59      * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_SWITCH} is implemented, then it may be set
60      * to any of the following modes: {@link WindshieldWipersSwitch#MIST}, {@code
61      * INTERMITTENT_LEVEL_*}, {@code CONTINUOUS_LEVEL_*}, or {@link WindshieldWipersSwitch#AUTO}.
62      */
63     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
64             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
65     public static final int ON = 2;
66 
67     /**
68      * Windshield wipers are in the service mode.
69      */
70     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
71             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
72     public static final int SERVICE = 3;
73 
WindshieldWipersState()74     private WindshieldWipersState() {}
75 
76     /**
77      * Returns a user-friendly representation of a {@code WindshieldWipersState}.
78      */
79     @NonNull
80     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
81             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
toString( @indshieldWipersStateInt int windshieldWipersState)82     public static String toString(
83             @WindshieldWipersStateInt int windshieldWipersState) {
84         switch (windshieldWipersState) {
85             case OTHER:
86                 return "OTHER";
87             case OFF:
88                 return "OFF";
89             case ON:
90                 return "ON";
91             case SERVICE:
92                 return "SERVICE";
93             default:
94                 return "0x" + Integer.toHexString(windshieldWipersState);
95         }
96     }
97 
98     /** @hide */
99     @IntDef({OTHER, OFF, ON, SERVICE})
100     @Retention(RetentionPolicy.SOURCE)
101     public @interface WindshieldWipersStateInt {}
102 }
103