/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.gnss@2.1;

import @2.0::IGnssCallback;

/**
 * This interface is required for the HAL to communicate certain information
 * like status and location info back to the platform, the platform implements
 * the interfaces and passes a handle to the HAL.
 */
interface IGnssCallback extends @2.0::IGnssCallback {
    /**
     * Flags for the gnssSetCapabilities callback.
     */
    @export(name = "", value_prefix = "GPS_CAPABILITY_")
    enum Capabilities : @2.0::IGnssCallback.Capabilities {
        /**
         * GNSS supports measurement corrections
         */
        ANTENNA_INFO = 1 << 11,
    };

    /**
     * Callback to inform framework of the GNSS HAL implementation's capabilities.
     *
     * @param capabilities Capability parameter is a bit field of the Capabilities enum.
     */
    gnssSetCapabilitiesCb_2_1(bitfield<Capabilities> capabilities);

    /**
     * Extends a GnssSvInfo, adding a basebandCN0DbHz.
     */
    struct GnssSvInfo {
        /**
         * GNSS satellite information for a single satellite and frequency.
         */
        @2.0::IGnssCallback.GnssSvInfo v2_0;

        /**
         * Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains
         * the measured C/N0 value for the signal measured at the baseband.
         *
         * This is typically a few dB weaker than the value estimated for C/N0 at the antenna port,
         * which is reported in cN0DbHz.
         *
         * If a signal has separate components (e.g. Pilot and Data channels) and the receiver only
         * processes one of the components, then the reported basebandCN0DbHz reflects only the
         * component that is processed.
         *
         * This value is mandatory. Like cN0DbHz, it may be reported as 0 for satellites being
         * reported that may be searched for, but not yet tracked.
         */
        double basebandCN0DbHz;
    };

    /**
     * Callback for the HAL to pass a vector of GnssSvInfo back to the client.
     *
     * @param svInfoList SV info list information from HAL.
     */
    gnssSvStatusCb_2_1(vec<GnssSvInfo> svInfoList);
};
