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 
17 package android.net.wifi;
18 
19 import android.net.wifi.IPnoScanEvent;
20 import android.net.wifi.IScanEvent;
21 import com.android.server.wifi.wificond.NativeScanResult;
22 import com.android.server.wifi.wificond.PnoSettings;
23 import com.android.server.wifi.wificond.SingleScanSettings;
24 
25 interface IWifiScannerImpl {
26   // Returns an array of available frequencies for 2.4GHz channels.
27   // Returrns null on failure.
getAvailable2gChannels()28   @nullable int[] getAvailable2gChannels();
29 
30   // Returns an array of available frequencies for 5GHz non-DFS channels.
31   // Returrns null on failure.
getAvailable5gNonDFSChannels()32   @nullable int[] getAvailable5gNonDFSChannels();
33 
34   // Returns an array of available frequencies for DFS channels.
35   // Returrns null on failure.
getAvailableDFSChannels()36   @nullable int[] getAvailableDFSChannels();
37 
38   // Get the latest scan results from kernel.
getScanResults()39   NativeScanResult[] getScanResults();
40 
41   // Request a single scan using a SingleScanSettings parcelable object.
scan(in SingleScanSettings scanSettings)42   boolean scan(in SingleScanSettings scanSettings);
43 
44   // Subscribe single scanning events.
45   // Scanner assumes there is only one subscriber.
46   // This call will replace any existing |handler|.
subscribeScanEvents(IScanEvent handler)47   oneway void subscribeScanEvents(IScanEvent handler);
48 
49   // Unsubscribe single scanning events .
unsubscribeScanEvents()50   oneway void unsubscribeScanEvents();
51 
52   // Subscribe Pno scanning events.
53   // Scanner assumes there is only one subscriber.
54   // This call will replace any existing |handler|.
subscribePnoScanEvents(IPnoScanEvent handler)55   oneway void subscribePnoScanEvents(IPnoScanEvent handler);
56 
57   // Unsubscribe Pno scanning events .
unsubscribePnoScanEvents()58   oneway void unsubscribePnoScanEvents();
59 
60   // Request a scheduled scan.
startPnoScan(in PnoSettings pnoSettings)61   boolean startPnoScan(in PnoSettings pnoSettings);
62 
63   // Stop any existing scheduled scan.
64   // Returns true on success.
65   // Returns false on failure or there is no existing scheduled scan.
stopPnoScan()66   boolean stopPnoScan();
67 
68   // Abort ongoing scan.
abortScan()69   void abortScan();
70 
71   // TODO(nywang) add more interfaces.
72 }
73