summaryrefslogtreecommitdiff
path: root/gnss/1.0/types.hal
blob: ea2c7567db905979991a4e281b8cd765bd6016de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.gnss@1.0;

@export(name="", value_prefix="GNSS_MAX_")
enum GnssMax : uint32_t {
/** Maximum number of SVs for gnssSvStatusCb(). */
    SVS_COUNT = 64,
};

/** Milliseconds since January 1, 1970 */
typedef int64_t GnssUtcTime;

/**
 * Constellation type of GnssSvInfo
 */

@export(name="", value_prefix="GNSS_CONSTELLATION_")
enum GnssConstellationType : uint8_t {
    UNKNOWN = 0,
    GPS     = 1,
    SBAS    = 2,
    GLONASS = 3,
    QZSS    = 4,
    BEIDOU  = 5,
    GALILEO = 6,
};

/** Bit mask to indicate which values are valid in a GnssLocation object. */
@export(name="", value_prefix="GPS_LOCATION_")
enum GnssLocationFlags : uint16_t {
    /** GnssLocation has valid latitude and longitude. */
    HAS_LAT_LONG              = 0x0001,
    /** GnssLocation has valid altitude. */
    HAS_ALTITUDE              = 0x0002,
    /** GnssLocation has valid speed. */
    HAS_SPEED                 = 0x0004,
    /** GnssLocation has valid bearing. */
    HAS_BEARING               = 0x0008,
    /** GpsLocation has valid horizontal accuracy. */
    HAS_HORIZONTAL_ACCURACY   = 0x0010,
    /** GpsLocation has valid vertical accuracy. */
    HAS_VERTICAL_ACCURACY     = 0x0020,
    /** GpsLocation has valid speed accuracy. */
    HAS_SPEED_ACCURACY        = 0x0040,
    /** GpsLocation has valid bearing accuracy. */
    HAS_BEARING_ACCURACY      = 0x0080
};

/** Represents a location. */
struct GnssLocation {
    /** Contains GnssLocationFlags bits. */
    bitfield<GnssLocationFlags> gnssLocationFlags;

    /** Represents latitude in degrees. */
    double latitudeDegrees;

    /** Represents longitude in degrees. */
    double longitudeDegrees;

    /**
     * Represents altitude in meters above the WGS 84 reference ellipsoid.
     */
    double altitudeMeters;

    /** Represents speed in meters per second. */
    float speedMetersPerSec;

    /** Represents heading in degrees. */
    float bearingDegrees;

    /**
    * Represents expected horizontal position accuracy, radial, in meters
    * (68% confidence).
    */
    float horizontalAccuracyMeters;

    /**
    * Represents expected vertical position accuracy in meters
    * (68% confidence).
    */
    float verticalAccuracyMeters;

    /**
    * Represents expected speed accuracy in meter per seconds
    * (68% confidence).
    */
    float speedAccuracyMetersPerSecond;

    /**
    * Represents expected bearing accuracy in degrees
    * (68% confidence).
    */
    float bearingAccuracyDegrees;

    /** Timestamp for the location fix. */
    GnssUtcTime timestamp;
};