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 IGnssMeasurementCallback;
20
21/**
22 * Extended interface for GNSS Measurements support.
23 */
24interface IGnssMeasurement {
25    @export(name="", value_prefix="GPS_MEASUREMENT_")
26    enum GnssMeasurementStatus : int32_t {
27        SUCCESS = 0,
28        ERROR_ALREADY_INIT = -100,
29        ERROR_GENERIC = -101
30    };
31
32    /**
33     * Initializes the interface and registers the callback routines with the HAL.
34     * After a successful call to 'setCallback' the HAL must begin to provide updates at
35     * an average output rate of 1Hz (occasional
36     * intra-measurement time offsets in the range from 0-2000msec can be
37     * tolerated.)
38     *
39     * @param callback Handle to GnssMeasurement callback interface.
40     *
41     * @return initRet Returns SUCCESS if successful.
42     * Returns ERROR_ALREADY_INIT if a callback has already been
43     * registered without a corresponding call to 'close'.
44     * Returns ERROR_GENERIC for any other error. The HAL must
45     * not generate any other updates upon returning this error code.
46     */
47    setCallback(IGnssMeasurementCallback callback) generates (GnssMeasurementStatus initRet);
48
49    /**
50     * Stops updates from the HAL, and unregisters the callback routines.
51     * After a call to close(), the previously registered callbacks must be
52     * considered invalid by the HAL.
53     * If close() is invoked without a previous setCallback, this function must perform
54     * no work.
55     */
56    close();
57
58};
59