-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Added Connectivity Manager Implementation Basis and Delegate Objects #43537
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
gerickson
wants to merge
4
commits into
project-chip:master
Choose a base branch
from
Nuovations:user/gerickson/github-issue-42516-added-basis-and-delegate-objects
base: master
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.
+266
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2a2bd6e
Initial revision of connectivity manager implementation network manag…
gerickson f619555
Initial revision of a network management basis class.
gerickson bc1ee76
Added 'ConnectivityManagerImpl_NetworkManagementBasis.{h,cpp}' to Lin…
gerickson 49e92e2
Added 'ConnectivityManagerImpl_NetworkManagementDelegate.h' to Linux …
gerickson 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
49 changes: 49 additions & 0 deletions
49
src/platform/Linux/ConnectivityManagerImpl_NetworkManagementBasis.cpp
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,49 @@ | ||
| /* | ||
| * | ||
| * Copyright (c) 2026 Project CHIP Authors | ||
| * | ||
| * 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 "ConnectivityManagerImpl_NetworkManagementBasis.h" | ||
|
|
||
| #include <lib/support/CodeUtils.h> | ||
|
|
||
| #include "ConnectivityManagerImpl_NetworkManagementDelegate.h" | ||
|
|
||
| namespace chip { | ||
| namespace DeviceLayer { | ||
| namespace Internal { | ||
|
|
||
| CHIP_ERROR NetworkManagementBasis::Init() noexcept | ||
| { | ||
| mDelegate = nullptr; | ||
|
|
||
| return CHIP_NO_ERROR; | ||
| } | ||
|
|
||
| void NetworkManagementBasis::SetDelegate(NetworkManagementDelegate * inNetworkManagementDelegate) noexcept | ||
| { | ||
| mDelegate = inNetworkManagementDelegate; | ||
| } | ||
|
|
||
| void NetworkManagementBasis::OnWiFiMediumAvailable(bool inAvailable) noexcept | ||
| { | ||
| VerifyOrReturn(mDelegate != nullptr); | ||
|
|
||
| mDelegate->OnWiFiMediumAvailable(*this, inAvailable); | ||
| } | ||
|
|
||
| } // namespace Internal | ||
| } // namespace DeviceLayer | ||
| } // namespace chip | ||
132 changes: 132 additions & 0 deletions
132
src/platform/Linux/ConnectivityManagerImpl_NetworkManagementBasis.h
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,132 @@ | ||
| /* | ||
| * | ||
| * Copyright (c) 2026 Project CHIP Authors | ||
| * | ||
| * 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 <lib/core/CHIPError.h> | ||
|
|
||
| namespace chip { | ||
| namespace DeviceLayer { | ||
| namespace Internal { | ||
|
|
||
| // Forward Declarations | ||
|
|
||
| class NetworkManagementDelegate; | ||
|
|
||
| /** | ||
| * @brief | ||
| * A lightweight base class providing delegate wiring for Linux | ||
| * Connectivity Manager network management implementations. | ||
| * | ||
| * This serves as a common base for concrete Linux Connectivity | ||
| * Manager network management backends (for example, Connection | ||
| * Manager- (also known as, connman) or wpa_supplicant-based | ||
| * management). | ||
| * | ||
| * The class provides: | ||
| * | ||
| * * Storage and management of an optional network management | ||
| * delegate. | ||
| * * A protected action-delegation helper for reporting Wi-Fi | ||
| * medium availability changes to the delegate. | ||
| * | ||
| * This base does not define the full network management | ||
| * control-plane API. Instead, it provides a small amount of shared | ||
| * "glue" used to coordinate cross-cutting concerns between the | ||
| * network management backend and the owning platform Connectivity | ||
| * Manager implementation (which may also be coordinating the Wi-Fi | ||
| * NAN USD / PAF commissioning transport). | ||
| * | ||
| * @note | ||
| * The delegate is not owned by this class. Callers must ensure the | ||
| * delegate remains valid for as long as it is set. | ||
| * | ||
| * @note | ||
| * This type is intended to be used as a mix-in base alongside a | ||
| * concrete network management interface implementation. | ||
| * | ||
| */ | ||
| class NetworkManagementBasis | ||
| { | ||
| public: | ||
| virtual ~NetworkManagementBasis() = default; | ||
|
|
||
| /** | ||
| * @brief | ||
| * Perform explicit class initialization. | ||
| * | ||
| * Initializes internal state used by the base class, including | ||
| * clearing any previously-set delegate. | ||
| * | ||
| * Concrete derived classes should invoke this during their own | ||
| * initialization (typically before establishing subscriptions or | ||
| * starting external network management services). | ||
| * | ||
| * @returns | ||
| * #CHIP_NO_ERROR on success; otherwise @c | ||
| * !::chip::ChipError::IsSuccess. | ||
| * | ||
| */ | ||
| CHIP_ERROR Init() noexcept; | ||
|
|
||
| /** | ||
| * @brief | ||
| * Set the delegate to receive coordination callbacks. | ||
| * | ||
| * Sets (or clears) the network management delegate that will be | ||
| * notified of relevant state changes observed by the network | ||
| * management backend. | ||
| * | ||
| * @note | ||
| * The delegate is not owned by this object. | ||
| * | ||
| * @param[in] inNetworkManagementDelegate | ||
| * A pointer to the delegate to set, or null to clear the | ||
| * delegate. | ||
| * | ||
| * @sa OnWiFiMediumAvailable | ||
| * | ||
| */ | ||
| void SetDelegate(NetworkManagementDelegate * inNetworkManagementDelegate) noexcept; | ||
|
|
||
| protected: | ||
| /** | ||
| * @brief | ||
| * Notify the delegate of Wi-Fi medium availability changes. | ||
| * | ||
| * Derived classes should invoke this helper when the underlying | ||
| * Wi-Fi control plane indicates that the Wi-Fi medium (radio / | ||
| * interface resources) has become available or unavailable. | ||
| * | ||
| * If a delegate is set, this forwards the notification to | ||
| * NetworkManagementDelegate::OnWiFiMediumAvailable. | ||
| * | ||
| * @param[in] inAvailable | ||
| * A Boolean indicating whether the Wi-Fi medium is available. | ||
| * | ||
| * @sa SetDelegate | ||
| * | ||
| */ | ||
| void OnWiFiMediumAvailable(bool inAvailable) noexcept; | ||
|
|
||
| private: | ||
| NetworkManagementDelegate * mDelegate; | ||
| }; | ||
|
|
||
| } // namespace Internal | ||
| } // namespace DeviceLayer | ||
| } // namespace chip |
82 changes: 82 additions & 0 deletions
82
src/platform/Linux/ConnectivityManagerImpl_NetworkManagementDelegate.h
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,82 @@ | ||
| /* | ||
| * | ||
| * Copyright (c) 2026 Project CHIP Authors | ||
| * | ||
| * 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 | ||
|
|
||
| namespace chip { | ||
| namespace DeviceLayer { | ||
|
|
||
| namespace Internal { | ||
|
|
||
| // Forward Declarations | ||
|
|
||
| class NetworkManagementBasis; | ||
|
|
||
| /** | ||
| * @brief | ||
| * A delegate interface for coordinating network-management-driven | ||
| * Wi-Fi medium availability with other Connectivity Manager | ||
| * implementation subsystems. | ||
| * | ||
| * This delegate is used by a concrete network management basis | ||
| * implementation to report changes in Wi-Fi medium availability to | ||
| * an owning coordinator (typically the platform Connectivity Manager | ||
| * implementation). | ||
| * | ||
| * Wi-Fi medium availability reflects whether the underlying Wi-Fi | ||
| * control plane / radio resources are usable for Wi-Fi operations | ||
| * (for example, whether the Wi-Fi interface is present and powered, | ||
| * and not blocked or otherwise unavailable). | ||
| * | ||
| * The coordinator may use these notifications to: | ||
| * | ||
| * * Update cached Connectivity Manager state. | ||
| * * Drive Device Layer events and diagnostic attributes. | ||
| * * Coordinate ownership or arbitration of Wi-Fi radio resources | ||
| * between operational Wi-Fi usage (station / AP) and the | ||
| * Wi-Fi Neighbor Awareness Networking (NAN) Unsynchronized Service | ||
| * Discovery (USD) / Public Action Frame (PAF) commissioning | ||
| * transport. | ||
| * | ||
| * Concrete implementations should assume that notifications may be | ||
| * delivered from an implementation-defined execution | ||
| * context. Delegates should avoid blocking for extended periods. | ||
| * | ||
| */ | ||
| class NetworkManagementDelegate | ||
| { | ||
| public: | ||
| virtual ~NetworkManagementDelegate(void) = default; | ||
|
|
||
| /** | ||
| * @brief | ||
| * Indicate whether the Wi-Fi medium is available. | ||
| * | ||
| * @param[in,out] inOutNetworkManagement | ||
gerickson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * A reference to the mutable network management entity making | ||
| * the delegation. | ||
| * | ||
| * @param[in] inAvailable | ||
| * A Boolean indicating whether the Wi-Fi medium is available. | ||
| * | ||
| */ | ||
| virtual void OnWiFiMediumAvailable(NetworkManagementBasis & inOutNetworkManagement, bool inAvailable) = 0; | ||
| }; | ||
|
|
||
| } // namespace Internal | ||
| } // namespace DeviceLayer | ||
| } // namespace chip | ||
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.
Uh oh!
There was an error while loading. Please reload this page.