/*
 * Copyright 2018 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.supplicant@1.2;

import @1.0::ISupplicantP2pIface;
import @1.0::MacAddress;
import @1.0::Ssid;
import @1.0::SupplicantStatus;

/**
 * Interface exposed by the supplicant for each P2P mode network
 * interface (e.g p2p0) it controls.
 * To use 1.2 features you must cast specific interfaces returned from the
 * 1.2 HAL. For example V1_2::ISupplicant::addIface() adds V1_2::ISupplicantIface,
 * which can be cast to V1_2::ISupplicantP2pIface.
 */
interface ISupplicantP2pIface extends @1.0::ISupplicantP2pIface {
    /**
     * Set up a P2P group owner or join a group as a group client
     * with the specified configuration.
     *
     * If joinExistingGroup is false, this device sets up a P2P group owner manually (i.e.,
     * without group owner negotiation with a specific peer) with the specified SSID,
     * passphrase, persistent mode, and frequency/band.
     *
     * If joinExistingGroup is true, this device acts as a group client and joins the group
     * whose network name and group owner's MAC address matches the specified SSID
     * and peer address without WPS process. If peerAddress is 00:00:00:00:00:00, the first found
     * group whose network name matches the specified SSID is joined.
     *
     * @param ssid The SSID of this group.
     * @param pskPassphrase The passphrase of this group.
     * @param persistent Used to request a persistent group to be formed,
     *        only applied for the group owner.
     * @param freq The required frequency or band for this group.
     *        only applied for the group owner.
     *        The following values are supported:
     *        0: automatic channel selection,
     *        2: for 2.4GHz channels
     *        5: for 5GHz channels
     *        specific frequency, i.e., 2412, 5500, etc.
     *        If an invalid band or unsupported frequency are specified, it fails.
     * @param peerAddress the group owner's MAC address, only applied for the group client.
     *        If the MAC is "00:00:00:00:00:00", the device must try to find a peer
     *        whose network name matches the specified SSID.
     * @param joinExistingGroup if true, join a group as a group client; otherwise,
     *        create a group as a group owner.
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
     */
    addGroup_1_2(Ssid ssid, string pskPassphrase, bool persistent,
                 uint32_t freq, MacAddress peerAddress, bool joinExistingGroup)
        generates (SupplicantStatus status);

    /**
     * Set MAC randomization enabled/disabled.
     *
     * @param enable true to enable, false to disable.
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
     */
    setMacRandomization(bool enable) generates (SupplicantStatus status);
};
