public class BackgroundScanScheduler extends Object
This class takes a series of scan requests and formulates the best hardware level scanning schedule it can to try and satisfy requests. The hardware level accepts a series of buckets, where each bucket represents a set of channels and an interval to scan at. This scheduler operates as follows:
Each new request is placed in the best predefined bucket. Once all requests have been added the last buckets (lower priority) are placed in the next best bucket until the number of buckets is less than the number supported by the hardware.
Finally, the scheduler creates a WifiNative.ScanSettings from the list of buckets which may be passed through the Wifi HAL.
This class is not thread safe.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_AP_PER_SCAN |
static int |
DEFAULT_MAX_BUCKETS |
static int |
DEFAULT_MAX_CHANNELS_PER_BUCKET |
static int |
DEFAULT_MAX_SCANS_TO_BATCH |
Constructor and Description |
---|
BackgroundScanScheduler(ChannelHelper channelHelper) |
Modifier and Type | Method and Description |
---|---|
WifiScanner.ScanData[] |
filterResultsForSettings(WifiScanner.ScanData[] scanDatas,
WifiScanner.ScanSettings settings)
Returns a filtered version of the scan results from the chip that represents only the data
requested in the settings.
|
int |
getMaxApPerScan() |
int |
getMaxBatch() |
int |
getMaxBuckets() |
int |
getMaxChannelsPerBucket() |
WifiNative.ScanSettings |
getSchedule()
Retrieves the current scanning schedule.
|
int |
getScheduledBucket(WifiScanner.ScanSettings settings)
Retrieves the max time period bucket idx at which this setting was scheduled
|
void |
setMaxApPerScan(int maxApPerScan) |
void |
setMaxBatch(int maxBatch) |
void |
setMaxBuckets(int maxBuckets) |
void |
setMaxChannelsPerBucket(int maxChannels) |
boolean |
shouldReportFullScanResultForSettings(ScanResult result,
int bucketsScanned,
WifiScanner.ScanSettings settings)
Returns true if the given scan result should be reported to a listener with the given
settings.
|
void |
updateSchedule(Collection<WifiScanner.ScanSettings> requests)
Updates the schedule from the given set of requests.
|
public static final int DEFAULT_MAX_BUCKETS
public static final int DEFAULT_MAX_CHANNELS_PER_BUCKET
public static final int DEFAULT_MAX_SCANS_TO_BATCH
public static final int DEFAULT_MAX_AP_PER_SCAN
public BackgroundScanScheduler(ChannelHelper channelHelper)
public int getMaxBuckets()
public void setMaxBuckets(int maxBuckets)
public int getMaxChannelsPerBucket()
public void setMaxChannelsPerBucket(int maxChannels)
public int getMaxBatch()
public void setMaxBatch(int maxBatch)
public int getMaxApPerScan()
public void setMaxApPerScan(int maxApPerScan)
public void updateSchedule(Collection<WifiScanner.ScanSettings> requests)
public WifiNative.ScanSettings getSchedule()
public boolean shouldReportFullScanResultForSettings(ScanResult result, int bucketsScanned, WifiScanner.ScanSettings settings)
public WifiScanner.ScanData[] filterResultsForSettings(WifiScanner.ScanData[] scanDatas, WifiScanner.ScanSettings settings)
public int getScheduledBucket(WifiScanner.ScanSettings settings)