1/*
2 * Copyright (C) 2016 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
17package android.hardware.gnss@1.0;
18
19@export(name="", value_prefix="GNSS_MAX_")
20enum GnssMax : uint32_t {
21/** Maximum number of SVs for gnssSvStatusCb(). */
22    SVS_COUNT = 64,
23};
24
25/** Milliseconds since January 1, 1970 */
26typedef int64_t GnssUtcTime;
27
28/**
29 * Constellation type of GnssSvInfo
30 */
31
32@export(name="", value_prefix="GNSS_CONSTELLATION_")
33enum GnssConstellationType : uint8_t {
34    UNKNOWN = 0,
35    GPS     = 1,
36    SBAS    = 2,
37    GLONASS = 3,
38    QZSS    = 4,
39    BEIDOU  = 5,
40    GALILEO = 6,
41};
42
43/** Bit mask to indicate which values are valid in a GnssLocation object. */
44@export(name="", value_prefix="GPS_LOCATION_")
45enum GnssLocationFlags : uint16_t {
46    /** GnssLocation has valid latitude and longitude. */
47    HAS_LAT_LONG              = 0x0001,
48    /** GnssLocation has valid altitude. */
49    HAS_ALTITUDE              = 0x0002,
50    /** GnssLocation has valid speed. */
51    HAS_SPEED                 = 0x0004,
52    /** GnssLocation has valid bearing. */
53    HAS_BEARING               = 0x0008,
54    /** GpsLocation has valid horizontal accuracy. */
55    HAS_HORIZONTAL_ACCURACY   = 0x0010,
56    /** GpsLocation has valid vertical accuracy. */
57    HAS_VERTICAL_ACCURACY     = 0x0020,
58    /** GpsLocation has valid speed accuracy. */
59    HAS_SPEED_ACCURACY        = 0x0040,
60    /** GpsLocation has valid bearing accuracy. */
61    HAS_BEARING_ACCURACY      = 0x0080
62};
63
64/** Represents a location. */
65struct GnssLocation {
66    /** Contains GnssLocationFlags bits. */
67    bitfield<GnssLocationFlags> gnssLocationFlags;
68
69    /** Represents latitude in degrees. */
70    double latitudeDegrees;
71
72    /** Represents longitude in degrees. */
73    double longitudeDegrees;
74
75    /**
76     * Represents altitude in meters above the WGS 84 reference ellipsoid.
77     */
78    double altitudeMeters;
79
80    /** Represents speed in meters per second. */
81    float speedMetersPerSec;
82
83    /** Represents heading in degrees. */
84    float bearingDegrees;
85
86    /**
87    * Represents expected horizontal position accuracy, radial, in meters
88    * (68% confidence).
89    */
90    float horizontalAccuracyMeters;
91
92    /**
93    * Represents expected vertical position accuracy in meters
94    * (68% confidence).
95    */
96    float verticalAccuracyMeters;
97
98    /**
99    * Represents expected speed accuracy in meter per seconds
100    * (68% confidence).
101    */
102    float speedAccuracyMetersPerSecond;
103
104    /**
105    * Represents expected bearing accuracy in degrees
106    * (68% confidence).
107    */
108    float bearingAccuracyDegrees;
109
110    /** Timestamp for the location fix. */
111    GnssUtcTime timestamp;
112};
113