blob: a96fd6ce6eb57f972e8637f873235d2b59594396 [file] [log] [blame]
gomo1da4b5c2018-12-02 02:49:10 -08001/*
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 android.hardware.gnss@2.0;
18
19import @1.0::IGnssCallback;
20import @1.1::IGnssCallback;
Pierre Fite-Georgel12ac2b52019-01-17 16:56:17 -080021import GnssLocation;
Yu-Han Yang6999a0f2019-03-14 11:08:43 -070022import GnssConstellationType;
gomo1da4b5c2018-12-02 02:49:10 -080023
24/**
Anil Admal86450fa2019-03-11 15:31:05 -070025 * This interface is required for the HAL to communicate certain information
gomo1da4b5c2018-12-02 02:49:10 -080026 * like status and location info back to the platform, the platform implements
27 * the interfaces and passes a handle to the HAL.
28 */
29interface IGnssCallback extends @1.1::IGnssCallback {
30
31 /** Flags for the gnssSetCapabilities callback. */
32 @export(name="", value_prefix="GPS_CAPABILITY_")
Anil Admal86450fa2019-03-11 15:31:05 -070033 enum Capabilities : uint32_t {
34 /**
35 * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
36 * If this is not set, then the framework will use 1000ms for
37 * minInterval and must call start() and stop() to schedule the GNSS.
38 */
39 SCHEDULING = 1 << 0,
40 /** GNSS supports MS-Based AGNSS mode */
41 MSB = 1 << 1,
42 /** GNSS supports MS-Assisted AGNSS mode */
43 MSA = 1 << 2,
44 /** GNSS supports single-shot fixes */
45 SINGLE_SHOT = 1 << 3,
46 /** GNSS supports on demand time injection */
47 ON_DEMAND_TIME = 1 << 4,
48 /**
49 * Values for the flags removed from IGnssCallback.hal@1.0 Capabilities
50 * enum are marked as reserved and not reused here to avoid confusion.
51 */
52 RESERVED_1 = 1 << 5,
53 RESERVED_2 = 1 << 6,
54 RESERVED_3 = 1 << 7,
55 /** GNSS supports low power mode */
56 LOW_POWER_MODE = 1 << 8,
57 /** GNSS supports blacklisting satellites */
58 SATELLITE_BLACKLIST = 1 << 9
gomo1da4b5c2018-12-02 02:49:10 -080059 };
60
61 /**
Anil Admal86450fa2019-03-11 15:31:05 -070062 * Callback to inform framework of the GNSS HAL implementation's capabilities.
gomo1da4b5c2018-12-02 02:49:10 -080063 *
64 * @param capabilities Capability parameter is a bit field of the Capabilities enum.
65 */
66 gnssSetCapabilitiesCb_2_0(bitfield<Capabilities> capabilities);
67
Pierre Fite-Georgel12ac2b52019-01-17 16:56:17 -080068 /**
69 * Called when a GNSS location is available.
70 *
71 * @param location Location information from HAL.
72 */
73 gnssLocationCb_2_0(GnssLocation location);
74
Yu-Han Yang75b35de2019-02-13 12:04:52 -080075 /**
76 * Callback for requesting Location.
77 *
78 * HAL implementation must call this when it wants the framework to provide locations to assist
79 * with GNSS HAL operation, for example, to assist with time to first fix, error recovery, or to
80 * supplement GNSS location for other clients of the GNSS HAL.
81 *
82 * If a request is made with independentFromGnss set to true, the framework must avoid
83 * providing locations derived from GNSS locations (such as "fused" location), to help improve
84 * information independence for situations such as error recovery.
85 *
86 * In response to this method call, GNSS HAL can expect zero, one, or more calls to
87 * IGnss::injectLocation or IGnss::injectBestLocation, dependent on availability of location
88 * from other sources, which may happen at some arbitrary delay. Generally speaking, HAL
89 * implementations must be able to handle calls to IGnss::injectLocation or
90 * IGnss::injectBestLocation at any time.
91 *
92 * @param independentFromGnss True if requesting a location that is independent from GNSS.
93 * @param isUserEmergency True if the location request is for delivery of this location to an
94 * emergency services endpoint, during a user-initiated emergency session (e.g.
95 * during-call to E911, or up to 5 minutes after end-of-call or text to E911).
96 */
97 gnssRequestLocationCb_2_0(bool independentFromGnss, bool isUserEmergency);
Yu-Han Yang6999a0f2019-03-14 11:08:43 -070098
99 /** Extends a GnssSvInfo, replacing the GnssConstellationType. */
100 struct GnssSvInfo {
101 /**
102 * GNSS satellite information for a single satellite and frequency.
103 *
104 * In this version of the HAL, the field 'constellation' in the v1_0 struct is deprecated,
105 * and is no longer used by the framework. The constellation type is instead reported in
106 * @2.0::IGnssCallback.GnssSvInfo.constellation.
107 */
108 @1.0::IGnssCallback.GnssSvInfo v1_0;
109
110 /** Defines the constellation of the given SV. */
111 GnssConstellationType constellation;
112 };
113
114 /**
115 * Callback for the HAL to pass a vector of GnssSvInfo back to the client.
116 *
117 * @param svInfo SV status information from HAL.
118 */
119 gnssSvStatusCb_2_0(vec<GnssSvInfo> svInfoList);
Anil Admal86450fa2019-03-11 15:31:05 -0700120};