#include <android-base/logging.h>
#include <wifi_system/supplicant_manager.h>
-#include <wifi_system/wifi.h>
#include "wificond/client_interface_binder.h"
#include "wificond/net/mlme_event.h"
using android::wifi_system::InterfaceTool;
using android::wifi_system::SupplicantManager;
+using std::endl;
using std::string;
using std::unique_ptr;
using std::vector;
}
void MlmeEventHandlerImpl::OnConnect(unique_ptr<MlmeConnectEvent> event) {
- if (event->GetStatusCode() == 0) {
+ if (!event->IsTimeout() && event->GetStatusCode() == 0) {
client_interface_->is_associated_ = true;
client_interface_->RefreshAssociateFreq();
client_interface_->bssid_ = event->GetBSSID();
} else {
+ if (event->IsTimeout()) {
+ LOG(INFO) << "Connect timeout";
+ }
client_interface_->is_associated_ = false;
client_interface_->bssid_.clear();
}
}
void MlmeEventHandlerImpl::OnAssociate(unique_ptr<MlmeAssociateEvent> event) {
- if (event->GetStatusCode() == 0) {
+ if (!event->IsTimeout() && event->GetStatusCode() == 0) {
client_interface_->is_associated_ = true;
client_interface_->RefreshAssociateFreq();
client_interface_->bssid_ = event->GetBSSID();
} else {
+ if (event->IsTimeout()) {
+ LOG(INFO) << "Associate timeout";
+ }
client_interface_->is_associated_ = false;
client_interface_->bssid_.clear();
}
return binder_;
}
+void ClientInterfaceImpl::Dump(std::stringstream* ss) const {
+ *ss << "------- Dump of client interface with index: "
+ << interface_index_ << " and name: " << interface_name_
+ << "-------" << endl;
+ *ss << "Max number of ssids for single shot scan: "
+ << static_cast<int>(scan_capabilities_.max_num_scan_ssids) << endl;
+ *ss << "Max number of ssids for scheduled scan: "
+ << static_cast<int>(scan_capabilities_.max_num_sched_scan_ssids) << endl;
+ *ss << "Max number of match sets for scheduled scan: "
+ << static_cast<int>(scan_capabilities_.max_match_sets) << endl;
+ *ss << "Device supports random MAC for single shot scan: "
+ << wiphy_features_.supports_random_mac_oneshot_scan << endl;
+ *ss << "Device supports random MAC for scheduled scan: "
+ << wiphy_features_.supports_random_mac_sched_scan << endl;
+ *ss << "------- Dump End -------" << endl;
+}
+
bool ClientInterfaceImpl::EnableSupplicant() {
return supplicant_manager_->StartSupplicant();
}
return false;
}
-bool ClientInterfaceImpl::IsAssociated() {
+bool ClientInterfaceImpl::IsAssociated() const {
return is_associated_;
}