-
Notifications
You must be signed in to change notification settings - Fork 3
[RDKEMW-6163] [RDKEMW-6164] CEC source and sink changes #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/RDKEMW-6163-k1
Are you sure you want to change the base?
Changes from all commits
f8c01b3
7a0d569
bef0aa3
7c031cf
b334b82
81cc8f5
5979423
2bf6395
1ea0522
919f2de
4d59de8
54daae7
8a169f8
2965ff4
b45107c
8606999
1ba78d1
1bcbf2b
cfc3f0c
ff9fcdb
dee3405
39b9eef
f41b6f4
1e0b57c
5797322
0951d07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in HdmiCecSink/HdmiCecSink.h
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -41,6 +41,8 @@ | |
#include "UtilsLogging.h" | ||
#include <interfaces/IPowerManager.h> | ||
#include "PowerManagerInterface.h" | ||
#include "host.hpp" | ||
|
||
|
||
using namespace WPEFramework; | ||
using PowerState = WPEFramework::Exchange::IPowerManager::PowerState; | ||
|
@@ -482,7 +484,7 @@ | |
// As the registration/unregistration of notifications is realized by the class PluginHost::JSONRPC, | ||
// this class exposes a public method called, Notify(), using this methods, all subscribed clients | ||
// will receive a JSONRPC message as a notification, in case this method is called. | ||
class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC { | ||
class HdmiCecSink : public PluginHost::IPlugin, public PluginHost::JSONRPC, public device::Host::IHdmiInEvents { | ||
|
||
enum { | ||
POLL_THREAD_STATE_NONE, | ||
|
@@ -530,6 +532,7 @@ | |
virtual const string Initialize(PluginHost::IShell* shell) override; | ||
virtual void Deinitialize(PluginHost::IShell* service) override; | ||
virtual string Information() const override { return {}; } | ||
virtual void OnHdmiInEventHotPlug(dsHdmiInPort_t port, bool isConnected) override; | ||
static HdmiCecSink* _instance; | ||
CECDeviceParams deviceList[16]; | ||
std::vector<HdmiPortMap> hdmiInputs; | ||
|
@@ -586,6 +589,13 @@ | |
END_INTERFACE_MAP | ||
|
||
private: | ||
template <typename T> | ||
T* baseInterface() | ||
{ | ||
static_assert(std::is_base_of<T, HdmiCecSink>(), "base type mismatch"); | ||
return static_cast<T*>(this); | ||
} | ||
|
||
class PowerManagerNotification : public Exchange::IPowerManager::IModeChangedNotification { | ||
private: | ||
PowerManagerNotification(const PowerManagerNotification&) = delete; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
Check failure on line 1 in HdmiCecSource/HdmiCecSourceImplementation.cpp
|
||
* If not stated otherwise in this file or this component's LICENSE | ||
* file the following copyright and licenses apply: | ||
* | ||
|
@@ -25,7 +25,6 @@ | |
#include "ccec/MessageEncoder.hpp" | ||
#include "host.hpp" | ||
|
||
#include "dsMgr.h" | ||
#include "dsDisplay.h" | ||
#include "videoOutputPort.hpp" | ||
#include "manager.hpp" | ||
|
@@ -389,8 +388,7 @@ | |
_powerManagerPlugin.Reset(); | ||
} | ||
_registeredEventHandlers = false; | ||
|
||
DeinitializeIARM(); | ||
device::Host::getInstance().UnRegister(baseInterface<device::Host::IDisplayDeviceEvents>()); | ||
} | ||
|
||
Core::hresult HdmiCecSourceImplementation::Configure(PluginHost::IShell* service) | ||
|
@@ -409,7 +407,6 @@ | |
logicalAddress = 0xFF; | ||
|
||
//CEC plugin functionalities will only work if CECmgr is available. If plugin Initialize failure upper layer will call dtor directly. | ||
InitializeIARM(); | ||
InitializePowerManager(service); | ||
|
||
// load persistence setting | ||
|
@@ -418,6 +415,8 @@ | |
{ | ||
//TODO(MROLLINS) this is probably per process so we either need to be running in our own process or be carefull no other plugin is calling it | ||
device::Manager::Initialize(); | ||
device::Host::getInstance().Register(baseInterface<device::Host::IDisplayDeviceEvents>(), "WPE::CecSource"); | ||
|
||
std::string strVideoPort = device::Host::getInstance().getDefaultVideoPortName(); | ||
device::VideoOutputPort vPort = device::Host::getInstance().getVideoOutputPort(strVideoPort.c_str()); | ||
if (vPort.isDisplayConnected()) | ||
|
@@ -731,20 +730,6 @@ | |
registerEventHandlers(); | ||
} | ||
|
||
const void HdmiCecSourceImplementation::InitializeIARM() | ||
{ | ||
IARM_Result_t res; | ||
IARM_CHECK( IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, dsHdmiEventHandler) ); | ||
} | ||
|
||
void HdmiCecSourceImplementation::DeinitializeIARM() | ||
{ | ||
if (Utils::IARM::isConnected()) | ||
{ | ||
IARM_Result_t res; | ||
IARM_CHECK( IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG,dsHdmiEventHandler) ); | ||
} | ||
} | ||
void HdmiCecSourceImplementation::threadHotPlugEventHandler(int data) | ||
{ | ||
LOGINFO("entry threadHotPlugEventHandler \r\n"); | ||
|
@@ -759,25 +744,21 @@ | |
LOGINFO("Exit threadHotPlugEventHandler \r\n"); | ||
} | ||
|
||
void HdmiCecSourceImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) | ||
void HdmiCecSourceImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) | ||
{ | ||
if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) | ||
{ | ||
LOGINFO("Return from dsHdmiEventHandler due HdmiCecSourceImplementation::_instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); | ||
return; | ||
} | ||
LOGINFO("HdmiCecSourceImplementation::OnDisplayHDMIHotPlug : displayEvent = %d ", displayEvent); | ||
|
||
if(!HdmiCecSourceImplementation::_instance || !_instance->cecEnableStatus) | ||
{ | ||
LOGINFO("HdmiCecSourceImplementation::OnDisplayHDMIHotPlug failed _instance:%p cecEnableStatus:%d \r\n", HdmiCecSourceImplementation::_instance, _instance->cecEnableStatus); | ||
return; | ||
} | ||
|
||
int hdmi_hotplug_event = (int) displayEvent; | ||
karuppaiyak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event); | ||
std::thread worker(threadHotPlugEventHandler,hdmi_hotplug_event); | ||
worker.detach(); | ||
|
||
if (owner && !strcmp(owner, IARM_BUS_DSMGR_NAME) && (IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG == eventId)) | ||
{ | ||
IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; | ||
if(eventData) | ||
{ | ||
int hdmi_hotplug_event = eventData->data.hdmi_hpd.event; | ||
LOGINFO("Received IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG event data:%d \r\n", hdmi_hotplug_event); | ||
std::thread worker(threadHotPlugEventHandler,hdmi_hotplug_event); | ||
worker.detach(); | ||
} | ||
} | ||
} | ||
|
||
void HdmiCecSourceImplementation::onPowerModeChanged(const PowerState currentState, const PowerState newState) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* If not stated otherwise in this file or this component's LICENSE file the | ||
Check failure on line 2 in Tests/L1Tests/tests/test_HdmiCecSource.cpp
|
||
* following copyright and licenses apply: | ||
* | ||
* Copyright 2022 RDK Management | ||
|
@@ -342,29 +342,9 @@ | |
.WillByDefault(::testing::Return()); | ||
ON_CALL(*p_connectionImplMock, addFrameListener(::testing::_)) | ||
.WillByDefault(::testing::Return()); | ||
ON_CALL(*p_iarmBusImplMock, IARM_Bus_RegisterEventHandler(::testing::_, ::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Invoke( | ||
[&](const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) { | ||
if ((string(IARM_BUS_CECMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_CECMGR_EVENT_DAEMON_INITIALIZED)) { | ||
EXPECT_TRUE(handler != nullptr); | ||
cecMgrEventHandler = handler; | ||
} | ||
if ((string(IARM_BUS_CECMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_CECMGR_EVENT_STATUS_UPDATED)) { | ||
EXPECT_TRUE(handler != nullptr); | ||
cecMgrEventHandler = handler; | ||
} | ||
if ((string(IARM_BUS_DSMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG)) { | ||
EXPECT_TRUE(handler != nullptr); | ||
dsHdmiEventHandler = handler; | ||
} | ||
if ((string(IARM_BUS_PWRMGR_NAME) == string(ownerName)) && (eventId == IARM_BUS_PWRMGR_EVENT_MODECHANGED)) { | ||
EXPECT_TRUE(handler != nullptr); | ||
pwrMgrEventHandler = handler; | ||
} | ||
|
||
return IARM_RESULT_SUCCESS; | ||
})); | ||
|
||
EXPECT_CALL(*p_managerImplMock, Initialize()) | ||
.Times(::testing::AnyNumber()) | ||
.WillRepeatedly(::testing::Return()); | ||
} | ||
virtual ~HdmiCecSourceTest() override | ||
{ | ||
|
@@ -1408,18 +1388,14 @@ | |
iCounter ++; | ||
} | ||
|
||
ASSERT_TRUE(dsHdmiEventHandler != nullptr); | ||
EXPECT_CALL(*p_hostImplMock, getDefaultVideoPortName()) | ||
.Times(1) | ||
.WillOnce(::testing::Return("TEST")); | ||
|
||
|
||
IARM_Bus_DSMgr_EventData_t eventData; | ||
eventData.data.hdmi_hpd.event = 0; | ||
|
||
EVENT_SUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); | ||
|
||
dsHdmiEventHandler(IARM_BUS_DSMGR_NAME, IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, &eventData , 0); | ||
//plugin->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); | ||
Plugin::HdmiCecSourceImplementation::_instance->OnDisplayHDMIHotPlug(dsDISPLAY_EVENT_CONNECTED); | ||
|
||
EVENT_UNSUBSCRIBE(0, _T("onHdmiHotPlug"), _T("client.events.onHdmiHotPlug"), message); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.