From 195f802e24c0f5c34d77104fb3dc5a15dcd884de Mon Sep 17 00:00:00 2001
From: RAFI <103924677+cmuhammedrafi@users.noreply.github.com>
Date: Tue, 19 Nov 2024 22:13:49 +0530
Subject: [PATCH] DELIA-66876 : Fxing onWifiSignalThresholdChanged and
onDefaultInterfaceChanged EventData (#36)
* The onWifiSignalThresholdChanged and onDefaultInterfaceChanged events are posted with empty/null event data. Fixing it
* Updated the release version
---
CMakeLists.txt | 2 +-
LegacyPlugin_NetworkAPIs.cpp | 12 ++++++------
LegacyPlugin_WiFiManagerAPIs.cpp | 10 +++++-----
NetworkManager.json | 2 +-
WiFiSignalStrengthMonitor.cpp | 7 +++----
docs/NetworkManagerPlugin.md | 4 ++--
6 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb91a4bd..e2c1dacb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ find_package(WPEFramework)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(VERSION_MAJOR 0)
set(VERSION_MINOR 5)
-set(VERSION_PATCH 1)
+set(VERSION_PATCH 2)
add_compile_definitions(NETWORKMANAGER_MAJOR_VERSION=${VERSION_MAJOR})
add_compile_definitions(NETWORKMANAGER_MINOR_VERSION=${VERSION_MINOR})
diff --git a/LegacyPlugin_NetworkAPIs.cpp b/LegacyPlugin_NetworkAPIs.cpp
index 64a6c04f..1919c3b1 100644
--- a/LegacyPlugin_NetworkAPIs.cpp
+++ b/LegacyPlugin_NetworkAPIs.cpp
@@ -1014,10 +1014,10 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = {
{
JsonObject legacyParams;
- legacyParams["oldInterfaceName"] = getInterfaceNameToType(parameters["oldInterfaceName"].String());
- legacyParams["newInterfaceName"] = getInterfaceNameToType(parameters["newInterfaceName"].String());
+ legacyParams["oldInterfaceName"] = getInterfaceNameToType(parameters["prevActiveInterface"].String());
+ legacyParams["newInterfaceName"] = getInterfaceNameToType(parameters["currentActiveInterface"].String());
- m_defaultInterface = parameters["newInterfaceName"].String();
+ m_defaultInterface = parameters["currentActiveInterface"].String();
string json;
legacyParams.ToString(json);
@@ -1032,7 +1032,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = {
JsonObject legacyParams;
legacyParams["interface"] = getInterfaceNameToType(parameters["interface"].String());
- if (parameters["isIPv6"].Boolean())
+ if (parameters["ipversion"].String() == "IPv6")
{
legacyParams["ip6Address"] = parameters["ipaddress"];
}
@@ -1049,8 +1049,8 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = {
Notify("onIPAddressStatusChanged", legacyParams);
- if ("ACQUIRED" == parameters["status"].String())
- m_defaultInterface = parameters["interface"].String();
+ // if ("ACQUIRED" == parameters["status"].String())
+ // m_defaultInterface = parameters["interface"].String();
return;
}
diff --git a/LegacyPlugin_WiFiManagerAPIs.cpp b/LegacyPlugin_WiFiManagerAPIs.cpp
index ba0c6427..5dada6b2 100644
--- a/LegacyPlugin_WiFiManagerAPIs.cpp
+++ b/LegacyPlugin_WiFiManagerAPIs.cpp
@@ -697,7 +697,7 @@ namespace WPEFramework
}
}
else
- NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
+ NMLOG_WARNING("Ignoring %s", __FUNCTION__);
return;
}
@@ -710,7 +710,7 @@ namespace WPEFramework
if(_gWiFiInstance)
_gWiFiInstance->Notify("onAvailableSSIDs", parameters);
else
- NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
+ NMLOG_WARNING("Ignoring %s", __FUNCTION__);
return;
}
@@ -718,8 +718,8 @@ namespace WPEFramework
void WiFiManager::onWiFiSignalStrengthChange(const JsonObject& parameters)
{
JsonObject legacyParams;
- legacyParams["signalStrength"] = parameters["signalQuality"];
- legacyParams["strength"] = parameters["signalLevel"];
+ legacyParams["signalStrength"] = parameters["strength"];
+ legacyParams["strength"] = parameters["quality"];
string json;
legacyParams.ToString(json);
@@ -727,7 +727,7 @@ namespace WPEFramework
if (_gWiFiInstance)
_gWiFiInstance->Notify("onWifiSignalThresholdChanged", legacyParams);
else
- NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
+ NMLOG_WARNING("Ignoring %s", __FUNCTION__);
return;
}
diff --git a/NetworkManager.json b/NetworkManager.json
index e7f5c534..fc96137e 100644
--- a/NetworkManager.json
+++ b/NetworkManager.json
@@ -9,7 +9,7 @@
"status": "development",
"description": "A Unified `NetworkManager` plugin that allows you to manage Ethernet and Wifi interfaces on the device.",
"sourcelocation": "https://github.com/rdkcentral/networkmanager/blob/main/NetworkManager.json",
- "version": "0.5.1"
+ "version": "0.5.2"
},
"definitions": {
"success": {
diff --git a/WiFiSignalStrengthMonitor.cpp b/WiFiSignalStrengthMonitor.cpp
index 27243b3b..32aaa4c9 100644
--- a/WiFiSignalStrengthMonitor.cpp
+++ b/WiFiSignalStrengthMonitor.cpp
@@ -54,8 +54,8 @@ namespace WPEFramework
ssid = retrieveValues(ssid_command, "ssid", buff, sizeof (buff));
if (ssid.empty())
{
- NMLOG_ERROR("ssid is empty");
quality = Exchange::INetworkManager::WIFI_SIGNAL_DISCONNECTED;
+ strengthOut = "0.00";
return;
}
@@ -71,6 +71,7 @@ namespace WPEFramework
if (signalStrengthOut == 0.0f)
{
quality = Exchange::INetworkManager::WIFI_SIGNAL_DISCONNECTED;
+ strengthOut = "0.00";
}
else if (signalStrengthOut >= signalStrengthThresholdExcellent && signalStrengthOut < 0)
{
@@ -100,14 +101,12 @@ namespace WPEFramework
isRunning = true;
monitorThread = std::thread(&WiFiSignalStrengthMonitor::monitorThreadFunction, this, interval);
monitorThread.detach();
- std::thread::id threadId = monitorThread.get_id();
- NMLOG_INFO("Thread started with interval: %d seconds", interval);
}
void WiFiSignalStrengthMonitor::monitorThreadFunction(int interval)
{
static Exchange::INetworkManager::WiFiSignalQuality oldSignalQuality = Exchange::INetworkManager::WIFI_SIGNAL_DISCONNECTED;
- NMLOG_INFO("WiFiSignalStrengthMonitor thread started !");
+ NMLOG_INFO("WiFiSignalStrengthMonitor thread started ! (%d)", interval);
while (!stopThread)
{
string ssid = "";
diff --git a/docs/NetworkManagerPlugin.md b/docs/NetworkManagerPlugin.md
index 0a48ddfb..f8a41b66 100644
--- a/docs/NetworkManagerPlugin.md
+++ b/docs/NetworkManagerPlugin.md
@@ -2,7 +2,7 @@
# NetworkManager Plugin
-**Version: 0.5.1**
+**Version: 0.5.2**
**Status: :white_circle::white_circle::white_circle:**
@@ -23,7 +23,7 @@ org.rdk.NetworkManager interface for Thunder framework.
## Scope
-This document describes purpose and functionality of the org.rdk.NetworkManager interface (version 0.5.1). It includes detailed specification about its methods provided and notifications sent.
+This document describes purpose and functionality of the org.rdk.NetworkManager interface (version 0.5.2). It includes detailed specification about its methods provided and notifications sent.
## Case Sensitivity