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 IAGnssCallback;
20
21/**
22 * Extended interface for Assisted GNSS support.
23 */
24interface IAGnss {
25    enum ApnIpType : uint8_t {
26        INVALID  = 0,
27        IPV4     = 1,
28        IPV6     = 2,
29        IPV4V6   = 3
30    };
31
32    /**
33     * Opens the AGNSS interface and provides the callback routines to the
34     * implementation of this interface.
35     *
36     * @param callback Handle to the AGNSS status callback interface.
37     */
38    setCallback(IAGnssCallback callback);
39
40    /**
41     * Notifies that the AGNSS data connection has been closed.
42     *
43     * @return success True if the operation is successful.
44     */
45    dataConnClosed() generates (bool success);
46
47    /**
48     * Notifies that a data connection is not available for AGNSS.
49     *
50     * @return success True if the operation is successful.
51     */
52    dataConnFailed() generates (bool success);
53
54    /**
55     * Sets the hostname and port for the AGNSS server.
56     *
57     * @param type Specifies if SUPL or C2K.
58     * @param hostname Hostname of the AGNSS server.
59     * @param port Port number associated with the server.
60     *
61     * @return success True if the operation is successful.
62     */
63    setServer(AGnssType type, string hostname, int32_t port)
64        generates (bool success);
65
66    /**
67     * Notifies GNSS that a data connection is available and sets the network handle,
68     * name of the APN, and its IP type to be used for SUPL connections.
69     *
70     * The HAL implementation must use the network handle to set the network for the
71     * SUPL connection sockets using the android_setsocknetwork function. This will ensure
72     * that there is a network path to the SUPL server. The network handle can also be used
73     * to get the IP address of SUPL FQDN using the android_getaddrinfofornetwork() function.
74     *
75     * @param networkHandle Handle representing the network for use with the NDK API.
76     * @param apn Access Point Name (follows regular APN naming convention).
77     * @param apnIpType Specifies IP type of APN.
78     *
79     * @return success True if the operation is successful.
80     */
81    dataConnOpen(net_handle_t networkHandle, string apn, ApnIpType apnIpType)
82        generates (bool success);
83};