ISupplicantP2pIface.hal revision 282a0b35b8cad48ddaa246af597e2f1d94b01a4a
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.supplicant@1.0;
18
19import ISupplicantIface;
20import ISupplicantP2pIfaceCallback;
21
22/**
23 * Interface exposed by the supplicant for each P2P mode network
24 * interface (e.g p2p0) it controls.
25 */
26interface ISupplicantP2pIface extends ISupplicantIface {
27  enum WpsProvisionMethod : uint32_t {
28    /**
29     * Push button method.
30     */
31    PBC,
32    /**
33     * Display pin method configuration - pin is generated and displayed on
34     * device.
35     */
36    DISPLAY,
37    /**
38     * Keypad pin method configuration - pin is entered on device.
39     */
40    KEYPAD
41  };
42
43  enum GroupCapabilityMask : uint32_t {
44    GROUP_OWNER = 1 << 0,
45    PERSISTENT_GROUP = 1 << 1,
46    GROUP_LIMIT = 1 << 2,
47    INTRA_BSS_DIST = 1 << 3,
48    CROSS_CONN = 1 << 4,
49    PERSISTENT_RECONN = 1 << 5,
50    GROUP_FORMATION = 1 << 6
51  };
52
53  /**
54   * Use to specify a range of frequencies.
55   * For example: 2412-2432,2462,5000-6000, etc.
56   */
57  struct FreqRange {
58      uint32_t min;
59      uint32_t max;
60  };
61
62  /**
63   * Register for callbacks from this interface.
64   *
65   * These callbacks are invoked for events that are specific to this interface.
66   * Registration of multiple callback objects is supported. These objects must
67   * be automatically deleted when the corresponding client process is dead or
68   * if this interface is removed.
69   *
70   * @param callback An instance of the |ISupplicantP2pIfaceCallback| HIDL
71   *        interface object.
72   * @return status Status of the operation.
73   *         Possible status codes:
74   *         |SupplicantStatusCode.SUCCESS|,
75   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
76   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
77   */
78  registerCallback(ISupplicantP2pIfaceCallback callback)
79      generates (SupplicantStatus status);
80
81  /**
82   * Gets the MAC address of the device.
83   *
84   * @return status Status of the operation.
85   *         Possible status codes:
86   *         |SupplicantStatusCode.SUCCESS|,
87   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
88   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
89   * @return deviceAddress MAC address of the device.
90   */
91  getDeviceAddress()
92      generates (SupplicantStatus status, MacAddress deviceAddress);
93
94  /**
95   * Set the postfix to be used for P2P SSID's.
96   *
97   * @param postfix String to be appended to SSID.
98   * @return status Status of the operation.
99   *         Possible status codes:
100   *         |SupplicantStatusCode.SUCCESS|,
101   *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
102   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
103   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
104   */
105  setSsidPostfix(vec<uint8_t> postfix) generates (SupplicantStatus status);
106
107  /**
108   * Set the Maximum idle time in seconds for P2P groups.
109   * This value controls how long a P2P group is maintained after there
110   * is no other members in the group. As a group owner, this means no
111   * associated stations in the group. As a P2P client, this means no
112   * group owner seen in scan results.
113   *
114   * @param groupIfName Group interface name to use.
115   * @param timeoutInSec Timeout value in seconds.
116   * @return status Status of the operation.
117   *         Possible status codes:
118   *         |SupplicantStatusCode.SUCCESS|,
119   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
120   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
121   */
122  setGroupIdle(string groupIfName, uint32_t timeoutInSec)
123      generates (SupplicantStatus status);
124
125  /**
126   * Turn on/off power save mode for the interface.
127   *
128   * @param groupIfName Group interface name to use.
129   * @param enable Indicate if power save is to be turned on/off.
130   * @return status Status of the operation.
131   *         Possible status codes:
132   *         |SupplicantStatusCode.SUCCESS|,
133   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
134   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
135   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
136   */
137  setPowerSave(string groupIfName, bool enable)
138      generates (SupplicantStatus status);
139
140  /**
141   * Initiate a P2P service discovery with an optional timeout.
142   *
143   * @param timeoutInSec Max time to be spent is peforming discovery.
144   *        Set to 0 to indefinely continue discovery untill and explicit
145   *        |stopFind| is sent.
146   * @return status Status of the operation.
147   *         Possible status codes:
148   *         |SupplicantStatusCode.SUCCESS|,
149   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
150   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
151   */
152  find(uint32_t timeoutInSec) generates (SupplicantStatus status);
153
154  /**
155   * Stop an ongoing P2P service discovery.
156   *
157   * @return status Status of the operation.
158   *         Possible status codes:
159   *         |SupplicantStatusCode.SUCCESS|,
160   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
161   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
162   */
163  stopFind() generates (SupplicantStatus status);
164
165  /**
166   * Flush P2P peer table and state.
167   *
168   * @return status Status of the operation.
169   *         Possible status codes:
170   *         |SupplicantStatusCode.SUCCESS|,
171   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
172   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
173   */
174  flush() generates (SupplicantStatus status);
175
176  /**
177   * Start P2P group formation with a discovered P2P peer. This includes
178   * optional group owner negotiation, group interface setup, provisioning,
179   * and establishing data connection.
180   *
181   * @param peerAddress MAC address of the device to connect to.
182   * @method provisionMethod Provisioning method to use.
183   * @param preSelectedPin Pin to be used, if |provisionMethod| uses one of the
184   *        preselected |PIN*| methods.
185   * @param joinExistingGroup Indicates that this is a command to join an
186   *        existing group as a client. It skips the group owner negotiation
187   *        part. This must send a Provision Discovery Request message to the
188   *        target group owner before associating for WPS provisioning.
189   * @param persistent Used to request a persistent group to be formed.
190   * @param goIntent Used to override the default Intent for this group owner
191   *        negotiation (Values from 1-15). Refer to section 4.1.6 in
192   *        Wi-Fi Peer-to-Peer (P2P) Technical Specification Version 1.7.
193   * @return status Status of the operation.
194   *         Possible status codes:
195   *         |SupplicantStatusCode.SUCCESS|,
196   *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
197   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
198   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
199   * @return generatedPin Pin generated, if |provisionMethod| uses one of the
200   *         generated |PIN*| methods.
201   */
202  connect(MacAddress peerAddress,
203          WpsProvisionMethod provisionMethod,
204          string preSelectedPin,
205          bool joinExistingGroup,
206          bool persistent,
207          uint32_t goIntent)
208      generates (SupplicantStatus status, string generatedPin);
209
210  /**
211   * Cancel an ongoing P2P group formation and joining-a-group related
212   * operation. This operation unauthorizes the specific peer device (if any
213   * had been authorized to start group formation), stops P2P find (if in
214   * progress), stops pending operations for join-a-group, and removes the
215   * P2P group interface (if one was used) that is in the WPS provisioning
216   * step. If the WPS provisioning step has been completed, the group is not
217   * terminated.
218   *
219   * @return status Status of the operation.
220   *         Possible status codes:
221   *         |SupplicantStatusCode.SUCCESS|,
222   *         |SupplicantStatusCode.FAILURE_NOT_STARTED|,
223   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
224   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
225   */
226  cancelConnect() generates (SupplicantStatus status);
227
228  /**
229   * Send P2P provision discovery request to the specified peer. The
230   * parameters for this command are the P2P device address of the peer and the
231   * desired configuration method.
232   *
233   * @param peerAddress MAC address of the device to send discovery.
234   * @method provisionMethod Provisioning method to use.
235   * @return status Status of the operation.
236   *         Possible status codes:
237   *         |SupplicantStatusCode.SUCCESS|,
238   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
239   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
240   */
241  provisionDiscovery(MacAddress peerAddress,
242                     WpsProvisionMethod provisionMethod)
243      generates (SupplicantStatus status);
244
245  /**
246   * Set up a P2P group owner manually (i.e., without group owner
247   * negotiation with a specific peer). This is also known as autonomous
248   * group owner. Optional |persistent| may be used to specify restart of a
249   * persistent group.
250   *
251   * @param persistent Used to request a persistent group to be formed.
252   * @param persistentNetworkId Used to specify the restart of a persistent
253   *        group.
254   * @return status Status of the operation.
255   *         Possible status codes:
256   *         |SupplicantStatusCode.SUCCESS|,
257   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
258   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
259   */
260  addGroup(bool persistent, SupplicantNetworkId persistentNetworkId)
261      generates (SupplicantStatus status);
262
263  /**
264   * Terminate a P2P group. If a new virtual network interface was used for
265   * the group, it must also be removed. The network interface name of the
266   * group interface is used as a parameter for this command.
267   *
268   * @param groupIfName Group interface name to use.
269   * @return status Status of the operation.
270   *         Possible status codes:
271   *         |SupplicantStatusCode.SUCCESS|,
272   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
273   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
274   */
275  removeGroup(string groupIfName) generates (SupplicantStatus status);
276
277  /**
278   * Reject connection attempt from a peer (specified with a device
279   * address). This is a mechanism to reject a pending group owner negotiation
280   * with a peer and request to automatically block any further connection or
281   * discovery of the peer.
282   *
283   * @param peerAddress MAC address of the device to reject.
284   * @return status Status of the operation.
285   *         Possible status codes:
286   *         |SupplicantStatusCode.SUCCESS|,
287   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
288   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
289   */
290  reject(MacAddress peerAddress) generates (SupplicantStatus status);
291
292  /**
293   * Invite a device to a persistent group.
294   * If the peer device is the group owner of the persistent group, the peer
295   * parameter is not needed. Otherwise it is used to specify which
296   * device to invite. |goDeviceAddress| parameter may be used to override
297   * the group owner device address for Invitation Request should it not be
298   * known for some reason (this should not be needed in most cases).
299   *
300   * @param groupIfName Group interface name to use.
301   * @param goDeviceAddress MAC address of the group owner device.
302   * @param peerAddress MAC address of the device to invite.
303   * @return status Status of the operation.
304   *         Possible status codes:
305   *         |SupplicantStatusCode.SUCCESS|,
306   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
307   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
308   */
309  invite(string groupIfName, MacAddress goDeviceAddress, MacAddress peerAddress)
310      generates (SupplicantStatus status);
311
312  /**
313   * Reinvoke a device from a persistent group.
314   *
315   * @param persistentNetworkId Used to specify the persistent group.
316   * @param peerAddress MAC address of the device to reinvoke.
317   * @return status Status of the operation.
318   *         Possible status codes:
319   *         |SupplicantStatusCode.SUCCESS|,
320   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
321   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
322   */
323  reinvoke(SupplicantNetworkId persistentNetworkId, MacAddress peerAddress)
324      generates (SupplicantStatus status);
325
326  /**
327   * Configure Extended Listen Timing.
328   *
329   * If enabled, listen state must be entered every |intervalInMillis| for at
330   * least |periodInMillis|. Both values have acceptable range of 1-65535
331   * (with interval obviously having to be larger than or equal to duration).
332   * If the P2P module is not idle at the time the Extended Listen Timing
333   * timeout occurs, the Listen State operation must be skipped.
334   *
335   * @param periodInMillis Period in milliseconds.
336   * @param intervalInMillis Interval in milliseconds.
337   * @return status Status of the operation.
338   *         Possible status codes:
339   *         |SupplicantStatusCode.SUCCESS|,
340   *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
341   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
342   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
343   */
344  configureExtListen(bool enable,
345                     uint32_t periodInMillis,
346                     uint32_t intervalInMillis)
347      generates (SupplicantStatus status);
348
349  /**
350   * Set P2P Listen channel.
351   *
352   * When specifying a social channel on the 2.4 GHz band (1/6/11) there is no
353   * need to specify the operating class since it defaults to 81. When
354   * specifying a social channel on the 60 GHz band (2), specify the 60 GHz
355   * operating class (180).
356   *
357   * @param channel Wifi channel. eg, 1, 6, 11.
358   * @param operatingClass Operating Class indicates the channel set of the AP
359   *        indicated by this BSSID
360   * @return status Status of the operation.
361   *         Possible status codes:
362   *         |SupplicantStatusCode.SUCCESS|,
363   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
364   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
365   */
366  setListenChannel(uint32_t channel, uint32_t operatingClass)
367      generates (SupplicantStatus status);
368
369  /**
370   * Set P2P disallowed frequency ranges.
371   *
372   * Specify ranges of frequencies that are disallowed for any p2p operations.
373
374   * @param ranges List of ranges which needs to be disallowed.
375   * @return status Status of the operation.
376   *         Possible status codes:
377   *         |SupplicantStatusCode.SUCCESS|,
378   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
379   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
380   */
381  setDisallowedFrequencies(vec<FreqRange> ranges)
382      generates (SupplicantStatus status);
383
384  /**
385   * Gets the operational SSID of the device.
386   *
387   * @param peerAddress MAC address of the peer.
388   * @return status Status of the operation.
389   *         Possible status codes:
390   *         |SupplicantStatusCode.SUCCESS|,
391   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
392   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
393   * @return ssid SSID of the device
394   */
395  getSsid(MacAddress peerAddress)
396      generates (SupplicantStatus status, Ssid ssid);
397
398  /**
399   * Gets the capability of the group which the device is a
400   * member of.
401   *
402   * @param peerAddress MAC address of the peer.
403   * @return status Status of the operation.
404   *         Possible status codes:
405   *         |SupplicantStatusCode.SUCCESS|,
406   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
407   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
408   * @return capabilityMask Combination of |GroupCapabilityMask| values.
409   */
410  getGroupCapability(MacAddress peerAddress)
411      generates (SupplicantStatus status, uint32_t capabilities);
412
413  /**
414   * This command can be used to add a bonjour service.
415   *
416   * @param query Hex dump of the query data.
417   * @param return Hex dump of the response data.
418   * @return status Status of the operation.
419   *         Possible status codes:
420   *         |SupplicantStatusCode.SUCCESS|,
421   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
422   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
423   */
424  addBonjourService(vec<uint8_t> query, vec<uint8_t> response)
425      generates (SupplicantStatus status);
426
427  /**
428   * This command can be used to remove a bonjour service.
429   *
430   * @param query Hex dump of the query data.
431   * @return status Status of the operation.
432   *         Possible status codes:
433   *         |SupplicantStatusCode.SUCCESS|,
434   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
435   *         |SupplicantStatusCode.FAILURE_NOT_STARTED|,
436   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
437   */
438  removeBonjourService(vec<uint8_t> query) generates (SupplicantStatus status);
439
440  /**
441   * This command can be used to add a UPNP service.
442   *
443   * @param version Version to be used.
444   * @package serviceName Service name to be used.
445   * @return status Status of the operation.
446   *         Possible status codes:
447   *         |SupplicantStatusCode.SUCCESS|,
448   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
449   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
450   */
451  addUpnpService(uint32_t version, string serviceName)
452      generates (SupplicantStatus status);
453
454  /**
455   * This command can be used to remove a UPNP service.
456   *
457   * @param version Version to be used.
458   * @package serviceName Service name to be used.
459   * @return status Status of the operation.
460   *         Possible status codes:
461   *         |SupplicantStatusCode.SUCCESS|,
462   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
463   *         |SupplicantStatusCode.FAILURE_NOT_STARTED|,
464   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
465   */
466  removeUpnpService(uint32_t version, string serviceName)
467      generates (SupplicantStatus status);
468
469  /**
470   * This command can be used to flush all services from the
471   * device.
472   *
473   * @return status Status of the operation.
474   *         Possible status codes:
475   *         |SupplicantStatusCode.SUCCESS|,
476   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
477   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
478   */
479  flushServices(uint32_t version, string serviceName)
480      generates (SupplicantStatus status);
481
482  /**
483   * Schedule a P2P service discovery request. The parameters for this command
484   * are the device address of the peer device (or 00:00:00:00:00:00 for
485   * wildcard query that is sent to every discovered P2P peer that supports
486   * service discovery) and P2P Service Query TLV(s) as hexdump.
487   *
488   * @param peerAddress MAC address of the device to discover.
489   * @param query Hex dump of the query data.
490   * @return status Status of the operation.
491   *         Possible status codes:
492   *         |SupplicantStatusCode.SUCCESS|,
493   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
494   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
495   * @return identifier Identifier for the request. Can be used to cancel the
496   *         request.
497   */
498  requestServiceDiscovery(MacAddress peerAddress, vec<uint8_t> query)
499      generates (SupplicantStatus status, uint64_t identifier);
500
501  /**
502   * Cancel a previous service discovery request.
503   *
504   * @return identifier Identifier for the request to cancel.
505   * @return status Status of the operation.
506   *         Possible status codes:
507   *         |SupplicantStatusCode.SUCCESS|,
508   *         |SupplicantStatusCode.FAILURE_NOT_STARTED|,
509   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
510   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
511   */
512  cancelServiceDiscovery(uint64_t identifier)
513      generates (SupplicantStatus status);
514};
515