1/*
2 * Copyright (C) 2018 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 [email protected];
18
19import @1.0::GnssLocation;
20
21/** Network handle type. */
22typedef uint64_t net_handle_t;
23
24/**
25 * Flags indicating the validity of the fields in ElapsedRealtime.
26 */
27@export(name="", value_prefix="ELAPSED_REALTIME_")
28enum ElapsedRealtimeFlags : uint16_t {
29    /** A valid timestampNs is stored in the data structure. */
30    HAS_TIMESTAMP_NS        = 1 << 0,
31    /** A valid timeUncertaintyNs is stored in the data structure. */
32    HAS_TIME_UNCERTAINTY_NS = 1 << 1,
33};
34
35/**
36 * Represents an estimate of elapsed time since boot of Android for a given event.
37 *
38 * This timestamp MUST represent the time the event happened and MUST be synchronized
39 * with the SystemClock.elapsedRealtimeNanos() clock.
40 */
41struct ElapsedRealtime {
42    /**
43     * A set of flags indicating the validity of each field in this data structure.
44     *
45     * Fields may have invalid information in them, if not marked as valid by the
46     * corresponding bit in flags.
47     */
48    bitfield<ElapsedRealtimeFlags> flags;
49
50    /**
51     * Estimate of the elapsed time since boot value for the corresponding event in nanoseconds.
52     */
53    uint64_t timestampNs;
54
55    /**
56     * Estimate of the relative precision of the alignment of this SystemClock
57     * timestamp, with the reported measurements in nanoseconds (68% confidence).
58     */
59    uint64_t timeUncertaintyNs;
60};
61
62/** Represents a location. */
63struct GnssLocation {
64    @1.0::GnssLocation v1_0;
65
66    /**
67     * Timing information of the GNSS location synchronized with SystemClock.elapsedRealtimeNanos()
68     * clock.
69     *
70     * This clock information can be obtained from SystemClock.elapsedRealtimeNanos(), when the GNSS
71     * is attached straight to the AP/SOC. When it is attached to a separate module the timestamp
72     * needs to be estimated by syncing the notion of time via PTP or some other mechanism.
73     */
74    ElapsedRealtime elapsedRealtime;
75};
76
77/**
78 * GNSS constellation type
79 *
80 * This is to specify the navigation satellite system, for example, as listed in Section 3.5 in
81 * RINEX Version 3.04.
82 */
83enum GnssConstellationType : uint8_t {
84    UNKNOWN = 0,
85    /** Global Positioning System. */
86    GPS     = 1,
87    /** Satellite-Based Augmentation System. */
88    SBAS    = 2,
89    /** Global Navigation Satellite System. */
90    GLONASS = 3,
91    /** Quasi-Zenith Satellite System. */
92    QZSS    = 4,
93    /** BeiDou Navigation Satellite System. */
94    BEIDOU  = 5,
95    /** Galileo Navigation Satellite System. */
96    GALILEO = 6,
97    /** Indian Regional Navigation Satellite System. */
98    IRNSS   = 7,
99};
100