Skip to content

Commit 4bed586

Browse files
KaleeswaranGnanagurusamykaruppaiyakapatel859
authored
RDKEMW-6120: Updating Hdcp, AvInput and HdmiCEC DS MGR client to use libds client library (#262)
* RDKEMW-6120: Updating Hdcp, AvInput and HdmiCEC DS MGR client to use libds client library * Updated testframework branch to resolve native build issue * Update tests-trigger.yml * coverity fix for _instance dereference * Updated the develop branch in yml file * Reverted the HdmiCecSink changes * L1 testframework changed to PR branch * HdmiCecSink changes moved to COMRPC latest * Updated the ds plugin related test modifications * testframework branch updated to develop * Update HdmiCecSinkImplementation.h * Update HdmiCecSinkImplementation.cpp * Update test_HdmiCecSink.cpp * Update test_HdmiCecSink.cpp * Update test_HdmiCecSink.cpp --------- Co-authored-by: karuppaiyak <[email protected]> Co-authored-by: apatel859 <[email protected]>
1 parent 48cf3e3 commit 4bed586

13 files changed

+621
-883
lines changed

AVInput/AVInput.cpp

Lines changed: 172 additions & 244 deletions
Large diffs are not rendered by default.

AVInput/AVInput.h

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121

2222
#include "Module.h"
2323
#include "libIBus.h"
24+
2425
#include "dsTypes.h"
26+
#include "host.hpp"
27+
#include "manager.hpp"
2528

2629
#define DEFAULT_PRIM_VOL_LEVEL 25
2730
#define MAX_PRIM_VOL_LEVEL 100
@@ -30,9 +33,13 @@
3033
namespace WPEFramework {
3134
namespace Plugin {
3235

33-
class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
34-
{
36+
class AVInput: public PluginHost::IPlugin,
37+
public PluginHost::JSONRPC,
38+
public device::Host::IHdmiInEvents,
39+
public device::Host::ICompositeInEvents{
40+
3541
private:
42+
3643
AVInput(const AVInput &) = delete;
3744
AVInput &operator=(const AVInput &) = delete;
3845

@@ -45,6 +52,15 @@ class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
4552
INTERFACE_ENTRY(PluginHost::IDispatcher)
4653
END_INTERFACE_MAP
4754

55+
private:
56+
57+
template <typename T>
58+
T* baseInterface()
59+
{
60+
static_assert(std::is_base_of<T, AVInput>(), "base type mismatch");
61+
return static_cast<T*>(this);
62+
}
63+
4864
int m_primVolume;
4965
int m_inputVolume; //Player Volume
5066

@@ -57,9 +73,7 @@ class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
5773
virtual string Information() const override;
5874

5975
protected:
60-
void InitializeIARM();
61-
void DeinitializeIARM();
62-
76+
6377
void RegisterAll();
6478
void UnregisterAll();
6579

@@ -124,6 +138,30 @@ class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
124138

125139
void hdmiInputAviContentTypeChange(int port, int content_type);
126140
static void dsAviContentTypeEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
141+
142+
private:
143+
144+
bool _registeredDsEventHandlers;
145+
146+
public:
147+
148+
/* HdmiInEventNotification*/
149+
150+
void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) override;
151+
void OnHdmiInEventSignalStatus(dsHdmiInPort_t port, dsHdmiInSignalStatus_t signalStatus) override;
152+
void OnHdmiInEventStatus(dsHdmiInPort_t activePort, bool isPresented) override;
153+
void OnHdmiInVideoModeUpdate(dsHdmiInPort_t port, const dsVideoPortResolution_t& videoPortResolution) override;
154+
void OnHdmiInAllmStatus(dsHdmiInPort_t port, bool allmStatus) override;
155+
void OnHdmiInAVIContentType(dsHdmiInPort_t port, dsAviContentType_t aviContentType) override;
156+
void OnHdmiInVRRStatus(dsHdmiInPort_t port, dsVRRType_t vrrType) override;
157+
158+
/* CompositeInEventNotification */
159+
160+
void OnCompositeInHotPlug(dsCompositeInPort_t port, bool isConnected) override;
161+
void OnCompositeInSignalStatus(dsCompositeInPort_t port, dsCompInSignalStatus_t signalStatus) override;
162+
void OnCompositeInStatus(dsCompositeInPort_t activePort, bool isPresented) override;
163+
void OnCompositeInVideoModeUpdate(dsCompositeInPort_t activePort, dsVideoPortResolution_t videoResolution) override;
164+
127165
public:
128166
static AVInput* _instance;
129167
};

HdcpProfile/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ target_link_libraries(${PLUGIN_IMPLEMENTATION} PRIVATE ${NAMESPACE}Protocols::${
6767
endif (USE_THUNDER_R4)
6868

6969
find_package(DS)
70-
find_package(IARMBus)
7170
find_package(CEC)
7271

7372
if (RDK_SERVICE_L2_TEST)
@@ -82,14 +81,13 @@ if (RDK_SERVICE_L2_TEST)
8281
endif()
8382

8483

85-
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${IARMBUS_INCLUDE_DIRS})
8684
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ${DS_INCLUDE_DIRS})
8785
target_include_directories(${PLUGIN_IMPLEMENTATION} PRIVATE ../helpers)
8886

8987

9088
set_source_files_properties(HdcpProfile.cpp PROPERTIES COMPILE_FLAGS "-fexceptions")
9189

92-
target_link_libraries(${PLUGIN_IMPLEMENTATION} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${IARMBUS_LIBRARIES} ${DS_LIBRARIES})
90+
target_link_libraries(${PLUGIN_IMPLEMENTATION} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${DS_LIBRARIES})
9391

9492
install(TARGETS ${PLUGIN_IMPLEMENTATION}
9593
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)

HdcpProfile/HdcpProfileImplementation.cpp

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,9 @@
2323

2424
#include "videoOutputPort.hpp"
2525
#include "videoOutputPortConfig.hpp"
26-
#include "dsMgr.h"
2726
#include "manager.hpp"
28-
#include "host.hpp"
2927

3028
#include "UtilsJsonRpc.h"
31-
#include "UtilsIarm.h"
32-
33-
#include "UtilsSynchroIarm.hpp"
3429

3530
#define HDMI_HOT_PLUG_EVENT_CONNECTED 0
3631
#define HDMI_HOT_PLUG_EVENT_DISCONNECTED 1
@@ -61,14 +56,15 @@
6156
HdcpProfileImplementation::~HdcpProfileImplementation()
6257
{
6358
LOGINFO("Call HdcpProfileImplementation destructor\n");
59+
device::Host::getInstance().UnRegister(baseInterface<device::Host::IVideoOutputPortEvents>());
60+
device::Host::getInstance().UnRegister(baseInterface<device::Host::IDisplayDeviceEvents>());
6461
if (_powerManagerPlugin) {
6562
_powerManagerPlugin.Reset();
6663
}
6764
if(_service != nullptr)
6865
{
6966
_service->Release();
7067
}
71-
DeinitializeIARM();
7268
HdcpProfileImplementation::_instance = nullptr;
7369
mShell = nullptr;
7470
}
@@ -82,26 +78,7 @@
8278
.createInterface();
8379
}
8480

85-
void HdcpProfileImplementation::InitializeIARM()
86-
{
87-
Utils::IARM::init();
88-
89-
IARM_Result_t res;
90-
IARM_CHECK( Utils::Synchro::RegisterLockedIarmEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) );
91-
IARM_CHECK( Utils::Synchro::RegisterLockedIarmEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, dsHdmiEventHandler) );
92-
}
93-
94-
void HdcpProfileImplementation::DeinitializeIARM()
95-
{
96-
if (Utils::IARM::isConnected())
97-
{
98-
IARM_Result_t res;
99-
IARM_CHECK( Utils::Synchro::RemoveLockedEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) );
100-
IARM_CHECK( Utils::Synchro::RemoveLockedEventHandler<HdcpProfileImplementation>(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, dsHdmiEventHandler) );
101-
}
102-
}
103-
104-
void HdcpProfileImplementation::onHdmiOutputHotPlug(int connectStatus)
81+
void HdcpProfileImplementation::onHdmiOutputHotPlug(dsDisplayEvent_t connectStatus)
10582
{
10683
if (HDMI_HOT_PLUG_EVENT_CONNECTED == connectStatus)
10784
{
@@ -137,49 +114,36 @@
137114
status.hdcpReason);
138115
}
139116

140-
void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(int hdcpStatus)
117+
void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(dsHdcpStatus_t hdcpStatus)
141118
{
142119
LOGINFO("hdcpStatus[%d]",hdcpStatus);
143120
onHdcpProfileDisplayConnectionChanged();
144121
}
145122

146-
void HdcpProfileImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
123+
void HdcpProfileImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent)
124+
{
125+
LOGINFO("Received OnDisplayHDMIHotPlug event data:%d \r\n", displayEvent);
126+
HdcpProfileImplementation::_instance->onHdmiOutputHotPlug(displayEvent);
127+
}
128+
129+
void HdcpProfileImplementation::OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus)
147130
{
148131
uint32_t res = Core::ERROR_GENERAL;
149132
PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;
150133
PowerState pwrStatePrev = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;
151-
152-
if(!HdcpProfileImplementation::_instance)
153-
return;
154-
155-
if (IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG == eventId)
156-
{
157-
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
158-
int hdmi_hotplug_event = eventData->data.hdmi_hpd.event;
159-
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event);
160-
161-
HdcpProfileImplementation::_instance->onHdmiOutputHotPlug(hdmi_hotplug_event);
162-
}
163-
else if (IARM_BUS_DSMGR_EVENT_HDCP_STATUS == eventId)
164-
{
165-
ASSERT (_powerManagerPlugin);
166-
if (_powerManagerPlugin){
167-
res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev);
168-
if (Core::ERROR_NONE != res)
169-
{
170-
LOGWARN("Failed to Invoke RPC method: GetPowerState");
171-
}
172-
else
173-
{
174-
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data;
175-
int hdcpStatus = eventData->data.hdmi_hdcp.hdcpStatus;
176-
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDCP_STATUS event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur);
177-
HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(hdcpStatus);
178-
}
134+
135+
ASSERT (_powerManagerPlugin);
136+
if (_powerManagerPlugin){
137+
res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev);
138+
if (Core::ERROR_NONE != res)
139+
{
140+
LOGWARN("Failed to Invoke RPC method: GetPowerState");
179141
}
142+
LOGINFO("Received OnHDCPStatusChange event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur);
143+
HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(hdcpStatus);
180144
}
181145
}
182-
146+
183147
/**
184148
* Register a notification callback
185149
*/
@@ -243,7 +207,8 @@
243207
_service = service;
244208
_service->AddRef();
245209
ASSERT(service != nullptr);
246-
InitializeIARM();
210+
device::Host::getInstance().Register(baseInterface<device::Host::IVideoOutputPortEvents>(),"WPE::HdcpProfile");
211+
device::Host::getInstance().Register(baseInterface<device::Host::IDisplayDeviceEvents>(),"WPE::HdcpProfile");
247212
InitializePowerManager(service);
248213
return result;
249214
}

HdcpProfile/HdcpProfileImplementation.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,27 @@
2929
#include <core/core.h>
3030
#include <mutex>
3131
#include <vector>
32-
33-
#include "libIBus.h"
34-
32+
33+
#include "host.hpp"
34+
3535
#include "PowerManagerInterface.h"
3636

3737
namespace WPEFramework
3838
{
3939
namespace Plugin
4040
{
4141

42-
class HdcpProfileImplementation : public Exchange::IHdcpProfile, public Exchange::IConfiguration
42+
class HdcpProfileImplementation : public Exchange::IHdcpProfile, public Exchange::IConfiguration, public device::Host::IVideoOutputPortEvents, public device::Host::IDisplayDeviceEvents
4343
// , public Exchange::IConfiguration
4444
{
4545
public:
4646
// We do not allow this plugin to be copied !!
4747
HdcpProfileImplementation();
4848
~HdcpProfileImplementation() override;
49-
49+
50+
virtual void OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) override;
51+
virtual void OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus) override;
52+
5053
static HdcpProfileImplementation *instance(HdcpProfileImplementation *HdcpProfileImpl = nullptr);
5154

5255
// We do not allow this plugin to be copied !!
@@ -110,18 +113,22 @@
110113

111114

112115
public:
116+
template <typename T>
117+
T* baseInterface()
118+
{
119+
static_assert(std::is_base_of<T, HdcpProfileImplementation>(), "base type mismatch");
120+
return static_cast<T*>(this);
121+
}
122+
113123
Core::hresult Register(Exchange::IHdcpProfile::INotification *notification) override;
114124
Core::hresult Unregister(Exchange::IHdcpProfile::INotification *notification) override;
115125

116126
Core::hresult GetHDCPStatus(HDCPStatus& hdcpstatus,bool& success) override;
117127
Core::hresult GetSettopHDCPSupport(string& supportedHDCPVersion,bool& isHDCPSupported,bool& success) override;
118128
bool GetHDCPStatusInternal(HDCPStatus& hdcpstatus);
119129
void InitializePowerManager(PluginHost::IShell *service);
120-
void InitializeIARM();
121-
void DeinitializeIARM();
122-
static void dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
123-
void onHdmiOutputHotPlug(int connectStatus);
124-
void onHdmiOutputHDCPStatusEvent(int);
130+
void onHdmiOutputHotPlug(dsDisplayEvent_t connectStatus);
131+
void onHdmiOutputHDCPStatusEvent(dsHdcpStatus_t);
125132
void logHdcpStatus (const char *trigger, HDCPStatus& status);
126133
void onHdcpProfileDisplayConnectionChanged();
127134
static PowerManagerInterfaceRef _powerManagerPlugin;
@@ -143,4 +150,4 @@
143150
};
144151

145152
} // namespace Plugin
146-
} // namespace WPEFramework
153+
} // namespace WPEFramework

0 commit comments

Comments
 (0)