1/*
2 * Copyright (C) 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.net.wifi;
18
19import android.net.wifi.IApInterface;
20import android.net.wifi.IClientInterface;
21import android.net.wifi.IInterfaceEventCallback;
22
23// Service interface that exposes primitives for controlling the WiFi
24// subsystems of a device.
25interface IWificond {
26
27    // Create a network interface suitable for use as an AP.
28    @nullable IApInterface createApInterface(@utf8InCpp String iface_name);
29
30    // Create a network interface suitable for use as a WiFi client.
31    @nullable IClientInterface createClientInterface(@utf8InCpp String iface_name);
32
33    // Remove a previously created AP network interface.
34    boolean tearDownApInterface(@utf8InCpp String iface_name);
35
36    // Remove a previously created STA network interface.
37    boolean tearDownClientInterface(@utf8InCpp String iface_name);
38
39    // Tear down all existing interfaces.  This should enable clients to create
40    // future interfaces immediately after this method returns.
41    void tearDownInterfaces();
42
43    // @return list of the currently configured IClientInterface instances.
44    List<IBinder> GetClientInterfaces();
45
46    // @return list of the currently configured IApInterface instances.
47    List<IBinder> GetApInterfaces();
48
49    // Returns an array of available frequencies for 2.4GHz channels.
50    // Returrns null on failure.
51    @nullable int[] getAvailable2gChannels();
52
53    // Returns an array of available frequencies for 5GHz non-DFS channels.
54    // Returrns null on failure.
55    @nullable int[] getAvailable5gNonDFSChannels();
56
57    // Returns an array of available frequencies for DFS channels.
58    // This also includes passive only frequecies which are not for DFS channels.
59    // Returrns null on failure.
60    @nullable int[] getAvailableDFSChannels();
61
62    // Enable wpa_supplicant.
63    // Returns true if supplicant was successfully enabled,
64    // or is already enabled.
65    boolean enableSupplicant();
66
67    // Disable wpa_supplicant.
68    // Returns true if supplicant was successfully disabled,
69    // or is already disabled.
70    boolean disableSupplicant();
71
72    // Register a callback to receive interface status updates.
73    //
74    // Multiple callbacks can be registered simultaneously.
75    // Duplicate registrations of the same callback will be ignored.
76    //
77    // @param callback object to add to the set of registered callbacks.
78    oneway void RegisterCallback(IInterfaceEventCallback callback);
79
80    // Remove a callback from the set of registered callbacks.
81    //
82    // This must be the same instance as previously registered.
83    // Requests to remove unknown callbacks will be ignored.
84    //
85    // @param callback object to remove from the set of registered callbacks.
86    oneway void UnregisterCallback(IInterfaceEventCallback callback);
87}
88