summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSohani Rao2017-08-17 10:13:09 -0500
committerandroid-build-merger2017-08-17 10:13:09 -0500
commit924ddb7b9b972f28ca9fb8cd3d60d21ff8af6633 (patch)
treed0917db696758963a69f41c4209384d3c0303bfc
parent3a6b1c97650b1a188d3d8357a2f655b043609dfc (diff)
parent64187ec9e8b48b4de5565e8ae1dbf2f2f3e859bd (diff)
downloadsystem-connectivity-wificond-924ddb7b9b972f28ca9fb8cd3d60d21ff8af6633.tar.gz
system-connectivity-wificond-924ddb7b9b972f28ca9fb8cd3d60d21ff8af6633.tar.xz
system-connectivity-wificond-924ddb7b9b972f28ca9fb8cd3d60d21ff8af6633.zip
Wifficond: Implement API to get PNO scan results
am: 64187ec9e8 Change-Id: I667c9f0ac0b0c5d9b99735890d7f79cabce30cc5
-rw-r--r--aidl/android/net/wifi/IWifiScannerImpl.aidl6
-rw-r--r--scanning/scanner_impl.cpp21
-rw-r--r--scanning/scanner_impl.h8
3 files changed, 33 insertions, 2 deletions
diff --git a/aidl/android/net/wifi/IWifiScannerImpl.aidl b/aidl/android/net/wifi/IWifiScannerImpl.aidl
index da0ca2d..e83b79c 100644
--- a/aidl/android/net/wifi/IWifiScannerImpl.aidl
+++ b/aidl/android/net/wifi/IWifiScannerImpl.aidl
@@ -35,9 +35,13 @@ interface IWifiScannerImpl {
35 // Returrns null on failure. 35 // Returrns null on failure.
36 @nullable int[] getAvailableDFSChannels(); 36 @nullable int[] getAvailableDFSChannels();
37 37
38 // Get the latest scan results from kernel. 38 // Get the latest single scan results from kernel.
39 NativeScanResult[] getScanResults(); 39 NativeScanResult[] getScanResults();
40 40
41 // Get the latest pno scan results from the interface which has most recently
42 // completed disconnected mode PNO scans
43 NativeScanResult[] getPnoScanResults();
44
41 // Request a single scan using a SingleScanSettings parcelable object. 45 // Request a single scan using a SingleScanSettings parcelable object.
42 boolean scan(in SingleScanSettings scanSettings); 46 boolean scan(in SingleScanSettings scanSettings);
43 47
diff --git a/scanning/scanner_impl.cpp b/scanning/scanner_impl.cpp
index e9ff517..308811a 100644
--- a/scanning/scanner_impl.cpp
+++ b/scanning/scanner_impl.cpp
@@ -56,6 +56,8 @@ ScannerImpl::ScannerImpl(uint32_t wiphy_index, uint32_t interface_index,
56 scan_started_(false), 56 scan_started_(false),
57 pno_scan_started_(false), 57 pno_scan_started_(false),
58 offload_scan_supported_(false), 58 offload_scan_supported_(false),
59 pno_scan_running_over_offload_(false),
60 pno_scan_results_from_offload_(false),
59 wiphy_index_(wiphy_index), 61 wiphy_index_(wiphy_index),
60 interface_index_(interface_index), 62 interface_index_(interface_index),
61 scan_capabilities_(scan_capabilities), 63 scan_capabilities_(scan_capabilities),
@@ -166,6 +168,23 @@ Status ScannerImpl::getScanResults(vector<NativeScanResult>* out_scan_results) {
166 return Status::ok(); 168 return Status::ok();
167} 169}
168 170
171Status ScannerImpl::getPnoScanResults(
172 vector<NativeScanResult>* out_scan_results) {
173 if (!CheckIsValid()) {
174 return Status::ok();
175 }
176 if (pno_scan_results_from_offload_) {
177 if (!offload_scan_manager_->getScanResults(out_scan_results)) {
178 LOG(ERROR) << "Failed to get scan results via Offload HAL";
179 }
180 } else {
181 if (!scan_utils_->GetScanResult(interface_index_, out_scan_results)) {
182 LOG(ERROR) << "Failed to get scan results via NL80211";
183 }
184 }
185 return Status::ok();
186}
187
169Status ScannerImpl::scan(const SingleScanSettings& scan_settings, 188Status ScannerImpl::scan(const SingleScanSettings& scan_settings,
170 bool* out_success) { 189 bool* out_success) {
171 if (!CheckIsValid()) { 190 if (!CheckIsValid()) {
@@ -214,6 +233,7 @@ Status ScannerImpl::scan(const SingleScanSettings& scan_settings,
214Status ScannerImpl::startPnoScan(const PnoSettings& pno_settings, 233Status ScannerImpl::startPnoScan(const PnoSettings& pno_settings,
215 bool* out_success) { 234 bool* out_success) {
216 pno_settings_ = pno_settings; 235 pno_settings_ = pno_settings;
236 pno_scan_results_from_offload_ = false;
217 if (offload_scan_supported_ && StartPnoScanOffload(pno_settings)) { 237 if (offload_scan_supported_ && StartPnoScanOffload(pno_settings)) {
218 // scanning over offload succeeded 238 // scanning over offload succeeded
219 *out_success = true; 239 *out_success = true;
@@ -485,6 +505,7 @@ void ScannerImpl::OnOffloadScanResult() {
485 return; 505 return;
486 } 506 }
487 LOG(INFO) << "Offload Scan results received"; 507 LOG(INFO) << "Offload Scan results received";
508 pno_scan_results_from_offload_ = true;
488 if (pno_scan_event_handler_ != nullptr) { 509 if (pno_scan_event_handler_ != nullptr) {
489 pno_scan_event_handler_->OnPnoNetworkFound(); 510 pno_scan_event_handler_->OnPnoNetworkFound();
490 } else { 511 } else {
diff --git a/scanning/scanner_impl.h b/scanning/scanner_impl.h
index e97e967..ff1d50f 100644
--- a/scanning/scanner_impl.h
+++ b/scanning/scanner_impl.h
@@ -54,10 +54,15 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
54 // Returns a vector of available frequencies for DFS channels. 54 // Returns a vector of available frequencies for DFS channels.
55 ::android::binder::Status getAvailableDFSChannels( 55 ::android::binder::Status getAvailableDFSChannels(
56 ::std::unique_ptr<::std::vector<int32_t>>* out_frequencies) override; 56 ::std::unique_ptr<::std::vector<int32_t>>* out_frequencies) override;
57 // Get the latest scan results from kernel. 57 // Get the latest single scan results from kernel.
58 ::android::binder::Status getScanResults( 58 ::android::binder::Status getScanResults(
59 std::vector<com::android::server::wifi::wificond::NativeScanResult>* 59 std::vector<com::android::server::wifi::wificond::NativeScanResult>*
60 out_scan_results) override; 60 out_scan_results) override;
61 // Get the latest pno scan results from the interface that most recently
62 // completed PNO scans
63 ::android::binder::Status getPnoScanResults(
64 std::vector<com::android::server::wifi::wificond::NativeScanResult>*
65 out_scan_results) override;
61 ::android::binder::Status scan( 66 ::android::binder::Status scan(
62 const ::com::android::server::wifi::wificond::SingleScanSettings& 67 const ::com::android::server::wifi::wificond::SingleScanSettings&
63 scan_settings, 68 scan_settings,
@@ -108,6 +113,7 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
108 bool pno_scan_started_; 113 bool pno_scan_started_;
109 bool offload_scan_supported_; 114 bool offload_scan_supported_;
110 bool pno_scan_running_over_offload_; 115 bool pno_scan_running_over_offload_;
116 bool pno_scan_results_from_offload_;
111 ::com::android::server::wifi::wificond::PnoSettings pno_settings_; 117 ::com::android::server::wifi::wificond::PnoSettings pno_settings_;
112 118
113 const uint32_t wiphy_index_; 119 const uint32_t wiphy_index_;