Skip to content

Commit

Permalink
Revert "RDKE-352 - Add StartWPS in GNOME libnm (rdkcentral#28)"
Browse files Browse the repository at this point in the history
This reverts commit 24b26f5.
  • Loading branch information
cmuhammedrafi committed Nov 28, 2024
1 parent 0d445ea commit a46304e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 76 deletions.
12 changes: 2 additions & 10 deletions NetworkManagerGnomeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,21 +790,13 @@ namespace WPEFramework

uint32_t NetworkManagerImplementation::StartWPS(const WiFiWPS& method /* @in */, const string& wps_pin /* @in */)
{
uint32_t rc = Core::ERROR_NONE;
if(wifi->initiateWPS())
NMLOG_INFO ("startWPS success");
else
rc = Core::ERROR_RPC_CALL_FAILED;
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
return rc;
}

uint32_t NetworkManagerImplementation::StopWPS(void)
{
uint32_t rc = Core::ERROR_NONE;
if(wifi->cancelWPS())
NMLOG_INFO ("cancelWPS success");
else
rc = Core::ERROR_RPC_CALL_FAILED;
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
return rc;
}

Expand Down
64 changes: 0 additions & 64 deletions NetworkManagerGnomeWIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,8 @@
#include "NetworkManagerGnomeUtils.h"
#include "NetworkManagerImplementation.h"

using namespace std;
namespace WPEFramework
{
class Job : public Core::IDispatch {
public:
Job(function<void()> work)
: _work(work)
{
}
void Dispatch() override
{
_work();
}

private:
function<void()> _work;
};
namespace Plugin
{
extern NetworkManagerImplementation* _instance;
Expand Down Expand Up @@ -944,55 +929,6 @@ namespace WPEFramework
return false;
}

bool wifiManager::initiateWPS()
{
Core::IWorkerPool::Instance().Submit(Core::ProxyType<Core::IDispatch>(Core::ProxyType<Job>::Create([&]() {
const GPtrArray *aps;
int count = 1, wpsConnected = 0;
if(!createClientNewConnection())
return;

sleep(10); /* As we will get the ap info with NM_802_11_AP_FLAGS_WPS_PBC set after pressing the PBC button.
So we are waiting for 10 seconds here*/
do{
if(wifiScanRequest(""))
{
aps = nm_device_wifi_get_access_points(NM_DEVICE_WIFI(getNmDevice()));
for (guint i = 0; i < aps->len; i++) {
NMAccessPoint *ap = static_cast<NMAccessPoint *>(g_ptr_array_index(aps, i));

guint32 flags = nm_access_point_get_flags(ap);

NMLOG_INFO("AP Flags: 0x%x\n", flags);

if (flags & NM_802_11_AP_FLAGS_WPS_PBC) {
Exchange::INetworkManager::WiFiConnectTo wifiData;
GBytes *ssid;
ssid = nm_access_point_get_ssid(ap);
gsize size;
const guint8 *ssidData = static_cast<const guint8 *>(g_bytes_get_data(ssid, &size));
std::string ssidTmp(reinterpret_cast<const char *>(ssidData), size);
wifiData.ssid = ssidTmp.c_str();
NMLOG_INFO("connected ssid: %s", ssidTmp.c_str());
if(wifiConnect(wifiData))
wpsConnected = 1;
break;
}
}
}
sleep(3); /* Waiting time between successive scan */
count++;
}while(count <= 3 && !wpsConnected);
NMLOG_INFO("Completed scanning and wpsconnect status = %d", wpsConnected);
})));
return true;
}

bool wifiManager::cancelWPS()
{
return true;
}

static void deviceManagedCb(GObject *object, GAsyncResult *result, gpointer user_data)
{
wifiManager *_wifiManager = static_cast<wifiManager *>(user_data);
Expand Down
2 changes: 0 additions & 2 deletions NetworkManagerGnomeWIFI.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ namespace WPEFramework
bool removeKnownSSID(const string& ssid);
bool quit(NMDevice *wifiNMDevice);
bool wait(GMainLoop *loop, int timeOutMs = 10000); // default maximium set as 10 sec
bool initiateWPS();
bool cancelWPS();
bool setInterfaceState(std::string interface, bool enabled);
private:
NMDevice *getNmDevice();
Expand Down

0 comments on commit a46304e

Please sign in to comment.