RDKEMW-15309 : Improvements in Wifi Connection Processing in Network Manager plugin#284
RDKEMW-15309 : Improvements in Wifi Connection Processing in Network Manager plugin#284cmuhammedrafi wants to merge 18 commits intodevelopfrom
Conversation
…#283) * spike Initial code change
There was a problem hiding this comment.
Pull request overview
Adds BSSID/frequency support to WiFi connection flow and introduces a new JSON-RPC API to connect using a saved/known SSID, with corresponding updates across the interface, implementations, schema/docs, and L2 tests.
Changes:
- Extend
WiFiConnectinput to acceptbssidandfrequency(band) and include BSSID in scan/event payloads. - Add
ConnectToKnownSSIDAPI end-to-end (interface → implementations → JSON-RPC → docs/schema). - Update libnm L2 tests/mocks to cover the new API and expanded AP property usage.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mocks/INetworkManagerMock.h | Extends mock interface with ConnectToKnownSSID. |
| tests/l2Test/libnm/l2_test_libnmproxyWifi.cpp | Adds/adjusts WiFi connection tests including ConnectToKnownSSID and AP property mocks. |
| tests/l2Test/libnm/l2_test_libnmproxyEvent.cpp | Updates scan/event test setup to accommodate BSSID/frequency additions and device handling. |
| plugin/rdk/NetworkManagerRDKProxy.cpp | Adds RDK stub implementation for ConnectToKnownSSID (returns unavailable). |
| plugin/gnome/NetworkManagerGnomeWIFI.h | Adds connectToKnownSSID to the WiFi manager interface. |
| plugin/gnome/NetworkManagerGnomeWIFI.cpp | Implements BSSID-aware AP matching, band restriction, and connectToKnownSSID; refactors connected AP info retrieval. |
| plugin/gnome/NetworkManagerGnomeUtils.h | Declares new BSSID validation helper. |
| plugin/gnome/NetworkManagerGnomeUtils.cpp | Implements BSSID format validation. |
| plugin/gnome/NetworkManagerGnomeProxy.cpp | Wires ConnectToKnownSSID; updates WiFiConnect flow and adds BSSID validation. |
| plugin/gnome/NetworkManagerGnomeEvents.cpp | Adds BSSID to AP JSON and adjusts scan result handling/notification gating. |
| plugin/NetworkManagerLogger.cpp | Changes default log level to DEBUG. |
| plugin/NetworkManagerJsonRpc.cpp | Registers new JSON-RPC method; parses bssid/frequency for WiFiConnect. |
| plugin/NetworkManagerImplementation.h | Adds ConnectToKnownSSID to the implementation interface. |
| plugin/NetworkManager.h | Adds JSON-RPC handler declaration for ConnectToKnownSSID. |
| interface/INetworkManager.h | Adds ConnectToKnownSSID, bssid/frequency fields, and WIFIFrequency enum. |
| docs/NetworkManagerPlugin.md | Documents new API and adds bssid/frequency to WiFiConnect. |
| definition/NetworkManager.json | Updates JSON-RPC schema with new method and new WiFiConnect parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
plugin/gnome/NetworkManagerGnomeWIFI.cpp:1112
activeSSIDis no longer populated, but it’s still used in the log message when the connected SSID differs (NMLOG_DEBUG("wifi already connected with %s AP", activeSSID.c_str())). This will always log an empty string and makes debugging misleading; consider loggingconnectedApInfo.ssid(or removing the variable/log entirely).
}
else
NMLOG_DEBUG("wifi already connected with %s AP", activeSSID.c_str());
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if(!_nmEventInstance->doScanNotify) | ||
| { | ||
| NMLOG_DEBUG("wifi scan result received but notify is false, skipping event notify"); | ||
| return; | ||
| } | ||
|
|
||
| NMLOG_INFO("No of AP Available = %d", static_cast<int>(accessPoints->len)); | ||
|
|
||
| JsonArray ssidList = JsonArray(); | ||
| for (guint i = 0; i < accessPoints->len; i++) | ||
| { | ||
| JsonObject ssidObj; | ||
| ap = static_cast<NMAccessPoint*>(accessPoints->pdata[i]); | ||
| JsonObject ssidObj{}; | ||
| NMAccessPoint *ap = static_cast<NMAccessPoint*>(accessPoints->pdata[i]); | ||
| if(GnomeNetworkManagerEvents::apToJsonObject(ap, ssidObj)) | ||
| ssidList.Add(ssidObj); | ||
| } | ||
|
|
||
| NMLOG_DEBUG("No of AP Available = %d", static_cast<int>(accessPoints->len)); | ||
|
|
||
| if(_nmEventInstance->doScanNotify) { | ||
| if(_instance != nullptr) { | ||
| _nmEventInstance->doScanNotify = false; | ||
| _instance->ReportAvailableSSIDs(ssidList); | ||
| } |
There was a problem hiding this comment.
changes not needed
| g_object_unref(deviceDummy); | ||
| g_object_unref(conn1); | ||
| g_object_unref(conn2); | ||
| g_object_unref(conn3); |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| "summary": "Frequency band: `1` - 2.4GHz, `2` - 5GHz. If specified, connects only to SSIDs on the given frequency band. Defaults to best available.", | ||
| "type": "integer", |
| if(ssidGBytes) | ||
| if(ssidGBytes == nullptr) | ||
| { | ||
| NMLOG_DEBUG("hidden ssid found, bssid: %s", nm_access_point_get_bssid(ap)); |
| bool nmUtils::isValidBSSID(const std::string& bssid) | ||
| { | ||
| // Regular expression to match valid BSSID formats (e.g., "00:11:22:33:44:55") | ||
| const std::regex bssidRegex("^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$"); | ||
| if (!std::regex_match(bssid, bssidRegex)) | ||
| { | ||
| NMLOG_ERROR("Invalid BSSID format: %s. Expected format is XX:XX:XX:XX:XX:XX where X is a hexadecimal digit.", bssid.c_str()); | ||
| return false; |
| virtual uint32_t GetKnownSSIDs(IStringIterator*& ssids /* @out */) = 0; | ||
| virtual uint32_t AddToKnownSSIDs(const WiFiConnectTo& ssid /* @in */) = 0; | ||
| virtual uint32_t RemoveKnownSSID(const string& ssid /* @in */) = 0; | ||
| virtual uint32_t ConnectToKnownSSID(const string& ssid /* @in */) = 0; |
| ## *GetPrimaryInterface [<sup>method</sup>](#head.Methods)* | ||
|
|
||
| Gets the primary/default network interface for the device. The active network interface is defined as the one that can make requests to the external network. Returns one of the supported interfaces as per `GetAvailableInterfaces`. | ||
| Gets the primary/default network interface for the device. The active network interface is defined as the one that can make requests to the external network. Returns one of the supported interfaces as per `GetAvailableInterfaces`. if no active network is available, it returns empty string. |
| NMLOG_WARNING("ssid is empty activating last connected ssid !"); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID)) | ||
| { | ||
| rc = Core::ERROR_NONE; |
| if(_instance != nullptr) { | ||
| _nmEventInstance->doScanNotify = false; | ||
| _instance->ReportAvailableSSIDs(ssidList); | ||
| } |
| | params?.passphrase | string | <sup>*(optional)*</sup> The access point password | | ||
| | params?.security | integer | <sup>*(optional)*</sup> Optional override to explicitly select the security mode; if omitted, the mode is decided based on the highest security mode provided by the SSID. See `GetSupportedSecurityModes` for valid values | | ||
| | params?.bssid | string | <sup>*(optional)*</sup> BSSID to connect to. If specified, restricts connection to this BSSID only. Defaults to the best available BSSID for the SSID | | ||
| | params?.frequency | integer | <sup>*(optional)*</sup> Frequency band: `1` - 2.4GHz, `2` - 5GHz. If specified, connects only to SSIDs on the given frequency band. Defaults to best available | |
| ## *WiFiConnect [<sup>method</sup>](#head.Methods)* | ||
|
|
||
| Initiates request to connect to the specified SSID with the given passphrase. Passphrase can be `null` when the network security is `NONE`. By default, the security mode is decided based on the highest security mode provided by the SSID, but it can be explicitly overridden via the optional `params.security` parameter. Also when called with no arguments, this method attempts to connect to the saved SSID and password. See `AddToKnownSSIDs`. | ||
| Initiates request to connect to the specified SSID with the given passphrase. Passphrase can be `null` when the network security is `NONE`. The security mode is decided based on the highest security mode provided by the SSID. Also when called with no arguments, this method attempts to connect to the saved SSID and password. See `AddToKnownSSIDs`. |
| }, | ||
| "GetPrimaryInterface": { | ||
| "summary": "Gets the primary/default network interface for the device. The active network interface is defined as the one that can make requests to the external network. Returns one of the supported interfaces as per `GetAvailableInterfaces`.", | ||
| "summary": "Gets the primary/default network interface for the device. The active network interface is defined as the one that can make requests to the external network. Returns one of the supported interfaces as per `GetAvailableInterfaces`. if no active network is available, it returns empty string.", |
Reason for change: