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