1163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius/*
2163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * Copyright (C) 2008 The Android Open Source Project
3163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius *
4163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * Licensed under the Apache License, Version 2.0 (the "License");
5163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * you may not use this file except in compliance with the License.
6163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * You may obtain a copy of the License at
7163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius *
8163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius *      http://www.apache.org/licenses/LICENSE-2.0
9163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius *
10163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * Unless required by applicable law or agreed to in writing, software
11163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * distributed under the License is distributed on an "AS IS" BASIS,
12163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * See the License for the specific language governing permissions and
14163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * limitations under the License.
15163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius */
16163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
17163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piuspackage com.android.server.wifi.p2p;
18163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
19163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piusimport android.net.wifi.p2p.WifiP2pConfig;
20163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piusimport android.net.wifi.p2p.WifiP2pGroup;
21163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piusimport android.net.wifi.p2p.WifiP2pGroupList;
22163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piusimport android.net.wifi.p2p.nsd.WifiP2pServiceInfo;
23163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
24163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius/**
25163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * Native calls for bring up/shut down of the supplicant daemon and for
26163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * sending requests to the supplicant daemon
27163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius *
28163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius * {@hide}
29163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius */
30163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Piuspublic class WifiP2pNative {
31163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    private final String mTAG;
32163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    private final String mInterfaceName;
33163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    private final SupplicantP2pIfaceHal mSupplicantP2pIfaceHal;
34163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
35163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public WifiP2pNative(String interfaceName, SupplicantP2pIfaceHal p2pIfaceHal) {
36163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        mTAG = "WifiP2pNative-" + interfaceName;
37163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        mInterfaceName = interfaceName;
38163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        mSupplicantP2pIfaceHal = p2pIfaceHal;
39163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
40163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
41163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String getInterfaceName() {
42163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mInterfaceName;
43163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
44163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
45163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
46163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Enable verbose logging for all sub modules.
47163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
48163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public void enableVerboseLogging(int verbose) {
49163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
50163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
51163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /********************************************************
52163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Supplicant operations
53163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     ********************************************************/
54163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
55163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This method is called repeatedly until the connection to wpa_supplicant is established.
56163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
57163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if connection is established, false otherwise.
58163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * TODO: Add unit tests for these once we remove the legacy code.
59163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
60163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean connectToSupplicant() {
61163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        // Start initialization if not already started.
62163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        if (!mSupplicantP2pIfaceHal.isInitializationStarted()
63163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius                && !mSupplicantP2pIfaceHal.initialize()) {
64163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius            return false;
65163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        }
66163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        // Check if the initialization is complete.
67163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.isInitializationComplete();
68163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
69163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
70163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
71163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Close supplicant connection.
72163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
73163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public void closeSupplicantConnection() {
74163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        // Nothing to do for HIDL.
75163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
76163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
77163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
78163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set WPS device name.
79163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
80163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param name String to be set.
81163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if request is sent successfully, false otherwise.
82163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
83163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setDeviceName(String name) {
84163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setWpsDeviceName(name);
85163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
86163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
87163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
88163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Populate list of available networks or update existing list.
89163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
90163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if list has been modified.
91163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
92163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pListNetworks(WifiP2pGroupList groups) {
93163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.loadGroups(groups);
94163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
95163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
96163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
97163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Initiate WPS Push Button setup.
98163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * The PBC operation requires that a button is also pressed at the
99163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * AP/Registrar at about the same time (2 minute window).
100163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
101163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
102163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
103163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
104163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
105163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean startWpsPbc(String iface, String bssid) {
106163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.startWpsPbc(iface, bssid);
107163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
108163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
109163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
110163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Initiate WPS Pin Keypad setup.
111163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
112163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
113163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param pin 8 digit pin to be used.
114163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
115163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
116163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean startWpsPinKeypad(String iface, String pin) {
117163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.startWpsPinKeypad(iface, pin);
118163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
119163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
120163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
121163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Initiate WPS Pin Display setup.
122163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
123163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
124163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
125163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return generated pin if operation was successful, null otherwise.
126163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
127163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String startWpsPinDisplay(String iface, String bssid) {
128163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.startWpsPinDisplay(iface, bssid);
129163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
130163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
131163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
132163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Remove network with provided id.
133163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
134163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param netId Id of the network to lookup.
135163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
136163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
137163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean removeP2pNetwork(int netId) {
138163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.removeNetwork(netId);
139163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
140163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
141163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
142163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set WPS device name.
143163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
144163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param name String to be set.
145163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if request is sent successfully, false otherwise.
146163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
147163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pDeviceName(String name) {
148163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setWpsDeviceName(name);
149163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
150163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
151163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
152163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set WPS device type.
153163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
154163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param type Type specified as a string. Used format: <categ>-<OUI>-<subcateg>
155163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if request is sent successfully, false otherwise.
156163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
157163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pDeviceType(String type) {
158163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setWpsDeviceType(type);
159163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
160163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
161163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
162163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set WPS config methods
163163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
164163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param cfg List of config methods.
165163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if request is sent successfully, false otherwise.
166163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
167163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setConfigMethods(String cfg) {
168163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setWpsConfigMethods(cfg);
169163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
170163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
171163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
172163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set the postfix to be used for P2P SSID's.
173163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
174163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param postfix String to be appended to SSID.
175163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
176163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
177163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
178163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pSsidPostfix(String postfix) {
179163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setSsidPostfix(postfix);
180163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
181163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
182163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
183163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set the Maximum idle time in seconds for P2P groups.
184163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This value controls how long a P2P group is maintained after there
185163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * is no other members in the group. As a group owner, this means no
186163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * associated stations in the group. As a P2P client, this means no
187163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * group owner seen in scan results.
188163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
189163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
190163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param time Timeout value in seconds.
191163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
192163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
193163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
194163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pGroupIdle(String iface, int time) {
195163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setGroupIdle(iface, time);
196163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
197163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
198163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
199163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Turn on/off power save mode for the interface.
200163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
201163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
202163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param enabled Indicate if power save is to be turned on/off.
203163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
204163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
205163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
206163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pPowerSave(String iface, boolean enabled) {
207163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setPowerSave(iface, enabled);
208163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
209163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
210163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
211163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Enable/Disable Wifi Display.
212163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
213163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param enable true to enable, false to disable.
214163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
215163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
216163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setWfdEnable(boolean enable) {
217163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.enableWfd(enable);
218163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
219163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
220163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
221163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set Wifi Display device info.
222163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
223163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param hex WFD device info as described in section 5.1.2 of WFD technical
224163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        specification v1.0.0.
225163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
226163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
227163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setWfdDeviceInfo(String hex) {
228163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setWfdDeviceInfo(hex);
229163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
230163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
231163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
232163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Initiate a P2P service discovery indefinitely.
233163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Will trigger {@link WifiP2pMonitor#P2P_DEVICE_FOUND_EVENT} on finding devices.
234163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
235163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
236163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
237163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pFind() {
238163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return p2pFind(0);
239163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
240163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
241163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
242163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Initiate a P2P service discovery with a (optional) timeout.
243163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
244163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param timeout Max time to be spent is peforming discovery.
245163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        Set to 0 to indefinely continue discovery untill and explicit
246163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        |stopFind| is sent.
247163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
248163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
249163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pFind(int timeout) {
250163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.find(timeout);
251163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
252163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
253163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
254163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Stop an ongoing P2P service discovery.
255163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
256163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
257163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
258163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pStopFind() {
259163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.stopFind();
260163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
261163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
262163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
263163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Configure Extended Listen Timing.
264163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
265163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * If enabled, listen state must be entered every |intervalInMillis| for at
266163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * least |periodInMillis|. Both values have acceptable range of 1-65535
267163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * (with interval obviously having to be larger than or equal to duration).
268163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * If the P2P module is not idle at the time the Extended Listen Timing
269163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * timeout occurs, the Listen State operation must be skipped.
270163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
271163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param enable Enables or disables listening.
272163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param period Period in milliseconds.
273163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param interval Interval in milliseconds.
274163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
275163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
276163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
277163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pExtListen(boolean enable, int period, int interval) {
278163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.configureExtListen(enable, period, interval);
279163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
280163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
281163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
282163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set P2P Listen channel.
283163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
284163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * When specifying a social channel on the 2.4 GHz band (1/6/11) there is no
285163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * need to specify the operating class since it defaults to 81. When
286163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * specifying a social channel on the 60 GHz band (2), specify the 60 GHz
287163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * operating class (180).
288163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
289163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param lc Wifi channel. eg, 1, 6, 11.
290163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param oc Operating Class indicates the channel set of the AP
291163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        indicated by this BSSID
292163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
293163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
294163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
295163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pSetChannel(int lc, int oc) {
296163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setListenChannel(lc, oc);
297163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
298163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
299163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
300163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Flush P2P peer table and state.
301163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
302163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
303163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
304163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pFlush() {
305163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.flush();
306163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
307163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
308163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
309163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Start P2P group formation with a discovered P2P peer. This includes
310163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * optional group owner negotiation, group interface setup, provisioning,
311163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * and establishing data connection.
312163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
313163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param config Configuration to use to connect to remote device.
314163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param joinExistingGroup Indicates that this is a command to join an
315163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        existing group as a client. It skips the group owner negotiation
316163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        part. This must send a Provision Discovery Request message to the
317163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        target group owner before associating for WPS provisioning.
318163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
319163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return String containing generated pin, if selected provision method
320163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        uses PIN.
321163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
322163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String p2pConnect(WifiP2pConfig config, boolean joinExistingGroup) {
323163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.connect(config, joinExistingGroup);
324163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
325163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
326163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
327163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Cancel an ongoing P2P group formation and joining-a-group related
328163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * operation. This operation unauthorizes the specific peer device (if any
329163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * had been authorized to start group formation), stops P2P find (if in
330163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * progress), stops pending operations for join-a-group, and removes the
331163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * P2P group interface (if one was used) that is in the WPS provisioning
332163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * step. If the WPS provisioning step has been completed, the group is not
333163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * terminated.
334163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
335163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
336163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
337163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pCancelConnect() {
338163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.cancelConnect();
339163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
340163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
341163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
342163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Send P2P provision discovery request to the specified peer. The
343163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * parameters for this command are the P2P device address of the peer and the
344163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * desired configuration method.
345163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
346163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param config Config class describing peer setup.
347163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
348163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
349163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
350163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pProvisionDiscovery(WifiP2pConfig config) {
351163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.provisionDiscovery(config);
352163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
353163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
354163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
355163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set up a P2P group owner manually.
356163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This is a helper method that invokes groupAdd(networkId, isPersistent) internally.
357163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
358163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param persistent Used to request a persistent group to be formed.
359163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
360163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
361163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
362163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pGroupAdd(boolean persistent) {
363163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.groupAdd(persistent);
364163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
365163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
366163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
367163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set up a P2P group owner manually (i.e., without group owner
368163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * negotiation with a specific peer). This is also known as autonomous
369163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * group owner.
370163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
371163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param netId Used to specify the restart of a persistent group.
372163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
373163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
374163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
375163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pGroupAdd(int netId) {
376163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.groupAdd(netId, true);
377163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
378163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
379163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
380163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Terminate a P2P group. If a new virtual network interface was used for
381163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * the group, it must also be removed. The network interface name of the
382163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * group interface is used as a parameter for this command.
383163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
384163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param iface Group interface name to use.
385163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
386163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
387163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pGroupRemove(String iface) {
388163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.groupRemove(iface);
389163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
390163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
391163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
392163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Reject connection attempt from a peer (specified with a device
393163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * address). This is a mechanism to reject a pending group owner negotiation
394163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * with a peer and request to automatically block any further connection or
395163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * discovery of the peer.
396163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
397163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param deviceAddress MAC address of the device to reject.
398163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
399163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
400163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
401163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pReject(String deviceAddress) {
402163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.reject(deviceAddress);
403163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
404163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
405163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
406163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Invite a device to a persistent group.
407163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * If the peer device is the group owner of the persistent group, the peer
408163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * parameter is not needed. Otherwise it is used to specify which
409163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * device to invite. |goDeviceAddress| parameter may be used to override
410163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * the group owner device address for Invitation Request should it not be
411163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * known for some reason (this should not be needed in most cases).
412163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
413163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param group Group object to use.
414163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param deviceAddress MAC address of the device to invite.
415163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
416163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
417163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
418163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pInvite(WifiP2pGroup group, String deviceAddress) {
419163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.invite(group, deviceAddress);
420163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
421163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
422163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
423163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Reinvoke a device from a persistent group.
424163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
425163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param netId Used to specify the persistent group.
426163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param deviceAddress MAC address of the device to reinvoke.
427163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
428163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
429163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
430163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pReinvoke(int netId, String deviceAddress) {
431163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.reinvoke(netId, deviceAddress);
432163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
433163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
434163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
435163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Gets the operational SSID of the device.
436163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
437163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param deviceAddress MAC address of the peer.
438163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
439163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return SSID of the device.
440163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
441163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String p2pGetSsid(String deviceAddress) {
442163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getSsid(deviceAddress);
443163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
444163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
445163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
446163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Gets the MAC address of the device.
447163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
448163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return MAC address of the device.
449163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
450163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String p2pGetDeviceAddress() {
451163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getDeviceAddress();
452163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
453163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
454163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
455163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Gets the capability of the group which the device is a
456163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * member of.
457163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
458163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param deviceAddress MAC address of the peer.
459163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
460163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return combination of |GroupCapabilityMask| values.
461163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
462163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public int getGroupCapability(String deviceAddress) {
463163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getGroupCapability(deviceAddress);
464163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
465163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
466163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
467163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This command can be used to add a upnp/bonjour service.
468163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
469163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param servInfo List of service queries.
470163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
471163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
472163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
473163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pServiceAdd(WifiP2pServiceInfo servInfo) {
474163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.serviceAdd(servInfo);
475163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
476163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
477163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
478163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This command can be used to remove a upnp/bonjour service.
479163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
480163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param servInfo List of service queries.
481163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
482163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
483163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
484163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pServiceDel(WifiP2pServiceInfo servInfo) {
485163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.serviceRemove(servInfo);
486163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
487163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
488163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
489163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * This command can be used to flush all services from the
490163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * device.
491163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
492163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return boolean value indicating whether operation was successful.
493163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
494163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pServiceFlush() {
495163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.serviceFlush();
496163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
497163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
498163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
499163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Schedule a P2P service discovery request. The parameters for this command
500163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * are the device address of the peer device (or 00:00:00:00:00:00 for
501163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * wildcard query that is sent to every discovered P2P peer that supports
502163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * service discovery) and P2P Service Query TLV(s) as hexdump.
503163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
504163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param addr MAC address of the device to discover.
505163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param query Hex dump of the query data.
506163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return identifier Identifier for the request. Can be used to cancel the
507163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *         request.
508163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
509163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String p2pServDiscReq(String addr, String query) {
510163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.requestServiceDiscovery(addr, query);
511163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
512163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
513163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
514163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Cancel a previous service discovery request.
515163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
516163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param id Identifier for the request to cancel.
517163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
518163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
519163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean p2pServDiscCancelReq(String id) {
520163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.cancelServiceDiscovery(id);
521163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
522163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
523163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
524163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Send driver command to set Miracast mode.
525163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
526163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param mode Mode of Miracast.
527163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        0 = disabled
528163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        1 = operating as source
529163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *        2 = operating as sink
530163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
531163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public void setMiracastMode(int mode) {
532163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        mSupplicantP2pIfaceHal.setMiracastMode(mode);
533163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
534163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
535163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
536163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Get NFC handover request message.
537163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
538163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return select message if created successfully, null otherwise.
539163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
540163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String getNfcHandoverRequest() {
541163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getNfcHandoverRequest();
542163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
543163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
544163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
545163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Get NFC handover select message.
546163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
547163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return select message if created successfully, null otherwise.
548163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
549163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String getNfcHandoverSelect() {
550163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getNfcHandoverSelect();
551163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
552163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
553163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
554163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Report NFC handover select message.
555163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
556163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if reported successfully, false otherwise.
557163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
558163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean initiatorReportNfcHandover(String selectMessage) {
559163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.initiatorReportNfcHandover(selectMessage);
560163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
561163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
562163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
563163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Report NFC handover request message.
564163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
565163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true if reported successfully, false otherwise.
566163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
567163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean responderReportNfcHandover(String requestMessage) {
568163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.responderReportNfcHandover(requestMessage);
569163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
570163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
571163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
572163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set the client list for the provided network.
573163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
574163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param netId Id of the network.
575163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return  Space separated list of clients if successfull, null otherwise.
576163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
577163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public String getP2pClientList(int netId) {
578163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.getClientList(netId);
579163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
580163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
581163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
582163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Set the client list for the provided network.
583163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
584163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param netId Id of the network.
585163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @param list Space separated list of clients.
586163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true, if operation was successful.
587163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
588163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean setP2pClientList(int netId, String list) {
589163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.setClientList(netId, list);
590163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
591163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius
592163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    /**
593163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * Save the current configuration to p2p_supplicant.conf.
594163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     *
595163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     * @return true on success, false otherwise.
596163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius     */
597163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    public boolean saveConfig() {
598163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius        return mSupplicantP2pIfaceHal.saveConfig();
599163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius    }
600163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius}
601