|
25 | 25 | #include "videoOutputPortConfig.hpp" |
26 | 26 | #include "dsMgr.h" |
27 | 27 | #include "manager.hpp" |
28 | | - #include "host.hpp" |
29 | 28 |
|
30 | 29 | #include "UtilsJsonRpc.h" |
31 | | - #include "UtilsIarm.h" |
32 | | - |
33 | | - #include "UtilsSynchroIarm.hpp" |
34 | 30 |
|
35 | 31 | #define HDMI_HOT_PLUG_EVENT_CONNECTED 0 |
36 | 32 | #define HDMI_HOT_PLUG_EVENT_DISCONNECTED 1 |
|
61 | 57 | HdcpProfileImplementation::~HdcpProfileImplementation() |
62 | 58 | { |
63 | 59 | LOGINFO("Call HdcpProfileImplementation destructor\n"); |
| 60 | + device::Host::getInstance().UnRegister(baseInterface<device::Host::IVideoOutputPortEvents>()); |
| 61 | + device::Host::getInstance().UnRegister(baseInterface<device::Host::IDisplayDeviceEvents>()); |
64 | 62 | if (_powerManagerPlugin) { |
65 | 63 | _powerManagerPlugin.Reset(); |
66 | 64 | } |
67 | 65 | if(_service != nullptr) |
68 | 66 | { |
69 | 67 | _service->Release(); |
70 | 68 | } |
71 | | - DeinitializeIARM(); |
72 | 69 | HdcpProfileImplementation::_instance = nullptr; |
73 | 70 | mShell = nullptr; |
74 | 71 | } |
|
82 | 79 | .createInterface(); |
83 | 80 | } |
84 | 81 |
|
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 | 82 | void HdcpProfileImplementation::onHdmiOutputHotPlug(int connectStatus) |
105 | 83 | { |
106 | 84 | if (HDMI_HOT_PLUG_EVENT_CONNECTED == connectStatus) |
|
143 | 121 | onHdcpProfileDisplayConnectionChanged(); |
144 | 122 | } |
145 | 123 |
|
146 | | - void HdcpProfileImplementation::dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) |
| 124 | + void HdcpProfileImplementation::OnDisplayHDMIHotPlug(dsDisplayEvent_t displayEvent) |
| 125 | + { |
| 126 | + LOGINFO("Received OnDisplayHDMIHotPlug event data:%d \r\n", displayEvent); |
| 127 | + HdcpProfileImplementation::_instance->onHdmiOutputHotPlug(static_cast<int>(displayEvent)); |
| 128 | + } |
| 129 | + |
| 130 | + void HdcpProfileImplementation::OnHDCPStatusChange(dsHdcpStatus_t hdcpStatus) |
147 | 131 | { |
148 | 132 | uint32_t res = Core::ERROR_GENERAL; |
149 | 133 | PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN; |
150 | 134 | 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 | | - } |
| 135 | + |
| 136 | + ASSERT (_powerManagerPlugin); |
| 137 | + if (_powerManagerPlugin){ |
| 138 | + res = _powerManagerPlugin->GetPowerState(pwrStateCur, pwrStatePrev); |
| 139 | + if (Core::ERROR_NONE != res) |
| 140 | + { |
| 141 | + LOGWARN("Failed to Invoke RPC method: GetPowerState"); |
| 142 | + } |
| 143 | + else |
| 144 | + { |
| 145 | + LOGINFO("Received OnHDCPStatusChange event data:%d param.curState: %d \r\n", hdcpStatus,pwrStateCur); |
| 146 | + HdcpProfileImplementation::_instance->onHdmiOutputHDCPStatusEvent(static_cast<int>(hdcpStatus)); |
179 | 147 | } |
180 | 148 | } |
181 | 149 | } |
182 | | - |
| 150 | + |
183 | 151 | /** |
184 | 152 | * Register a notification callback |
185 | 153 | */ |
|
243 | 211 | _service = service; |
244 | 212 | _service->AddRef(); |
245 | 213 | ASSERT(service != nullptr); |
246 | | - InitializeIARM(); |
| 214 | + device::Host::getInstance().Register(baseInterface<device::Host::IVideoOutputPortEvents>(),"WPE[HdcpProfile]"); |
| 215 | + device::Host::getInstance().Register(baseInterface<device::Host::IDisplayDeviceEvents>(),"WPE[HdcpProfile]"); |
247 | 216 | InitializePowerManager(service); |
248 | 217 | return result; |
249 | 218 | } |
|
0 commit comments