1/*
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
19import IAGnssRilCallback;
20
21/**
22 * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
23 * Layer interface allows the GNSS chipset to request radio interface layer
24 * information from Android platform. Examples of such information are reference
25 * location, unique subscriber ID, phone number string and network availability changes.
26 */
27interface IAGnssRil {
28    @export(name="", value_prefix="AGPS_SETID_TYPE_")
29    enum SetIDType : uint8_t {
30        NONE    = 0,
31        IMSI    = 1,
32        MSISDM  = 2
33    };
34
35    @export(name="", value_prefix="AGPS_RIL_NETWORK_TYPE_")
36    enum NetworkType : uint8_t {
37        MOBILE  = 0,
38        WIFI    = 1,
39        MMS     = 2,
40        SUPL    = 3,
41        DUN     = 4,
42        HIPRI   = 5,
43        WIMAX   = 6,
44    };
45
46    @export(name="", value_prefix="AGPS_REF_LOCATION_TYPE_")
47    enum AGnssRefLocationType : uint8_t {
48        GSM_CELLID   = 1,
49        UMTS_CELLID  = 2,
50        LTE_CELLID   = 4,
51    };
52
53    /** CellID for 2G, 3G and LTE, used in AGNSS. */
54    struct AGnssRefLocationCellID {
55        AGnssRefLocationType type;
56
57        /** Mobile Country Code. */
58        uint16_t mcc;
59
60        /**
61         * Mobile Network Code .*/
62        uint16_t mnc;
63
64        /**
65         * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
66         * lac is populated with tac, to ensure that we don't break old clients that
67         * might rely in the old (wrong) behavior.
68         */
69        uint16_t lac;
70
71        /** Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
72        uint32_t cid;
73
74        /** Tracking Area Code in LTE. */
75        uint16_t tac;
76
77        /** Physical Cell id in LTE (not used in 2G and 3G) */
78        uint16_t pcid;
79    };
80
81    /** Represents ref locations */
82    struct AGnssRefLocation {
83        AGnssRefLocationType type;
84
85        AGnssRefLocationCellID cellID;
86    };
87
88    /**
89     * Opens the AGNSS interface and provides the callback routines
90     * to the implementation of this interface.
91     *
92     * @param callback Interface for AGnssRil callbacks.
93     */
94    setCallback(IAGnssRilCallback callback);
95
96    /**
97     * Sets the reference location.
98     *
99     * @param agnssReflocation AGNSS reference location CellID.
100     */
101    setRefLocation(AGnssRefLocation agnssReflocation);
102
103    /**
104     * Sets the SET ID.
105     *
106     * @param type Must be populated with either IMSI or MSISDN or NONE.
107     * @param setid If type is IMSI then setid is populated with
108     * a string representing the unique Subscriber ID, for example, the IMSI for
109     * a GMS phone. If type is MSISDN, then setid must contain
110     * the phone number string for line 1. For example, the MSISDN for a GSM phone.
111     * If the type is NONE, then the string must be empty.
112     *
113     * @return success True if all parameters were valid and operation was
114     * successful.
115     */
116    setSetId(SetIDType type, string setid) generates (bool success);
117
118    /**
119     * Notify GNSS of network status changes.
120     *
121     * @param connected Indicates whether network connectivity exists and
122     * it is possible to establish connections and pass data.
123     * @param type Indicates the kind of network, for eg. mobile, wifi etc.
124     * @param roaming Indicates whether the device is currently roaming on
125     * this network.
126     *
127     * @return success True is all parameters were valid and operation was
128     * successful.
129     */
130    updateNetworkState(bool connected, NetworkType type, bool roaming)
131        generates (bool success);
132
133    /**
134     * Notify GNSS of network status changes and current APN.
135     *
136     * @param available Indicates whether network connectivity is available.
137     * @param apn String containing the telephony preferred Access Point Name.
138     *
139     * @return success True if all parameters were valid and the operation was
140     * successful.
141     */
142    updateNetworkAvailability(bool available, string apn) generates (bool success);
143
144};
145