/*
 * Copyright 2017 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.wifi@1.2;

import @1.0::WifiStatus;
import @1.1::IWifiChip;
import IWifiChipEventCallback;

/**
 * Interface that represents a chip that must be configured as a single unit.
 * The HAL/driver/firmware will be responsible for determining which phy is used
 * to perform operations like NAN, RTT, etc.
 */
interface IWifiChip extends @1.1::IWifiChip {
    /**
     * Capabilities exposed by this chip.
     */
    enum ChipCapabilityMask : @1.1::IWifiChip.ChipCapabilityMask {
        /**
         * Set/Reset Tx Power limits.
         */
         USE_BODY_HEAD_SAR = 1 << 11
    };

    /**
     * List of preset wifi radio TX power levels for different scenarios.
     * The actual power values (typically varies based on the channel,
     * 802.11 connection type, number of MIMO streams, etc) for each scenario
     * is defined by the OEM as a BDF file since it varies for each wifi chip
     * vendor and device.
     */
    enum TxPowerScenario : @1.1::IWifiChip.TxPowerScenario {
        ON_HEAD_CELL_OFF = 1,
        ON_HEAD_CELL_ON  = 2,
        ON_BODY_CELL_OFF = 3,
        ON_BODY_CELL_ON  = 4
    };

    /**
     * API to select one of the preset TX power scenarios.
     *
     * The framework must invoke this method with the appropriate scenario to let
     * the wifi chip change it's transmitting power levels.
     * OEM's should define various power profiles for each of the scenarios
     * above (defined in |TxPowerScenario|) in a vendor extension.
     *
     * @param scenario One of the preselected scenarios defined in
     *        |TxPowerScenario|.
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
     *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
     *         |WifiStatusCode.NOT_AVAILABLE|,
     *         |WifiStatusCode.UNKNOWN|
     */
    selectTxPowerScenario_1_2(TxPowerScenario scenario) generates (WifiStatus status);

    /**
     * Requests notifications of significant events on this chip. Multiple calls
     * to this must register multiple callbacks each of which must receive all
     * events.
     *
     * @param callback An instance of the |IWifiChipEventCallback| HIDL interface
     *        object.
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
     */
    registerEventCallback_1_2(IWifiChipEventCallback callback)
        generates (WifiStatus status);
};
