1/*
2 * Copyright 2017 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.wifi@1.2;
18
19import @1.0::MacAddress;
20import @1.0::NanDataPathConfirmInd;
21import @1.0::WifiChannelInMhz;
22import @1.0::WifiChannelWidthInMhz;
23
24/**
25 * NAN configuration request parameters added in the 1.2 HAL. These are supplemental to previous
26 * versions.
27 */
28struct NanConfigRequestSupplemental {
29    /**
30     * Specify the Discovery Beacon interval in ms. Specification only applicable if the device
31     * transmits Discovery Beacons (based on the Wi-Fi Aware protocol selection criteria). The value
32     * can be increased to reduce power consumption (on devices which would transmit Discovery
33     * Beacons), however - cluster synchronization time will likely increase.
34     * Values are:
35     *  - A value of 0 indicates that the HAL sets the interval to a default (implementation specific)
36     *  - A positive value
37     */
38    uint32_t discoveryBeaconIntervalMs;
39    /**
40     * The number of spatial streams to be used for transmitting NAN management frames (does NOT apply
41     * to data-path packets). A small value may reduce power consumption for small discovery packets.
42     * Values are:
43     *  - A value of 0 indicates that the HAL sets the number to a default (implementation specific)
44     *  - A positive value
45     */
46    uint32_t numberOfSpatialStreamsInDiscovery;
47    /**
48     * Controls whether the device may terminate listening on a Discovery Window (DW) earlier than the
49     * DW termination (16ms) if no information is received. Enabling the feature will result in
50     * lower power consumption, but may result in some missed messages and hence increased latency.
51     */
52    bool enableDiscoveryWindowEarlyTermination;
53    /**
54     * Controls whether NAN RTT (ranging) is permitted. Global flag on any NAN RTT operations are
55     * allowed. Controls ranging in the context of discovery as well as direct RTT.
56     */
57    bool enableRanging;
58};
59
60/**
61 * NAN data path channel information provided to the framework.
62 */
63struct NanDataPathChannelInfo {
64    /**
65     * Channel frequency in MHz.
66     */
67    WifiChannelInMhz channelFreq;
68    /**
69     * Channel bandwidth in MHz.
70     */
71    WifiChannelWidthInMhz channelBandwidth;
72    /**
73     * Number of spatial streams used in the channel.
74     */
75    uint32_t numSpatialStreams;
76};
77
78/**
79 * NAN Data path confirmation Indication structure.
80 * Event indication is received on both initiator and responder side when negotiation for a
81 * data-path finish: on success or failure.
82 */
83struct NanDataPathConfirmInd {
84    /**
85     * Baseline information as defined in HAL 1.0.
86     */
87    @1.0::NanDataPathConfirmInd V1_0;
88    /**
89     * The channel(s) on which the NDP is scheduled to operate.
90     * Updates to the operational channels are provided using the |eventDataPathScheduleUpdate|
91     * event.
92     */
93    vec<NanDataPathChannelInfo> channelInfo;
94};
95
96/**
97 * NAN data path channel information update indication structure.
98 * Event indication is received by all NDP owners whenever the channels on which the NDP operates
99 * are updated.
100 * Note: multiple NDPs may share the same schedule, the indication specifies all NDPs to which it
101 * applies.
102 */
103struct NanDataPathScheduleUpdateInd {
104    /**
105     * The discovery address (NMI) of the peer to which the NDP is connected.
106     */
107    MacAddress peerDiscoveryAddress;
108    /**
109     * The updated channel(s) information.
110     */
111    vec<NanDataPathChannelInfo> channelInfo;
112    /**
113     * The list of NDPs to which this update applies.
114     */
115    vec<uint32_t> ndpInstanceIds;
116};
117