|
23 | 23 |
|
24 | 24 | #include "videoOutputPort.hpp"
|
25 | 25 | #include "videoOutputPortConfig.hpp"
|
26 |
| - #include "dsMgr.h" |
27 | 26 | #include "manager.hpp"
|
28 |
| - #include "host.hpp" |
29 | 27 |
|
30 | 28 | #include "UtilsJsonRpc.h"
|
31 |
| - #include "UtilsIarm.h" |
32 |
| - |
33 |
| - #include "UtilsSynchroIarm.hpp" |
34 | 29 |
|
35 | 30 | #define HDMI_HOT_PLUG_EVENT_CONNECTED 0
|
36 | 31 | #define HDMI_HOT_PLUG_EVENT_DISCONNECTED 1
|
|
61 | 56 | HdcpProfileImplementation::~HdcpProfileImplementation()
|
62 | 57 | {
|
63 | 58 | LOGINFO("Call HdcpProfileImplementation destructor\n");
|
| 59 | + device::Host::getInstance().UnRegister(baseInterface<device::Host::IVideoOutputPortEvents>()); |
| 60 | + device::Host::getInstance().UnRegister(baseInterface<device::Host::IDisplayDeviceEvents>()); |
64 | 61 | if (_powerManagerPlugin) {
|
65 | 62 | _powerManagerPlugin.Reset();
|
66 | 63 | }
|
67 | 64 | if(_service != nullptr)
|
68 | 65 | {
|
69 | 66 | _service->Release();
|
70 | 67 | }
|
71 |
| - DeinitializeIARM(); |
72 | 68 | HdcpProfileImplementation::_instance = nullptr;
|
73 | 69 | mShell = nullptr;
|
74 | 70 | }
|
|
82 | 78 | .createInterface();
|
83 | 79 | }
|
84 | 80 |
|
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) |
105 | 82 | {
|
106 | 83 | if (HDMI_HOT_PLUG_EVENT_CONNECTED == connectStatus)
|
107 | 84 | {
|
|
137 | 114 | status.hdcpReason);
|
138 | 115 | }
|
139 | 116 |
|
140 |
| - void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(int hdcpStatus) |
| 117 | + void HdcpProfileImplementation::onHdmiOutputHDCPStatusEvent(dsHdcpStatus_t hdcpStatus) |
141 | 118 | {
|
142 | 119 | LOGINFO("hdcpStatus[%d]",hdcpStatus);
|
143 | 120 | onHdcpProfileDisplayConnectionChanged();
|
144 | 121 | }
|
145 | 122 |
|
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) |
147 | 130 | {
|
148 | 131 | uint32_t res = Core::ERROR_GENERAL;
|
149 | 132 | PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;
|
150 | 133 | 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"); |
179 | 141 | }
|
| 142 | + LOGINFO("Received OnHDCPStatusChange event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur); |
| 143 | + HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(hdcpStatus); |
180 | 144 | }
|
181 | 145 | }
|
182 |
| - |
| 146 | + |
183 | 147 | /**
|
184 | 148 | * Register a notification callback
|
185 | 149 | */
|
|
243 | 207 | _service = service;
|
244 | 208 | _service->AddRef();
|
245 | 209 | 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"); |
247 | 212 | InitializePowerManager(service);
|
248 | 213 | return result;
|
249 | 214 | }
|
|
0 commit comments