• 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 static android.car.feature.Flags.FLAG_ANDROID_VIC_VEHICLE_PROPERTIES;
20 
21 import android.annotation.FlaggedApi;
22 import android.annotation.IntDef;
23 import android.annotation.NonNull;
24 import android.annotation.SystemApi;
25 
26 import com.android.car.internal.util.ConstantDebugUtils;
27 
28 import java.lang.annotation.Retention;
29 import java.lang.annotation.RetentionPolicy;
30 
31 /**
32  * Used to enumerate the state of Cross Traffic Monitoring Warning system.
33  *
34  * @hide
35  */
36 @FlaggedApi(FLAG_ANDROID_VIC_VEHICLE_PROPERTIES)
37 @SystemApi
38 public final class CrossTrafficMonitoringWarningState {
39 
40     /**
41      * This state is used as an alternative to any {@code CrossTrafficMonitoringWarningState} value
42      * that is not defined in the platform. Ideally, implementations of {@link
43      * android.car.VehiclePropertyIds#CROSS_TRAFFIC_MONITORING_WARNING_STATE} should not use this
44      * state. The framework can use this field to remain backwards compatible if {@code
45      * CrossTrafficMonitoringWarningState} is extended to include additional states.
46      */
47     public static final int OTHER = 0;
48     /**
49      * Cross Traffic Monitoring Warning is enabled and monitoring safety, but no potential collision
50      * is detected.
51      */
52     public static final int NO_WARNING = 1;
53     /**
54      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
55      * moving objects coming from the driver's left side in front of the vehicle.
56      */
57     public static final int WARNING_FRONT_LEFT = 2;
58     /**
59      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
60      * moving objects coming from the driver's right side in front of the vehicle.
61      */
62     public static final int WARNING_FRONT_RIGHT = 3;
63     /**
64      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
65      * moving objects coming from both the driver's left side and the driver's right side in front
66      * of the vehicle.
67      */
68     public static final int WARNING_FRONT_BOTH = 4;
69     /**
70      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
71      * moving objects coming from the driver's left side behind the vehicle.
72      */
73     public static final int WARNING_REAR_LEFT = 5;
74     /**
75      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
76      * moving objects coming from the driver's right side behind the vehicle.
77      */
78     public static final int WARNING_REAR_RIGHT = 6;
79     /**
80      * Cross Traffic Monitoring Warning is enabled and is actively warning the user of incoming
81      * moving objects coming from the driver's left side and the driver's right side behind the
82      * vehicle.
83      */
84     public static final int WARNING_REAR_BOTH = 7;
85 
CrossTrafficMonitoringWarningState()86     private CrossTrafficMonitoringWarningState() {}
87 
88     /**
89      * Returns a user-friendly representation of {@code CrossTrafficMonitoringWarningState}.
90      */
91     @NonNull
toString( @rossTrafficMonitoringWarningStateInt int crossTrafficMonitoringWarningState)92     public static String toString(
93             @CrossTrafficMonitoringWarningStateInt int crossTrafficMonitoringWarningState) {
94         String crossTrafficMonitoringWarningStateString = ConstantDebugUtils.toName(
95                 CrossTrafficMonitoringWarningState.class, crossTrafficMonitoringWarningState);
96         return (crossTrafficMonitoringWarningStateString != null)
97                 ? crossTrafficMonitoringWarningStateString
98                 : "0x" + Integer.toHexString(crossTrafficMonitoringWarningState);
99     }
100 
101     /** @hide */
102     @IntDef({OTHER, NO_WARNING, WARNING_FRONT_LEFT, WARNING_FRONT_RIGHT, WARNING_FRONT_BOTH,
103             WARNING_REAR_LEFT, WARNING_REAR_RIGHT, WARNING_REAR_BOTH})
104     @Retention(RetentionPolicy.SOURCE)
105     public @interface CrossTrafficMonitoringWarningStateInt {}
106 }
107