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#BLIND_SPOT_WARNING_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 BlindSpotWarningState { 35 /** 36 * This state is used as an alternative for any {@code BlindSpotWarningState} value that 37 * is not defined in the platform. Ideally, implementations of {@link 38 * android.car.VehiclePropertyIds#BLIND_SPOT_WARNING_STATE} should not use this state. 39 * The framework can use this field to remain backwards compatible if {@code 40 * BlindSpotWarningState} is extended to include additional states. 41 */ 42 public static final int OTHER = 0; 43 44 /** 45 * BSW is enabled and monitoring safety, but no vehicle or object detected in the vehicle's 46 * blind spot. 47 */ 48 public static final int NO_WARNING = 1; 49 50 /** 51 * BSW is enabled, detects a vehicle or object in the vehicle's blind spot, and is actively 52 * warning the user. 53 */ 54 public static final int WARNING = 2; 55 BlindSpotWarningState()56 private BlindSpotWarningState() {} 57 58 /** 59 * Returns a user-friendly representation of a {@code BlindSpotWarningState}. 60 */ 61 @NonNull toString( @lindSpotWarningStateInt int blindSpotWarningState)62 public static String toString( 63 @BlindSpotWarningStateInt int blindSpotWarningState) { 64 switch (blindSpotWarningState) { 65 case OTHER: 66 return "OTHER"; 67 case NO_WARNING: 68 return "NO_WARNING"; 69 case WARNING: 70 return "WARNING"; 71 default: 72 return "0x" + Integer.toHexString(blindSpotWarningState); 73 } 74 } 75 76 /** @hide */ 77 @IntDef({OTHER, NO_WARNING, WARNING}) 78 @Retention(RetentionPolicy.SOURCE) 79 public @interface BlindSpotWarningStateInt {} 80 } 81 82