From ff69b162062669773bf26e33b30fb04cfb4623b3 Mon Sep 17 00:00:00 2001 From: mpalan315 Date: Thu, 3 Sep 2026 18:36:20 +0530 Subject: [PATCH 1/4] RDKEMW-24199: GetKnownSSIDs in RDKV returning Empty upon Disconnected Reason for change: GetKnownSSIDs must return stored WiFi Profile information. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com --- plugin/gnome/NetworkManagerGnomeProxy.cpp | 17 ++++----- plugin/rdk/NetworkManagerRDKProxy.cpp | 42 +++++++++++++++++++++-- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/plugin/gnome/NetworkManagerGnomeProxy.cpp b/plugin/gnome/NetworkManagerGnomeProxy.cpp index 7c877f5f..4fd0fccd 100644 --- a/plugin/gnome/NetworkManagerGnomeProxy.cpp +++ b/plugin/gnome/NetworkManagerGnomeProxy.cpp @@ -766,19 +766,14 @@ namespace WPEFramework std::list ssidList; if(wifi->getKnownSSIDs(ssidList)) { - if (!ssidList.empty()) - { - ssids = Core::Service::Create(ssidList); - if(ssids == nullptr) { - return Core::ERROR_GENERAL; - } - rc = Core::ERROR_NONE; - } - else - { + if (ssidList.empty()) NMLOG_INFO("known ssids not found !"); - rc = Core::ERROR_GENERAL; + + ssids = Core::Service::Create(ssidList); + if(ssids == nullptr) { + return Core::ERROR_GENERAL; } + rc = Core::ERROR_NONE; } return rc; diff --git a/plugin/rdk/NetworkManagerRDKProxy.cpp b/plugin/rdk/NetworkManagerRDKProxy.cpp index e8be4680..059d384a 100644 --- a/plugin/rdk/NetworkManagerRDKProxy.cpp +++ b/plugin/rdk/NetworkManagerRDKProxy.cpp @@ -21,6 +21,7 @@ #include "NetworkManagerRDKProxy.h" #include "libIBus.h" #include +#include using namespace WPEFramework; using namespace WPEFramework::Plugin; @@ -35,6 +36,10 @@ namespace WPEFramework { NetworkManagerImplementation* _instance = nullptr; + /* SSIDs reported by the last scan; used when there is no connected SSID */ + static Core::CriticalSection gScannedSsidsLock; + static std::set gScannedSsids; + Exchange::INetworkManager::WiFiState to_wifi_state(WiFiStatusCode_t code) { switch (code) { @@ -261,6 +266,7 @@ namespace WPEFramework } JsonArray ssids = eventDocument["getAvailableSSIDs"].Array(); + std::set scannedSsids; for (int i = 0; i < ssids.Length(); i++) { @@ -272,7 +278,19 @@ namespace WPEFramework newObject["strength"] = object["signalStrength"]; newObject["frequency"] = object["frequency"]; ssidsUpdated.Add(newObject); + + string scannedSsid = object["ssid"].String(); + if (!scannedSsid.empty()) + scannedSsids.insert(scannedSsid); + } + + if (!scannedSsids.empty()) + { + gScannedSsidsLock.Lock(); + gScannedSsids = scannedSsids; + gScannedSsidsLock.Unlock(); } + ::_instance->ReportAvailableSSIDs(ssidsUpdated); break; } @@ -1040,14 +1058,34 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = { memset(¶m, 0, sizeof(param)); - /* Must add new method to get all the known SSIDs but for now RDK-NM supports only one active SSID. So we repurpose this method */ retVal = IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getConnectedSSID, (void *)¶m, sizeof(param)); if(retVal == IARM_RESULT_SUCCESS) { auto &connectedSsid = param.data.getConnectedSSID; std::list ssidList; - ssidList.push_back(string(connectedSsid.ssid)); + + if(connectedSsid.ssid[0] != '\0') + ssidList.push_back(string(connectedSsid.ssid)); + else + { + /* WiFi is disconnected; fall back to the SSIDs found by the last scan */ + gScannedSsidsLock.Lock(); + ssidList.assign(gScannedSsids.begin(), gScannedSsids.end()); + gScannedSsidsLock.Unlock(); + + if (ssidList.empty()) + { + IARM_Bus_WiFiSrvMgr_SsidList_Param_t scanParam{}; + memset(&scanParam, 0, sizeof(scanParam)); + + /* No scan result cached yet; trigger a scan so that the results are available subsequently */ + if (IARM_RESULT_SUCCESS != IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsync, (void *)&scanParam, sizeof(IARM_Bus_WiFiSrvMgr_SsidList_Param_t))) + NMLOG_ERROR ("getAvailableSSIDsAsync failed"); + else + NMLOG_INFO ("known ssids not found; scan started"); + } + } NMLOG_INFO ("GetKnownSSIDs Success"); ssids = Core::Service::Create(ssidList); From 2fd3dd5c6d0eb2eae9419eb70f8b85c675aa4281 Mon Sep 17 00:00:00 2001 From: mpalan315 Date: Thu, 3 Sep 2026 21:30:04 +0530 Subject: [PATCH 2/4] RDKEMW-24199: GetKnownSSIDs in RDKV returning Empty upon Disconnected Reason for change: GetKnownSSIDs must return stored WiFi Profile information. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com --- plugin/rdk/NetworkManagerRDKProxy.cpp | 45 +++------------------------ plugin/rdk/NetworkManagerRDKProxy.h | 1 + 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/plugin/rdk/NetworkManagerRDKProxy.cpp b/plugin/rdk/NetworkManagerRDKProxy.cpp index 059d384a..f0732064 100644 --- a/plugin/rdk/NetworkManagerRDKProxy.cpp +++ b/plugin/rdk/NetworkManagerRDKProxy.cpp @@ -21,7 +21,6 @@ #include "NetworkManagerRDKProxy.h" #include "libIBus.h" #include -#include using namespace WPEFramework; using namespace WPEFramework::Plugin; @@ -36,10 +35,6 @@ namespace WPEFramework { NetworkManagerImplementation* _instance = nullptr; - /* SSIDs reported by the last scan; used when there is no connected SSID */ - static Core::CriticalSection gScannedSsidsLock; - static std::set gScannedSsids; - Exchange::INetworkManager::WiFiState to_wifi_state(WiFiStatusCode_t code) { switch (code) { @@ -266,7 +261,6 @@ namespace WPEFramework } JsonArray ssids = eventDocument["getAvailableSSIDs"].Array(); - std::set scannedSsids; for (int i = 0; i < ssids.Length(); i++) { @@ -278,17 +272,6 @@ namespace WPEFramework newObject["strength"] = object["signalStrength"]; newObject["frequency"] = object["frequency"]; ssidsUpdated.Add(newObject); - - string scannedSsid = object["ssid"].String(); - if (!scannedSsid.empty()) - scannedSsids.insert(scannedSsid); - } - - if (!scannedSsids.empty()) - { - gScannedSsidsLock.Lock(); - gScannedSsids = scannedSsids; - gScannedSsidsLock.Unlock(); } ::_instance->ReportAvailableSSIDs(ssidsUpdated); @@ -1058,34 +1041,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = { memset(¶m, 0, sizeof(param)); - retVal = IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getConnectedSSID, (void *)¶m, sizeof(param)); + /* Must add new method to get all the known SSIDs but for now RDK-NM supports only one saved SSID. */ + retVal = IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getPairedSSID, (void *)¶m, sizeof(param)); if(retVal == IARM_RESULT_SUCCESS) { - auto &connectedSsid = param.data.getConnectedSSID; + auto &pairedSsid = param.data.getPairedSSID; std::list ssidList; - - if(connectedSsid.ssid[0] != '\0') - ssidList.push_back(string(connectedSsid.ssid)); - else - { - /* WiFi is disconnected; fall back to the SSIDs found by the last scan */ - gScannedSsidsLock.Lock(); - ssidList.assign(gScannedSsids.begin(), gScannedSsids.end()); - gScannedSsidsLock.Unlock(); - - if (ssidList.empty()) - { - IARM_Bus_WiFiSrvMgr_SsidList_Param_t scanParam{}; - memset(&scanParam, 0, sizeof(scanParam)); - - /* No scan result cached yet; trigger a scan so that the results are available subsequently */ - if (IARM_RESULT_SUCCESS != IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsync, (void *)&scanParam, sizeof(IARM_Bus_WiFiSrvMgr_SsidList_Param_t))) - NMLOG_ERROR ("getAvailableSSIDsAsync failed"); - else - NMLOG_INFO ("known ssids not found; scan started"); - } - } + ssidList.push_back(string(pairedSsid.ssid)); NMLOG_INFO ("GetKnownSSIDs Success"); ssids = Core::Service::Create(ssidList); diff --git a/plugin/rdk/NetworkManagerRDKProxy.h b/plugin/rdk/NetworkManagerRDKProxy.h index 4a678d0b..967a38a3 100644 --- a/plugin/rdk/NetworkManagerRDKProxy.h +++ b/plugin/rdk/NetworkManagerRDKProxy.h @@ -357,6 +357,7 @@ typedef struct _IARM_Bus_WiFiSrvMgr_SsidList_Param_t { #define IARM_BUS_WIFI_MGR_API_initiateWPSPairing2 "initiateWPSPairing2" /**< Initiate connection via WPS via either Push Button or PIN */ #define IARM_BUS_WIFI_MGR_API_cancelWPSPairing "cancelWPSPairing" /**< Cancel in-progress WPS */ #define IARM_BUS_WIFI_MGR_API_getConnectedSSID "getConnectedSSID" /**< Return properties of the currently connected SSID */ +#define IARM_BUS_WIFI_MGR_API_getPairedSSID "getPairedSSID" /**< Return the saved SSID */ #define IARM_BUS_WIFI_MGR_API_saveSSID "saveSSID" /**< Save SSID and passphrase */ #define IARM_BUS_WIFI_MGR_API_clearSSID "clearSSID" /**< Clear given SSID */ #define IARM_BUS_WIFI_MGR_API_connect "connect" /**< Connect with given or saved SSID and passphrase */ From cdc40efaeec93ac767b793025212959188cb40f4 Mon Sep 17 00:00:00 2001 From: mpalan315 Date: Tue, 8 Sep 2026 17:58:42 +0530 Subject: [PATCH 3/4] RDKEMW-24199: GetKnownSSIDs in RDKV returning Empty upon Disconnected Reason for change: GetKnownSSIDs must return stored WiFi Profile information. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com --- plugin/gnome/NetworkManagerGnomeProxy.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/gnome/NetworkManagerGnomeProxy.cpp b/plugin/gnome/NetworkManagerGnomeProxy.cpp index 4fd0fccd..04934879 100644 --- a/plugin/gnome/NetworkManagerGnomeProxy.cpp +++ b/plugin/gnome/NetworkManagerGnomeProxy.cpp @@ -767,7 +767,10 @@ namespace WPEFramework if(wifi->getKnownSSIDs(ssidList)) { if (ssidList.empty()) + { NMLOG_INFO("known ssids not found !"); + ssidList.push_back(string()); + } ssids = Core::Service::Create(ssidList); if(ssids == nullptr) { From 33937a8f97c17a2102ed09a9cda72c6d7543af76 Mon Sep 17 00:00:00 2001 From: mpalan315 Date: Wed, 9 Sep 2026 10:34:06 +0530 Subject: [PATCH 4/4] RDKEMW-24199: GetKnownSSIDs in RDKV returning Empty upon Disconnected Reason for change: GetKnownSSIDs must return stored WiFi Profile information. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com --- tests/l2Test/rdk/l2_test_rdkproxy.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/l2Test/rdk/l2_test_rdkproxy.cpp b/tests/l2Test/rdk/l2_test_rdkproxy.cpp index 0d13cace..3f1cca33 100644 --- a/tests/l2Test/rdk/l2_test_rdkproxy.cpp +++ b/tests/l2Test/rdk/l2_test_rdkproxy.cpp @@ -711,11 +711,10 @@ TEST_F(NetworkManagerTest, GetKnownSSIDs_Success) { IARM_Bus_WiFiSrvMgr_Param_t mockParam = {}; mockParam.status = true; - strncpy(mockParam.data.getConnectedSSID.ssid, "TestNetwork", SSID_SIZE - 1); - mockParam.data.getConnectedSSID.securityMode = NET_WIFI_SECURITY_WPA_WPA2_PSK; + strncpy(mockParam.data.getPairedSSID.ssid, "TestNetwork", SSID_SIZE - 1); EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call(::testing::StrEq(IARM_BUS_NM_SRV_MGR_NAME), - ::testing::StrEq(IARM_BUS_WIFI_MGR_API_getConnectedSSID), + ::testing::StrEq(IARM_BUS_WIFI_MGR_API_getPairedSSID), ::testing::NotNull(), ::testing::_)) .WillOnce(::testing::DoAll( ::testing::Invoke([&mockParam](const char*, const char*, void* arg, size_t) { @@ -731,7 +730,7 @@ TEST_F(NetworkManagerTest, GetKnownSSIDs_Success) TEST_F(NetworkManagerTest, GetKnownSSIDs_Failed) { EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call(::testing::StrEq(IARM_BUS_NM_SRV_MGR_NAME), - ::testing::StrEq(IARM_BUS_WIFI_MGR_API_getConnectedSSID), + ::testing::StrEq(IARM_BUS_WIFI_MGR_API_getPairedSSID), ::testing::NotNull(), ::testing::_)) .WillOnce(::testing::Return(IARM_RESULT_IPCCORE_FAIL));