1/*
2 * Copyright 2016 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.0;
18
19/**
20 * NAN Response and Asynchronous Event Callbacks.
21 *
22 * References to "NAN Spec" are to the Wi-Fi Alliance "Wi-Fi Neighbor Awareness
23 * Networking (NAN) Technical Specification".
24 */
25interface IWifiNanIfaceEventCallback {
26  /**
27   * Notify callbacks are asynchronous callbacks - but in response to |IWifiNanIface| method calls.
28   * Each method will receive a notify callback to return results (on success) or failure status.
29   */
30
31  /**
32   * Asynchronous callback invoked in response to a capability request
33   * |IWifiNanIface.getCapabilitiesRequest|.
34   *
35   * @param cmdId command Id corresponding to the original request.
36   * @param status WifiNanStatus of the operation. Possible status codes are:
37   *        |NanStatusType.SUCCESS|
38   * @param capabilities Capability data.
39   */
40  oneway notifyCapabilitiesResponse(CommandIdShort id, WifiNanStatus status,
41                                    NanCapabilities capabilities);
42
43  /**
44   * Asynchronous callback invoked in response to an enable request |IWifiNanIface.enableRequest|.
45   *
46   * @param cmdId command Id corresponding to the original request.
47   * @param status WifiNanStatus of the operation. Possible status codes are:
48   *        |NanStatusType.SUCCESS|
49   *        |NanStatusType.ALREADY_ENABLED|
50   *        |NanStatusType.INVALID_ARGS|
51   *        |NanStatusType.INTERNAL_FAILURE|
52   *        |NanStatusType.PROTOCOL_FAILURE|
53   *        |NanStatusType.NAN_NOT_ALLOWED|
54   */
55  oneway notifyEnableResponse(CommandIdShort id, WifiNanStatus status);
56
57  /**
58   * Asynchronous callback invoked in response to a config request |IWifiNanIface.configRequest|.
59   *
60   * @param cmdId command Id corresponding to the original request.
61   * @param status WifiNanStatus of the operation. Possible status codes are:
62   *        |NanStatusType.SUCCESS|
63   *        |NanStatusType.INVALID_ARGS|
64   *        |NanStatusType.INTERNAL_FAILURE|
65   *        |NanStatusType.PROTOCOL_FAILURE|
66   */
67  oneway notifyConfigResponse(CommandIdShort id, WifiNanStatus status);
68
69  /**
70   * Asynchronous callback invoked in response to a disable request |IWifiNanIface.disableRequest|.
71   *
72   * @param cmdId command Id corresponding to the original request.
73   * @param status WifiNanStatus of the operation. Possible status codes are:
74   *        |NanStatusType.SUCCESS|
75   *        |NanStatusType.PROTOCOL_FAILURE|
76   */
77  oneway notifyDisableResponse(CommandIdShort id, WifiNanStatus status);
78
79  /**
80   * Asynchronous callback invoked to notify the status of the start publish request
81   * |IWifiNanIface.startPublishRequest|.
82   *
83   * @param cmdId command Id corresponding to the original request.
84   * @param status WifiNanStatus of the operation. Possible status codes are:
85   *        |NanStatusType.SUCCESS|
86   *        |NanStatusType.INVALID_ARGS|
87   *        |NanStatusType.PROTOCOL_FAILURE|
88   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
89   *        |NanStatusType.INVALID_SESSION_ID|
90   * @param sessionId ID of the new publish session (if successfully created).
91   */
92  oneway notifyStartPublishResponse(CommandIdShort id, WifiNanStatus status, uint8_t sessionId);
93
94  /**
95   * Asynchronous callback invoked in response to a stop publish request
96   * |IWifiNanIface.stopPublishRequest|.
97   *
98   * @param cmdId command Id corresponding to the original request.
99   * @param status WifiNanStatus of the operation. Possible status codes are:
100   *        |NanStatusType.SUCCESS|
101   *        |NanStatusType.INVALID_SESSION_ID|
102   *        |NanStatusType.INTERNAL_FAILURE|
103   */
104  oneway notifyStopPublishResponse(CommandIdShort id, WifiNanStatus status);
105
106  /**
107   * Asynchronous callback invoked to notify the status of the start subscribe request
108   * |IWifiNanIface.startSubscribeRequest|.
109   *
110   * @param cmdId command Id corresponding to the original request.
111   * @param status WifiNanStatus of the operation. Possible status codes are:
112   *        |NanStatusType.SUCCESS|
113   *        |NanStatusType.INVALID_ARGS|
114   *        |NanStatusType.PROTOCOL_FAILURE|
115   *        |NanStatusType.NO_RESOURCES_AVAILABLE|
116   *        |NanStatusType.INVALID_SESSION_ID|
117   * @param sessionId ID of the new subscribe session (if successfully created).
118   */
119  oneway notifyStartSubscribeResponse(CommandIdShort id, WifiNanStatus status, uint8_t sessionId);
120
121  /**
122   * Asynchronous callback invoked in response to a stop subscribe request
123   * |IWifiNanIface.stopSubscribeRequest|.
124   *
125   * @param cmdId command Id corresponding to the original request.
126   * @param status WifiNanStatus of the operation. Possible status codes are:
127   *        |NanStatusType.SUCCESS|
128   *        |NanStatusType.INVALID_SESSION_ID|
129   *        |NanStatusType.INTERNAL_FAILURE|
130   */
131  oneway notifyStopSubscribeResponse(CommandIdShort id, WifiNanStatus status);
132
133  /**
134   * Asynchronous callback invoked in response to a transmit followup request
135   * |IWifiNanIface.transmitFollowupRequest|.
136   *
137   * @param cmdId command Id corresponding to the original request.
138   * @param status WifiNanStatus of the operation. Possible status codes are:
139   *        |NanStatusType.SUCCESS|
140   *        |NanStatusType.INVALID_ARGS|
141   *        |NanStatusType.INTERNAL_FAILURE|
142   *        |NanStatusType.INVALID_SESSION_ID|
143   *        |NanStatusType.INVALID_PEER_ID|
144   *        |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
145   */
146  oneway notifyTransmitFollowupResponse(CommandIdShort id, WifiNanStatus status);
147
148  /**
149   * Asynchronous callback invoked in response to a create data interface request
150   * |IWifiNanIface.createDataInterfaceRequest|.
151   *
152   * @param cmdId command Id corresponding to the original request.
153   * @param status WifiNanStatus of the operation. Possible status codes are:
154   *        |NanStatusType.SUCCESS|
155   *        |NanStatusType.INVALID_ARGS|
156   *        |NanStatusType.INTERNAL_FAILURE|
157   */
158  oneway notifyCreateDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);
159
160  /**
161   * Asynchronous callback invoked in response to a delete data interface request
162   * |IWifiNanIface.deleteDataInterfaceRequest|.
163   *
164   * @param cmdId command Id corresponding to the original request.
165   * @param status WifiNanStatus of the operation. Possible status codes are:
166   *        |NanStatusType.SUCCESS|
167   *        |NanStatusType.INVALID_ARGS|
168   *        |NanStatusType.INTERNAL_FAILURE|
169   */
170  oneway notifyDeleteDataInterfaceResponse(CommandIdShort id, WifiNanStatus status);
171
172  /**
173   * Asynchronous callback invoked in response to an initiate data path request
174   * |IWifiNanIface.initiateDataPathRequest|.
175   *
176   * @param cmdId command Id corresponding to the original request.
177   * @param status WifiNanStatus of the operation. Possible status codes are:
178   *        |NanStatusType.SUCCESS|
179   *        |NanStatusType.INVALID_ARGS|
180   *        |NanStatusType.INTERNAL_FAILURE|
181   *        |NanStatusType.PROTOCOL_FAILURE|
182   *        |NanStatusType.INVALID_PEER_ID|
183   * @param ndpInstanceId ID of the new data path being negotiated (on successful status).
184   */
185  oneway notifyInitiateDataPathResponse(CommandIdShort id, WifiNanStatus status,
186        uint32_t ndpInstanceId );
187
188  /**
189   * Asynchronous callback invoked in response to a respond to data path indication request
190   * |IWifiNanIface.respondToDataPathIndicationRequest|.
191   *
192   * @param cmdId command Id corresponding to the original request.
193   * @param status WifiNanStatus of the operation. Possible status codes are:
194   *        |NanStatusType.SUCCESS|
195   *        |NanStatusType.INVALID_ARGS|
196   *        |NanStatusType.INTERNAL_FAILURE|
197   *        |NanStatusType.PROTOCOL_FAILURE|
198   *        |NanStatusType.INVALID_NDP_ID|
199   */
200  oneway notifyRespondToDataPathIndicationResponse(CommandIdShort id, WifiNanStatus status);
201
202  /**
203   * Asynchronous callback invoked in response to a terminate data path request
204   * |IWifiNanIface.terminateDataPathRequest|.
205   *
206   * @param cmdId command Id corresponding to the original request.
207   * @param status WifiNanStatus of the operation. Possible status codes are:
208   *        |NanStatusType.SUCCESS|
209   *        |NanStatusType.INVALID_ARGS|
210   *        |NanStatusType.INTERNAL_FAILURE|
211   *        |NanStatusType.PROTOCOL_FAILURE|
212   *        |NanStatusType.INVALID_NDP_ID|
213   */
214  oneway notifyTerminateDataPathResponse(CommandIdShort id, WifiNanStatus status);
215
216  /**
217   * Callbacks for the various asynchornous NAN Events.
218   */
219
220  /**
221   * Asynchronous callback indicating that a cluster event has been received.
222   *
223   * @param event: NanClusterEventInd containing event details.
224   */
225  oneway eventClusterEvent(NanClusterEventInd event);
226
227  /**
228   * Asynchronous callback indicating that a NAN has been disabled.
229   *
230   * @param status: WifiNanStatus describing the reason for the disable event.
231   *                Possible status codes are:
232   *                |NanStatusType.SUCCESS|
233   *                |NanStatusType.UNSUPPORTED_CONCURRENCY_NAN_DISABLED|
234   */
235  oneway eventDisabled(WifiNanStatus status);
236
237  /**
238   * Asynchronous callback indicating that an active publish session has terminated.
239   *
240   * @param sessionId: The discovery session ID of the terminated session.
241   * @param status: WifiNanStatus describing the reason for the session termination.
242   *                Possible status codes are:
243   *                |NanStatusType.SUCCESS|
244   */
245  oneway eventPublishTerminated(uint8_t sessionId, WifiNanStatus status);
246
247  /**
248   * Asynchronous callback indicating that an active subscribe session has terminated.
249   *
250   * @param sessionId: The discovery session ID of the terminated session.
251   * @param status: WifiNanStatus describing the reason for the session termination.
252   *                 Possible status codes are:
253   *                |NanStatusType.SUCCESS|
254   */
255  oneway eventSubscribeTerminated(uint8_t sessionId, WifiNanStatus status);
256
257  /**
258   * Asynchronous callback indicating that a match has occurred: i.e. a service has been
259   * discovered.
260   *
261   * @param event: NanMatchInd containing event details.
262   */
263  oneway eventMatch(NanMatchInd event);
264
265  /**
266   * Asynchronous callback indicating that a previously discovered match (service) has expired.
267   *
268   * @param discoverySessionId: The discovery session ID of the expired match.
269   * @param peerId: The peer ID of the expired match.
270   */
271  oneway eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId);
272
273  /**
274   * Asynchronous callback indicating that a followup message has been received from a peer.
275   *
276   * @param event: NanFollowupReceivedInd containing event details.
277   */
278  oneway eventFollowupReceived(NanFollowupReceivedInd event);
279
280  /**
281   * Asynchronous callback providing status on a completed followup message transmit operation.
282   *
283   * @param cmdId command Id corresponding to the original |transmitFollowupRequest| request.
284   * @param status WifiNanStatus of the operation.  Possible status codes are:
285   *               |NanStatusType.SUCCESS|
286   *               |NanStatusType.NO_OTA_ACK|
287   *               |NanStatusType.PROTOCOL_FAILURE|
288   */
289  oneway eventTransmitFollowup(CommandIdShort id, WifiNanStatus status);
290
291  /**
292   * Asynchronous callback indicating a data-path (NDP) setup has been requested by an Initiator
293   * peer (received by the intended Respodner).
294   *
295   * @param event: NanDataPathRequestInd containing event details.
296   */
297  oneway eventDataPathRequest(NanDataPathRequestInd event);
298
299  /**
300   * Asynchronous callback indicating a data-path (NDP) setup has been completed: received by
301   * both Initiator and Responder.
302   *
303   * @param event: NanDataPathConfirmInd containing event details.
304   */
305  oneway eventDataPathConfirm(NanDataPathConfirmInd event);
306
307  /**
308   * Asynchronous callback indicating a list of data-paths (NDP) have been terminated: received by
309   * both Initiator and Responder.
310   *
311   * @param ndpInstanceId: data-path ID of the terminated data-path.
312   */
313  oneway eventDataPathTerminated(uint32_t ndpInstanceId);
314};
315