Skip to content

Commit e4739d3

Browse files
committed
RDKEMW-1014: test com-rpc communication with dummy plugin
1 parent b7fa382 commit e4739d3

File tree

8 files changed

+317
-0
lines changed

8 files changed

+317
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if(PLUGIN_HDMIINPUT)
6060
add_subdirectory(HdmiInput)
6161
endif()
6262

63+
add_subdirectory(HdcpProfileClient)
6364

6465
if(WPEFRAMEWORK_CREATE_IPKG_TARGETS)
6566
set(CPACK_GENERATOR "DEB")

HdcpProfileClient/CMakeLists.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# If not stated otherwise in this file or this component's license file the
2+
# following copyright and licenses apply:
3+
#
4+
# Copyright 2020 RDK Management
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set(PLUGIN_NAME HdcpProfileClient)
19+
set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME})
20+
21+
set(PLUGIN_HDCPPROFILECLIENT_STARTUPORDER "" CACHE STRING "To configure startup order of HdcpProfileClient plugin")
22+
23+
find_package(${NAMESPACE}Plugins REQUIRED)
24+
find_package(DS)
25+
find_package(IARMBus)
26+
find_package(GLIB REQUIRED)
27+
28+
find_library(GLIB_LIBRARY NAMES glib-2.0 )
29+
30+
add_executable(${MODULE_NAME}
31+
HdcpProfileClient.cpp
32+
Module.cpp)
33+
34+
set_target_properties(${MODULE_NAME} PROPERTIES
35+
CXX_STANDARD 11
36+
CXX_STANDARD_REQUIRED YES)
37+
38+
target_include_directories(${MODULE_NAME}
39+
PRIVATE
40+
../helpers
41+
${IARMBUS_INCLUDE_DIRS}
42+
${DS_INCLUDE_DIRS}
43+
${GLIB_INCLUDE_DIRS})
44+
45+
target_link_libraries(${MODULE_NAME}
46+
PRIVATE
47+
${NAMESPACE}Plugins::${NAMESPACE}Plugins
48+
${IARMBUS_LIBRARIES}
49+
${DS_LIBRARIES}
50+
${GLIB_LIBRARIES})
51+
52+
add_definitions(-DDS_FOUND)
53+
54+
install(TARGETS ${MODULE_NAME}
55+
DESTINATION lib/${STORAGE_DIRECTORY}/plugins)
56+
57+
write_config(${PLUGIN_NAME})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
precondition = ["Platform"]
2+
callsign = "org.rdk.HdcpProfileClient"
3+
autostart = "@PLUGIN_HDCPPROFILECLIENT_AUTOSTART@"
4+
startuporder = "@PLUGIN_HDCPPROFILECLIENT_STARTUPORDER@"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set (autostart ${PLUGIN_HDCPPROFILECLIENT_AUTOSTART})
2+
set (preconditions Platform)
3+
set (callsign "org.rdk.HdcpProfileClient")
4+
5+
if(PLUGIN_HDCPPROFILECLIENT_STARTUPORDER)
6+
set (startuporder ${PLUGIN_HDCPPROFILECLIENT_STARTUPORDER})
7+
endif()
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/**
2+
* If not stated otherwise in this file or this component's LICENSE
3+
* file the following copyright and licenses apply:
4+
*
5+
* Copyright 2019 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
**/
19+
20+
#include "HdcpProfileClient.h"
21+
22+
#include "UtilsJsonRpc.h"
23+
24+
#include <glib.h>
25+
#include <glib/gstdio.h>
26+
27+
#define API_VERSION_NUMBER_MAJOR 1
28+
#define API_VERSION_NUMBER_MINOR 0
29+
#define API_VERSION_NUMBER_PATCH 0
30+
31+
using namespace std;
32+
33+
namespace WPEFramework {
34+
35+
namespace {
36+
37+
static Plugin::Metadata<Plugin::HdcpProfileClient> metadata(
38+
// Version (Major, Minor, Patch)
39+
API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH,
40+
// Preconditions
41+
{},
42+
// Terminations
43+
{},
44+
// Controls
45+
{}
46+
);
47+
}
48+
49+
namespace Plugin {
50+
51+
SERVICE_REGISTRATION(HdcpProfileClient, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH);
52+
53+
HdcpProfileClient* HdcpProfileClient::_instance = nullptr;
54+
55+
HdcpProfileClient::HdcpProfileClient()
56+
{
57+
LOGINFO("ctor");
58+
HdcpProfileClient::_instance = this;
59+
//Register("checkcomrpccomm", &HdcpProfileClient::checkcomrpccomm, this);
60+
}
61+
62+
HdcpProfileClient::~HdcpProfileClient()
63+
{
64+
LOGINFO("dtor");
65+
}
66+
67+
const string HdcpProfileClient::Initialize(PluginHost::IShell* service)
68+
{
69+
Exchange::IHdcpProfile* _remotStoreObject = nullptr;
70+
ASSERT(service != nullptr);
71+
ASSERT(m_service == nullptr);
72+
73+
m_service = service;
74+
m_service->AddRef();
75+
_remotStoreObject = service->QueryInterfaceByCallsign<Exchange::IHdcpProfile>("org.rdk.HdcpProfile");
76+
77+
// HDCPStatus _hdcpstatus;
78+
Exchange::IHdcpProfile::HDCPStatus _hdcpstatus;
79+
bool _success = false;
80+
_remotStoreObject->GetHDCPStatus(_hdcpstatus, _success);
81+
if (_success == false)
82+
{
83+
LOGERR("getHDCPStatus failed");
84+
return (string());
85+
}
86+
LOGINFO("getHDCPStatus: isConnected: %d isHDCPCompliant: %d isHDCPEnabled: %d hdcpReason: %d supportedHDCPVersion: %s receiverHDCPVersion: %s currentHDCPVersion: %s",
87+
_hdcpstatus.isConnected, _hdcpstatus.isHDCPCompliant, _hdcpstatus.isHDCPEnabled, _hdcpstatus.hdcpReason,
88+
_hdcpstatus.supportedHDCPVersion.c_str(), _hdcpstatus.receiverHDCPVersion.c_str(), _hdcpstatus.currentHDCPVersion.c_str());
89+
ASSERT (nullptr != _remotStoreObject);
90+
string supportedHDCPVersion;
91+
bool isHDCPSupported = false;
92+
bool success1 = false;
93+
_remotStoreObject->GetSettopHDCPSupport(supportedHDCPVersion, isHDCPSupported, success1);
94+
if (success1 == false)
95+
{
96+
LOGERR("getSettopHDCPSupport failed");
97+
return (string());
98+
}
99+
LOGINFO("getSettopHDCPSupport: supportedHDCPVersion: %s isHDCPSupported: %d", supportedHDCPVersion.c_str(), isHDCPSupported);
100+
//subscribe the events onDisplayConnectionChanged through com-rpc
101+
//register the notification
102+
Exchange::IHdcpProfile::INotification* notification = service->QueryInterfaceByCallsign<Exchange::IHdcpProfile::INotification>("org.rdk.HdcpProfile");
103+
if (notification == nullptr)
104+
{
105+
LOGERR("Failed to get notification interface");
106+
return (string());
107+
}
108+
//register the notification
109+
_remotStoreObject->Register(notification);
110+
111+
112+
// if (notification != nullptr)
113+
// {
114+
// notification->Release();
115+
// notification = nullptr;
116+
// }
117+
118+
// On success return empty, to indicate there is no error text.
119+
return (string());
120+
}
121+
122+
123+
//define the onDisplayConnectionChanged method
124+
void HdcpProfileClient::OnDisplayConnectionChanged(const Exchange::IHdcpProfile::HDCPStatus& hdcpstatus)
125+
{
126+
LOGINFO("OnDisplayConnectionChanged callback triggered: isConnected: %d isHDCPCompliant: %d isHDCPEnabled: %d hdcpReason: %d supportedHDCPVersion: %s receiverHDCPVersion: %s currentHDCPVersion: %s",
127+
hdcpstatus.isConnected, hdcpstatus.isHDCPCompliant, hdcpstatus.isHDCPEnabled, hdcpstatus.hdcpReason,
128+
hdcpstatus.supportedHDCPVersion.c_str(), hdcpstatus.receiverHDCPVersion.c_str(), hdcpstatus.currentHDCPVersion.c_str());
129+
}
130+
131+
132+
void HdcpProfileClient::Deinitialize(PluginHost::IShell* service )
133+
{
134+
ASSERT(service == m_service);
135+
136+
m_service->Release();
137+
m_service = nullptr;
138+
}
139+
140+
141+
142+
} // namespace Plugin
143+
} // namespace WPEFramework
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* If not stated otherwise in this file or this component's LICENSE
3+
* file the following copyright and licenses apply:
4+
*
5+
* Copyright 2019 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
**/
19+
20+
#pragma once
21+
22+
#include "Module.h"
23+
#include <interfaces/IHdcpProfile.h>
24+
25+
26+
namespace WPEFramework {
27+
namespace Plugin {
28+
29+
class HdcpProfileClient : public PluginHost::IPlugin {
30+
private:
31+
32+
HdcpProfileClient(const HdcpProfileClient&) = delete;
33+
HdcpProfileClient& operator=(const HdcpProfileClient&) = delete;
34+
35+
36+
37+
public:
38+
HdcpProfileClient();
39+
virtual ~HdcpProfileClient();
40+
virtual const string Initialize(PluginHost::IShell* shell) override ;
41+
virtual void Deinitialize(PluginHost::IShell* service) override;
42+
virtual string Information() const override { return {}; }
43+
void OnDisplayConnectionChanged(const Exchange::IHdcpProfile::HDCPStatus& hdcpstatus);
44+
45+
BEGIN_INTERFACE_MAP(HdcpProfileClient)
46+
INTERFACE_ENTRY(PluginHost::IPlugin)
47+
END_INTERFACE_MAP
48+
49+
public:
50+
static HdcpProfileClient* _instance;
51+
PluginHost::IShell* m_service = nullptr;
52+
};
53+
} // namespace Plugin
54+
} // namespace WPEFramework

HdcpProfileClient/Module.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* If not stated otherwise in this file or this component's LICENSE
3+
* file the following copyright and licenses apply:
4+
*
5+
* Copyright 2019 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
**/
19+
20+
#include "Module.h"
21+
22+
MODULE_NAME_DECLARATION(BUILD_REFERENCE)

HdcpProfileClient/Module.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* If not stated otherwise in this file or this component's LICENSE
3+
* file the following copyright and licenses apply:
4+
*
5+
* Copyright 2019 RDK Management
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
**/
19+
20+
#pragma once
21+
#ifndef MODULE_NAME
22+
#define MODULE_NAME Plugin_HdcpProfileClient
23+
#endif
24+
25+
#include <plugins/plugins.h>
26+
#include <tracing/tracing.h>
27+
28+
#undef EXTERNAL
29+
#define EXTERNAL

0 commit comments

Comments
 (0)