Skip to content

Commit

Permalink
interface state change event added
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuhammedrafi committed Nov 28, 2024
1 parent f6a67c1 commit e42ef9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LegacyPlugin_WiFiManagerAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ namespace WPEFramework

returnJson(rc);
}

uint32_t WiFiManager::connect(const JsonObject& parameters, JsonObject& response)
{
uint32_t rc = Core::ERROR_GENERAL;
Expand Down
20 changes: 18 additions & 2 deletions NetworkManagerGnomeWIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,14 +983,30 @@ namespace WPEFramework

NMDeviceState deviceState = nm_device_get_state(device);

if (enabled) {
if (enabled)
{
NMLOG_DEBUG("Enabling interface...");
if (deviceState >= NM_DEVICE_STATE_DISCONNECTED) // already enabled
{
if(_instance != nullptr)
{
/* if already enabled no event form networkmanger */
_instance->ReportInterfaceStateChange(Exchange::INetworkManager::INTERFACE_ADDED, interface);
}
return true;
} else {
}
}
else
{
NMLOG_DEBUG("Disabling interface...");
if (deviceState <= NM_DEVICE_STATE_UNMANAGED) // already disabled
{
if(_instance != nullptr) {
/* if already disabled no event form networkmanger */
_instance->ReportInterfaceStateChange(Exchange::INetworkManager::INTERFACE_REMOVED, interface);
}
return true;
}
else if (deviceState > NM_DEVICE_STATE_DISCONNECTED) {
nm_device_disconnect_async(device, nullptr, disconnectCb, this);
wait(loop);
Expand Down

0 comments on commit e42ef9c

Please sign in to comment.