README-NAN.md
1 Copyright 2018 The Android Open Source Project
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 # Wi-Fi Aware (NAN) HAL API Usage
16
17 The Wi-Fi Aware (NAN) HAL API is defined in (<i>hardware/interfaces/wifi/1.0/</i> and
18 <i>hardware/interfaces/wifi/1.2/</i>):
19
20 * IWifiNanIface.hal
21 * IWifiNanIfaceEventCallback.hal
22 * types.hal (structure definitions)
23
24 Note that the <i>1.2</i> HAL is supplemental to the <i>1.0</i> HAL - not a replacement.
25
26 The Wi-Fi Aware (NAN) HAL API surface is very large - only a subset is used from the framework.
27
28 Understanding of the HAL API subset which is actively used by the Android framework can be deduced
29 by reviewing framework code, specifically (<i>frameworks/opt/net/wifi/</i>):
30
31 * WifiAwareNativeApi.java
32 * WifiAwareNativeCallback.java
33
34 The above framework files determine the API usage - and should be consulted as the authoritative
35 reference. Please consult the primary HAL file for documentation - they will not be replicated
36 in this document. APIs which are in the HAL but are not listed in this README file are not used by
37 the framework.
38
39 Note: the HAL API is translated to the legacy HAL API (<i>wifi_nan.h</i>). This README file covers
40 the new HAL API only. To understand the mapping between new and legacy HALs please consult
41 <i>hardware/interfaces/wifi/\<version\>/default/hidl_struct_util.cpp</i>.
42
43 ## IWifiNanIface
44
45 Format:
46 * Hard-coded values are in <b>bold</b>, e.g. <b>true</b> or <b>5</b>
47 * Assigned but not fixed values are specified using the <i>variable</i> keyword, possibly with some
48 details/constraints
49 * Unassigned values are specified using the <i>N/A</i> keyword. Unassigned usually means initialized
50 to 0.
51
52 APIs:
53
54 * registerEventCallback_1_2(IWifiNanIfaceEventCallback_1_2 callback)
55 * getCapabilitiesRequest
56 * enableRequest_1_2
57 * NanEnableRequest
58 * bool[2] operateInBand
59 * Index [NanBandIndex.NAN_BAND_24GHZ] = <b>true</b>
60 * Index [NanBandIndex.NAN_BAND_5GHZ] = <i>variable</i>
61 * uint8_t hopCountMax = <b>2</b>
62 * NanConfigRequest configParams
63 * uint8_t masterPref = <i>variable</i>
64 * bool disableDiscoveryAddressChangeIndication = <i>variable</i>
65 * bool disableStartedClusterIndication = <i>variable</i>
66 * bool disableJoinedClusterIndication = <i>variable</i>
67 * bool includePublishServiceIdsInBeacon = <b>true</b>
68 * uint8_t numberOfPublishServiceIdsInBeacon = <b>0</b>
69 * bool includeSubscribeServiceIdsInBeacon = <b>true</b>
70 * uint8_t numberOfSubscribeServiceIdsInBeacon = <b>0</b>
71 * uint16_t rssiWindowSize = <b>8</b>
72 * uint32_t macAddressRandomizationIntervalSec = <i>variable</i>
73 * Normal run-time: set to <b>1800</b> (30 minutes)
74 * Tests: set to <b>120</b> (2 minutes)
75 * NanBandSpecificConfig[2] bandSpecificConfig
76 * Index [NanBandIndex.NAN_BAND_24GHZ]
77 * uint8_t rssiClose = <b>60</b>
78 * uint8_t rssiMiddle = <b>70</b>
79 * uint8_t rssiCloseProximity = <b>60</b>
80 * uint8_t dwellTimeMs = <b>200</b>
81 * uint16_t scanPeriodSec = <b>20</b>
82 * bool validDiscoveryWindowIntervalVal = <i>variable</i>
83 * uint8_t discoveryWindowIntervalVal = <i>variable</i>
84 * Index [NanBandIndex.NAN_BAND_5GHZ]
85 * uint8_t rssiClose = <b>60</b>
86 * uint8_t rssiMiddle = <b>75</b>
87 * uint8_t rssiCloseProximity = <b>60</b>
88 * uint8_t dwellTimeMs = <b>200</b>
89 * uint16_t scanPeriodSec = <b>20</b>
90 * bool validDiscoveryWindowIntervalVal = <i>variable</i>
91 * uint8_t discoveryWindowIntervalVal = <i>variable</i>
92 * NanDebugConfig debugConfigs
93 * bool validClusterIdVals = <b>true</b>
94 * uint16_t clusterIdBottomRangeVal = <i>variable</i>
95 * uint16_t clusterIdTopRangeVal = <i>variable</i>
96 * bool validIntfAddrVal = <b>false</b>
97 * MacAddress intfAddrVal = <i>N/A</i>
98 * bool validOuiVal = <b>false</b>
99 * uint32_t ouiVal = <i>N/A</i>
100 * bool validRandomFactorForceVal = <b>false</b>
101 * uint8_t randomFactorForceVal = <i>N/A</i>
102 * bool validHopCountForceVal = <b>false</b>
103 * uint8_t hopCountForceVal = <i>N/A</i>
104 * bool validDiscoveryChannelVal = <b>false</b>
105 * WifiChannelInMhz[2] discoveryChannelMhzVal = <i>N/A</i>
106 * bool validUseBeaconsInBandVal = <b>false</b>
107 * bool[2] useBeaconsInBandVal = <i>N/A</i>
108 * bool validUseSdfInBandVal = <b>false</b>
109 * bool[2] useSdfInBandVal = <i>N/A</i>
110 * NanConfigRequestSupplemental
111 * uint32_t discoveryBeaconIntervalMs = <b>0</b>
112 * uint32_t numberOfSpatialStreamsInDiscovery = <b>0</b>
113 * bool enableDiscoveryWindowEarlyTermination = <b>false</b>
114 * bool enableRanging = <b>true</b>
115 * configRequest_1_2
116 * NanConfigRequest: same as for <i>enableRequest_1_2</i>
117 * disableRequest
118 * startPublishRequest
119 * NanPublishRequest
120 * NanDiscoveryCommonConfig baseConfigs
121 * uint8_t sessionId = <i>variable</i>
122 * uint16_t ttlSec = <i>variable</i>
123 * uint16_t discoveryWindowPeriod = <b>1</b>
124 * uint8_t discoveryCount = <b>0</b>
125 * vec<uint8_t> serviceName = <i>variable</i>
126 * NanMatchAlg discoveryMatchIndicator = <b>NanMatchAlg.MATCH_NEVER</b>
127 * vec<uint8_t> serviceSpecificInfo = <i>variable</i>
128 * vec<uint8_t> extendedServiceSpecificInfo = <i>N/A</i>
129 e vec<uint8_t> rxMatchFilter = <i>variable</i>
130 * vec<uint8_t> txMatchFilter = <i>variable</i>
131 * bool useRssiThreshold = <b>false</b>
132 * bool disableDiscoveryTerminationIndication = <i>variable</i>
133 * bool disableMatchExpirationIndication = <b>true</b>
134 * bool disableFollowupReceivedIndication = <b>false</b>
135 * NanDataPathSecurityConfig securityConfig = <b>NanDataPathSecurityType.OPEN</b>
136 * bool rangingRequired = <b>false</b>
137 * uint32_t rangingIntervalMsec = <i>N/A</i>
138 * bitfield<NanRangingIndication> configRangingIndications = <i>N/A</i>
139 * uint16_t distanceIngressCm = <i>N/A</i>
140 * uint16_t distanceEgressCm = <i>N/A</i>
141 * NanPublishType publishType = <i>variable</i>
142 * NanTxType txType = <b>NanTxType.BROADCAST</b>
143 * bool autoAcceptDataPathRequests = <b>false</b>
144 * stopPublishRequest
145 * startSubscribeRequest
146 * NanSubscribeRequest
147 * NanDiscoveryCommonConfig baseConfigs
148 * Mostly same as <i>publish</i> above except:
149 * NanMatchAlg discoveryMatchIndicator = <b>NanMatchAlg.MATCH_ONCE</b>
150 * NanSubscribeType subscribeType = <i>variable</i>
151 * NanSrfType srfType = <i>N/A</i>
152 * bool srfRespondIfInAddressSet = <i>N/A</i>
153 * bool shouldUseSrf = <i>N/A</i>
154 * bool isSsiRequiredForMatch = <i>N/A</i>
155 * vec<MacAddress> intfAddr = <i>N/A</i>
156 * stopSubscribeRequest
157 * transmitFollowupRequest
158 * NanTransmitFollowupRequest
159 * uint8_t discoverySessionId = <i>variable</i>
160 * uint32_t peerId = <i>variable</i>
161 * MacAddress addr = <i>variable</i>
162 * bool isHighPriority = <b>false</b>
163 * bool shouldUseDiscoveryWindow = <b>true</b>
164 * vec<uint8_t> serviceSpecificInfo = <i>variable</i>
165 * vec<uint8_t> extendedServiceSpecificInfo = <i>N/A</i>
166 * bool disableFollowupResultIndication = <b>false</b>
167 * createDataInterfaceRequest
168 * deleteDataInterfaceRequest
169 * initiateDataPathRequest
170 * NanInitiateDataPathRequest
171 * uint32_t peerId = <i>variable</i>
172 * MacAddress peerDiscMacAddr = <i>variable</i>
173 * NanDataPathChannelCfg channelRequestType =
174 <i>NanDataPathChannelCfg.CHANNEL_NOT_REQUESTED</i>
175 * WifiChannelInMhz channel = <b>2437</b> (note that should be ignored though -
176 CHANNEL_NOT_REQUESTED!)
177 * string ifaceName = <i>variable</i>
178 * NanDataPathSecurityConfig securityConfig = <i>variable</i>
179 * vec<uint8_t> appInfo = <i>N/A</i>
180 * vec<uint8_t> serviceNameOutOfBand = <i>variable</i>
181 * respondToDataPathIndicationRequest
182 * NanRespondToDataPathIndicationRequest
183 * bool acceptRequest = <i>variable</i>
184 * uint32_t ndpInstanceId = <i>variable</i>
185 * string ifaceName = <i>variable</i>
186 * NanDataPathSecurityConfig securityConfig = <i>variable</i>
187 * vec<uint8_t> appInfo = <i>N/A</i>
188 * vec<uint8_t> serviceNameOutOfBand = <i>variable</i>
189 * terminateDataPathRequest
190
191 ## IWifiNanIfaceEventCallback_1_2
192
193 Format:
194 * Parameters whose values are <i>ignored</i> will be flagged, otherwise the parameter value is used
195 by the framework.
196
197 API:
198
199 * notifyXxxResponse: all callbacks are used by framework
200 * eventClusterEvent
201 * eventDisabled
202 * eventPublishTerminated
203 * eventSubscribeTerminated
204 * eventMatch
205 * NanMatchInd (all parameters are used except those listed below)
206 * vec<uint8_t> extendedServiceSpecificInfo: <i>ignored</i>
207 * bool matchOccuredInBeaconFlag: <i>ignored</i>
208 * bool outOfResourceFlag: <i>ignored</i>
209 * uint8_t rssiValue: <i>ignored</i>
210 * NanCipherSuiteType peerCipherType: <i>ignored</i>
211 * bool peerRequiresSecurityEnabledInNdp: <i>ignored</i>
212 * bool peerRequiresRanging: <i>ignored</i>
213 * uint32_t rangingMeasurementInCm: <i>ignored</i>
214 * bitfield<NanRangingIndication> rangingIndicationType: <i>ignored</i>
215 * eventMatchExpired: <i>ignored</i>
216 * eventFollowupReceived
217 * NanFollowupReceivedInd (all parameters are used except those listed below)
218 * bool receivedInFaw: <i>ignored</i>
219 * vec<uint8_t> extendedServiceSpecificInfo: <i>ignored</i>
220 * eventTransmitFollowup
221 * eventDataPathRequest
222 * NanDataPathRequestInd (all parameters are used except those listed below)
223 * bool securityRequired: <i>ignored</i>
224 * vec<uint8_t> appInfo: <i>ignored</i>
225 * eventDataPathConfirm
226 * NanDataPathConfirmInd (all parameters are used except those listed below)
227 * vec<uint8_t> appInfo: <i>ignored</i>
228 * eventDataPathScheduleUpdate
229 * NanDataPathScheduleUpdateInd
230 * eventDataPathTerminated
231
232