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 ISupplicantNetwork;
20
21/**
22 * Interface exposed by the supplicant for each network interface (e.g wlan0)
23 * it controls.
24 */
25interface ISupplicantIface {
26  /**
27   * Size limits for some of the params used in this interface.
28   */
29  enum ParamSizeLimits : uint32_t {
30      WPS_DEVICE_NAME_MAX_LEN = 32,
31      WPS_MANUFACTURER_MAX_LEN = 64,
32      WPS_MODEL_NAME_MAX_LEN = 32,
33      WPS_MODEL_NUMBER_MAX_LEN = 32,
34      WPS_SERIAL_NUMBER_MAX_LEN = 32
35  };
36
37  /**
38   * Retrieves the name of the network interface.
39   *
40   * @return status Status of the operation.
41   *         Possible status codes:
42   *         |SupplicantStatusCode.SUCCESS|,
43   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
44   * @return name Name of the network interface, e.g., wlan0
45   */
46  getName() generates (SupplicantStatus status, string name);
47
48  /**
49   * Retrieves the type of the network interface.
50   *
51   * @return status Status of the operation.
52   *         Possible status codes:
53   *         |SupplicantStatusCode.SUCCESS|,
54   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
55   * @return type Type of the network interface, e.g., STA.
56   */
57  getType() generates (SupplicantStatus status, IfaceType type);
58
59  /**
60   * Add a new network to the interface.
61   *
62   * @return status Status of the operation.
63   *         Possible status codes:
64   *         |SupplicantStatusCode.SUCCESS|,
65   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
66   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
67   * @return network HIDL interface object representing the new network if
68   *         successful, null otherwise.
69   */
70  addNetwork()
71      generates (SupplicantStatus status, ISupplicantNetwork network);
72
73  /**
74   * Remove a network from the interface.
75   *
76   * Use |ISupplicantNetwork.getId()| on the corresponding network HIDL
77   * interface object to retrieve the ID.
78   *
79   * @param id Network ID allocated to the corresponding network.
80   * @return status Status of the operation.
81   *         Possible status codes:
82   *         |SupplicantStatusCode.SUCCESS|,
83   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
84   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
85   *         |SupplicantStatusCode.FAILURE_NETWORK_UNKNOWN|
86   */
87  removeNetwork(SupplicantNetworkId id)
88      generates (SupplicantStatus status);
89
90  /**
91   * Gets a HIDL interface object for the network corresponding to the
92   * |SupplicantNetworkId|.
93   *
94   * Use |ISupplicantNetwork.getId()| on the corresponding network HIDL
95   * interface object to retrieve the ID.
96   *
97   * @param id Network ID allocated to the corresponding network.
98   * @return status Status of the operation.
99   *         Possible status codes:
100   *         |SupplicantStatusCode.SUCCESS|,
101   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
102   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
103   *         |SupplicantStatusCode.FAILURE_NETWORK_UNKNOWN|
104   * @return network HIDL interface object representing the new network if
105   *         successful, null otherwise.
106   */
107  getNetwork(SupplicantNetworkId id)
108      generates (SupplicantStatus status, ISupplicantNetwork network);
109
110  /**
111   * Retrieve a list of all the network Id's controlled by the supplicant.
112   *
113   * The corresponding |ISupplicantNetwork| object for any network can be
114   * retrieved using |getNetwork| method.
115   *
116   * @return status Status of the operation.
117   *         Possible status codes:
118   *         |SupplicantStatusCode.SUCCESS|,
119   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
120   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
121   * @return networkIds List of all network Id's controlled by the supplicant.
122   */
123  listNetworks()
124      generates (SupplicantStatus status, vec<SupplicantNetworkId> networkIds);
125
126  /**
127   * Set the device name for WPS operations.
128   * User-friendly description of device (up to |WPS_DEVICE_NAME_MAX_LEN|
129   * octets encoded in UTF-8).
130   *
131   * @parm name Name to be set.
132   * @return status Status of the operation.
133   *         Possible status codes:
134   *         |SupplicantStatusCode.SUCCESS|,
135   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
136   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
137   */
138  setWpsDeviceName(string name) generates (SupplicantStatus status);
139
140  /**
141   * Set the device type for WPS operations.
142   *
143   * @parm type Type of device. Refer to section B.1 of Wifi P2P
144   *       Technical specification v1.2.
145   * @return status Status of the operation.
146   *         Possible status codes:
147   *         |SupplicantStatusCode.SUCCESS|,
148   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
149   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
150   */
151  setWpsDeviceType(uint8_t[8] type) generates (SupplicantStatus status);
152
153  /**
154   * Set the manufacturer for WPS operations.
155   * The manufacturer of the device (up to |WPS_MANUFACTURER_MAX_LEN| ASCII
156   * characters).
157   *
158   * @parm manufacturer Manufacture to be set.
159   * @return status Status of the operation.
160   *         Possible status codes:
161   *         |SupplicantStatusCode.SUCCESS|,
162   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
163   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
164   */
165  setWpsManufacturer(string manufacturer) generates (SupplicantStatus status);
166
167  /**
168   * Set the model name for WPS operations.
169   * Model of the device (up to |WPS_MODEL_NAME_MAX_LEN| ASCII characters).
170   *
171   * @parm modelName Model name to be set.
172   * @return status Status of the operation.
173   *         Possible status codes:
174   *         |SupplicantStatusCode.SUCCESS|,
175   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
176   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
177   */
178  setWpsModelName(string modelName) generates (SupplicantStatus status);
179
180  /**
181   * Set the model number for WPS operations.
182   * Additional device description (up to |WPS_MODEL_NUMBER_MAX_LEN| ASCII
183   * characters).
184   *
185   * @parm modelNumber Model number to be set.
186   * @return status Status of the operation.
187   *         Possible status codes:
188   *         |SupplicantStatusCode.SUCCESS|,
189   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
190   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
191   */
192  setWpsModelNumber(string modelNumber) generates (SupplicantStatus status);
193
194  /**
195   * Set the serial number for WPS operations.
196   * Serial number of the device (up to |WPS_SERIAL_NUMBER_MAX_LEN| characters)
197   *
198   * @parm serialNumber Serial number to be set.
199   * @return status Status of the operation.
200   *         Possible status codes:
201   *         |SupplicantStatusCode.SUCCESS|,
202   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
203   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
204   */
205  setWpsSerialNumber(string serialNumber) generates (SupplicantStatus status);
206
207  /**
208   * Set the list of supported config methods for WPS operations.
209   *
210   * @param configMethods Mask of WPS configuration methods supported by the
211   *        device.
212   * @return status Status of the operation.
213   *         Possible status codes:
214   *         |SupplicantStatusCode.SUCCESS|,
215   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
216   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
217   */
218  setWpsConfigMethods(bitfield<WpsConfigMethods> configMethods)
219      generates (SupplicantStatus status);
220};
221