From 77677eb34407a056ed5f7dea6c8b3ef9acbeae98 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Tue, 5 Mar 2024 19:42:38 +0000 Subject: [PATCH 1/4] RDKTV-29180 - [Miracast]: TV name shows as "Miracast-Generic" in casting devices Signed-off-by: yuvaramachandran_gurusamy --- Miracast/MiracastService/MiracastService.cpp | 45 +++++++++++++++++--- Miracast/MiracastService/MiracastService.h | 4 +- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Miracast/MiracastService/MiracastService.cpp b/Miracast/MiracastService/MiracastService.cpp index 4ac284c065..59fa2be713 100644 --- a/Miracast/MiracastService/MiracastService.cpp +++ b/Miracast/MiracastService/MiracastService.cpp @@ -113,6 +113,11 @@ namespace WPEFramework delete m_SystemPluginObj; m_SystemPluginObj = nullptr; } + if (m_FriendlyNameMonitorTimerID) + { + g_source_remove(m_FriendlyNameMonitorTimerID); + m_FriendlyNameMonitorTimerID = 0; + } Unregister(METHOD_MIRACAST_SET_ENABLE); Unregister(METHOD_MIRACAST_GET_ENABLE); Unregister(METHOD_MIRACAST_STOP_CLIENT_CONNECT); @@ -190,7 +195,15 @@ namespace WPEFramework getSystemPlugin(); // subscribe for event m_SystemPluginObj->Subscribe(1000, "onFriendlyNameChanged", &MiracastService::onFriendlyNameUpdateHandler, this); - updateSystemFriendlyName(); + if ( false == updateSystemFriendlyName()) + { + m_FriendlyNameMonitorTimerID = g_timeout_add(2000, MiracastService::monitor_friendly_name_timercallback, this); + MIRACASTLOG_WARNING("Unable to get friendlyName, requires polling [%u]...",m_FriendlyNameMonitorTimerID); + } + else + { + MIRACASTLOG_INFO("friendlyName updated properly..."); + } m_isServiceInitialized = true; m_miracast_ctrler_obj->m_ePlayer_state = MIRACAST_PLAYER_STATE_IDLE; } @@ -226,7 +239,6 @@ namespace WPEFramework } } } - // On success return empty, to indicate there is no error text. return msg; } @@ -906,15 +918,18 @@ namespace WPEFramework } } - int MiracastService::updateSystemFriendlyName() + bool MiracastService::updateSystemFriendlyName() { JsonObject params, Result; + bool return_value = false; MIRACASTLOG_INFO("Entering..!!!"); + getSystemPlugin(); + if (nullptr == m_SystemPluginObj) { LOGERR("m_SystemPluginObj not yet instantiated"); - return Core::ERROR_GENERAL; + return false; } uint32_t ret = m_SystemPluginObj->Invoke(THUNDER_RPC_TIMEOUT, _T("getFriendlyName"), params, Result); @@ -927,6 +942,7 @@ namespace WPEFramework friendlyName = Result["friendlyName"].String(); m_miracast_ctrler_obj->set_FriendlyName(friendlyName); MIRACASTLOG_INFO("Miracast FriendlyName=%s", friendlyName.c_str()); + return_value = true; } else { @@ -938,7 +954,7 @@ namespace WPEFramework { LOGERR("updateSystemFriendlyName call failed E[%u]", ret); } - return ret; + return return_value; } void MiracastService::onFriendlyNameUpdateHandler(const JsonObject ¶meters) @@ -956,6 +972,25 @@ namespace WPEFramework } } + gboolean MiracastService::monitor_friendly_name_timercallback(gpointer userdata) + { + gboolean timer_retry_state = G_SOURCE_CONTINUE; + MIRACASTLOG_TRACE("Entering..!!!"); + MiracastService *self = (MiracastService *)userdata; + MIRACASTLOG_INFO("TimerCallback Triggered for updating friendlyName..."); + if ( true == self->updateSystemFriendlyName() ) + { + MIRACASTLOG_INFO("friendlyName updated properly, No polling required..."); + timer_retry_state = G_SOURCE_REMOVE; + } + else + { + MIRACASTLOG_WARNING("Unable to get friendlyName, still requires polling..."); + } + MIRACASTLOG_TRACE("Exiting..!!!"); + return timer_retry_state; + } + void MiracastService::onMiracastServiceLaunchRequest(string src_dev_ip, string src_dev_mac, string src_dev_name, string sink_dev_ip) { MIRACASTLOG_INFO("Entering..!!!"); diff --git a/Miracast/MiracastService/MiracastService.h b/Miracast/MiracastService/MiracastService.h index 3e40f67953..9dd86e5abc 100644 --- a/Miracast/MiracastService/MiracastService.h +++ b/Miracast/MiracastService/MiracastService.h @@ -88,6 +88,7 @@ namespace WPEFramework private: bool m_isServiceInitialized; bool m_isServiceEnabled; + guint m_FriendlyNameMonitorTimerID{0}; eMIRA_SERVICE_STATES m_eService_state; WPEFramework::JSONRPC::LinkType *m_SystemPluginObj = NULL; uint32_t setEnable(const JsonObject ¶meters, JsonObject &response); @@ -100,8 +101,9 @@ namespace WPEFramework std::string reasonDescription(eMIRACAST_SERVICE_ERR_CODE e); void getSystemPlugin(); - int updateSystemFriendlyName(); + bool updateSystemFriendlyName(); void onFriendlyNameUpdateHandler(const JsonObject ¶meters); + static gboolean monitor_friendly_name_timercallback(gpointer userdata); bool envGetValue(const char *key, std::string &value); // We do not allow this plugin to be copied !! From 4441a9680e82b54b6c7f4fa1d1e3bef24cfad59c Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Wed, 6 Mar 2024 06:55:49 +0000 Subject: [PATCH 2/4] RDKTV-29180 - [Miracast]: TV name shows as "Miracast-Generic" in casting devices - Updated the CHANGELOG.md and Patch version Signed-off-by: yuvaramachandran_gurusamy --- Miracast/CHANGELOG.md | 4 ++++ Miracast/MiracastService/MiracastService.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Miracast/CHANGELOG.md b/Miracast/CHANGELOG.md index 2ee21aa896..4ad2d05c68 100644 --- a/Miracast/CHANGELOG.md +++ b/Miracast/CHANGELOG.md @@ -13,6 +13,10 @@ All notable changes to this RDK Service will be documented in this file. Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development. For more details, refer to versioning section under Main README. +## [1.0.4] - 2024-03-06 +### Added +- Fix for RDKTV-29180. + ## [1.0.3] - 2023-12-22 ### Added - Added the opt flags to suppress P2P events and change config methods and dynamically handled the authType. diff --git a/Miracast/MiracastService/MiracastService.cpp b/Miracast/MiracastService/MiracastService.cpp index 59fa2be713..8d863475c2 100644 --- a/Miracast/MiracastService/MiracastService.cpp +++ b/Miracast/MiracastService/MiracastService.cpp @@ -47,7 +47,7 @@ using namespace std; #define API_VERSION_NUMBER_MAJOR 1 #define API_VERSION_NUMBER_MINOR 0 -#define API_VERSION_NUMBER_PATCH 3 +#define API_VERSION_NUMBER_PATCH 4 #define SERVER_DETAILS "127.0.0.1:9998" #define SYSTEM_CALLSIGN "org.rdk.System" From f6285c45bf8a0841540da0b6eb6f60d16502affd Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Thu, 7 Mar 2024 06:45:49 +0000 Subject: [PATCH 3/4] RDKTV-29180 - [Miracast]: TV name shows as "Miracast-Generic" in casting devices - updating the FriendlyName based on Miracast discovery mode. Signed-off-by: yuvaramachandran_gurusamy --- Miracast/MiracastService/MiracastService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Miracast/MiracastService/MiracastService.cpp b/Miracast/MiracastService/MiracastService.cpp index 8d863475c2..ac5f976f19 100644 --- a/Miracast/MiracastService/MiracastService.cpp +++ b/Miracast/MiracastService/MiracastService.cpp @@ -940,7 +940,7 @@ namespace WPEFramework { std::string friendlyName = ""; friendlyName = Result["friendlyName"].String(); - m_miracast_ctrler_obj->set_FriendlyName(friendlyName); + m_miracast_ctrler_obj->set_FriendlyName(friendlyName,m_isServiceEnabled); MIRACASTLOG_INFO("Miracast FriendlyName=%s", friendlyName.c_str()); return_value = true; } From 2bd07b7ce52b81f36371d2c9159d8e809a803b1b Mon Sep 17 00:00:00 2001 From: yuvaramachandran-gurusamy <123441336+yuvaramachandran-gurusamy@users.noreply.github.com> Date: Thu, 14 Mar 2024 22:23:03 +0530 Subject: [PATCH 4/4] Update CHANGELOG.md --- Miracast/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Miracast/CHANGELOG.md b/Miracast/CHANGELOG.md index 4ad2d05c68..beeb725cd7 100644 --- a/Miracast/CHANGELOG.md +++ b/Miracast/CHANGELOG.md @@ -14,8 +14,8 @@ All notable changes to this RDK Service will be documented in this file. For more details, refer to versioning section under Main README. ## [1.0.4] - 2024-03-06 -### Added -- Fix for RDKTV-29180. +### Fixed +- Added the timer to get and update the friendlyName for Miracast if it fails get it from SystemServices. ## [1.0.3] - 2023-12-22 ### Added