Skip to content

Commit

Permalink
Merge pull request rdkcentral#5667 from yuvaramachandran-gurusamy/spr…
Browse files Browse the repository at this point in the history
…int/24Q3/RDKTV-32602

RDKTV-32602:Miracast : increase scan inter to 5 sec rdkcentral#5665
  • Loading branch information
apatel859 authored Aug 30, 2024
2 parents 621de8b + 1adde23 commit a41ccc7
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Miracast/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions Miracast/MiracastService/MiracastController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1337,6 +1340,28 @@ 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<char *>("MiracastPlugin"), "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Miracast.Enable", &param);
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 , type value %d", isMiracastRFCEnabled, wdmpStatus, param.type);
#else
isMiracastRFCEnabled = true;
#endif //RFC_ENABLED

if(!isMiracastRFCEnabled)
{
MIRACASTLOG_INFO("----------MIRACAST RFC Disabled---------- ");
return;
}

if ( true == is_enabled)
{
Expand Down
2 changes: 1 addition & 1 deletion Miracast/MiracastService/MiracastService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Miracast/MiracastService/P2P/MiracastP2P.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 21 additions & 1 deletion Tests/L1Tests/tests/test_MiracastService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "WrapsMock.h"
#include "WpaCtrlMock.h"
#include "IarmBusMock.h"
#include "RfcApiMock.h"

using ::testing::NiceMock;
using namespace WPEFramework;
Expand Down Expand Up @@ -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()
Expand All @@ -93,6 +95,9 @@ class MiracastServiceTest : public ::testing::Test {
p_iarmBusImplMock = new testing::NiceMock <IarmBusImplMock>;
IarmBus::setImpl(p_iarmBusImplMock);

p_rfcApiImplMock = new testing::NiceMock <RfcApiImplMock>;
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; }));
Expand Down Expand Up @@ -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
{
Expand All @@ -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;
}
}
};

Expand Down Expand Up @@ -2046,4 +2066,4 @@ TEST_F(MiracastServiceEventTest, wifiStateChange)

removeEntryFromFile("/etc/device.properties","WIFI_P2P_CTRL_INTERFACE=p2p0");
removeFile("/var/run/wpa_supplicant/p2p0");
}
}

0 comments on commit a41ccc7

Please sign in to comment.