Skip to content

Commit

Permalink
DELIA-66876 : Fxing onWifiSignalThresholdChanged and onDefaultInterfa…
Browse files Browse the repository at this point in the history
…ceChanged EventData (rdkcentral#36)

* The onWifiSignalThresholdChanged and onDefaultInterfaceChanged events are posted with empty/null event data. Fixing it
* Updated the release version
  • Loading branch information
cmuhammedrafi authored Nov 19, 2024
1 parent 1936e82 commit 195f802
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
12 changes: 6 additions & 6 deletions LegacyPlugin_NetworkAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"];
}
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions LegacyPlugin_WiFiManagerAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ namespace WPEFramework
}
}
else
NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
NMLOG_WARNING("Ignoring %s", __FUNCTION__);

return;
}
Expand All @@ -710,24 +710,24 @@ namespace WPEFramework
if(_gWiFiInstance)
_gWiFiInstance->Notify("onAvailableSSIDs", parameters);
else
NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
NMLOG_WARNING("Ignoring %s", __FUNCTION__);

return;
}

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);
NMLOG_INFO("Posting onWifiSignalThresholdChanged as %s", json.c_str());
if (_gWiFiInstance)
_gWiFiInstance->Notify("onWifiSignalThresholdChanged", legacyParams);
else
NMLOG_WARNING("Ignoring %s\n", __FUNCTION__);
NMLOG_WARNING("Ignoring %s", __FUNCTION__);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion NetworkManager.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 3 additions & 4 deletions WiFiSignalStrengthMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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)
{
Expand Down Expand Up @@ -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 = "";
Expand Down
4 changes: 2 additions & 2 deletions docs/NetworkManagerPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a name="head.NetworkManager_Plugin"></a>
# NetworkManager Plugin

**Version: 0.5.1**
**Version: 0.5.2**

**Status: :white_circle::white_circle::white_circle:**

Expand All @@ -23,7 +23,7 @@ org.rdk.NetworkManager interface for Thunder framework.
<a name="head.Scope"></a>
## 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.

<a name="head.Case_Sensitivity"></a>
## Case Sensitivity
Expand Down

0 comments on commit 195f802

Please sign in to comment.