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 by {@link android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_COMMAND} to enumerate
28  * commands.
29  *
30  * @hide
31  */
32 @SystemApi
33 public final class LaneCenteringAssistCommand {
34     /**
35      * When {@link android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_STATE} = {@link
36      * LaneCenteringAssistState#ENABLED}, this command sends a request to activate steering control
37      * that keeps the vehicle centered in its lane. While waiting for the LCA System to take control
38      * of the vehicle, {@link android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_STATE} will be in
39      * the {@link LaneCenteringAssistState#ACTIVATION_REQUESTED} state. Once the vehicle takes
40      * control of steering, then {@link android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_STATE}
41      * will be in the {@link LaneCenteringAssistState#ACTIVATED} state. Otherwise, an error
42      * can be communicated through an {@link ErrorState} value.
43      */
44     public static final int ACTIVATE = 1;
45 
46     /**
47      * When {@link android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_STATE} is set to {@link
48      * LaneCenteringAssistState#ACTIVATION_REQUESTED} or {@link LaneCenteringAssistState#ACTIVATED},
49      * this command deactivates steering control and the driver should take full control of the
50      * vehicle. If this command succeeds, {@link
51      * android.car.VehiclePropertyIds#LANE_CENTERING_ASSIST_STATE} will be updated to {@link
52      * LaneCenteringAssistState#ENABLED}.
53      */
54     public static final int DEACTIVATE = 2;
55 
LaneCenteringAssistCommand()56     private LaneCenteringAssistCommand() {}
57 
58     /**
59      * Returns a user-friendly representation of a {@code LaneCenteringAssistCommand}.
60      */
61     @NonNull
toString( @aneCenteringAssistCommandInt int laneCenteringAssistCommand)62     public static String toString(
63             @LaneCenteringAssistCommandInt int laneCenteringAssistCommand) {
64         switch (laneCenteringAssistCommand) {
65             case ACTIVATE:
66                 return "ACTIVATE";
67             case DEACTIVATE:
68                 return "DEACTIVATE";
69             default:
70                 return "0x" + Integer.toHexString(laneCenteringAssistCommand);
71         }
72     }
73 
74     /** @hide */
75     @IntDef({ACTIVATE, DEACTIVATE})
76     @Retention(RetentionPolicy.SOURCE)
77     public @interface LaneCenteringAssistCommandInt {}
78 }
79 
80