• 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 position of {@link
29  * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_SWITCH}.
30  *
31  * <p>This list of enum values may be extended in future releases to include additional values.
32  * @hide
33  */
34 @SystemApi
35 public final class WindshieldWipersSwitch {
36     /**
37      * This value is used as an alternative for any {@code WindshieldWipersSwitch} value that is not
38      * defined in the platform. Ideally, implementations of {@link
39      * android.car.VehiclePropertyIds#WINDSHIELD_WIPERS_SWITCH} should not use this value. The
40      * framework can use this field to remain backwards compatible if {@code WindshieldWipersSwitch}
41      * is extended to include additional values.
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      * The windshield wipers switch is set to the off position.
49      */
50     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
51             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
52     public static final int OFF = 1;
53 
54     /**
55      * {@code MIST} mode performs a single wipe, and then returns to the {@link #OFF} position.
56      */
57     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
58             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
59     public static final int MIST = 2;
60 
61     /**
62      * {@code INTERMITTENT_LEVEL_*} modes performs intermittent wiping. As the level increases, the
63      * intermittent time period decreases.
64      */
65     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
66             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
67     public static final int INTERMITTENT_LEVEL_1 = 3;
68 
69     /**
70      * See {@link #INTERMITTENT_LEVEL_1}.
71      */
72     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
73             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
74     public static final int INTERMITTENT_LEVEL_2 = 4;
75 
76     /**
77      * See {@link #INTERMITTENT_LEVEL_1}.
78      */
79     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
80             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
81     public static final int INTERMITTENT_LEVEL_3 = 5;
82 
83     /**
84      * See {@link #INTERMITTENT_LEVEL_1}.
85      */
86     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
87             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
88     public static final int INTERMITTENT_LEVEL_4 = 6;
89 
90     /**
91      * See {@link #INTERMITTENT_LEVEL_1}.
92      */
93     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
94             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
95     public static final int INTERMITTENT_LEVEL_5 = 7;
96 
97     /**
98      * {@code CONTINUOUS_LEVEL_*} modes performs continuous wiping. As the level increases the speed
99      * of the wiping increases as well.
100      */
101     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
102             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
103     public static final int CONTINUOUS_LEVEL_1 = 8;
104 
105     /**
106      * See {@link #CONTINUOUS_LEVEL_1}.
107      */
108     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
109             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
110     public static final int CONTINUOUS_LEVEL_2 = 9;
111 
112     /**
113      * See {@link #CONTINUOUS_LEVEL_1}.
114      */
115     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
116             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
117     public static final int CONTINUOUS_LEVEL_3 = 10;
118 
119     /**
120      * See {@link #CONTINUOUS_LEVEL_1}.
121      */
122     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
123             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
124     public static final int CONTINUOUS_LEVEL_4 = 11;
125 
126     /**
127      * See {@link #CONTINUOUS_LEVEL_1}.
128      */
129     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
130             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
131     public static final int CONTINUOUS_LEVEL_5 = 12;
132 
133     /**
134      * {@code AUTO} allows the vehicle to decide the required wiping level based on the exterior
135      * weather conditions.
136      */
137     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
138             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
139     public static final int AUTO = 13;
140 
141     /**
142      * Windshield wipers are set to the service mode.
143      */
144     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
145             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
146     public static final int SERVICE = 14;
147 
WindshieldWipersSwitch()148     private WindshieldWipersSwitch() {}
149 
150     /**
151      * Returns a user-friendly representation of a {@code WindshieldWipersSwitch}.
152      */
153     @NonNull
154     @ApiRequirements(minCarVersion = ApiRequirements.CarVersion.UPSIDE_DOWN_CAKE_0,
155             minPlatformVersion = ApiRequirements.PlatformVersion.TIRAMISU_0)
toString( @indshieldWipersSwitchInt int windshieldWipersSwitch)156     public static String toString(
157             @WindshieldWipersSwitchInt int windshieldWipersSwitch) {
158         switch (windshieldWipersSwitch) {
159             case OTHER:
160                 return "OTHER";
161             case OFF:
162                 return "OFF";
163             case MIST:
164                 return "MIST";
165             case INTERMITTENT_LEVEL_1:
166                 return "INTERMITTENT_LEVEL_1";
167             case INTERMITTENT_LEVEL_2:
168                 return "INTERMITTENT_LEVEL_2";
169             case INTERMITTENT_LEVEL_3:
170                 return "INTERMITTENT_LEVEL_3";
171             case INTERMITTENT_LEVEL_4:
172                 return "INTERMITTENT_LEVEL_4";
173             case INTERMITTENT_LEVEL_5:
174                 return "INTERMITTENT_LEVEL_5";
175             case CONTINUOUS_LEVEL_1:
176                 return "CONTINUOUS_LEVEL_1";
177             case CONTINUOUS_LEVEL_2:
178                 return "CONTINUOUS_LEVEL_2";
179             case CONTINUOUS_LEVEL_3:
180                 return "CONTINUOUS_LEVEL_3";
181             case CONTINUOUS_LEVEL_4:
182                 return "CONTINUOUS_LEVEL_4";
183             case CONTINUOUS_LEVEL_5:
184                 return "CONTINUOUS_LEVEL_5";
185             case AUTO:
186                 return "AUTO";
187             case SERVICE:
188                 return "SERVICE";
189             default:
190                 return "0x" + Integer.toHexString(windshieldWipersSwitch);
191         }
192     }
193 
194     /** @hide */
195     @IntDef({
196             OTHER,
197             OFF,
198             MIST,
199             INTERMITTENT_LEVEL_1,
200             INTERMITTENT_LEVEL_2,
201             INTERMITTENT_LEVEL_3,
202             INTERMITTENT_LEVEL_4,
203             INTERMITTENT_LEVEL_5,
204             CONTINUOUS_LEVEL_1,
205             CONTINUOUS_LEVEL_2,
206             CONTINUOUS_LEVEL_3,
207             CONTINUOUS_LEVEL_4,
208             CONTINUOUS_LEVEL_5,
209             AUTO,
210             SERVICE
211     })
212     @Retention(RetentionPolicy.SOURCE)
213     public @interface WindshieldWipersSwitchInt {}
214 }
215