Skip to content

Commit

Permalink
DELIA-66876 Posting onWifiSignalThresholdChanged and onDefaultInterfa…
Browse files Browse the repository at this point in the history
…ceChanged as null
  • Loading branch information
cmuhammedrafi committed Nov 19, 2024
1 parent 1936e82 commit b49ab17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
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
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

0 comments on commit b49ab17

Please sign in to comment.