blob: 97a28e2a052963e70126c8e6230eceedea1fdf81 [file] [log] [blame]
Hridya Valsarajue596a712016-09-22 14:07:22 -07001/*
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/*
20 * The interface is required for the HAL to communicate certain information
21 * like status and location info back to the platform, the platform implements
22 * the interfaces and passes a handle to the HAL.
23 */
24interface IGnssCallback {
25 /* Flags for the gnssSetCapabilities callback. */
26 enum Capabilities : uint32_t {
27 /*
28 * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
29 * If this is not set, then the framework will use 1000ms for
30 * minInterval and will call start() and stop() to schedule the GNSS.
31 */
32 SCHEDULING = 1 << 0,
33 /** GNSS supports MS-Based AGNSS mode */
34 MSB = 1 << 1,
35 /** GNSS supports MS-Assisted AGNSS mode */
36 MSA = 1 << 2,
37 /** GNSS supports single-shot fixes */
38 SINGLE_SHOT = 1 << 3,
39 /** GNSS supports on demand time injection */
40 ON_DEMAND_TIME = 1 << 4,
41 /** GNSS supports Geofencing */
42 GEOFENCING = 1 << 5,
43 /** GNSS supports Measurements. */
44 MEASUREMENTS = 1 << 6,
45 /** GNSS supports Navigation Messages */
46 NAV_MESSAGES = 1 << 7,
47 };
48
49 /* GNSS status event values. */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -070050 enum GnssStatusValue : uint8_t {
Hridya Valsarajue596a712016-09-22 14:07:22 -070051 /** GNSS status unknown. */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -070052 NONE = 0,
Hridya Valsarajue596a712016-09-22 14:07:22 -070053 /** GNSS has begun navigating. */
54 SESSION_BEGIN = 1,
55 /** GNSS has stopped navigating. */
56 SESSION_END = 2,
57 /** GNSS has powered on but is not navigating. */
58 ENGINE_ON = 3,
59 /** GNSS is powered off. */
60 ENGINE_OFF = 4
61 };
62
63 /*
64 * Flags that indicate information about the satellite
65 */
66 enum GnssSvFlags : uint8_t {
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -070067 NONE = 0,
Hridya Valsarajue596a712016-09-22 14:07:22 -070068 HAS_EPHEMERIS_DATA = 1 << 0,
69 HAS_ALMANAC_DATA = 1 << 1,
70 USED_IN_FIX = 1 << 2
71 };
72
73 struct GnssSvInfo {
74 /*
75 * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The
76 * distinction is made by looking at constellation field. Values must be
77 * in the range of:
78 *
79 * - GNSS: 1-32
80 * - SBAS: 120-151, 183-192
81 * - GLONASS: 1-24, the orbital slot number (OSN), if known. Or, if not:
82 * 93-106, the frequency channel number (FCN) (-7 to +6) offset by
83 * + 100
84 * i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6
85 * as 106.
86 * - QZSS: 193-200
87 * - Galileo: 1-36
88 * - Beidou: 1-37
89 */
90 int16_t svid;
91
92 /*
93 * Defines the constellation of the given SV.
94 */
95 GnssConstellationType constellation;
96
97 /*
98 * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
99 * It contains the measured C/N0 value for the signal at the antenna port.
100 *
101 * This is a mandatory value.
102 */
103 float cN0Dbhz;
104
105 /** Elevation of SV in degrees. */
106 float elevationDegrees;
107
108 /** Azimuth of SV in degrees. */
109 float azimuthDegrees;
110
111 /*
112 * Contains additional data about the given SV.
113 */
Yifan Hong35e2aac2016-12-05 12:35:05 -0800114 bitfield<GnssSvFlags> svFlag;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700115 };
116
117 /*
118 * Represents SV status.
119 */
120 struct GnssSvStatus {
121 /*
122 * Number of GNSS SVs currently visible, refers to the SVs stored in sv_list
123 */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -0700124 uint32_t numSvs;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700125
126 /*
127 * Pointer to an array of SVs information for all GNSS constellations,
128 * except GNSS, which is reported using svList
129 */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -0700130 GnssSvInfo[GnssMax:SVS_COUNT] gnssSvList;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700131
132 };
133
134 /*
135 * Called when a GNSS location is available.
136 *
137 * @param location Location information from HAL.
138 */
139 gnssLocationCb(GnssLocation location);
140
141 /*
142 * Called to communicate the status of the GNSS engine.
143 *
144 * @param status Status information from HAL.
145 */
146 gnssStatusCb(GnssStatusValue status);
147
148 /*
149 * @param svInfo SV status information from HAL.
150 */
151 gnssSvStatusCb(GnssSvStatus svInfo);
152
153 /*
154 * Called when NMEA data is available.
155 * Callback for reporting NMEA sentences.
156 *
157 * @param timestamp Marks the instance of reporting.
158 * @param nmea Follows standard NMEA 0183. Each sentence begins with a '$'
159 * and ends with a carriage return/line feed sequence and can be no longer
160 * than 80 characters of visible text (plus the line terminators). The data
161 * is contained within this single line with data items separated by commas.
162 * The data itself is just ascii text and may extend over multiple sentences
163 * in certain specialized instances but is normally fully contained in one
164 * variable length sentence. The data may vary in the amount of precision
165 * contained in the message. For example time might be indicated to decimal
166 * parts of a second or location may be shown with 3 or even 4 digits after
167 * the decimal point. Programs that read the data must only use the commas
168 * to determine the field boundaries and not depend on column positions.
169 * There is a provision for a checksum at the end of each sentence which may
170 * or may not be checked by the unit that reads the data. The checksum field
171 * consists of a '*' and two hex digits representing an 8 bit exclusive OR
172 * of all characters between, but not including, the '$' and '*'.
173 */
174 gnssNmeaCb(GnssUtcTime timestamp, string nmea);
175
176 /*
177 * Callback to inform framework of the GNSS engine's capabilities.
178 *
179 * @param capabilities Capability parameter is a bit field of
180 * the Capabilities enum.
181 */
182 gnssSetCapabilitesCb(uint32_t capabilities);
183
184 /*
185 * Callback utility for acquiring the GNSS wakelock. This can be used to prevent
186 * the CPU from suspending while handling GNSS events.
187 */
188 gnssAcquireWakelockCb();
189
190 /** Callback utility for releasing the GNSS wakelock. */
191 gnssReleaseWakelockCb();
192
193 /** Callback for requesting NTP time */
194 gnssRequestTimeCb();
195
196 /*
197 * Provides information about how new the underlying GPS/GNSS hardware and
198 * software is.
199 *
200 * This information will be available for Android Test Applications. If a GNSS
201 * HAL does not provide this information, it will be considered "2015 or
202 * earlier".
203 *
204 * If a GNSS HAL does provide this information, then newer years will need to
205 * meet newer CTS standards. E.g. if the date are 2016 or above, then N+ level
206 * GnssMeasurement support will be verified.
207 */
208 struct GnssSystemInfo{
209 /*
210 * year in which the last update was made to the underlying hardware/firmware
211 * used to capture GNSS signals, e.g. 2016
212 */
213 uint16_t yearOfHw;
214 };
215
216 /*
217 * Callback to inform framework of the engine's hardware version information.
218 *
219 * @param info GnssSystemInfo about the GPS/GNSS hardware.
220 */
221 gnssSetSystemInfoCb(GnssSystemInfo info);
222};