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