Skip to content

Commit

Permalink
Merge pull request #3 from rdkcentral/develop
Browse files Browse the repository at this point in the history
rebase develop
  • Loading branch information
tabbas651 authored Nov 21, 2024
2 parents 63f5554 + c7f1673 commit 84ab5a6
Show file tree
Hide file tree
Showing 19 changed files with 1,185 additions and 718 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/gnome_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
unit-tests:
name: Build and run unit tests
runs-on: ubuntu-latest

steps:
- name: Configure cache
if: ${{ !env.ACT }}
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Install packages
run: |
sudo apt update
sudo apt-get install -y pkg-config libglib2.0-dev libnm-dev libcurl4-openssl-dev ninja-build
sudo apt-get install -y pkg-config libglib2.0-dev libnm-dev libcurl4-openssl-dev lcov ninja-build
- name: Configure Python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
uses: actions/checkout@v3
with:
path: networkmanager

- name: Build networkmanager with Gnome Proxy
run: >
cmake
Expand All @@ -99,7 +99,32 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}"
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
-DCMAKE_CXX_FLAGS=" -fprofile-arcs -ftest-coverage "
-DENABLE_GNOME_NETWORKMANAGER=ON
-DENABLE_UNIT_TESTING=ON
&&
cmake --build build/GnomeNetworkmanager --target install -j8
- name: Run unit tests without valgrind
run: >
PATH=${{github.workspace}}/install/usr/bin:${PATH}
LD_LIBRARY_PATH=${{github.workspace}}/install/usr/lib:${{github.workspace}}/install/usr/lib/wpeframework/plugins:${LD_LIBRARY_PATH}
tests
- name: Generate coverage
run: |
lcov -c -o coverage.info -d build/GnomeNetworkmanager
lcov -r coverage.info '/usr/include/*' '*/build/GnomeNetworkmanager/*' \
'*/install/usr/include/*' '*/Tests/*' 'googlemock/*' 'googletest/*' \
-o filtered_coverage.info
- name: Generate the html report
run: |
genhtml filtered_coverage.info --output-directory /tmp/coverage_report
- name: Upload the coverage report to Pull request using actions
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /tmp/coverage_report

8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ find_package(WPEFramework)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(VERSION_MAJOR 0)
set(VERSION_MINOR 5)
set(VERSION_PATCH 0)
set(VERSION_PATCH 3)

add_compile_definitions(NETWORKMANAGER_MAJOR_VERSION=${VERSION_MAJOR})
add_compile_definitions(NETWORKMANAGER_MINOR_VERSION=${VERSION_MINOR})
Expand All @@ -17,6 +17,8 @@ set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
include(CmakeHelperFunctions)

option(USE_RDK_LOGGER "Enable RDK Logger for logging" OFF )
option(ENABLE_UNIT_TESTING "Enable unit tests" OFF)


string(TOLOWER ${NAMESPACE} STORAGE_DIRECTORY)
get_directory_property(SEVICES_DEFINES COMPILE_DEFINITIONS)
Expand Down Expand Up @@ -167,3 +169,7 @@ write_config()
write_config(PLUGINS LegacyPlugin_NetworkAPIs CLASSNAME Network LOCATOR lib${PLUGIN_LEGACY_DEPRECATED_NETWORK}.so)
write_config(PLUGINS LegacyPlugin_WiFiManagerAPIs CLASSNAME WiFiManager LOCATOR lib${PLUGIN_LEGACY_DEPRECATED_WIFI}.so)

if(ENABLE_UNIT_TESTING)
include(Tests/unit_test/tests.cmake)
endif(ENABLE_UNIT_TESTING)

16 changes: 8 additions & 8 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,13 +1032,13 @@ 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"];
legacyParams["ip6Address"] = parameters["ipaddress"];
}
else
{
legacyParams["ip4Address"] = parameters["ipAddress"];
legacyParams["ip4Address"] = parameters["ipaddress"];
}

legacyParams["status"] = parameters["status"];
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
2 changes: 0 additions & 2 deletions LegacyPlugin_WiFiManagerAPIs.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ namespace WPEFramework {
uint32_t getPairedSSID(const JsonObject& parameters, JsonObject& response);
uint32_t getPairedSSIDInfo(const JsonObject& parameters, JsonObject& response);
uint32_t isPaired(const JsonObject& parameters, JsonObject& response);
uint32_t setSignalThresholdChangeEnabled(const JsonObject& parameters, JsonObject& response);
uint32_t isSignalThresholdChangeEnabled(const JsonObject& parameters, JsonObject& response);
uint32_t getSupportedSecurityModes(const JsonObject& parameters, JsonObject& response);
//End methods

Expand Down
2 changes: 1 addition & 1 deletion NetworkManager.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"status": "development",
"description": "A Unified `NetworkManager` plugin that allows you to manage Ethernet and Wifi interfaces on the device.",
"sourcelocation": "https://github.com/rdkcentral/networkmanager/blob/main/NetworkManager.json",
"version": "0.5.0"
"version": "0.5.3"
},
"definitions": {
"success": {
Expand Down
Loading

0 comments on commit 84ab5a6

Please sign in to comment.