aidl/android/net/wifi/IANQPDoneCallback.aidl \
aidl/android/net/wifi/IClientInterface.aidl \
aidl/android/net/wifi/IInterfaceEventCallback.aidl \
+ aidl/android/net/wifi/IPnoScanEvent.aidl \
aidl/android/net/wifi/IRttClient.aidl \
aidl/android/net/wifi/IRttController.aidl \
aidl/android/net/wifi/IScanEvent.aidl \
--- /dev/null
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.wifi;
+
+// A callback for receiving pno scanning events.
+interface IPnoScanEvent {
+ oneway void OnPnoNetworkFound();
+}
package android.net.wifi;
+import android.net.wifi.IPnoScanEvent;
import android.net.wifi.IScanEvent;
import com.android.server.wifi.wificond.NativeScanResult;
import com.android.server.wifi.wificond.PnoSettings;
// Request a single scan using a SingleScanSettings parcelable object.
boolean scan(in SingleScanSettings scanSettings);
- // Subscribe the scanning events.
+ // Subscribe single scanning events.
// Scanner assumes there is only one subscriber.
// This call will replace any existing |handler|.
void subscribeScanEvents(IScanEvent handler);
- // Unsubscribe the scanning events .
+ // Unsubscribe single scanning events .
void unsubscribeScanEvents();
+ // Subscribe Pno scanning events.
+ // Scanner assumes there is only one subscriber.
+ // This call will replace any existing |handler|.
+ void subscribePnoScanEvents(IPnoScanEvent handler);
+
+ // Unsubscribe Pno scanning events .
+ void unsubscribePnoScanEvents();
+
// Request a scheduled scan.
boolean startPnoScan(in PnoSettings pnoSettings);
#include "wificond/scanning/scan_utils.h"
using android::binder::Status;
+using android::net::wifi::IPnoScanEvent;
using android::net::wifi::IScanEvent;
using android::String16;
using android::sp;
<< " This subscription request will unsubscribe it";
}
scan_event_handler_ = handler;
+ // Subscribe one-shot scan result notification.
scan_utils_->SubscribeScanResultNotification(
interface_index_,
std::bind(&ScannerImpl::OnScanResultsReady,
}
Status ScannerImpl::unsubscribeScanEvents() {
+
scan_utils_->UnsubscribeScanResultNotification(interface_index_);
scan_event_handler_ = nullptr;
return Status::ok();
}
+
+Status ScannerImpl::subscribePnoScanEvents(const sp<IPnoScanEvent>& handler) {
+ if (pno_scan_event_handler_ != nullptr) {
+ LOG(ERROR) << "Found existing pno scan events subscriber."
+ << " This subscription request will unsubscribe it";
+ }
+ pno_scan_event_handler_ = handler;
+
+ // Subscribe scheduled scan result notification.
+ scan_utils_->SubscribeSchedScanResultNotification(
+ interface_index_,
+ std::bind(&ScannerImpl::OnSchedScanResultsReady,
+ this,
+ _1));
+
+ return Status::ok();
+}
+
+Status ScannerImpl::unsubscribePnoScanEvents() {
+ scan_utils_->UnsubscribeSchedScanResultNotification(interface_index_);
+ pno_scan_event_handler_ = nullptr;
+ return Status::ok();
+}
+
void ScannerImpl::OnScanResultsReady(
uint32_t interface_index,
bool aborted,
}
}
+void ScannerImpl::OnSchedScanResultsReady(uint32_t interface_index) {
+ if (pno_scan_event_handler_ != nullptr) {
+ pno_scan_event_handler_->OnPnoNetworkFound();
+ }
+}
+
} // namespace wificond
} // namespace android
const ::com::android::server::wifi::wificond::SingleScanSettings&
scan_settings,
bool* out_success) override;
- ::android::binder::Status subscribeScanEvents(
- const ::android::sp<::android::net::wifi::IScanEvent>& handler) override;
- ::android::binder::Status unsubscribeScanEvents() override;
::android::binder::Status startPnoScan(
const ::com::android::server::wifi::wificond::PnoSettings& pno_settings,
bool* out_success) override;
::android::binder::Status stopPnoScan(bool* out_success) override;
+
+ ::android::binder::Status subscribeScanEvents(
+ const ::android::sp<::android::net::wifi::IScanEvent>& handler) override;
+ ::android::binder::Status unsubscribeScanEvents() override;
+ ::android::binder::Status subscribePnoScanEvents(
+ const ::android::sp<::android::net::wifi::IPnoScanEvent>& handler) override;
+ ::android::binder::Status unsubscribePnoScanEvents() override;
void Invalidate() { valid_ = false; }
private:
bool aborted,
std::vector<std::vector<uint8_t>>& ssids,
std::vector<uint32_t>& frequencies);
+ void OnSchedScanResultsReady(uint32_t interface_index);
bool valid_;
uint32_t interface_index_;
const WiphyFeatures wiphy_features_;
ScanUtils* scan_utils_;
+ ::android::sp<::android::net::wifi::IPnoScanEvent> pno_scan_event_handler_;
::android::sp<::android::net::wifi::IScanEvent> scan_event_handler_;
DISALLOW_COPY_AND_ASSIGN(ScannerImpl);