From 48a2c14701a9911842fdefd38c4e28d200d05114 Mon Sep 17 00:00:00 2001 From: apatel859 Date: Tue, 20 Aug 2024 13:12:27 -0400 Subject: [PATCH 1/2] RDKTV-32602:Miracast : increase scan inter to 5 sec Signed-off-by: apatel859 --- Miracast/CHANGELOG.md | 8 ++++++ .../MiracastService/MiracastController.cpp | 27 +++++++++++++++++++ Miracast/MiracastService/MiracastService.cpp | 2 +- Miracast/MiracastService/P2P/MiracastP2P.cpp | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Miracast/CHANGELOG.md b/Miracast/CHANGELOG.md index 6a8eea2ccd..9d2462a2b7 100644 --- a/Miracast/CHANGELOG.md +++ b/Miracast/CHANGELOG.md @@ -13,6 +13,14 @@ 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.10] - 2024-08-27 +### Fixed +- Increase scan interval to 5 sec and added RFC support. + +## [1.0.9] - 2024-07-03 +### Fixed +- Added the handling to Disable and Enable Miracast discovery later while wakeup from Deepsleep and switching from one ssid to another ssid. + ## [1.0.8] - 2024-05-15 ### Fixed - Added the changes to remove the old ip entry from ARP table diff --git a/Miracast/MiracastService/MiracastController.cpp b/Miracast/MiracastService/MiracastController.cpp index 1e056d00bd..ce13b6d0a3 100644 --- a/Miracast/MiracastService/MiracastController.cpp +++ b/Miracast/MiracastService/MiracastController.cpp @@ -18,6 +18,9 @@ */ #include "MiracastController.h" +#ifdef RFC_ENABLED +#include "rfcapi.h" +#endif //RFC_ENABLED void ControllerThreadCallback(void *args); #ifdef ENABLE_MIRACAST_SERVICE_TEST_NOTIFIER @@ -1337,6 +1340,30 @@ void MiracastController::send_thundermsg_to_controller_thread(CONTROLLER_MSGQ_ST void MiracastController::set_enable(bool is_enabled) { MIRACASTLOG_TRACE("Entering..."); + bool isMiracastRFCEnabled = false; +#ifdef RFC_ENABLED + RFC_ParamData_t param; + WDMP_STATUS wdmpStatus = getRFCParameter(const_cast("MiracastPlugin"), "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Miracast.Enable", ¶m); + if (wdmpStatus == WDMP_SUCCESS || wdmpStatus == WDMP_ERR_DEFAULT_VALUE) + { + if( param.type == WDMP_BOOLEAN ) + { + if(strncasecmp(param.value,"true",4) == 0 ) + isMiracastRFCEnabled = true; + } + } + + MIRACASTLOG_INFO(" Is Miracast RFC enabled ? %d , call value %d ", isMiracastRFCEnabled, wdmpStatus); +#else + isMiracastRFCEnabled = true; +#endif //RFC_ENABLED + + + if(!isMiracastRFCEnabled) + { + MIRACASTLOG_INFO("----------MIRACAST RFC Disabled---------- "); + return; + } if ( true == is_enabled) { diff --git a/Miracast/MiracastService/MiracastService.cpp b/Miracast/MiracastService/MiracastService.cpp index 04740cda63..6beca0862c 100644 --- a/Miracast/MiracastService/MiracastService.cpp +++ b/Miracast/MiracastService/MiracastService.cpp @@ -60,7 +60,7 @@ using namespace std; #define API_VERSION_NUMBER_MAJOR 1 #define API_VERSION_NUMBER_MINOR 0 -#define API_VERSION_NUMBER_PATCH 8 +#define API_VERSION_NUMBER_PATCH 10 #define SERVER_DETAILS "127.0.0.1:9998" #define SYSTEM_CALLSIGN "org.rdk.System" diff --git a/Miracast/MiracastService/P2P/MiracastP2P.cpp b/Miracast/MiracastService/P2P/MiracastP2P.cpp index 9a966e3d4d..111a5e272b 100644 --- a/Miracast/MiracastService/P2P/MiracastP2P.cpp +++ b/Miracast/MiracastService/P2P/MiracastP2P.cpp @@ -471,7 +471,7 @@ MiracastError MiracastP2P::discover_devices(void) } else { - command = "P2P_EXT_LISTEN 200 1000"; + command = "P2P_EXT_LISTEN 200 5000"; } ret = executeCommand(command, NON_GLOBAL_INTERFACE, retBuffer); From 1adde2365074986c56c342c9515ccf18585229b2 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 30 Aug 2024 09:26:36 +0000 Subject: [PATCH 2/2] RDKTV-32602: Update MiracastService unit test based on getRFCParameter API Signed-off-by: yuvaramachandran_gurusamy --- .../MiracastService/MiracastController.cpp | 4 +--- Tests/L1Tests/tests/test_MiracastService.cpp | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Miracast/MiracastService/MiracastController.cpp b/Miracast/MiracastService/MiracastController.cpp index ce13b6d0a3..67e182cd91 100644 --- a/Miracast/MiracastService/MiracastController.cpp +++ b/Miracast/MiracastService/MiracastController.cpp @@ -1352,13 +1352,11 @@ void MiracastController::set_enable(bool is_enabled) isMiracastRFCEnabled = true; } } - - MIRACASTLOG_INFO(" Is Miracast RFC enabled ? %d , call value %d ", isMiracastRFCEnabled, wdmpStatus); + MIRACASTLOG_INFO(" Is Miracast RFC enabled ? %d , call value %d , type value %d", isMiracastRFCEnabled, wdmpStatus, param.type); #else isMiracastRFCEnabled = true; #endif //RFC_ENABLED - if(!isMiracastRFCEnabled) { MIRACASTLOG_INFO("----------MIRACAST RFC Disabled---------- "); diff --git a/Tests/L1Tests/tests/test_MiracastService.cpp b/Tests/L1Tests/tests/test_MiracastService.cpp index a960fb9342..b1a87c29c2 100644 --- a/Tests/L1Tests/tests/test_MiracastService.cpp +++ b/Tests/L1Tests/tests/test_MiracastService.cpp @@ -5,6 +5,7 @@ #include "WrapsMock.h" #include "WpaCtrlMock.h" #include "IarmBusMock.h" +#include "RfcApiMock.h" using ::testing::NiceMock; using namespace WPEFramework; @@ -77,6 +78,7 @@ class MiracastServiceTest : public ::testing::Test { WrapsImplMock *p_wrapsImplMock = nullptr; WpaCtrlApiImplMock *p_wpaCtrlImplMock = nullptr; IarmBusImplMock *p_iarmBusImplMock = nullptr; + RfcApiImplMock *p_rfcApiImplMock = nullptr; IARM_EventHandler_t pwrMgrEventHandler; MiracastServiceTest() @@ -93,6 +95,9 @@ class MiracastServiceTest : public ::testing::Test { p_iarmBusImplMock = new testing::NiceMock ; IarmBus::setImpl(p_iarmBusImplMock); + p_rfcApiImplMock = new testing::NiceMock ; + RfcApi::setImpl(p_rfcApiImplMock); + EXPECT_CALL(service, QueryInterfaceByCallsign(::testing::_, ::testing::_)) .Times(::testing::AnyNumber()) .WillRepeatedly(::testing::Invoke([&](const uint32_t, const string& name) -> void* { return nullptr; })); @@ -121,6 +126,14 @@ class MiracastServiceTest : public ::testing::Test { } return IARM_RESULT_SUCCESS; }); + ON_CALL(*p_rfcApiImplMock, getRFCParameter) + .WillByDefault([](char* pcCallerID, const char* pcParameterName, RFC_ParamData_t* pstParamData){ + EXPECT_EQ(string(pcCallerID), string("MiracastPlugin")); + EXPECT_EQ(string(pcParameterName), string("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Miracast.Enable")); + strncpy(pstParamData->value, "true", sizeof(pstParamData->value)); + pstParamData->type = WDMP_BOOLEAN; + return WDMP_SUCCESS; + }); } virtual ~MiracastServiceTest() override { @@ -144,6 +157,13 @@ class MiracastServiceTest : public ::testing::Test { delete p_iarmBusImplMock; p_iarmBusImplMock = nullptr; } + + RfcApi::setImpl(nullptr); + if (p_rfcApiImplMock != nullptr) + { + delete p_rfcApiImplMock; + p_rfcApiImplMock = nullptr; + } } }; @@ -2046,4 +2066,4 @@ TEST_F(MiracastServiceEventTest, wifiStateChange) removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0"); removeFile("/var/run/wpa_supplicant/p2p0"); -} \ No newline at end of file +}