From c8d2130d717bbdcd95f0eda8c78aa004df3f322b Mon Sep 17 00:00:00 2001 From: gururaajar <83449026+gururaajar@users.noreply.github.com> Date: Thu, 7 Mar 2024 22:40:24 -0500 Subject: [PATCH 1/3] Added the events for the Network manager legacy mode (#4997) * Modification done for event addition for the legacy code Co-authored-by: Karunakaran A <48997923+karuna2git@users.noreply.github.com> --- NetworkManager/interface/INetworkManager.h | 73 ++++----- NetworkManager/service/NetworkConnectivity.h | 2 +- NetworkManager/service/NetworkManager.h | 140 ++++++++++++++---- .../service/NetworkManagerImplementation.cpp | 37 ++--- .../service/NetworkManagerImplementation.h | 5 +- .../service/NetworkManagerJsonRpc.cpp | 52 ++++++- .../service/NetworkManagerLegacy.cpp | 62 +++++++- .../service/NetworkManagerRDKProxy.cpp | 74 +++++---- 8 files changed, 318 insertions(+), 127 deletions(-) diff --git a/NetworkManager/interface/INetworkManager.h b/NetworkManager/interface/INetworkManager.h index 01399f4f4a..4c5eedad6b 100644 --- a/NetworkManager/interface/INetworkManager.h +++ b/NetworkManager/interface/INetworkManager.h @@ -77,11 +77,11 @@ namespace WPEFramework // Define the RPC methods enum InternetStatus : uint8_t { - INTERNET_UNKNOWN, INTERNET_NOT_AVAILABLE, INTERNET_LIMITED, INTERNET_CAPTIVE_PORTAL, INTERNET_FULLY_CONNECTED, + INTERNET_UNKNOWN, }; enum WiFiFrequency : uint8_t @@ -165,6 +165,35 @@ namespace WPEFramework LOG_LEVEL_TRACE }; + // The state of the interface + enum InterfaceState : uint8_t + { + INTERFACE_ADDED, + INTERFACE_LINK_UP, + INTERFACE_LINK_DOWN, + INTERFACE_ACQUIRING_IP, + INTERFACE_REMOVED, + INTERFACE_DISABLED + }; + + enum WiFiState : uint8_t + { + WIFI_STATE_UNINSTALLED, + WIFI_STATE_DISABLED, + WIFI_STATE_DISCONNECTED, + WIFI_STATE_PAIRING, + WIFI_STATE_CONNECTING, + WIFI_STATE_CONNECTED, + WIFI_STATE_SSID_NOT_FOUND, + WIFI_STATE_SSID_CHANGED, + WIFI_STATE_CONNECTION_LOST, + WIFI_STATE_CONNECTION_FAILED, + WIFI_STATE_CONNECTION_INTERRUPTED, + WIFI_STATE_INVALID_CREDENTIALS, + WIFI_STATE_AUTHENTICATION_FAILED, + WIFI_STATE_ERROR + }; + using IInterfaceDetailsIterator = RPC::IIteratorType; using ISecurityModeIterator = RPC::IIteratorType; using IStringIterator = RPC::IIteratorType; @@ -231,6 +260,7 @@ namespace WPEFramework virtual uint32_t StartWPS(const WiFiWPS& method /* @in */, const string& wps_pin /* @in */) = 0; virtual uint32_t StopWPS(void) = 0; + virtual uint32_t GetWifiState(WiFiState &state /* @out */) = 0; virtual uint32_t GetWiFiSignalStrength(string& ssid /* @out */, string& signalStrength /* @out */, WiFiSignalQuality& quality /* @out */) = 0; virtual uint32_t GetSupportedSecurityModes(ISecurityModeIterator*& securityModes /* @out */) const = 0; @@ -245,45 +275,16 @@ namespace WPEFramework { enum { ID = ID_NETWORKMANAGER_NOTIFICATION }; - // The state of the interface - enum InterfaceState : uint8_t - { - INTERFACE_ADDED, - INTERFACE_LINK_UP, - INTERFACE_LINK_DOWN, - INTERFACE_ACQUIRING_IP, - INTERFACE_REMOVED, - INTERFACE_DISABLED - }; - - enum WiFiState : uint8_t - { - WIFI_STATE_UNINSTALLED, - WIFI_STATE_DISABLED, - WIFI_STATE_DISCONNECTED, - WIFI_STATE_PAIRING, - WIFI_STATE_CONNECTING, - WIFI_STATE_CONNECTED, - WIFI_STATE_SSID_NOT_FOUND, - WIFI_STATE_SSID_CHANGED, - WIFI_STATE_CONNECTION_LOST, - WIFI_STATE_CONNECTION_FAILED, - WIFI_STATE_CONNECTION_INTERRUPTED, - WIFI_STATE_INVALID_CREDENTIALS, - WIFI_STATE_AUTHENTICATION_FAILED, - WIFI_STATE_ERROR - }; - // Network Notifications that other processes can subscribe to - virtual void onInterfaceStateChanged(const InterfaceState event /* @in */, const string interface /* @in */) = 0; - virtual void onActiveInterfaceChanged(const string prevActiveInterface /* @in */, const string currentActiveinterface /* @in */) = 0; - virtual void onIPAddressChanged(const string interface /* @in */, const bool isAcquired /* @in */, const bool isIPv6 /* @in */, const string ipAddress /* @in */) = 0; - virtual void onInternetStatusChanged(const InternetStatus oldState /* @in */, const InternetStatus newstate /* @in */) = 0; + virtual void onInterfaceStateChange(const InterfaceState event /* @in */, const string interface /* @in */) = 0; + virtual void onActiveInterfaceChange(const string prevActiveInterface /* @in */, const string currentActiveinterface /* @in */) = 0; + virtual void onIPAddressChange(const string interface /* @in */, const bool isAcquired /* @in */, const bool isIPv6 /* @in */, const string ipAddress /* @in */) = 0; + virtual void onInternetStatusChange(const InternetStatus oldState /* @in */, const InternetStatus newstate /* @in */) = 0; // WiFi Notifications that other processes can subscribe to virtual void onAvailableSSIDs(const string jsonOfWiFiScanResults /* @in */) = 0; - virtual void onWiFiStateChanged(const WiFiState state /* @in */) = 0; - virtual void onWiFiSignalStrengthChanged(const string ssid /* @in */, const string signalLevel /* @in */, const WiFiSignalQuality signalQuality /* @in */) = 0; + virtual void onWiFiStateChange(const WiFiState state /* @in */) = 0; + virtual void onWiFiSignalStrengthChange(const string ssid /* @in */, const string signalLevel /* @in */, const WiFiSignalQuality signalQuality /* @in */) = 0; }; // Allow other processes to register/unregister from our notifications diff --git a/NetworkManager/service/NetworkConnectivity.h b/NetworkManager/service/NetworkConnectivity.h index 2f0dcd4c8c..59f319611b 100644 --- a/NetworkManager/service/NetworkConnectivity.h +++ b/NetworkManager/service/NetworkConnectivity.h @@ -23,7 +23,7 @@ enum nsm_ipversion { }; enum nsm_internetState { - UNKNOWN = 0, + UNKNOWN = -1, NO_INTERNET, LIMITED_INTERNET, CAPTIVE_PORTAL, diff --git a/NetworkManager/service/NetworkManager.h b/NetworkManager/service/NetworkManager.h index f1ffb45f55..977409fdf2 100644 --- a/NetworkManager/service/NetworkManager.h +++ b/NetworkManager/service/NetworkManager.h @@ -52,26 +52,44 @@ namespace WPEFramework Notification() = delete; Notification(const Notification &) = delete; Notification &operator=(const Notification &) = delete; - string InterfaceStateToString(Exchange::INetworkManager::INotification::InterfaceState event) + string InterfaceStateToString(Exchange::INetworkManager::InterfaceState event) { switch (event) { - case Exchange::INetworkManager::INotification::INTERFACE_ADDED: + case Exchange::INetworkManager::INTERFACE_ADDED: return "INTERFACE_ADDED"; - case Exchange::INetworkManager::INotification::INTERFACE_LINK_UP: + case Exchange::INetworkManager::INTERFACE_LINK_UP: return "INTERFACE_LINK_UP"; - case Exchange::INetworkManager::INotification::INTERFACE_LINK_DOWN: + case Exchange::INetworkManager::INTERFACE_LINK_DOWN: return "INTERFACE_LINK_DOWN"; - case Exchange::INetworkManager::INotification::INTERFACE_ACQUIRING_IP: + case Exchange::INetworkManager::INTERFACE_ACQUIRING_IP: return "INTERFACE_ACQUIRING_IP"; - case Exchange::INetworkManager::INotification::INTERFACE_REMOVED: + case Exchange::INetworkManager::INTERFACE_REMOVED: return "INTERFACE_REMOVED"; - case Exchange::INetworkManager::INotification::INTERFACE_DISABLED: + case Exchange::INetworkManager::INTERFACE_DISABLED: return "INTERFACE_DISABLED"; } return ""; } + string WiFiSignalQualityToString(Exchange::INetworkManager::WiFiSignalQuality quality) + { + switch (quality) + { + case Exchange::INetworkManager::WiFiSignalQuality::WIFI_SIGNAL_DISCONNECTED: + return "Disconnected"; + case Exchange::INetworkManager::WiFiSignalQuality::WIFI_SIGNAL_WEAK: + return "Weak"; + case Exchange::INetworkManager::WiFiSignalQuality::WIFI_SIGNAL_FAIR: + return "Fair"; + case Exchange::INetworkManager::WiFiSignalQuality::WIFI_SIGNAL_GOOD: + return "Good"; + case Exchange::INetworkManager::WiFiSignalQuality::WIFI_SIGNAL_EXCELLENT: + return "Excellent"; + } + return ""; + } + string InternetStatusToString(const Exchange::INetworkManager::InternetStatus internetStatus) { switch (internetStatus) @@ -99,47 +117,104 @@ namespace WPEFramework } public: - void onInterfaceStateChanged(const Exchange::INetworkManager::INotification::InterfaceState event, const string interface) override + void onInterfaceStateChange(const Exchange::INetworkManager::InterfaceState event, const string interface) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject params; +#ifdef ENABLE_LEGACY_NSM_SUPPORT + JsonObject legacyParams; + JsonObject onConnParams; + std::string json; + if(interface == "wlan0") + legacyParams["interface"] = "WIFI"; + else if(interface == "eth0") + legacyParams["interface"] = "ETHERNET"; + if(event == Exchange::INetworkManager::INTERFACE_ADDED) + legacyParams["enabled"] = true; + else if(event == Exchange::INetworkManager::INTERFACE_REMOVED) + legacyParams["enabled"] = false; + _parent.Notify("onInterfaceStatusChanged", legacyParams); + if(event == Exchange::INetworkManager::INTERFACE_LINK_UP) + onConnParams["status"] = "CONNECTED"; + else if(event == Exchange::INetworkManager::INTERFACE_LINK_DOWN) + onConnParams["status"] = "DISCONNECTED"; + onConnParams["interface"] = legacyParams["interface"]; + onConnParams.ToString(json); + NMLOG_TRACE("onConnectionStatusChanged onConnParams=%s", json.c_str() ); + _parent.Notify("onConnectionStatusChanged", onConnParams); +#endif params["interface"] = interface; params["state"] = InterfaceStateToString(event); - _parent.Notify("onInterfaceStateChanged", params); + _parent.Notify("onInterfaceStateChange", params); } - void onIPAddressChanged(const string interface, const bool isAcquired, const bool isIPv6, const string ipAddress) override + void onIPAddressChange(const string interface, const bool isAcquired, const bool isIPv6, const string ipAddress) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject params; - params["interface"] = interface; +#ifdef ENABLE_LEGACY_NSM_SUPPORT + JsonObject legacyParams; + if(isIPv6) + { + legacyParams["ip6Address"] = ipAddress; + legacyParams["ip4Address"] = ""; + } + else + { + legacyParams["ip4Address"] = ipAddress; + legacyParams["ip6Address"] = ""; + } + if(interface == "wlan0") + legacyParams["interface"] = "WIFI"; + else if(interface == "eth0") + legacyParams["interface"] = "ETHERNET"; + legacyParams["status"] = string (isAcquired ? "ACQUIRED" : "LOST"); + _parent.Notify("onIPAddressStatusChanged", legacyParams); +#endif params["status"] = string (isAcquired ? "ACQUIRED" : "LOST"); + params["interface"] = interface; params["ipAddress"] = ipAddress; params["isIPv6"] = isIPv6; - - _parent.Notify("onIPAddressChanged", params); + _parent.Notify("onIPAddressChange", params); } - void onActiveInterfaceChanged(const string prevActiveInterface, const string currentActiveinterface) override + void onActiveInterfaceChange(const string prevActiveInterface, const string currentActiveinterface) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject params; +#ifdef ENABLE_LEGACY_NSM_SUPPORT + JsonObject legacyParams; + string oldInterface; + string newInterface; + if(prevActiveInterface == "wlan0") + oldInterface = "WIFI"; + else if(prevActiveInterface == "eth0") + oldInterface = "ETHERNET"; + if(currentActiveinterface == "wlan0") + newInterface = "WIFI"; + else if(currentActiveinterface == "eth0") + newInterface = "ETHERNET"; + legacyParams["oldInterfaceName"] = oldInterface; + legacyParams["newInterfaceName"] = newInterface; + _parent.Notify("onDefaultInterfaceChanged", legacyParams); +#endif params["oldInterfaceName"] = prevActiveInterface; params["newInterfaceName"] = currentActiveinterface; + _parent.Notify("onActiveInterfaceChange", params); - _parent.Notify("onActiveInterfaceChanged", params); } - void onInternetStatusChanged(const Exchange::INetworkManager::InternetStatus oldState, const Exchange::INetworkManager::InternetStatus newstate) override + void onInternetStatusChange(const Exchange::INetworkManager::InternetStatus oldState, const Exchange::INetworkManager::InternetStatus newstate) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject params; - params["prevState"] = static_cast (oldState); - params["prevStatus"] = InternetStatusToString(oldState); + params["state"] = static_cast (newstate);; params["status"] = InternetStatusToString(newstate); + params["prevState"] = static_cast (oldState); + params["prevStatus"] = InternetStatusToString(oldState); - _parent.Notify("onInternetStatusChanged", params); + _parent.Notify("onInternetStatusChange", params); if (Exchange::INetworkManager::InternetStatus::INTERNET_FULLY_CONNECTED == newstate) { @@ -159,24 +234,37 @@ namespace WPEFramework _parent.Notify("onAvailableSSIDs", result); } - void onWiFiStateChanged(const Exchange::INetworkManager::INotification::WiFiState state) override + + void onWiFiStateChange(const Exchange::INetworkManager::WiFiState state) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject result; +#ifdef ENABLE_LEGACY_NSM_SUPPORT + JsonObject legacyResult; + legacyResult["state"] = static_cast (state); + legacyResult["isLNF"] = false; + _parent.Notify("onWiFiStateChanged", legacyResult); +#endif result["state"] = static_cast (state); - _parent.Notify("onWiFiStateChanged", result); + _parent.Notify("onWiFiStateChange", result); } - void onWiFiSignalStrengthChanged(const string ssid, const string signalLevel, const Exchange::INetworkManager::WiFiSignalQuality signalQuality) override + + void onWiFiSignalStrengthChange(const string ssid, const string signalLevel, const Exchange::INetworkManager::WiFiSignalQuality signalQuality) override { NMLOG_TRACE("%s", __FUNCTION__); JsonObject result; +#ifdef ENABLE_LEGACY_NSM_SUPPORT + JsonObject legacyResult; + legacyResult["signalStrength"] = WiFiSignalQualityToString(signalQuality); + legacyResult["strength"] = signalLevel; + _parent.Notify("onWiFiSignalStrengthChanged", legacyResult); +#endif result["ssid"] = ssid; + result["signalQuality"] = WiFiSignalQualityToString(signalQuality); result["signalLevel"] = signalLevel; - result["signalQuality"] = static_cast (signalQuality); - _parent.Notify("onWiFiSignalStrengthChanged", result); + _parent.Notify("onWiFiSignalStrengthChange", result); } - // The activated/deactived methods are part of the RPC::IRemoteConnection::INotification // interface. These are triggered when Thunder detects a connection/disconnection over the // COM-RPC link. @@ -288,6 +376,7 @@ namespace WPEFramework uint32_t GetConnectedSSID(const JsonObject& parameters, JsonObject& response); uint32_t StartWPS(const JsonObject& parameters, JsonObject& response); uint32_t StopWPS(const JsonObject& parameters, JsonObject& response); + uint32_t GetWifiState(const JsonObject& parameters, JsonObject& response); uint32_t GetWiFiSignalStrength(const JsonObject& parameters, JsonObject& response); uint32_t GetSupportedSecurityModes(const JsonObject& parameters, JsonObject& response); #ifdef ENABLE_LEGACY_NSM_SUPPORT @@ -319,6 +408,7 @@ namespace WPEFramework uint32_t getSupportedSecurityModes(const JsonObject& parameters, JsonObject& response); uint32_t startScan(const JsonObject& parameters, JsonObject& response); uint32_t stopScan(const JsonObject& parameters, JsonObject& response); + uint32_t getCurrentState(const JsonObject& parameters, JsonObject& response); #endif private: uint32_t _connectionId; diff --git a/NetworkManager/service/NetworkManagerImplementation.cpp b/NetworkManager/service/NetworkManagerImplementation.cpp index c08394e7e8..7470420487 100644 --- a/NetworkManager/service/NetworkManagerImplementation.cpp +++ b/NetworkManager/service/NetworkManagerImplementation.cpp @@ -460,16 +460,13 @@ namespace WPEFramework return Core::ERROR_NONE; } - void NetworkManagerImplementation::ReportInterfaceStateChangedEvent(INetworkManager::INotification::InterfaceState state, string interface) + void NetworkManagerImplementation::ReportInterfaceStateChangedEvent(INetworkManager::InterfaceState state, string interface) { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onInterfaceStateChanged(state, interface); + callback->onInterfaceStateChange(state, interface); } - _notificationLock.Unlock(); } @@ -477,12 +474,9 @@ namespace WPEFramework { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onIPAddressChanged(interface, isAcquired, isIPv6, ipAddress); + callback->onIPAddressChange(interface, isAcquired, isIPv6, ipAddress); } - _notificationLock.Unlock(); } @@ -490,12 +484,9 @@ namespace WPEFramework { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onActiveInterfaceChanged(prevActiveInterface, currentActiveinterface); + callback->onActiveInterfaceChange(prevActiveInterface, currentActiveinterface); } - _notificationLock.Unlock(); } @@ -503,12 +494,9 @@ namespace WPEFramework { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onInternetStatusChanged(oldState, newstate); + callback->onInternetStatusChange(oldState, newstate); } - _notificationLock.Unlock(); } @@ -516,23 +504,19 @@ namespace WPEFramework { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - NMLOG_INFO("scan result is, %s", jsonOfWiFiScanResults.c_str()); for (const auto callback : _notificationCallbacks) { callback->onAvailableSSIDs(jsonOfWiFiScanResults); } - _notificationLock.Unlock(); } - void NetworkManagerImplementation::ReportWiFiStateChangedEvent(const INetworkManager::INotification::WiFiState state) + void NetworkManagerImplementation::ReportWiFiStateChangedEvent(const INetworkManager::WiFiState state) { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onWiFiStateChanged(state); + callback->onWiFiStateChange(state); } _notificationLock.Unlock(); } @@ -541,13 +525,10 @@ namespace WPEFramework { LOG_ENTRY_FUNCTION(); _notificationLock.Lock(); - - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); for (const auto callback : _notificationCallbacks) { - callback->onWiFiSignalStrengthChanged(ssid, signalLevel, signalQuality); - NMLOG_INFO("We have %d subscribed clients to trigger notifications", (int) _notificationCallbacks.size()); + callback->onWiFiSignalStrengthChange(ssid, signalLevel, signalQuality); + } - _notificationLock.Unlock(); } } diff --git a/NetworkManager/service/NetworkManagerImplementation.h b/NetworkManager/service/NetworkManagerImplementation.h index 7069232c61..5107398be6 100644 --- a/NetworkManager/service/NetworkManagerImplementation.h +++ b/NetworkManager/service/NetworkManagerImplementation.h @@ -170,6 +170,7 @@ namespace WPEFramework uint32_t StartWPS(const WiFiWPS& method /* @in */, const string& wps_pin /* @in */) override; uint32_t StopWPS(void) override; + uint32_t GetWifiState(WiFiState &state) override; uint32_t GetWiFiSignalStrength(string& ssid /* @out */, string& signalStrength /* @out */, WiFiSignalQuality& quality /* @out */) override; uint32_t SetStunEndpoint (string const endPoint /* @in */, const uint32_t port /* @in */, const uint32_t bindTimeout /* @in */, const uint32_t cacheTimeout /* @in */) override; @@ -208,12 +209,12 @@ namespace WPEFramework uint32_t Configure(const string& configLine /* @in */, NMLogging& logLevel /* @out */) override; /* Events */ - void ReportInterfaceStateChangedEvent(INetworkManager::INotification::InterfaceState state, string interface); + void ReportInterfaceStateChangedEvent(INetworkManager::InterfaceState state, string interface); void ReportIPAddressChangedEvent(const string& interface, bool isAcquired, bool isIPv6, const string& ipAddress); void ReportActiveInterfaceChangedEvent(const string prevActiveInterface, const string currentActiveinterface); void ReportInternetStatusChangedEvent(const InternetStatus oldState, const InternetStatus newstate); void ReportAvailableSSIDsEvent(const string jsonOfWiFiScanResults); - void ReportWiFiStateChangedEvent(const INetworkManager::INotification::WiFiState state); + void ReportWiFiStateChangedEvent(const INetworkManager::WiFiState state); void ReportWiFiSignalStrengthChangedEvent(const string ssid , const string signalLevel , const WiFiSignalQuality signalQuality); private: diff --git a/NetworkManager/service/NetworkManagerJsonRpc.cpp b/NetworkManager/service/NetworkManagerJsonRpc.cpp index 0f1320de44..02fd997d27 100644 --- a/NetworkManager/service/NetworkManagerJsonRpc.cpp +++ b/NetworkManager/service/NetworkManagerJsonRpc.cpp @@ -67,6 +67,7 @@ namespace WPEFramework Register("GetConnectedSSID", &NetworkManager::GetConnectedSSID, this); Register("StartWPS", &NetworkManager::StartWPS, this); Register("StopWPS", &NetworkManager::StopWPS, this); + Register("GetWifiState", &NetworkManager::GetWifiState, this); Register("GetWiFiSignalStrength", &NetworkManager::GetWiFiSignalStrength, this); Register("GetSupportedSecurityModes", &NetworkManager::GetSupportedSecurityModes, this); } @@ -104,6 +105,7 @@ namespace WPEFramework Unregister("GetConnectedSSID"); Unregister("StartWPS"); Unregister("StopWPS"); + Unregister("GetWifiState"); Unregister("GetWiFiSignalStrength"); Unregister("GetSupportedSecurityModes"); } @@ -130,6 +132,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -165,7 +168,7 @@ namespace WPEFramework response["interfaces"] = array; response["success"] = true; } - + LOGTRACEMETHODFIN(); return rc; } @@ -184,6 +187,7 @@ namespace WPEFramework response["interface"] = interface; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -201,6 +205,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -219,6 +224,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -250,6 +256,7 @@ namespace WPEFramework response["secondarydns"] = result.m_secondaryDns; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -280,6 +287,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -305,6 +313,7 @@ namespace WPEFramework response["cacheTimeout"] = cacheTimeout; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -326,6 +335,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -356,6 +366,7 @@ namespace WPEFramework response["success"] = true; } } + LOGTRACEMETHODFIN(); return rc; } @@ -401,6 +412,7 @@ namespace WPEFramework if (endpointsIter) endpointsIter->Release(); + LOGTRACEMETHODFIN(); return rc; } @@ -441,6 +453,7 @@ namespace WPEFramework response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -459,6 +472,7 @@ namespace WPEFramework response["uri"] = endPoint; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -478,6 +492,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -495,6 +510,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -522,6 +538,7 @@ namespace WPEFramework m_publicIPAddress = ipAddress; m_publicIPAddressType = ipversion; } + LOGTRACEMETHODFIN(); return rc; } @@ -576,6 +593,7 @@ namespace WPEFramework reply["success"] = true; response = reply; } + LOGTRACEMETHODFIN(); return rc; } @@ -598,6 +616,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -616,6 +635,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -633,6 +653,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -663,6 +684,7 @@ namespace WPEFramework response["ssids"] = ssids; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -688,6 +710,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -710,6 +733,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -735,6 +759,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -752,6 +777,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -777,6 +803,7 @@ namespace WPEFramework response["noise"] = ssidInfo.m_noise; response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -806,6 +833,7 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -823,6 +851,26 @@ namespace WPEFramework { response["success"] = true; } + LOGTRACEMETHODFIN(); + return rc; + } + + uint32_t NetworkManager::GetWifiState(const JsonObject& parameters, JsonObject& response) + { + Exchange::INetworkManager::WiFiState state; + uint32_t rc = Core::ERROR_GENERAL; + + LOGINFOMETHOD(); + if (_NetworkManager) + rc = _NetworkManager->GetWifiState(state); + else + rc = Core::ERROR_UNAVAILABLE; + if (Core::ERROR_NONE == rc) + { + response["state"] = static_cast (state); + response["success"] = true; + } + LOGTRACEMETHODFIN(); return rc; } @@ -846,6 +894,7 @@ namespace WPEFramework response["quality"] = static_cast (quality); response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } @@ -874,6 +923,7 @@ namespace WPEFramework } response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } } diff --git a/NetworkManager/service/NetworkManagerLegacy.cpp b/NetworkManager/service/NetworkManagerLegacy.cpp index 2a286b50d0..f3fbd14c51 100644 --- a/NetworkManager/service/NetworkManagerLegacy.cpp +++ b/NetworkManager/service/NetworkManagerLegacy.cpp @@ -18,7 +18,12 @@ **/ #include "NetworkManager.h" +#include "NetworkConnectivity.h" +#define LOGINFOMETHOD() { std::string json; parameters.ToString(json); NMLOG_TRACE("Legacy params=%s", json.c_str() ); } +#define LOGTRACEMETHODFIN() { std::string json; response.ToString(json); NMLOG_TRACE("Legacy response=%s", json.c_str() ); } + +using namespace std; using namespace WPEFramework::Plugin; namespace WPEFramework @@ -64,6 +69,7 @@ namespace WPEFramework Register("isPaired", &NetworkManager::isPaired, this); Register("saveSSID", &NetworkManager::AddToKnownSSIDs, this); Register("getSupportedSecurityModes", &NetworkManager::GetSupportedSecurityModes, this); + Register("getCurrentState", &NetworkManager::GetWifiState, this); } /** @@ -99,6 +105,7 @@ namespace WPEFramework Unregister("isPaired"); Unregister("saveSSID"); Unregister("getSupportedSecurityModes"); + Unregister("getCurrentState"); } #define CIDR_NETMASK_IP_LEN 32 @@ -143,6 +150,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; JsonArray array; + LOGINFOMETHOD(); rc = GetAvailableInterfaces(parameters, tmpResponse); const JsonArray& tmpArray = tmpResponse["interfaces"].Array(); @@ -160,6 +168,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["Interfaces"] = array; response["success"] = tmpResponse["success"]; + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::setInterfaceEnabled (const JsonObject& parameters, JsonObject& response) @@ -168,6 +177,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { string interface; JsonObject tmpParameters; + LOGINFOMETHOD(); if("WIFI" == parameters["interface"].String()) interface = "wlan0"; else if("ETHERNET" == parameters["interface"].String()) @@ -177,6 +187,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { tmpParameters["enabled"] = parameters["enabled"]; rc = SetInterfaceEnabled(tmpParameters, response); + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::getDefaultInterface (const JsonObject& parameters, JsonObject& response) @@ -184,6 +195,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; + LOGINFOMETHOD(); rc = GetPrimaryInterface(parameters, tmpResponse); if (Core::ERROR_NONE == rc) @@ -194,6 +206,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["interface"] = "ETHERNET"; response["success"] = tmpResponse["success"]; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::setDefaultInterface(const JsonObject& parameters, JsonObject& response) @@ -201,12 +214,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; string interface; + LOGINFOMETHOD(); if("WIFI" == parameters["interface"].String()) tmpParameters["interface"] = "wlan0"; else if("ETHERNET" == parameters["interface"].String()) tmpParameters["interface"] = "eth0"; rc = SetPrimaryInterface(tmpParameters, response); + LOGTRACEMETHODFIN(); return rc; } @@ -216,6 +231,8 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; JsonObject tmpParameters; Exchange::INetworkManager::IPAddressInfo result{}; + + LOGINFOMETHOD(); if("WIFI" == parameters["interface"].String()) tmpParameters["interface"] = "wlan0"; @@ -241,6 +258,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["supported"] = true; response["success"] = tmpResponse["success"]; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::getIPSettings (const JsonObject& parameters, JsonObject& response) @@ -251,6 +269,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpParameters; size_t index; + LOGINFOMETHOD(); tmpParameters["ipversion"] = parameters["ipversion"]; if ("WIFI" == parameters["interface"].String()) tmpParameters["interface"] = "wlan0"; @@ -276,6 +295,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["secondarydns"] = tmpResponse["secondarydns"]; response["success"] = tmpResponse["success"]; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::isConnectedToInternet(const JsonObject& parameters, JsonObject& response) @@ -283,15 +303,18 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; + LOGINFOMETHOD(); string ipversion = parameters["ipversion"].String(); rc = IsConnectedToInternet(parameters, tmpResponse); if (Core::ERROR_NONE == rc) { response["connectedToInternet"] = tmpResponse["isConnectedToInternet"]; - response["ipversion"] = ipversion.c_str(); + if(ipversion == "IPV4" || ipversion == "IPV6") + response["ipversion"] = ipversion.c_str(); response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::getInternetConnectionState(const JsonObject& parameters, JsonObject& response) @@ -302,21 +325,35 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; JsonObject captivePortalResponse; JsonObject tmpParameters; + string status; + + LOGINFOMETHOD(); string ipversion = parameters["ipversion"].String(); rc = IsConnectedToInternet(parameters, tmpResponse); if (Core::ERROR_NONE == rc) { - response["state"] = tmpResponse["internetState"]; - if (response["state"].Number() == 2) + status = tmpResponse["status"].String(); + NMLOG_TRACE("status = %s\n", status ); + NMLOG_TRACE("tmpResponse[status].String() = %s\n", tmpResponse["status"].String() ); + if(status == "LIMITED_INTERNET") + response["state"] = static_cast(nsm_internetState::LIMITED_INTERNET); + else if(status == "CAPTIVE_PORTAL") { + response["state"] = static_cast(nsm_internetState::CAPTIVE_PORTAL); rc1 = getCaptivePortalURI(tmpParameters, captivePortalResponse); - if (Core::ERROR_NONE == rc1) response["uri"] = captivePortalResponse["uri"]; } - response["ipversion"] = ipversion.c_str(); + else if(status == "FULLY_CONNECTED") + response["state"] = static_cast(nsm_internetState::FULLY_CONNECTED); + else + response["state"] = static_cast(nsm_internetState::NO_INTERNET); + + if(ipversion == "IPV4" || ipversion == "IPV6") + response["ipversion"] = ipversion.c_str(); response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::ping(const JsonObject& parameters, JsonObject& response) @@ -328,6 +365,8 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpResponse; string endpoint{}; + LOGINFOMETHOD(); + endpoint = parameters["endpoint"].String(); if (inet_pton(AF_INET, endpoint.c_str(), &ipv4address) > 0) @@ -346,6 +385,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { { response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::getPublicIP(const JsonObject& parameters, JsonObject& response) @@ -356,6 +396,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { JsonObject tmpParameters; JsonObject tmpResponse; + LOGINFOMETHOD(); if("WIFI" == parameters["iface"].String()) interface = "wlan0"; else if("ETHERNET" == parameters["iface"].String()) @@ -375,6 +416,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["public_ip"] = tmpResponse["publicIP"]; response["success"] = tmpResponse["success"]; } + LOGTRACEMETHODFIN(); return rc; } @@ -383,6 +425,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; + LOGINFOMETHOD(); rc = GetAvailableInterfaces(parameters, tmpResponse); const JsonArray& tmpArray = tmpResponse["interfaces"].Array(); @@ -397,6 +440,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { } } response["success"] = tmpResponse["success"]; + LOGTRACEMETHODFIN(); return rc; } @@ -405,9 +449,12 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpParameters; + LOGINFOMETHOD(); + tmpParameters["ssid"] = ""; rc = RemoveKnownSSID(tmpParameters, response); + LOGTRACEMETHODFIN(); return rc; } @@ -416,6 +463,8 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { uint32_t rc = Core::ERROR_GENERAL; JsonObject tmpResponse; + LOGINFOMETHOD(); + rc = GetConnectedSSID(parameters, tmpResponse); if (Core::ERROR_NONE == rc) @@ -429,12 +478,14 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { response["frequency"] = tmpResponse["frequency"]; response["success"] = tmpResponse["success"]; } + LOGTRACEMETHODFIN(); return rc; } uint32_t NetworkManager::isPaired (const JsonObject& parameters, JsonObject& response) { uint32_t rc = Core::ERROR_GENERAL; + LOGINFOMETHOD(); rc = GetKnownSSIDs(parameters, response); @@ -451,6 +502,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { } response["success"] = true; } + LOGTRACEMETHODFIN(); return rc; } } diff --git a/NetworkManager/service/NetworkManagerRDKProxy.cpp b/NetworkManager/service/NetworkManagerRDKProxy.cpp index b95db1861d..9a68db2b16 100644 --- a/NetworkManager/service/NetworkManagerRDKProxy.cpp +++ b/NetworkManager/service/NetworkManagerRDKProxy.cpp @@ -350,6 +350,7 @@ typedef struct _IARM_Bus_WiFiSrvMgr_SsidList_Param_t { #define IARM_BUS_WIFI_MGR_API_clearSSID "clearSSID" /**< Clear given SSID */ #define IARM_BUS_WIFI_MGR_API_connect "connect" /**< Connect with given or saved SSID and passphrase */ #define IARM_BUS_WIFI_MGR_API_disconnectSSID "disconnectSSID" /**< Disconnect from current SSID */ +#define IARM_BUS_WIFI_MGR_API_getCurrentState "getCurrentState" /**< Retrieve current state */ namespace WPEFramework @@ -361,6 +362,27 @@ namespace WPEFramework const float signalStrengthThresholdFair = -67.0f; NetworkManagerImplementation* _instance = nullptr; + Exchange::INetworkManager::WiFiState to_wifi_state(WiFiStatusCode_t code) { + switch (code) + { + case WIFI_DISCONNECTED: + return Exchange::INetworkManager::WIFI_STATE_DISCONNECTED; + case WIFI_PAIRING: + return Exchange::INetworkManager::WIFI_STATE_PAIRING; + case WIFI_CONNECTING: + return Exchange::INetworkManager::WIFI_STATE_CONNECTING; + case WIFI_CONNECTED: + return Exchange::INetworkManager::WIFI_STATE_CONNECTED; + case WIFI_FAILED: + return Exchange::INetworkManager::WIFI_STATE_CONNECTION_FAILED; + case WIFI_UNINSTALLED: + return Exchange::INetworkManager::WIFI_STATE_UNINSTALLED; + case WIFI_DISABLED: + return Exchange::INetworkManager::WIFI_STATE_DISABLED; + } + return Exchange::INetworkManager::WIFI_STATE_CONNECTION_FAILED; + } + void NetworkManagerInternalEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) { LOG_ENTRY_FUNCTION(); @@ -385,9 +407,9 @@ namespace WPEFramework IARM_BUS_NetSrvMgr_Iface_EventInterfaceEnabledStatus_t *e = (IARM_BUS_NetSrvMgr_Iface_EventInterfaceEnabledStatus_t*) data; NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_ENABLED_STATUS :: %s", e->interface); if (e->status) - ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INotification::INTERFACE_ADDED, string(e->interface)); + ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_ADDED, string(e->interface)); else - ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INotification::INTERFACE_REMOVED, string(e->interface)); + ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_REMOVED, string(e->interface)); break; } case IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS: @@ -395,9 +417,9 @@ namespace WPEFramework IARM_BUS_NetSrvMgr_Iface_EventInterfaceConnectionStatus_t *e = (IARM_BUS_NetSrvMgr_Iface_EventInterfaceConnectionStatus_t*) data; NMLOG_INFO ("IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS :: %s", e->interface); if (e->status) - ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INotification::INTERFACE_LINK_UP, string(e->interface)); + ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_UP, string(e->interface)); else - ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INotification::INTERFACE_LINK_DOWN, string(e->interface)); + ::_instance->ReportInterfaceStateChangedEvent(Exchange::INetworkManager::INTERFACE_LINK_DOWN, string(e->interface)); break; } case IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS: @@ -441,34 +463,12 @@ namespace WPEFramework case IARM_BUS_WIFI_MGR_EVENT_onWIFIStateChanged: { IARM_BUS_WiFiSrvMgr_EventData_t* e = (IARM_BUS_WiFiSrvMgr_EventData_t *) data; - Exchange::INetworkManager::INotification::WiFiState state = Exchange::INetworkManager::INotification::WIFI_STATE_DISCONNECTED; + Exchange::INetworkManager::WiFiState state = Exchange::INetworkManager::WIFI_STATE_DISCONNECTED; NMLOG_INFO("Event IARM_BUS_WIFI_MGR_EVENT_onWIFIStateChanged received; state=%d", e->data.wifiStateChange.state); - switch (e->data.wifiStateChange.state) - { - case WIFI_DISCONNECTED: - state = Exchange::INetworkManager::INotification::WIFI_STATE_DISCONNECTED; - break; - case WIFI_PAIRING: - state = Exchange::INetworkManager::INotification::WIFI_STATE_PAIRING; - break; - case WIFI_CONNECTING: - state = Exchange::INetworkManager::INotification::WIFI_STATE_CONNECTING; - break; - case WIFI_CONNECTED: - state = Exchange::INetworkManager::INotification::WIFI_STATE_CONNECTED; + state = to_wifi_state(e->data.wifiStateChange.state); + if(e->data.wifiStateChange.state == WIFI_CONNECTED) WifiSignalStrengthMonitor::getInstance()->startWifiSignalStrengthMonitor(DEFAULT_WIFI_SIGNAL_TEST_INTERVAL_SEC); - break; - case WIFI_FAILED: - state = Exchange::INetworkManager::INotification::WIFI_STATE_CONNECTION_FAILED; - break; - case WIFI_UNINSTALLED: - state = Exchange::INetworkManager::INotification::WIFI_STATE_UNINSTALLED; - break; - case WIFI_DISABLED: - state = Exchange::INetworkManager::INotification::WIFI_STATE_DISABLED; - break; - } ::_instance->ReportWiFiStateChangedEvent(state); break; } @@ -1147,5 +1147,21 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN] = { return rc; } + + uint32_t NetworkManagerImplementation::GetWifiState(WiFiState &state) + { + LOG_ENTRY_FUNCTION(); + uint32_t rc = Core::ERROR_RPC_CALL_FAILED; + IARM_Result_t retVal = IARM_RESULT_SUCCESS; + IARM_Bus_WiFiSrvMgr_Param_t param; + memset(¶m, 0, sizeof(param)); + + if(IARM_RESULT_SUCCESS == IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getCurrentState, (void *)¶m, sizeof(param))) + { + state = to_wifi_state(param.data.wifiStatus); + rc = Core::ERROR_NONE; + } + return rc; + } } } From b181dc10757c1b07f1160cd333f4d72626ce0d1c Mon Sep 17 00:00:00 2001 From: cmuhammedrafi <103924677+cmuhammedrafi@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:08:44 +0530 Subject: [PATCH 2/3] XIONE-14127 WPE_ERR_ProcessCrash with function "__libc_do_syscall" (#5005) updated connectivity monitor remove singleton design pattern --- Network/Network.h | 2 +- Network/NetworkConnectivity.cpp | 2 +- Network/NetworkConnectivity.h | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Network/Network.h b/Network/Network.h index 7d441f5c53..6a8521cd9a 100644 --- a/Network/Network.h +++ b/Network/Network.h @@ -254,7 +254,7 @@ namespace WPEFramework { static Network *_instance; static Network *getInstance() {return _instance;} Config config; - ConnectivityMonitor& connectivityMonitor = ConnectivityMonitor::getInstance(); + ConnectivityMonitor connectivityMonitor; private: PluginHost::IShell* m_service; diff --git a/Network/NetworkConnectivity.cpp b/Network/NetworkConnectivity.cpp index 5caa7c420e..baf41af7e8 100644 --- a/Network/NetworkConnectivity.cpp +++ b/Network/NetworkConnectivity.cpp @@ -542,7 +542,6 @@ namespace WPEFramework { bool ConnectivityMonitor::stopContinuousConnectivityMonitoring() { - LOGINFO("Entry"); if (!isMonitorThreadRunning()) { LOGWARN("Connectivity monitor not running"); @@ -550,6 +549,7 @@ namespace WPEFramework { } cv_.notify_all(); stopFlag = true; + LOGINFO("stoping connectivityMonitor..."); if (thread_.joinable()) { diff --git a/Network/NetworkConnectivity.h b/Network/NetworkConnectivity.h index 9fd639831e..1a286905d7 100644 --- a/Network/NetworkConnectivity.h +++ b/Network/NetworkConnectivity.h @@ -101,11 +101,6 @@ namespace WPEFramework { class ConnectivityMonitor : public Connectivity { public: - static ConnectivityMonitor& getInstance() { - static ConnectivityMonitor instance; - return instance; - } - bool isConnectedToInternet(nsm_ipversion ipversion); nsm_internetState getInternetConnectionState(nsm_ipversion ipversion); std::string getCaptivePortalURI(); @@ -119,7 +114,6 @@ namespace WPEFramework { void signalConnectivityMonitor(); void resetConnectivityCache() { g_internetState = nsm_internetState::UNKNOWN;} - private: ConnectivityMonitor() : stopFlag(false), threadRunning(false), isContinuesMonitoringNeeded(false) { setConnectivityMonitorEndpoints(getConnectivityDefaultEndpoints()); @@ -129,6 +123,7 @@ namespace WPEFramework { LOGINFO("~ConnectivityMonitor"); stopContinuousConnectivityMonitoring(); } + private: std::vector getConnectivityMonitorEndpoints(); ConnectivityMonitor(const ConnectivityMonitor&) = delete; From 122c7e99064c44ce9e030f7fbb2cb20f963c964a Mon Sep 17 00:00:00 2001 From: tabbas651 <74683978+tabbas651@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:31:42 -0400 Subject: [PATCH 3/3] RDKTV-29404: Apache 2K /Pioneer-2 - R2 Builds show Blank screen after boot up (#5008) Reason for change: PersistentStore.json is not generated in R2 build due to write_config() empty parameter. as per Thunder R2 release , we need to pass Plugin/Project name as parameter to write_config Test Procedure: Verify in Jenkin Build Risks: High Signed-off-by: Thamim Razith --- PersistentStore/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PersistentStore/CMakeLists.txt b/PersistentStore/CMakeLists.txt index 1afd301c4d..baac30eefd 100644 --- a/PersistentStore/CMakeLists.txt +++ b/PersistentStore/CMakeLists.txt @@ -17,12 +17,12 @@ cmake_minimum_required(VERSION 3.14) -project(PersistentStore) +set(PLUGIN_NAME PersistentStore) +set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) set(CMAKE_CXX_STANDARD 11) find_package(WPEFramework) -set(MODULE_NAME "${NAMESPACE}${PROJECT_NAME}") set(PLUGIN_PERSISTENTSTORE_MODE "Off" CACHE STRING "Controls if the plugin should run in its own process, in process or remote") set(PLUGIN_PERSISTENTSTORE_URI "ss.eu.prod.developer.comcast.com:443" CACHE STRING "Account scope endpoint") @@ -67,4 +67,4 @@ endif () install(TARGETS ${MODULE_NAME} DESTINATION lib/${STORAGE_DIRECTORY}/plugins) -write_config() +write_config(${PLUGIN_NAME})