Skip to content

Commit ff25a16

Browse files
authored
Merge pull request #8 from rdkcentral/topic/RDK-55887
RDK-55887: Update the Plugin Client with QueryInterface with CallSign
2 parents 7f61695 + d519935 commit ff25a16

File tree

11 files changed

+50
-148
lines changed

11 files changed

+50
-148
lines changed

HdcpProfile/HdcpProfile.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,18 @@ namespace WPEFramework
7777
: PluginHost::JSONRPC()
7878
{
7979
RegisterAll();
80-
_engine = Core::ProxyType<RPC::InvokeServerType<1, 0, 4>>::Create();
81-
_communicatorClient = Core::ProxyType<RPC::CommunicatorClient>::Create(Core::NodeId("/tmp/communicator"), Core::ProxyType<Core::IIPCServer>(_engine));
8280
}
8381

8482
HdcpProfile::~HdcpProfile()
8583
{
8684
UnregisterAll();
8785
}
8886

89-
const string HdcpProfile::Initialize(PluginHost::IShell * /* service */)
87+
const string HdcpProfile::Initialize(PluginHost::IShell *service)
9088
{
9189
HdcpProfile::_instance = this;
9290
InitializeIARM();
93-
InitializePowerManager();
91+
InitializePowerManager(service);
9492
try
9593
{
9694
device::Manager::Initialize();
@@ -109,27 +107,16 @@ namespace WPEFramework
109107
_powerManagerPlugin.Reset();
110108
}
111109

112-
LOGINFO("Disconnect from the COM-RPC socket\n");
113-
114-
// Disconnect from the COM-RPC socket
115-
if (_communicatorClient.IsValid()) {
116-
_communicatorClient->Close(RPC::CommunicationTimeOut);
117-
_communicatorClient.Release();
118-
}
119-
if (_engine.IsValid()) {
120-
_engine.Release();
121-
}
122110
HdcpProfile::_instance = nullptr;
123111
// No need to run device::Manager::DeInitialize for individual plugin. As it is a singleton instance
124112
// and shared among all wpeframework plugins
125113
DeinitializeIARM();
126114
}
127115

128-
void HdcpProfile::InitializePowerManager()
116+
void HdcpProfile::InitializePowerManager(PluginHost::IShell *service)
129117
{
130-
_powerManagerPlugin = PowerManagerInterfaceBuilder(_communicatorClient, _T("org.rdk.PowerManager"))
131-
.withTimeout(3000)
132-
.withVersion(~0)
118+
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
119+
.withIShell(service)
133120
.createInterface();
134121
}
135122

HdcpProfile/HdcpProfile.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@ namespace WPEFramework {
4646
// We do not allow this plugin to be copied !!
4747
HdcpProfile(const HdcpProfile&) = delete;
4848
HdcpProfile& operator=(const HdcpProfile&) = delete;
49-
Core::ProxyType<RPC::InvokeServerType<1, 0, 4> > _engine;
50-
Core::ProxyType<RPC::CommunicatorClient> _communicatorClient;
5149
static PowerManagerInterfaceRef _powerManagerPlugin;
5250

5351
void InitializeIARM();
5452
void DeinitializeIARM();
5553

5654
void RegisterAll();
5755
void UnregisterAll();
58-
void InitializePowerManager();
56+
void InitializePowerManager(PluginHost::IShell * service);
5957

6058
//Begin methods
6159
uint32_t getHDCPStatusWrapper(const JsonObject& parameters, JsonObject& response);

HdmiCecSink/HdmiCecSink.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -687,16 +687,14 @@ namespace WPEFramework
687687
, _registeredEventHandlers(false)
688688
{
689689
LOGWARN("Initlaizing HdmiCecSink");
690-
_engine = Core::ProxyType<RPC::InvokeServerType<1, 0, 4>>::Create();
691-
_communicatorClient = Core::ProxyType<RPC::CommunicatorClient>::Create(Core::NodeId("/tmp/communicator"), Core::ProxyType<Core::IIPCServer>(_engine));
692690
}
693691

694692
HdmiCecSink::~HdmiCecSink()
695693
{
696694
}
697-
const std::string HdmiCecSink::Initialize(PluginHost::IShell * /* service */)
695+
const std::string HdmiCecSink::Initialize(PluginHost::IShell *service)
698696
{
699-
InitializePowerManager();
697+
InitializePowerManager(service);
700698
profileType = searchRdkProfile();
701699

702700
if (profileType == STB || profileType == NOT_FOUND)
@@ -826,17 +824,6 @@ namespace WPEFramework
826824
{
827825
_powerManagerPlugin.Reset();
828826
}
829-
LOGINFO("Disconnect from the COM-RPC socket\n");
830-
// Disconnect from the COM-RPC socket
831-
if (_communicatorClient.IsValid())
832-
{
833-
_communicatorClient->Close(RPC::CommunicationTimeOut);
834-
_communicatorClient.Release();
835-
}
836-
if(_engine.IsValid())
837-
{
838-
_engine.Release();
839-
}
840827
_registeredEventHandlers = false;
841828

842829
profileType = searchRdkProfile();
@@ -910,11 +897,10 @@ namespace WPEFramework
910897
}
911898
}
912899

913-
void HdmiCecSink::InitializePowerManager()
900+
void HdmiCecSink::InitializePowerManager(PluginHost::IShell *service)
914901
{
915-
_powerManagerPlugin = PowerManagerInterfaceBuilder(_communicatorClient, _T("org.rdk.PowerManager"))
916-
.withTimeout(3000)
917-
.withVersion(~0)
902+
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
903+
.withIShell(service)
918904
.createInterface();
919905
registerEventHandlers();
920906
}

HdmiCecSink/HdmiCecSink.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ namespace WPEFramework {
646646
uint32_t getAudioDeviceConnectedStatusWrapper(const JsonObject& parameters, JsonObject& response);
647647
uint32_t requestAudioDevicePowerStatusWrapper(const JsonObject& parameters, JsonObject& response);
648648
uint32_t setLatencyInfoWrapper(const JsonObject& parameters, JsonObject& response);
649-
void InitializePowerManager();
649+
void InitializePowerManager(PluginHost::IShell *service);
650650
//End methods
651651
std::string logicalAddressDeviceType;
652652
bool cecSettingEnabled;
@@ -690,8 +690,6 @@ namespace WPEFramework {
690690
std::vector<uint8_t> m_connectedDevices;
691691
HdmiCecSinkProcessor *msgProcessor;
692692
HdmiCecSinkFrameListener *msgFrameListener;
693-
Core::ProxyType<RPC::InvokeServerType<1, 0, 4> > _engine;
694-
Core::ProxyType<RPC::CommunicatorClient> _communicatorClient;
695693
PowerManagerInterfaceRef _powerManagerPlugin;
696694
Core::Sink<PowerManagerNotification> _pwrMgrNotification;
697695
bool _registeredEventHandlers;

HdmiCecSource/HdmiCecSource.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -404,16 +404,14 @@ namespace WPEFramework
404404
, _registeredEventHandlers(false)
405405
{
406406
LOGWARN("ctor");
407-
_engine = Core::ProxyType<RPC::InvokeServerType<1, 0, 4>>::Create();
408-
_communicatorClient = Core::ProxyType<RPC::CommunicatorClient>::Create(Core::NodeId("/tmp/communicator"), Core::ProxyType<Core::IIPCServer>(_engine));
409407
}
410408

411409
HdmiCecSource::~HdmiCecSource()
412410
{
413411
LOGWARN("dtor");
414412
}
415413

416-
const string HdmiCecSource::Initialize(PluginHost::IShell* /* service */)
414+
const string HdmiCecSource::Initialize(PluginHost::IShell *service)
417415
{
418416
LOGWARN("Initlaizing CEC_2");
419417
uint32_t res = Core::ERROR_GENERAL;
@@ -456,7 +454,7 @@ namespace WPEFramework
456454

457455
//CEC plugin functionalities will only work if CECmgr is available. If plugin Initialize failure upper layer will call dtor directly.
458456
InitializeIARM();
459-
InitializePowerManager();
457+
InitializePowerManager(service);
460458

461459
// load persistence setting
462460
loadSettings();
@@ -539,17 +537,6 @@ namespace WPEFramework
539537
{
540538
_powerManagerPlugin.Reset();
541539
}
542-
LOGINFO("Disconnect from the COM-RPC socket\n");
543-
// Disconnect from the COM-RPC socket
544-
if (_communicatorClient.IsValid())
545-
{
546-
_communicatorClient->Close(RPC::CommunicationTimeOut);
547-
_communicatorClient.Release();
548-
}
549-
if(_engine.IsValid())
550-
{
551-
_engine.Release();
552-
}
553540
_registeredEventHandlers = false;
554541

555542
profileType = searchRdkProfile();
@@ -729,12 +716,11 @@ namespace WPEFramework
729716
return ret;
730717
}
731718

732-
void HdmiCecSource::InitializePowerManager()
719+
void HdmiCecSource::InitializePowerManager(PluginHost::IShell *service)
733720
{
734721
LOGINFO("Connect the COM-RPC socket\n");
735-
_powerManagerPlugin = PowerManagerInterfaceBuilder(_communicatorClient, _T("org.rdk.PowerManager"))
736-
.withTimeout(3000)
737-
.withVersion(~0)
722+
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
723+
.withIShell(service)
738724
.createInterface();
739725
registerEventHandlers();
740726
}

HdmiCecSource/HdmiCecSource.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ namespace WPEFramework {
297297

298298
HdmiCecSourceProcessor *msgProcessor;
299299
HdmiCecSourceFrameListener *msgFrameListener;
300-
void InitializePowerManager();
300+
void InitializePowerManager(PluginHost::IShell *service);
301301
const void InitializeIARM();
302302
void DeinitializeIARM();
303303
static void dsHdmiEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
@@ -329,8 +329,6 @@ namespace WPEFramework {
329329
static void threadHotPlugEventHandler(int data);
330330
static void threadCecDaemonInitHandler();
331331
static void threadCecStatusUpdateHandler(int data);
332-
Core::ProxyType<RPC::InvokeServerType<1, 0, 4> > _engine;
333-
Core::ProxyType<RPC::CommunicatorClient> _communicatorClient;
334332
PowerManagerInterfaceRef _powerManagerPlugin;
335333
Core::Sink<PowerManagerNotification> _pwrMgrNotification;
336334
bool _registeredEventHandlers;

HdmiCec_2/HdmiCec_2.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,6 @@ namespace WPEFramework
405405
Register(HDMICEC2_METHOD_GET_ACTIVE_SOURCE_STATUS, &HdmiCec_2::getActiveSourceStatus, this);
406406
Register(HDMICEC2_METHOD_SEND_KEY_PRESS,&HdmiCec_2::sendRemoteKeyPressWrapper,this);
407407
Register("getDeviceList", &HdmiCec_2::getDeviceList, this);
408-
_engine = Core::ProxyType<RPC::InvokeServerType<1, 0, 4>>::Create();
409-
_communicatorClient = Core::ProxyType<RPC::CommunicatorClient>::Create(Core::NodeId("/tmp/communicator"), Core::ProxyType<Core::IIPCServer>(_engine));
410408
}
411409

412410
HdmiCec_2::~HdmiCec_2()
@@ -415,7 +413,7 @@ namespace WPEFramework
415413
LOGWARN("dtor");
416414
}
417415

418-
const string HdmiCec_2::Initialize(PluginHost::IShell* /* service */)
416+
const string HdmiCec_2::Initialize(PluginHost::IShell* service)
419417
{
420418
LOGWARN("Initlaizing CEC_2");
421419
string msg;
@@ -448,7 +446,7 @@ namespace WPEFramework
448446

449447
//CEC plugin functionalities will only work if CECmgr is available. If plugin Initialize failure upper layer will call dtor directly.
450448
InitializeIARM();
451-
InitializePowerManager();
449+
InitializePowerManager(service);
452450

453451
// load persistence setting
454452
loadSettings();
@@ -520,17 +518,6 @@ namespace WPEFramework
520518
{
521519
_powerManagerPlugin.Reset();
522520
}
523-
LOGINFO("Disconnect from the COM-RPC socket\n");
524-
// Disconnect from the COM-RPC socket
525-
if (_communicatorClient.IsValid())
526-
{
527-
_communicatorClient->Close(RPC::CommunicationTimeOut);
528-
_communicatorClient.Release();
529-
}
530-
if(_engine.IsValid())
531-
{
532-
_engine.Release();
533-
}
534521
_registeredEventHandlers = false;
535522
if(true == getEnabled())
536523
{
@@ -554,12 +541,11 @@ namespace WPEFramework
554541
}
555542
}
556543

557-
void HdmiCec_2::InitializePowerManager()
544+
void HdmiCec_2::InitializePowerManager(PluginHost::IShell* service)
558545
{
559546
LOGINFO("Connect the COM-RPC socket\n");
560-
_powerManagerPlugin = PowerManagerInterfaceBuilder(_communicatorClient, _T("org.rdk.PowerManager"))
561-
.withTimeout(3000)
562-
.withVersion(~0)
547+
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
548+
.withIShell(service)
563549
.createInterface();
564550
registerEventHandlers();
565551
}

HdmiCec_2/HdmiCec_2.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,10 @@ namespace WPEFramework {
294294

295295
HdmiCec_2Processor *msgProcessor;
296296
HdmiCec_2FrameListener *msgFrameListener;
297-
Core::ProxyType<RPC::InvokeServerType<1, 0, 4> > _engine;
298-
Core::ProxyType<RPC::CommunicatorClient> _communicatorClient;
299297
PowerManagerInterfaceRef _powerManagerPlugin;
300298
Core::Sink<PowerManagerNotification> _pwrMgrNotification;
301299
bool _registeredEventHandlers;
302-
void InitializePowerManager();
300+
void InitializePowerManagerPluginHost::IShell *service
303301
const void InitializeIARM();
304302
void DeinitializeIARM();
305303
static void cecMgrEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);

0 commit comments

Comments
 (0)