xref: /aosp_15_r20/hardware/interfaces/gnss/2.0/IGnssCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport @1.0::IGnssCallback;
20*4d7e907cSAndroid Build Coastguard Workerimport @1.1::IGnssCallback;
21*4d7e907cSAndroid Build Coastguard Workerimport GnssLocation;
22*4d7e907cSAndroid Build Coastguard Workerimport GnssConstellationType;
23*4d7e907cSAndroid Build Coastguard Worker
24*4d7e907cSAndroid Build Coastguard Worker/**
25*4d7e907cSAndroid Build Coastguard Worker * This interface is required for the HAL to communicate certain information
26*4d7e907cSAndroid Build Coastguard Worker * like status and location info back to the platform, the platform implements
27*4d7e907cSAndroid Build Coastguard Worker * the interfaces and passes a handle to the HAL.
28*4d7e907cSAndroid Build Coastguard Worker */
29*4d7e907cSAndroid Build Coastguard Workerinterface IGnssCallback extends @1.1::IGnssCallback {
30*4d7e907cSAndroid Build Coastguard Worker
31*4d7e907cSAndroid Build Coastguard Worker    /** Flags for the gnssSetCapabilities callback. */
32*4d7e907cSAndroid Build Coastguard Worker    @export(name="", value_prefix="GPS_CAPABILITY_")
33*4d7e907cSAndroid Build Coastguard Worker    enum Capabilities : @1.0::IGnssCallback.Capabilities {
34*4d7e907cSAndroid Build Coastguard Worker        /** GNSS supports low power mode */
35*4d7e907cSAndroid Build Coastguard Worker        LOW_POWER_MODE                          = 1 << 8,
36*4d7e907cSAndroid Build Coastguard Worker        /** GNSS supports blacklisting satellites */
37*4d7e907cSAndroid Build Coastguard Worker        SATELLITE_BLACKLIST                     = 1 << 9,
38*4d7e907cSAndroid Build Coastguard Worker        /** GNSS supports measurement corrections */
39*4d7e907cSAndroid Build Coastguard Worker        MEASUREMENT_CORRECTIONS                 = 1 << 10
40*4d7e907cSAndroid Build Coastguard Worker    };
41*4d7e907cSAndroid Build Coastguard Worker
42*4d7e907cSAndroid Build Coastguard Worker    /**
43*4d7e907cSAndroid Build Coastguard Worker     * Callback to inform framework of the GNSS HAL implementation's capabilities.
44*4d7e907cSAndroid Build Coastguard Worker     *
45*4d7e907cSAndroid Build Coastguard Worker     * @param capabilities Capability parameter is a bit field of the Capabilities enum.
46*4d7e907cSAndroid Build Coastguard Worker     */
47*4d7e907cSAndroid Build Coastguard Worker    gnssSetCapabilitiesCb_2_0(bitfield<Capabilities> capabilities);
48*4d7e907cSAndroid Build Coastguard Worker
49*4d7e907cSAndroid Build Coastguard Worker   /**
50*4d7e907cSAndroid Build Coastguard Worker     * Called when a GNSS location is available.
51*4d7e907cSAndroid Build Coastguard Worker     *
52*4d7e907cSAndroid Build Coastguard Worker     * @param location Location information from HAL.
53*4d7e907cSAndroid Build Coastguard Worker     */
54*4d7e907cSAndroid Build Coastguard Worker    gnssLocationCb_2_0(GnssLocation location);
55*4d7e907cSAndroid Build Coastguard Worker
56*4d7e907cSAndroid Build Coastguard Worker    /**
57*4d7e907cSAndroid Build Coastguard Worker     * Callback for requesting Location.
58*4d7e907cSAndroid Build Coastguard Worker     *
59*4d7e907cSAndroid Build Coastguard Worker     * HAL implementation must call this when it wants the framework to provide locations to assist
60*4d7e907cSAndroid Build Coastguard Worker     * with GNSS HAL operation, for example, to assist with time to first fix, error recovery, or to
61*4d7e907cSAndroid Build Coastguard Worker     * supplement GNSS location for other clients of the GNSS HAL.
62*4d7e907cSAndroid Build Coastguard Worker     *
63*4d7e907cSAndroid Build Coastguard Worker     * If a request is made with independentFromGnss set to true, the framework must avoid
64*4d7e907cSAndroid Build Coastguard Worker     * providing locations derived from GNSS locations (such as "fused" location), to help improve
65*4d7e907cSAndroid Build Coastguard Worker     * information independence for situations such as error recovery.
66*4d7e907cSAndroid Build Coastguard Worker     *
67*4d7e907cSAndroid Build Coastguard Worker     * In response to this method call, GNSS HAL can expect zero, one, or more calls to
68*4d7e907cSAndroid Build Coastguard Worker     * IGnss::injectLocation or IGnss::injectBestLocation, dependent on availability of location
69*4d7e907cSAndroid Build Coastguard Worker     * from other sources, which may happen at some arbitrary delay. Generally speaking, HAL
70*4d7e907cSAndroid Build Coastguard Worker     * implementations must be able to handle calls to IGnss::injectLocation or
71*4d7e907cSAndroid Build Coastguard Worker     * IGnss::injectBestLocation at any time.
72*4d7e907cSAndroid Build Coastguard Worker     *
73*4d7e907cSAndroid Build Coastguard Worker     * @param independentFromGnss True if requesting a location that is independent from GNSS.
74*4d7e907cSAndroid Build Coastguard Worker     * @param isUserEmergency True if the location request is for delivery of this location to an
75*4d7e907cSAndroid Build Coastguard Worker     *        emergency services endpoint, during a user-initiated emergency session (e.g.
76*4d7e907cSAndroid Build Coastguard Worker     *        during-call to E911, or up to 5 minutes after end-of-call or text to E911).
77*4d7e907cSAndroid Build Coastguard Worker     */
78*4d7e907cSAndroid Build Coastguard Worker    gnssRequestLocationCb_2_0(bool independentFromGnss, bool isUserEmergency);
79*4d7e907cSAndroid Build Coastguard Worker
80*4d7e907cSAndroid Build Coastguard Worker    /** Extends a GnssSvInfo, replacing the GnssConstellationType. */
81*4d7e907cSAndroid Build Coastguard Worker    struct GnssSvInfo {
82*4d7e907cSAndroid Build Coastguard Worker        /**
83*4d7e907cSAndroid Build Coastguard Worker         * GNSS satellite information for a single satellite and frequency.
84*4d7e907cSAndroid Build Coastguard Worker         *
85*4d7e907cSAndroid Build Coastguard Worker         * In this version of the HAL, the field 'constellation' in the v1_0 struct is deprecated,
86*4d7e907cSAndroid Build Coastguard Worker         * and is no longer used by the framework. The constellation type is instead reported in
87*4d7e907cSAndroid Build Coastguard Worker         * @2.0::IGnssCallback.GnssSvInfo.constellation.
88*4d7e907cSAndroid Build Coastguard Worker         */
89*4d7e907cSAndroid Build Coastguard Worker        @1.0::IGnssCallback.GnssSvInfo v1_0;
90*4d7e907cSAndroid Build Coastguard Worker
91*4d7e907cSAndroid Build Coastguard Worker        /** Defines the constellation of the given SV. */
92*4d7e907cSAndroid Build Coastguard Worker        GnssConstellationType constellation;
93*4d7e907cSAndroid Build Coastguard Worker    };
94*4d7e907cSAndroid Build Coastguard Worker
95*4d7e907cSAndroid Build Coastguard Worker    /**
96*4d7e907cSAndroid Build Coastguard Worker     * Callback for the HAL to pass a vector of GnssSvInfo back to the client.
97*4d7e907cSAndroid Build Coastguard Worker     *
98*4d7e907cSAndroid Build Coastguard Worker     * @param svInfo SV status information from HAL.
99*4d7e907cSAndroid Build Coastguard Worker     */
100*4d7e907cSAndroid Build Coastguard Worker    gnssSvStatusCb_2_0(vec<GnssSvInfo> svInfoList);
101*4d7e907cSAndroid Build Coastguard Worker};
102