• 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 android.annotation.IntDef;
20 import android.annotation.NonNull;
21 
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 
25 /**
26  * Used by {@link android.car.VehiclePropertyIds#LOCATION_CHARACTERIZATION} to enumerate the
27  * supported bit flags.
28  *
29  * <p>These flags are used to indicate what sort of transformations are performed on the GNSS
30  * positions before exposed through the {@link android.location.LocationManager} APIs for the
31  * {@link android.location.LocationManager#GPS_PROVIDER} location provider.
32  *
33  * <p>This enum can be extended in future releases to include additional bit flags.
34  */
35 public class LocationCharacterization {
36     /**
37      * Prior location samples have been used to refine the raw GNSS data (e.g. a Kalman Filter).
38      */
39     public static final int PRIOR_LOCATIONS = 0x1;
40     /**
41      * Gyroscope data has been used to refine the raw GNSS data.
42      */
43     public static final int GYROSCOPE_FUSION = 0x2;
44     /**
45      * Accelerometer data has been used to refine the raw GNSS data.
46      */
47     public static final int ACCELEROMETER_FUSION = 0x4;
48     /**
49      * Compass data has been used to refine the raw GNSS data.
50      */
51     public static final int COMPASS_FUSION = 0x8;
52     /**
53      * Wheel speed has been used to refine the raw GNSS data.
54      */
55     public static final int WHEEL_SPEED_FUSION = 0x10;
56     /**
57      * Steering angle has been used to refine the raw GNSS data.
58      */
59     public static final int STEERING_ANGLE_FUSION = 0x20;
60     /**
61      * Car speed has been used to refine the raw GNSS data.
62      */
63     public static final int CAR_SPEED_FUSION = 0x40;
64     /**
65      * Some effort is made to dead-reckon location. In particular, this means that relative changes
66      * in location have meaning when no GNSS satellite is available.
67      */
68     public static final int DEAD_RECKONED = 0x80;
69     /**
70      * Location is based on GNSS satellite signals without sufficient fusion of other sensors for
71      * complete dead reckoning. This flag should be set when relative changes to location cannot be
72      * relied on when no GNSS satellite is available.
73      */
74     public static final int RAW_GNSS_ONLY = 0x100;
75 
LocationCharacterization()76     private LocationCharacterization() {}
77 
78     /**
79      * Returns a user-friendly representation of an {@code LocationCharacterization}.
80      */
81     @NonNull
toString( @ocationCharacterization.LocationCharacterizationInt int locationCharacterization)82     public static String toString(
83             @LocationCharacterization.LocationCharacterizationInt int locationCharacterization) {
84         switch (locationCharacterization) {
85             case PRIOR_LOCATIONS:
86                 return "PRIOR_LOCATIONS";
87             case GYROSCOPE_FUSION:
88                 return "GYROSCOPE_FUSION";
89             case ACCELEROMETER_FUSION:
90                 return "ACCELEROMETER_FUSION";
91             case COMPASS_FUSION:
92                 return "COMPASS_FUSION";
93             case WHEEL_SPEED_FUSION:
94                 return "WHEEL_SPEED_FUSION";
95             case STEERING_ANGLE_FUSION:
96                 return "STEERING_ANGLE_FUSION";
97             case CAR_SPEED_FUSION:
98                 return "CAR_SPEED_FUSION";
99             case DEAD_RECKONED:
100                 return "DEAD_RECKONED";
101             case RAW_GNSS_ONLY:
102                 return "RAW_GNSS_ONLY";
103             default:
104                 return "0x" + Integer.toHexString(locationCharacterization);
105         }
106     }
107 
108     /** @hide */
109     @IntDef({PRIOR_LOCATIONS, GYROSCOPE_FUSION, ACCELEROMETER_FUSION, COMPASS_FUSION,
110             WHEEL_SPEED_FUSION, STEERING_ANGLE_FUSION, CAR_SPEED_FUSION, DEAD_RECKONED,
111             RAW_GNSS_ONLY})
112     @Retention(RetentionPolicy.SOURCE)
113     public @interface LocationCharacterizationInt {}
114 }
115