Skip to content

Commit

Permalink
DELIA-65343 : Devices went to offline plui state after the initial ch…
Browse files Browse the repository at this point in the history
…ange (rdkcentral#5375)

* DELIA-65343 : Devices went to offline plui state after the initial change

Reason for change: Updated with review comments
Test Procedure: Do CDL and confirm the device boots up in online state
Risks: Low
Priority: P1
Signed-off-by: Gururaaja ESR <[email protected]>
  • Loading branch information
gururaajar authored Jun 3, 2024
1 parent 2bda9e6 commit 98c2984
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions NetworkManager/LegacyPlugin_NetworkAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ using namespace WPEFramework::Plugin;
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 0
#define NETWORK_MANAGER_CALLSIGN "org.rdk.NetworkManager.1"
#define SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS 5000

#define LOGINFOMETHOD() { string json; parameters.ToString(json); NMLOG_TRACE("Legacy params=%s", json.c_str() ); }
#define LOGTRACEMETHODFIN() { string json; response.ToString(json); NMLOG_TRACE("Legacy response=%s", json.c_str() ); }
Expand Down Expand Up @@ -117,13 +118,13 @@ namespace WPEFramework
reinterpret_cast<const uint8_t*>(payload.c_str()),
token)
== Core::ERROR_NONE) {
std::cout << "DisplaySettings got security token" << std::endl;
NMLOG_TRACE("Network plugin got security token");
} else {
std::cout << "DisplaySettings failed to get security token" << std::endl;
NMLOG_WARNING("Network plugin failed to get security token");
}
security->Release();
} else {
std::cout << "No security agent" << std::endl;
NMLOG_INFO("Network plugin: No security agent");
}

string query = "token=" + token;
Expand All @@ -148,7 +149,7 @@ namespace WPEFramework
Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T("127.0.0.1:9998")));
m_networkmanager = make_shared<WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement> >(_T(NETWORK_MANAGER_CALLSIGN), _T(NETWORK_MANAGER_CALLSIGN), false, query);

m_timer.start(5000);
m_timer.start(SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS);
return string();
}

Expand Down Expand Up @@ -776,6 +777,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = {
uint32_t errCode = Core::ERROR_GENERAL;
if (m_networkmanager)
{
/** ToDo: Don't subscribe for other events when one of the event subscription fails **/
errCode = m_networkmanager->Subscribe<JsonObject>(1000, _T("onInterfaceStateChange"), &Network::onInterfaceStateChange);
if (errCode != Core::ERROR_NONE)
{
Expand Down
10 changes: 6 additions & 4 deletions NetworkManager/LegacyPlugin_WiFiManagerAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ using namespace WPEFramework::Plugin;
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 0
#define NETWORK_MANAGER_CALLSIGN "org.rdk.NetworkManager.1"
#define SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS 5000

#define LOGINFOMETHOD() { string json; parameters.ToString(json); NMLOG_TRACE("Legacy params=%s", json.c_str() ); }
#define LOGTRACEMETHODFIN() { string json; response.ToString(json); NMLOG_TRACE("Legacy response=%s", json.c_str() ); }
Expand Down Expand Up @@ -116,13 +117,13 @@ namespace WPEFramework
reinterpret_cast<const uint8_t*>(payload.c_str()),
token)
== Core::ERROR_NONE) {
std::cout << "DisplaySettings got security token" << std::endl;
NMLOG_TRACE("WiFi manager plugin got security token");
} else {
std::cout << "DisplaySettings failed to get security token" << std::endl;
NMLOG_WARNING("WiFi manager plugin failed to get security token");
}
security->Release();
} else {
std::cout << "No security agent" << std::endl;
NMLOG_INFO("WiFi manager plugin: No security agent");
}

string query = "token=" + token;
Expand All @@ -146,7 +147,7 @@ namespace WPEFramework
Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T("127.0.0.1:9998")));
m_networkmanager = make_shared<WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement> >(_T(NETWORK_MANAGER_CALLSIGN), _T(NETWORK_MANAGER_CALLSIGN), false, query);

m_timer.start(5000);
m_timer.start(SUBSCRIPTION_TIMEOUT_IN_MILLISECONDS);
return string();
}

Expand Down Expand Up @@ -490,6 +491,7 @@ namespace WPEFramework
void WiFiManager::subscribeToEvents(void)
{
uint32_t errCode = Core::ERROR_GENERAL;
/** ToDo: Don't subscribe for other events when one of the event subscription fails **/
if (m_networkmanager)
{
errCode = m_networkmanager->Subscribe<JsonObject>(1000, _T("onWiFiStateChange"), &WiFiManager::onWiFiStateChange);
Expand Down
2 changes: 1 addition & 1 deletion docs/api/NetworkPlugin.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Generated automatically, DO NOT EDIT! -->
<a name="NetworkPlugin"></a>
<a name="NetworkPlugin"></a>(Deprecated)
# NetworkPlugin

**Version: [1.3.9](https://github.com/rdkcentral/rdkservices/blob/main/Network/CHANGELOG.md)**
Expand Down
2 changes: 1 addition & 1 deletion docs/api/WifiPlugin.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Generated automatically, DO NOT EDIT! -->
<a name="Wifi_Plugin"></a>
<a name="Wifi_Plugin"></a>(Deprecated)
# Wifi Plugin

**Version: [1.0.9](https://github.com/rdkcentral/rdkservices/blob/main/WifiManager/CHANGELOG.md)**
Expand Down

0 comments on commit 98c2984

Please sign in to comment.