Skip to content

Commit

Permalink
Merge branch 'wps_chg' of github.com:gururaajar/networkmanager into w…
Browse files Browse the repository at this point in the history
…ps_chg
  • Loading branch information
Gururaaja E S R authored and Gururaaja E S R committed Nov 24, 2024
2 parents abd1e5b + 3dbb26b commit 03c7c95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions NetworkManagerGnomeWIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ namespace WPEFramework
long timeDiff;

if(!wpsStop.load()){
if(!createClientNewConnection())
if(!this->createClientNewConnection())
return;
std::string wpaCliCommand = "wpa_cli -i " + std::string(nmUtils::wlanIface()) + " wps_pbc";
fp = popen(wpaCliCommand.c_str(), "r");
Expand Down Expand Up @@ -1051,7 +1051,7 @@ namespace WPEFramework
else if(security == "WPA2-PSK")
wifiData.security = Exchange::INetworkManager::WIFISecurityMode::WIFI_SECURITY_WPA2_PSK_AES;
}
if(wifiConnect(wifiData))
if(this->wifiConnect(wifiData))
NMLOG_INFO("WPS connected successfully");
else
NMLOG_ERROR("WPS connect failed");
Expand All @@ -1062,23 +1062,22 @@ namespace WPEFramework

bool wifiManager::initiateWPS()
{
NMLOG_INFO ("Start WPS %s", __FUNCTION__);
wpsStop.store(false);
job = Core::ProxyType<Core::IDispatch>(Core::ProxyType<Core::IDispatch>(Core::ProxyType<Job>::Create([&]() {
NMLOG_INFO ("Start WPS %s", __FUNCTION__);
wpsAction();
})));
Core::IWorkerPool::Instance().Submit(job);
if (wpsThread.joinable()) {
wpsThread.join();
}
wpsThread = std::thread(&wifiManager::wpsAction, this);
return true;
}

bool wifiManager::cancelWPS()
{
wpsStop.store(true);
NMLOG_INFO ("Stop WPS %s", __FUNCTION__);
/*sleep(2);
NMLOG_INFO ("Initiated revoke");
Core::IWorkerPool::Instance().Revoke(job);
NMLOG_INFO ("Revoke completed");*/
wpsStop.store(true);
if (wpsThread.joinable()) {
wpsThread.join();
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion NetworkManagerGnomeWIFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ namespace WPEFramework
void operator=(wifiManager const&) = delete;

bool createClientNewConnection();
Core::ProxyType<Core::IDispatch> job;
std::atomic<bool> wpsStop = {false};
std::thread wpsThread;

public:
NMClient *client;
Expand Down

0 comments on commit 03c7c95

Please sign in to comment.