@@ -70,29 +70,43 @@ namespace WPEFramework
70
70
ASSERT (nullptr == _hdmiCecSource);
71
71
ASSERT (0 == _connectionId);
72
72
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
+ }
73
84
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" ));
78
91
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
+ }
91
104
92
- if (0 != msg.length ())
93
- {
94
- Deinitialize (service);
95
- }
105
+ if (0 != msg.length ())
106
+ {
107
+ Deinitialize (service);
108
+ }
109
+ }
96
110
97
111
// On success return empty, to indicate there is no error text.
98
112
return msg;
@@ -153,6 +167,18 @@ namespace WPEFramework
153
167
_service->Unregister (&_notification);
154
168
_service->Release ();
155
169
_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
+
156
182
LOGINFO (" HdmiCecSource plugin is deactivated. Successfully deactivated HdmiCecSource Plugin" );
157
183
}
158
184
0 commit comments