Skip to content

Commit

Permalink
RDKTV-31166 posting internet event when interface connection changes (#…
Browse files Browse the repository at this point in the history
…5407)

* RDKTV-31166 internetStatus Event posting updated

* modefiy the same change in network manager
  • Loading branch information
cmuhammedrafi authored Jun 13, 2024
1 parent 8fbbd92 commit 00a6207
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
13 changes: 3 additions & 10 deletions Network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,17 +1461,10 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t {
m_defInterfaceCache = "";

sendNotify("onConnectionStatusChanged", params);
if(connected)
connectivityMonitor.doInitialConnectivityMonitoring(30);
if(!connected)
{
connectivityMonitor.doInitialConnectivityMonitoring(30);
}
else
{
if (!connectivityMonitor.isMonitorThreadRunning())
{
/*run the thread again to notify no_internet state*/
connectivityMonitor.doInitialConnectivityMonitoring(30);
}
/* if disconnectd need to stop the thread after one event */
connectivityMonitor.stopInitialConnectivityMonitoring();
}
}
Expand Down
1 change: 1 addition & 0 deletions Network/NetworkConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ namespace WPEFramework {
if (isMonitorThreadRunning() && stopFlag == false)
{
LOGINFO("Connectivity Monitor Thread is active so notify");
g_internetState = nsm_internetState::UNKNOWN;
cv_.notify_all();
}
else
Expand Down
1 change: 1 addition & 0 deletions NetworkManager/NetworkManagerConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ namespace WPEFramework {
if (isMonitorThreadRunning() && stopFlag == false)
{
NMLOG_INFO("Connectivity Monitor Thread is active so notify");
g_internetState = nsm_internetState::UNKNOWN;
cv_.notify_all();
}
else
Expand Down
16 changes: 13 additions & 3 deletions NetworkManager/NetworkManagerRDKProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,12 @@ namespace WPEFramework
{
if (e->status)
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_UP, interface);
else
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, interface);
else {
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, interface);
/* when ever interface down we start connectivity monitor to post noInternet event */
::_instance->connectivityMonitor.doInitialConnectivityMonitoring(5);
::_instance->connectivityMonitor.stopInitialConnectivityMonitoring();
}
}
break;
}
Expand All @@ -436,8 +440,14 @@ namespace WPEFramework
interface = e->interface;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS :: %s -- %s", interface.c_str(), e->ip_address);

if(interface == "eth0" || interface == "wlan0")
if(interface == "eth0" || interface == "wlan0") {
::_instance->ReportIPAddressChangedEvent(interface, e->acquired, e->is_ipv6, string(e->ip_address));
if(e->acquired)
{
/* if ip address acquired we start connectivity monitor */
::_instance->connectivityMonitor.doInitialConnectivityMonitoring(5);
}
}
break;
}
case IARM_BUS_NETWORK_MANAGER_EVENT_DEFAULT_INTERFACE:
Expand Down

0 comments on commit 00a6207

Please sign in to comment.