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   // Type of scan request. This is used in |SingleScanSettings.scan_type|.
27   const int SCAN_TYPE_LOW_SPAN = 0;
28   const int SCAN_TYPE_LOW_POWER = 1;
29   const int SCAN_TYPE_HIGH_ACCURACY = 2;
30   // Scan type used internally if the device does not support
31   // the type specified in |SingleScanSettings.scan_type|.
32   // Scan requests from framework with this type will be rejected.
33   const int SCAN_TYPE_DEFAULT = -1;
34 
35   // Get the latest single scan results from kernel.
getScanResults()36   NativeScanResult[] getScanResults();
37 
38   // Get the latest pno scan results from the interface which has most recently
39   // completed disconnected mode PNO scans
getPnoScanResults()40   NativeScanResult[] getPnoScanResults();
41 
42   // Request a single scan using a SingleScanSettings parcelable object.
scan(in SingleScanSettings scanSettings)43   boolean scan(in SingleScanSettings scanSettings);
44 
45   // Subscribe single scanning events.
46   // Scanner assumes there is only one subscriber.
47   // This call will replace any existing |handler|.
subscribeScanEvents(IScanEvent handler)48   oneway void subscribeScanEvents(IScanEvent handler);
49 
50   // Unsubscribe single scanning events .
unsubscribeScanEvents()51   oneway void unsubscribeScanEvents();
52 
53   // Subscribe Pno scanning events.
54   // Scanner assumes there is only one subscriber.
55   // This call will replace any existing |handler|.
subscribePnoScanEvents(IPnoScanEvent handler)56   oneway void subscribePnoScanEvents(IPnoScanEvent handler);
57 
58   // Unsubscribe Pno scanning events .
unsubscribePnoScanEvents()59   oneway void unsubscribePnoScanEvents();
60 
61   // Request a scheduled scan.
startPnoScan(in PnoSettings pnoSettings)62   boolean startPnoScan(in PnoSettings pnoSettings);
63 
64   // Stop any existing scheduled scan.
65   // Returns true on success.
66   // Returns false on failure or there is no existing scheduled scan.
stopPnoScan()67   boolean stopPnoScan();
68 
69   // Abort ongoing scan.
abortScan()70   void abortScan();
71 
72   // TODO(nywang) add more interfaces.
73 }
74