Skip to content

Commit da233a1

Browse files
committed
moved device setting init to plugin init
1 parent c768019 commit da233a1

File tree

3 files changed

+51
-25
lines changed

3 files changed

+51
-25
lines changed

HdmiCecSink/HdmiCecSink.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,11 @@ namespace WPEFramework
697697
try
698698
{
699699
device::Manager::Initialize();
700-
LOGINFO("device::Manager::Initialize success");
700+
LOGINFO("HdmiCecSink plugin device::Manager::Initialize success");
701701
}
702702
catch(const device::Exception& err)
703703
{
704-
LOGINFO("device::Manager::Initialize failed");
704+
LOGINFO("HdmiCecSink plugin device::Manager::Initialize failed");
705705
msg = "HdmiCecSink plugin Initialize failed";
706706
LOG_DEVICE_EXCEPTION0();
707707
}
@@ -915,11 +915,11 @@ namespace WPEFramework
915915
try
916916
{
917917
device::Manager::DeInitialize();
918-
LOGINFO("device::Manager::DeInitialize success");
918+
LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize success");
919919
}
920920
catch(const device::Exception& err)
921921
{
922-
LOGINFO("device::Manager::DeInitialize failed");
922+
LOGINFO("HdmiCecSink plugin device::Manager::DeInitialize failed");
923923
LOG_DEVICE_EXCEPTION0();
924924
}
925925

HdmiCecSource/HdmiCecSource.cpp

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,43 @@ namespace WPEFramework
7070
ASSERT(nullptr == _hdmiCecSource);
7171
ASSERT(0 == _connectionId);
7272

73+
try
74+
{
75+
device::Manager::Initialize();
76+
LOGINFO("HdmiCecSource plugin device::Manager::Initialize success");
77+
}
78+
catch(const device::Exception& err)
79+
{
80+
LOGINFO("HdmiCecSource plugin device::Manager::Initialize failed");
81+
msg = "HdmiCecSource plugin Initialize failed";
82+
LOG_DEVICE_EXCEPTION0();
83+
}
7384

74-
_service = service;
75-
_service->AddRef();
76-
_service->Register(&_notification);
77-
_hdmiCecSource = _service->Root<Exchange::IHdmiCecSource>(_connectionId, 5000, _T("HdmiCecSourceImplementation"));
85+
if (0 == msg.length())
86+
{
87+
_service = service;
88+
_service->AddRef();
89+
_service->Register(&_notification);
90+
_hdmiCecSource = _service->Root<Exchange::IHdmiCecSource>(_connectionId, 5000, _T("HdmiCecSourceImplementation"));
7891

79-
if(nullptr != _hdmiCecSource)
80-
{
81-
_hdmiCecSource->Configure(service);
82-
_hdmiCecSource->Register(&_notification);
83-
Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource);
84-
LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin");
85-
}
86-
else
87-
{
88-
msg = "HdmiCecSource plugin is not available";
89-
LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin");
90-
}
92+
if(nullptr != _hdmiCecSource)
93+
{
94+
_hdmiCecSource->Configure(service);
95+
_hdmiCecSource->Register(&_notification);
96+
Exchange::JHdmiCecSource::Register(*this, _hdmiCecSource);
97+
LOGINFO("HdmiCecSource plugin is available. Successfully activated HdmiCecSource Plugin");
98+
}
99+
else
100+
{
101+
msg = "HdmiCecSource plugin is not available";
102+
LOGINFO("HdmiCecSource plugin is not available. Failed to activate HdmiCecSource Plugin");
103+
}
91104

92-
if (0 != msg.length())
93-
{
94-
Deinitialize(service);
95-
}
105+
if (0 != msg.length())
106+
{
107+
Deinitialize(service);
108+
}
109+
}
96110

97111
// On success return empty, to indicate there is no error text.
98112
return msg;
@@ -153,6 +167,18 @@ namespace WPEFramework
153167
_service->Unregister(&_notification);
154168
_service->Release();
155169
_service = nullptr;
170+
171+
try
172+
{
173+
device::Manager::DeInitialize();
174+
LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize success");
175+
}
176+
catch(const device::Exception& err)
177+
{
178+
LOGINFO("HdmiCecSource plugin device::Manager::DeInitialize failed");
179+
LOG_DEVICE_EXCEPTION0();
180+
}
181+
156182
LOGINFO("HdmiCecSource plugin is deactivated. Successfully deactivated HdmiCecSource Plugin");
157183
}
158184

HdmiCecSource/HdmiCecSourceImplementation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ namespace WPEFramework
424424
try
425425
{
426426
//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
427-
device::Manager::Initialize();
427+
//device::Manager::Initialize();
428428

429429
#ifndef IO_HCEC_ENABLE_IARM
430430
device::Host::getInstance().Register(baseInterface<device::Host::IDisplayDeviceEvents>(), "WPE[HdmiCecSource]");

0 commit comments

Comments
 (0)