Skip to content

RDKEMW-19159: Migrate libds api to thunder.#188

Open
santoshcomcast wants to merge 8 commits into
mainfrom
feature/RDKEMW-19159-migrate-from-libds-to-thunder
Open

RDKEMW-19159: Migrate libds api to thunder.#188
santoshcomcast wants to merge 8 commits into
mainfrom
feature/RDKEMW-19159-migrate-from-libds-to-thunder

Conversation

@santoshcomcast

Copy link
Copy Markdown

Reason for change: Migrate libds api to thunder.
Test Procedure: refer RDKEMW-19159
Risks: High
Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com

Reason for change: Migrate libds api to thunder.
Test Procedure: refer RDKEMW-19159
Risks: High
Signed-off-by:gsanto722 <grandhi_santoshkumar@comcast.com>
Copilot AI review requested due to automatic review settings July 6, 2026 12:58
@santoshcomcast
santoshcomcast requested a review from a team as a code owner July 6, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a build-time option to migrate HDMI/HDCP/resolution handling from libds APIs to Thunder JSON-RPC plugins (HdcpProfile / DisplaySettings / DisplayInfo) in the RDK externals layer.

Changes:

  • Added USE_DS_THUNDER_PLUGIN compilation path that uses Thunder JSON-RPC for HDCP status and display resolution, plus Thunder event subscriptions.
  • Extended Thunder access plumbing with new plugin enums/callsigns (HDCPPROFILE, DISPLAYINFO).
  • Added a CMake flag (CMAKE_DS_THUNDER_PLUGIN) to enable the Thunder-based path.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
externals/rdk/PlayerThunderAccess.cpp Adds callsign mapping for HdcpProfile/DisplayInfo plugins.
externals/rdk/PlayerExternalsRdkInterface.h Adds conditional includes and Thunder object members for the new path.
externals/rdk/PlayerExternalsRdkInterface.cpp Implements Thunder-based SetHDMIStatus plus Thunder event registration/removal.
externals/PlayerThunderAccessBase.h Extends Thunder plugin enum with HDCPPROFILE and DISPLAYINFO.
externals/CMakeLists.txt Adds build flag to define USE_DS_THUNDER_PLUGIN.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 28 to +41
@@ -33,6 +35,10 @@
#include "dsDisplay.h"
#include "audioOutputPort.hpp"
#include "dsAudio.h"
#else
#include "PlayerThunderAccess.h"
#include <memory>
#endif
Comment on lines 132 to 136
SetHDMIStatus();
#ifdef USE_DS_EVENT_SUPPORTED
#ifdef USE_DS_THUNDER_PLUGIN
RegisterThunderEventHandlers();
#elif defined(USE_DS_EVENT_SUPPORTED)
RegisterDsClientEventHandler();
Comment thread externals/rdk/PlayerThunderAccess.cpp Outdated
Comment on lines +55 to +56
#define HDCPPROFILE_CALLSIGN "org.rdk.HdcpProfile.1"
#define DISPLAYINFO_CALLSIGN "DisplayInfo.1"
Comment on lines +249 to +265
bool isConnected = false;
bool isHDCPEnabled = false;
dsHdcpProtocolVersion_t hdcpCurrentProtocol = dsHDCP_VERSION_1X;

/* --- Query HDCP status via HdcpProfile.1 --- */
if (m_hdcpProfileThunder) {
JsonObject param, result;
if (m_hdcpProfileThunder->InvokeJSONRPC("getHDCPStatus", param, result)) {
isConnected = result["isConnected"].Boolean();
isHDCPEnabled = result["isHDCPEnabled"].Boolean();
std::string currentVer = result["currentHDCPVersion"].String();
hdcpCurrentProtocol = (currentVer == "2.2") ? dsHDCP_VERSION_2X : dsHDCP_VERSION_1X;
MW_LOG_WARN("SetHDMIStatus: connected=%d enabled=%d currentHDCPVersion=%s\n",
isConnected, isHDCPEnabled, currentVer.c_str());
} else {
MW_LOG_WARN("SetHDMIStatus: getHDCPStatus JSONRPC failed\n");
}
Comment on lines +408 to +412
void PlayerExternalsRdkInterface::RegisterThunderEventHandlers()
{
/* ---- HdcpProfile.1 ---- */
m_hdcpProfileThunder = std::make_unique<PlayerThunderAccess>(PlayerThunderAccessPlugin::HDCPPROFILE);
m_hdcpProfileThunder->ActivatePlugin();
Copilot AI review requested due to automatic review settings July 7, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

externals/rdk/IIarm/DeviceIARMInterface.cpp:266

  • IARMInit() becomes a no-op under USE_DS_THUNDER_PLUGIN, but DeviceIARMInterface is still instantiated (when not using Firebolt) and provides APIs that call IARM_Bus_Call() (e.g., GetTR181Config, network manager handlers). Skipping IARM_Bus_Init/Connect here is likely to break those calls at runtime.
void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
    //char processName[20] = {0};
    IARM_Result_t result;
    MW_PRE_LOGGER_LOG("IARM Interface Init started in Player\n");

Comment on lines 132 to 136
SetHDMIStatus();
#ifdef USE_DS_EVENT_SUPPORTED
#ifdef USE_DS_THUNDER_PLUGIN
RegisterThunderEventHandlers();
#elif defined(USE_DS_EVENT_SUPPORTED)
RegisterDsClientEventHandler();
Comment on lines +408 to +412
void PlayerExternalsRdkInterface::RegisterThunderEventHandlers()
{
/* ---- HdcpProfile.1 ---- */
m_hdcpProfileThunder = std::make_unique<PlayerThunderAccess>(PlayerThunderAccessPlugin::HDCPPROFILE);
m_hdcpProfileThunder->ActivatePlugin();
try {
//Get the HDMI port
device::Manager::Initialize();
device::Manager::Initialize();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this as we are not using libds?

Copilot AI review requested due to automatic review settings July 8, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Comment on lines 130 to 137
MW_PRE_LOGGER_LOG("Done getting interface \n");

SetHDMIStatus();
#ifdef USE_DS_EVENT_SUPPORTED
#ifdef USE_DS_THUNDER_PLUGIN
RegisterThunderEventHandlers();
#elif defined(USE_DS_EVENT_SUPPORTED)
RegisterDsClientEventHandler();
#endif
Comment on lines +239 to +261
#ifdef USE_DS_THUNDER_PLUGIN
/*
* Thunder path: replaces all libds (device::Manager / VideoOutputPort) calls.
* CSV mapping:
* getHDCPCurrentProtocol -> HdcpProfile.1 getHDCPStatus -> currentHDCPVersion
* getHDCPReceiverProtocol -> HdcpProfile.1 getHDCPStatus -> receiverHDCPVersion
* isContentProtected -> HdcpProfile.1 getHDCPStatus -> isHDCPEnabled
* isDisplayConnected -> HdcpProfile.1 getHDCPStatus -> isConnected
* getPixelResolution -> DisplayInfo.1 displayinfo -> width / height
*/
bool isConnected = false;
bool isHDCPEnabled = false;
dsHdcpProtocolVersion_t hdcpCurrentProtocol = dsHDCP_VERSION_1X;

/* --- Query HDCP status via HdcpProfile.1 --- */
if (m_hdcpProfileThunder) {
JsonObject param, result;
if (m_hdcpProfileThunder->InvokeJSONRPC("getHDCPStatus", param, result)) {
isConnected = result["isConnected"].Boolean();
isHDCPEnabled = result["isHDCPEnabled"].Boolean();
std::string currentVer = result["currentHDCPVersion"].String();
hdcpCurrentProtocol = (currentVer == "2.2") ? dsHDCP_VERSION_2X : dsHDCP_VERSION_1X;
MW_LOG_WARN("SetHDMIStatus: connected=%d enabled=%d currentHDCPVersion=%s\n",
Comment on lines 320 to 344
@@ -336,6 +340,7 @@ void DeviceIARMInterface::RegisterNtwMgrEventHandler()
}
IARM_Bus_RegisterEventHandler("NET_SRV_MGR", IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS, getActiveInterfaceEventHandler);
pInstance->SetActiveInterface(wifiStatus);
#endif /* USE_DS_THUNDER_PLUGIN */
}

void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
using namespace WPEFramework;

#define SERVER_DETAILS "127.0.0.1:9998"
#define SERVER_DETAILS "100.64.11.1:9998"
Copilot AI review requested due to automatic review settings July 9, 2026 10:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Comment thread externals/rdk/PlayerThunderAccess.h Outdated
#include "Module.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmacro-redefined"
using namespace WPEFramework;

#define SERVER_DETAILS "127.0.0.1:9998"
#define SERVER_DETAILS "100.64.11.1:9998"
Comment on lines +132 to +135
SetHDMIStatus();
#ifdef USE_DS_EVENT_SUPPORTED
#ifdef USE_DS_THUNDER_PLUGIN
RegisterThunderEventHandlers();
#elif defined(USE_DS_EVENT_SUPPORTED)

void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
#include "dsAudio.h"
#else
#include "PlayerThunderAccess.h"
#include <memory>
Comment on lines +442 to +449
void PlayerExternalsRdkInterface::RegisterThunderEventHandlers()
{
MW_LOG_WARN("[DS-Thunder] RegisterThunderEventHandlers() start\n");

/* ---- HdcpProfile.1 ---- */
MW_LOG_WARN("[DS-Thunder] Creating PlayerThunderAccess for HDCPPROFILE (org.rdk.HdcpProfile.1)\n");
m_hdcpProfileThunder = std::make_unique<PlayerThunderAccess>(PlayerThunderAccessPlugin::HDCPPROFILE);
bool activateRet = m_hdcpProfileThunder->ActivatePlugin();
Copilot AI review requested due to automatic review settings July 9, 2026 15:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

using namespace WPEFramework;

#define SERVER_DETAILS "127.0.0.1:9998"
#define SERVER_DETAILS "100.64.11.1:9998"
Comment on lines +492 to +498
MW_LOG_WARN("[DS-Thunder] RegisterThunderEventHandlers() start\n");

/* Start the worker thread that serialises SetHDMIStatus() calls */
m_eventWorkerStop = false;
m_eventPending = false;
m_eventWorkerThread = std::thread(&PlayerExternalsRdkInterface::EventWorkerLoop, this);
MW_LOG_WARN("[DS-Thunder] EventWorkerLoop thread started\n");
Comment on lines +506 to +508
/* onDisplayConnectionChanged: replaces IARM_BUS_DSMGR_EVENT_HDCP_STATUS */
/* NOTE: Thunder does not allow InvokeJSONRPC from within a callback.
* Spawn a detached thread so the callback returns immediately. */
Comment on lines 260 to 264
void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
//char processName[20] = {0};
IARM_Result_t result;
Comment on lines +448 to +452
void PlayerExternalsRdkInterface::PostHDMIStatusUpdate()
{
{
std::lock_guard<std::mutex> lk(m_eventMutex);
m_eventPending = true;
Comment on lines +144 to +148
MW_LOG_WARN( "[GSK-TAP-ACTIVATE] sending activate callsign=%s", pluginCallsign.c_str());
status = controllerObject->Invoke<JsonObject, JsonObject>(THUNDER_RPC_TIMEOUT, _T("activate"), controlParam, result);
if (Core::ERROR_NONE == status){
result.ToString(response);
MW_LOG_INFO( "[ThunderAccessPlayer] %s plugin Activated. Response : %s ", pluginCallsign.c_str(), response.c_str());
MW_LOG_WARN( "[GSK-TAP-ACTIVATE] %s activated OK response=%s", pluginCallsign.c_str(), response.c_str());
…SetHDMIStatus()

- IARM mode: Thunder events -> worker thread -> Thunder JSONRPC SetHDMIStatus()
- No libds/IARM API calls in either path
Copilot AI review requested due to automatic review settings July 10, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

using namespace WPEFramework;

#define SERVER_DETAILS "127.0.0.1:9998"
#define SERVER_DETAILS "100.64.11.1:9998"

void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
Comment on lines +506 to +514
MW_LOG_WARN("[DS-Thunder] RegisterThunderEventHandlers() start\n");

/* Start the worker thread that serialises SetHDMIStatus() calls.
* Needed in both modes: Thunder callbacks must not call InvokeJSONRPC
* directly, and Firebolt callbacks may arrive concurrently. */
m_eventWorkerStop = false;
m_eventPending = false;
m_eventWorkerThread = std::thread(&PlayerExternalsRdkInterface::EventWorkerLoop, this);
MW_LOG_WARN("[DS-Thunder] EventWorkerLoop thread started\n");
Comment on lines +600 to +611
/* Unsubscribe Thunder events — only if they were registered (IARM mode) */
if (m_initialized == InitState::IARM)
{
if (m_hdcpProfileThunder) {
m_hdcpProfileThunder->UnSubscribeEvent("onDisplayConnectionChanged");
}
if (m_dsThunder) {
m_dsThunder->UnSubscribeEvent("connectedVideoDisplaysUpdated");
m_dsThunder->UnSubscribeEvent("resolutionChanged");
m_dsThunder->UnSubscribeEvent("resolutionPreChange");
}
}
Comment thread externals/CMakeLists.txt
Comment on lines +146 to +151
# PlayerThunderAccess.cpp is required; ensure it is compiled even if CMAKE_WPEFRAMEWORK_REQUIRED was not set
if(NOT CMAKE_WPEFRAMEWORK_REQUIRED)
message("CMAKE_DS_THUNDER_PLUGIN: auto-enabling WPEFramework for PlayerThunderAccess")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
set(LIB_EXT_DEFINES "${LIB_EXT_DEFINES} -DUSE_CPP_THUNDER_PLUGIN_ACCESS")
set(THUNDER_INTERFACE_SRCS ${THUNDER_INTERFACE_SRCS} rdk/PlayerThunderAccess.cpp Module.cpp)
Comment on lines 227 to 232
if (result_internal["success"].Boolean()) {
result_internal.ToString(response);
MW_LOG_TRACE( "[ThunderAccessPlayer] %s success! Response : %s", method.c_str() , response.c_str());
MW_LOG_WARN( "[GSK-TAP-INVOKE] %s::%s SUCCESS response=%s", pluginCallsign.c_str(), method.c_str(), response.c_str());
} else {
result_internal.ToString(response);
MW_LOG_WARN( "[ThunderAccessPlayer] %s call failed! Response : %s", method.c_str() , response.c_str());
MW_LOG_WARN( "[GSK-TAP-INVOKE] %s::%s FAILED (no success field) response=%s", pluginCallsign.c_str(), method.c_str(), response.c_str());
ret = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants