summaryrefslogtreecommitdiffstats
path: root/client_interface_impl.cpp
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-09-08 16:57:18 -0700
committerXin Li <delphij@google.com>2020-09-08 16:57:18 -0700
commiteaf7c4998d15c61360bdcd716fb02b33acd8b526 (patch)
tree7535ac3f76cce213db2f66501107c5e68c4830e3 /client_interface_impl.cpp
parent0bcc0e4488989dad285c7664b4cdaa6eaad666d4 (diff)
parent7e90494ad7cd8b2a5f52781a636ae34af1904c97 (diff)
downloadplatform_system_connectivity_wificond-master.tar.gz
platform_system_connectivity_wificond-master.tar.bz2
platform_system_connectivity_wificond-master.zip
Merge Android RHEADmaster
Bug: 168057903 Merged-In: I3b0a326c6381091e8721811fb5ea352e6af1031f Change-Id: Id8a690a46c023b26372220ab8878b86b2b881eeb
Diffstat (limited to 'client_interface_impl.cpp')
-rw-r--r--client_interface_impl.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/client_interface_impl.cpp b/client_interface_impl.cpp
index 3e1cbca..38a59ff 100644
--- a/client_interface_impl.cpp
+++ b/client_interface_impl.cpp
@@ -29,9 +29,9 @@
#include "wificond/scanning/scan_utils.h"
#include "wificond/scanning/scanner_impl.h"
-using android::net::wifi::IClientInterface;
-using android::net::wifi::ISendMgmtFrameEvent;
-using com::android::server::wifi::wificond::NativeScanResult;
+using android::net::wifi::nl80211::IClientInterface;
+using android::net::wifi::nl80211::ISendMgmtFrameEvent;
+using android::net::wifi::nl80211::NativeScanResult;
using android::sp;
using android::wifi_system::InterfaceTool;
@@ -40,6 +40,8 @@ using std::string;
using std::unique_ptr;
using std::vector;
+using namespace std::placeholders;
+
namespace android {
namespace wificond {
@@ -131,6 +133,9 @@ ClientInterfaceImpl::ClientInterfaceImpl(
}
});
+ netlink_utils_->SubscribeChannelSwitchEvent(interface_index_,
+ std::bind(&ClientInterfaceImpl::OnChannelSwitchEvent, this, _1));
+
if (!netlink_utils_->GetWiphyInfo(wiphy_index_,
&band_info_,
&scan_capabilities_,
@@ -154,10 +159,11 @@ ClientInterfaceImpl::~ClientInterfaceImpl() {
scanner_->Invalidate();
netlink_utils_->UnsubscribeFrameTxStatusEvent(interface_index_);
netlink_utils_->UnsubscribeMlmeEvent(interface_index_);
+ netlink_utils_->UnsubscribeChannelSwitchEvent(interface_index_);
if_tool_->SetUpState(interface_name_.c_str(), false);
}
-sp<android::net::wifi::IClientInterface> ClientInterfaceImpl::GetBinder() const {
+sp<android::net::wifi::nl80211::IClientInterface> ClientInterfaceImpl::GetBinder() const {
return binder_;
}
@@ -236,24 +242,6 @@ const std::array<uint8_t, ETH_ALEN>& ClientInterfaceImpl::GetMacAddress() {
return interface_mac_addr_;
}
-bool ClientInterfaceImpl::SetMacAddress(const std::array<uint8_t, ETH_ALEN>& mac) {
- if (!if_tool_->SetWifiUpState(false)) {
- LOG(ERROR) << "SetWifiUpState(false) failed.";
- return false;
- }
- if (!if_tool_->SetMacAddress(interface_name_.c_str(), mac)) {
- LOG(ERROR) << "SetMacAddress(" << interface_name_ << ", "
- << LoggingUtils::GetMacString(mac) << ") failed.";
- return false;
- }
- if (!if_tool_->SetWifiUpState(true)) {
- LOG(ERROR) << "SetWifiUpState(true) failed.";
- return false;
- }
- LOG(DEBUG) << "Successfully SetMacAddress.";
- return true;
-}
-
bool ClientInterfaceImpl::RefreshAssociateFreq() {
// wpa_supplicant fetches associate frequency using the latest scan result.
// We should follow the same method here before we find a better solution.
@@ -269,6 +257,16 @@ bool ClientInterfaceImpl::RefreshAssociateFreq() {
return false;
}
+bool ClientInterfaceImpl::OnChannelSwitchEvent(uint32_t frequency) {
+ if(!frequency) {
+ LOG(ERROR) << "Frequency value is null";
+ return false;
+ }
+ LOG(INFO) << "New channel on frequency: " << frequency;
+ associate_freq_ = frequency;
+ return true;
+}
+
bool ClientInterfaceImpl::IsAssociated() const {
return is_associated_;
}