Skip to content

Commit

Permalink
To test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gururaaja E S R authored and Gururaaja E S R committed Jul 16, 2024
1 parent e43c257 commit 0cc4988
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
4 changes: 4 additions & 0 deletions NetworkManager/service/NetworkManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,14 @@ namespace WPEFramework
oldInterface = "WIFI";
else if(prevActiveInterface == "eth0")
oldInterface = "ETHERNET";
else
oldInterface = prevActiveInterface;
if(currentActiveinterface == "wlan0")
newInterface = "WIFI";
else if(currentActiveinterface == "eth0")
newInterface = "ETHERNET";
else
newInterface = currentActiveinterface;
legacyParams["oldInterfaceName"] = oldInterface;
legacyParams["newInterfaceName"] = newInterface;
_parent.Notify("onDefaultInterfaceChanged", legacyParams);
Expand Down
49 changes: 34 additions & 15 deletions NetworkManager/service/NetworkManagerRDKProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ namespace WPEFramework

void NetworkManagerInternalEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
{
string interface;
LOG_ENTRY_FUNCTION();
if (_instance)
{
Expand All @@ -405,37 +406,55 @@ namespace WPEFramework
case IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_ENABLED_STATUS:
{
IARM_BUS_NetSrvMgr_Iface_EventInterfaceEnabledStatus_t *e = (IARM_BUS_NetSrvMgr_Iface_EventInterfaceEnabledStatus_t*) data;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_ENABLED_STATUS :: %s", e->interface);
if (e->status)
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_ADDED, string(e->interface));
else
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_REMOVED, string(e->interface));
interface = e->interface;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_ENABLED_STATUS :: %s", interface.c_str());
if(interface == "eth0" || interface == "wlan0")
{
if (e->status)
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_ADDED, interface);
else
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_REMOVED, interface);
}
break;
}
case IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS:
{
IARM_BUS_NetSrvMgr_Iface_EventInterfaceConnectionStatus_t *e = (IARM_BUS_NetSrvMgr_Iface_EventInterfaceConnectionStatus_t*) data;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS :: %s", e->interface);
if (e->status)
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_UP, string(e->interface));
else
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, string(e->interface));
interface = e->interface;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS :: %s", interface.c_str());
if(interface == "eth0" || interface == "wlan0") {
if (e->status)
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_UP, interface);
else
::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, interface);
}
break;
}
case IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS:
{
IARM_BUS_NetSrvMgr_Iface_EventInterfaceIPAddress_t *e = (IARM_BUS_NetSrvMgr_Iface_EventInterfaceIPAddress_t*) data;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS :: %s -- %s", e->interface, e->ip_address);
interface = e->interface;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS :: %s -- %s", interface.c_str(), e->ip_address);

::_instance->ReportIPAddressChangedEvent(string(e->interface), e->acquired, e->is_ipv6, string(e->ip_address));
if(interface == "eth0" || interface == "wlan0") {
::_instance->ReportIPAddressChangedEvent(interface, e->acquired, e->is_ipv6, string(e->ip_address));
}
break;
}
case IARM_BUS_NETWORK_MANAGER_EVENT_DEFAULT_INTERFACE:
{
string oldInterface;
string newInterface;
IARM_BUS_NetSrvMgr_Iface_EventDefaultInterface_t *e = (IARM_BUS_NetSrvMgr_Iface_EventDefaultInterface_t*) data;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_DEFAULT_INTERFACE %s :: %s..", e->oldInterface, e->newInterface);

::_instance->ReportActiveInterfaceChangedEvent(e->oldInterface, e->newInterface);
oldInterface = e->oldInterface;
newInterface = e->newInterface;
NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_DEFAULT_INTERFACE %s :: %s..", oldInterface.c_str(), newInterface.c_str());
if(oldInterface != "eth0" || oldInterface != "wlan0")
oldInterface == ""; /* assigning "null" if the interface is not eth0 or wlan0 */
if(newInterface != "eth0" || newInterface != "wlan0")
newInterface == ""; /* assigning "null" if the interface is not eth0 or wlan0 */

::_instance->ReportActiveInterfaceChangedEvent(oldInterface, newInterface);
break;
}
case IARM_BUS_WIFI_MGR_EVENT_onAvailableSSIDs:
Expand Down

0 comments on commit 0cc4988

Please sign in to comment.