Skip to content

Commit

Permalink
RDK-47583 Implement GNOME support for NetworkManage (rdkcentral#4987)
Browse files Browse the repository at this point in the history
* RDK-47583 Implement GNOME support for NetworkManage
WiFiConnect, WiFiDisconnect, GetConnectedSSID APIs
  • Loading branch information
cmuhammedrafi authored Mar 7, 2024
1 parent 12063d3 commit cab9af5
Show file tree
Hide file tree
Showing 5 changed files with 820 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NetworkManager/service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ add_library(${PLUGIN_IMPLEMENTATION} SHARED
)

if(ENABLE_GNOME_NETWORKMANAGER)
target_sources(${PLUGIN_IMPLEMENTATION} PRIVATE NetworkManagerGnomeProxy.cpp)
target_sources(${PLUGIN_IMPLEMENTATION} PRIVATE NetworkManagerGnomeProxy.cpp NetworkManagerGnomeWIFI.cpp)
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${GLIB_INCLUDE_DIRS} ${LIBNM_INCLUDE_DIRS})
target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${LIBNM_LIBRARIES})
else()
Expand Down
2 changes: 1 addition & 1 deletion NetworkManager/service/NetworkConnectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <curl/curl.h>
#include <condition_variable>
#include <mutex>
#include "NetworkManagerLogger.h"
#include "Module.h"
#include "NetworkManagerLogger.h"
#include "NetworkManagerImplementation.h"

#define CAPTIVEPORTAL_MAX_LEN 512
Expand Down
9 changes: 9 additions & 0 deletions NetworkManager/service/NetworkManagerGnomeProxy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "NetworkManagerImplementation.h"
#include "NetworkManagerGnomeWIFI.h"
#include <libnm/NetworkManager.h>
#include <fstream>
#include <sstream>
Expand All @@ -15,6 +16,7 @@ namespace WPEFramework
{
namespace Plugin
{
wifiManager *wifi = nullptr;
const float signalStrengthThresholdExcellent = -50.0f;
const float signalStrengthThresholdGood = -60.0f;
const float signalStrengthThresholdFair = -67.0f;
Expand All @@ -37,6 +39,7 @@ namespace WPEFramework
return;
}
g_loop = g_main_loop_new(context, FALSE);
wifi = wifiManager::getInstance();
return;
}

Expand Down Expand Up @@ -608,18 +611,24 @@ namespace WPEFramework
uint32_t NetworkManagerImplementation::WiFiConnect(const WiFiConnectTo& ssid /* @in */)
{
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
if(wifi->wifiConnect(ssid.m_ssid.c_str(), ssid.m_passphrase.c_str(), ssid.m_securityMode))
rc = Core::ERROR_NONE;
return rc;
}

uint32_t NetworkManagerImplementation::WiFiDisconnect(void)
{
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
if(wifi->wifiDisconnect())
rc = Core::ERROR_NONE;
return rc;
}

uint32_t NetworkManagerImplementation::GetConnectedSSID(WiFiSSIDInfo& ssidInfo /* @out */)
{
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
if(wifi->wifiConnectedSSIDInfo(ssidInfo))
rc = Core::ERROR_NONE;
return rc;
}

Expand Down
Loading

0 comments on commit cab9af5

Please sign in to comment.