-
Notifications
You must be signed in to change notification settings - Fork 13
RDK-61724: Update Network Manager to publish a new event for route change. #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gururaajar
wants to merge
8
commits into
develop
Choose a base branch
from
topic/onroutechange
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5b611db
onroutechange event implementation
gururaajar 41427c9
Added macro to conditional compilation
fa3bf10
Modified the code to have separate client to get connectivity status …
0aa3f05
Added RFC for connectivity manager enabling in networkmanager
51fdfd2
Added enable of USE_RFCAPI in proper place
63fc462
Merge branch 'develop' into topic/onroutechange
9ce7102
updated with macro USE_CONNECTIVITYCHECKMGR
33217d7
Added the documentation
gururaajar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| /** | ||
| * If not stated otherwise in this file or this component's LICENSE | ||
| * file the following copyright and licenses apply: | ||
| * | ||
| * Copyright 2026 RDK Management | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| #include "NetworkManagerConnectivityClient.h" | ||
| #include "NetworkManagerLogger.h" | ||
| #include <com/com.h> | ||
|
|
||
| using namespace WPEFramework; | ||
| using namespace WPEFramework::Exchange; | ||
| using namespace WPEFramework::Plugin; | ||
|
|
||
| // --------------------------------------------------------------------------- | ||
| // NetworkManagerConnectivityClient | ||
| // --------------------------------------------------------------------------- | ||
|
|
||
| NetworkManagerConnectivityClient::NetworkManagerConnectivityClient() | ||
| { | ||
| NMLOG_INFO("connecting to ConnectivityCheckMgr"); | ||
| if (auto r = Open(RPC::CommunicationTimeOut, Connector(), "org.rdk.ConnectivityCheckMgr"); r == Core::ERROR_NONE) { | ||
| // Connected; Operational() will be called by the framework when the proxy is ready. | ||
| } else { | ||
| NMLOG_ERROR("failed to open link to ConnectivityCheckMgr (error %u)", r); | ||
| } | ||
| } | ||
|
|
||
| NetworkManagerConnectivityClient::~NetworkManagerConnectivityClient() | ||
| { | ||
| NMLOG_INFO("shutting down"); | ||
| { | ||
| std::lock_guard<std::mutex> lock(mLock); | ||
| if (mConnectivity != nullptr) { | ||
| mConnectivity->Release(); | ||
| mConnectivity = nullptr; | ||
| } | ||
| } | ||
| Close(Core::infinite); | ||
| } | ||
|
|
||
| bool NetworkManagerConnectivityClient::IsValid() const | ||
| { | ||
| LOG_ENTRY_FUNCTION(); | ||
| std::lock_guard<std::mutex> lock(mLock); | ||
| return mConnectivity != nullptr; | ||
| } | ||
|
|
||
| void NetworkManagerConnectivityClient::Operational(bool upAndRunning) | ||
| { | ||
| NMLOG_DEBUG("Operational(%s)", upAndRunning ? "true" : "false"); | ||
| std::lock_guard<std::mutex> lock(mLock); | ||
| if (upAndRunning) { | ||
| if (mConnectivity == nullptr) { | ||
| mConnectivity = Interface(); | ||
| } | ||
| } else { | ||
| if (mConnectivity != nullptr) { | ||
| mConnectivity->Release(); | ||
| mConnectivity = nullptr; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| NetworkManagerConnectivityClient::NmInternetStatus | ||
| NetworkManagerConnectivityClient::mapStatus(Exchange::IConnectivityCheck::InternetStatus status) | ||
| { | ||
| switch (status) { | ||
| case Exchange::IConnectivityCheck::NO_INTERNET: return Exchange::INetworkManager::INTERNET_NOT_AVAILABLE; | ||
| case Exchange::IConnectivityCheck::LIMITED_INTERNET: return Exchange::INetworkManager::INTERNET_LIMITED; | ||
| case Exchange::IConnectivityCheck::CAPTIVE_PORTAL: return Exchange::INetworkManager::INTERNET_CAPTIVE_PORTAL; | ||
| case Exchange::IConnectivityCheck::FULLY_CONNECTED: return Exchange::INetworkManager::INTERNET_FULLY_CONNECTED; | ||
| case Exchange::IConnectivityCheck::UNKNOWN: | ||
| default: return Exchange::INetworkManager::INTERNET_UNKNOWN; | ||
| } | ||
| } | ||
|
|
||
| NetworkManagerConnectivityClient::NmInternetStatus | ||
| NetworkManagerConnectivityClient::getInternetState() | ||
| { | ||
| LOG_ENTRY_FUNCTION(); | ||
| std::lock_guard<std::mutex> lock(mLock); | ||
| if (mConnectivity == nullptr) { | ||
| NMLOG_WARNING("ConnectivityCheckMgr not available; returning INTERNET_UNKNOWN"); | ||
| return Exchange::INetworkManager::INTERNET_UNKNOWN; | ||
| } | ||
|
|
||
| Exchange::IConnectivityCheck::StatusInfo info{}; | ||
| if (auto r = mConnectivity->GetInternetStatus(info); r != Core::ERROR_NONE) { | ||
| NMLOG_ERROR("ConnectivityCheckMgr GetInternetStatus failed (%u)", r); | ||
| return Exchange::INetworkManager::INTERNET_UNKNOWN; | ||
| } | ||
| return mapStatus(info.status); | ||
| } | ||
|
|
||
| std::string NetworkManagerConnectivityClient::getCaptivePortalURI() | ||
| { | ||
| LOG_ENTRY_FUNCTION(); | ||
| std::lock_guard<std::mutex> lock(mLock); | ||
| std::string uri; | ||
| if (mConnectivity == nullptr) { | ||
| NMLOG_WARNING("ConnectivityCheckMgr not available; returning empty captive-portal URI"); | ||
| return uri; | ||
| } | ||
| if (auto r = mConnectivity->GetCaptivePortalURI(uri); r != Core::ERROR_NONE) { | ||
| NMLOG_ERROR("ConnectivityCheckMgr GetCaptivePortalURI failed (%u)", r); | ||
| uri.clear(); | ||
| } | ||
| return uri; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /** | ||
| * If not stated otherwise in this file or this component's LICENSE | ||
| * file the following copyright and licenses apply: | ||
| * | ||
| * Copyright 2026 RDK Management | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "Module.h" | ||
| #include "INetworkManager.h" | ||
| #include <interfaces/IConnectivityCheck.h> | ||
| #include <mutex> | ||
| #include <string> | ||
|
|
||
| namespace WPEFramework { | ||
| namespace Plugin { | ||
|
|
||
| /** | ||
| * COM-RPC client that delegates internet-connectivity queries to the | ||
| * ConnectivityCheckMgr plugin (org.rdk.ConnectivityCheckMgr). | ||
| * | ||
| * Because the delegation lives in the out-of-process implementation, both the | ||
| * JSON-RPC surface (shell -> implementation) and direct COM-RPC callers of | ||
| * INetworkManager::IsConnectedToInternet / GetCaptivePortalURI are served | ||
| * consistently. | ||
| * | ||
| * Mirrors NetworkManagerPowerClient: | ||
| * - Inherits SmartInterfaceType<IConnectivityCheck> for automatic | ||
| * connect / reconnect and Operational() lifecycle callbacks. | ||
| * | ||
| * Lifecycle: | ||
| * Construction -> Open() connects to ConnectivityCheckMgr (async). | ||
| * Operational(true) -> acquires the proxy; IsValid() returns true. | ||
| * Operational(false) -> releases the proxy. | ||
| * Destruction -> Close(). | ||
| * | ||
| * All queries fall back to INTERNET_UNKNOWN / empty when the plugin is not | ||
| * available, so callers never crash on a boot-order race or NM/CCM restart. | ||
| */ | ||
| class NetworkManagerConnectivityClient : protected RPC::SmartInterfaceType<Exchange::IConnectivityCheck> { | ||
| public: | ||
| using NmInternetStatus = Exchange::INetworkManager::InternetStatus; | ||
|
|
||
| NetworkManagerConnectivityClient(); | ||
| ~NetworkManagerConnectivityClient() override; | ||
|
|
||
| NetworkManagerConnectivityClient(const NetworkManagerConnectivityClient&) = delete; | ||
| NetworkManagerConnectivityClient& operator=(const NetworkManagerConnectivityClient&) = delete; | ||
|
|
||
| /** Returns true when the ConnectivityCheckMgr COMRPC proxy is available. */ | ||
| bool IsValid() const; | ||
|
|
||
| /** Delegated internet status, mapped to NetworkManager's InternetStatus. */ | ||
| NmInternetStatus getInternetState(); | ||
|
|
||
| /** Delegated captive-portal URI (empty when unavailable / not captive). */ | ||
| std::string getCaptivePortalURI(); | ||
|
|
||
| private: | ||
| // SmartInterfaceType lifecycle callback. | ||
| void Operational(bool upAndRunning) override; | ||
|
|
||
| // 1:1 mapping ConnectivityCheckMgr InternetStatus -> NetworkManager InternetStatus. | ||
| static NmInternetStatus mapStatus(Exchange::IConnectivityCheck::InternetStatus status); | ||
|
|
||
| mutable std::mutex mLock; | ||
| Exchange::IConnectivityCheck* mConnectivity{nullptr}; | ||
| }; | ||
|
|
||
| } // namespace Plugin | ||
| } // namespace WPEFramework |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved