1 /* 2 * Copyright (C) 2022 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 * Possible turn signal states of a vehicle. 28 * 29 * <p>Applications can use {@link android.car.hardware.property.CarPropertyManager#getProperty(int, 30 * int)} with {@link android.car.VehiclePropertyIds#TURN_SIGNAL_STATE} to query the 31 * vehicle's turn signal state. 32 * 33 * @hide 34 */ 35 @SystemApi 36 public final class VehicleTurnSignal { 37 38 /** 39 * Neither right nor left signal in a vehicle are being used. 40 */ 41 public static final int STATE_NONE = 0; 42 43 /** 44 * Right turn signal in a vehicle is being used. 45 */ 46 public static final int STATE_RIGHT = 1; 47 48 /** 49 * Left turn signal in a vehicle is being used. 50 */ 51 public static final int STATE_LEFT = 2; 52 VehicleTurnSignal()53 private VehicleTurnSignal() { 54 } 55 56 /** 57 * Gets a user-friendly representation of a turn signal state. 58 */ 59 @NonNull toString(@ehicleTurnSignalInt int vehicleTurnSignal)60 public static String toString(@VehicleTurnSignalInt int vehicleTurnSignal) { 61 switch (vehicleTurnSignal) { 62 case STATE_NONE: 63 return "STATE_NONE"; 64 case STATE_RIGHT: 65 return "STATE_RIGHT"; 66 case STATE_LEFT: 67 return "STATE_LEFT"; 68 default: 69 return "0x" + Integer.toHexString(vehicleTurnSignal); 70 } 71 } 72 73 /** @hide */ 74 @IntDef({STATE_NONE, STATE_RIGHT, STATE_LEFT}) 75 @Retention(RetentionPolicy.SOURCE) 76 public @interface VehicleTurnSignalInt { 77 } 78 } 79