Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,31 @@ if(CMAKE_IARM_MGR)
set(EXT_SOURCES "${EXT_SOURCES}" rdk/IIarm/DeviceIARMInterface.cpp)
set(EXT_SOURCES "${EXT_SOURCES}" rdk/IFirebolt/DeviceFireboltInterface.cpp)
set(EXT_SOURCES "${EXT_SOURCES}" IFirebolt/FireboltInterface.cpp)
list(APPEND LIB_EXT_DEPENDS -lIARMBus -lds -ldshalcli)
if(CMAKE_DS_THUNDER_PLUGIN)
# Thunder path: libds (-lds -ldshalcli) replaced by Thunder plugins; keep only IARM bus
list(APPEND LIB_EXT_DEPENDS -lIARMBus)
else()
list(APPEND LIB_EXT_DEPENDS -lIARMBus -lds -ldshalcli)
endif()
endif()

if(CMAKE_DS_THUNDER_PLUGIN)
message("CMAKE_DS_THUNDER_PLUGIN set: libds replaced by Thunder HdcpProfile.1 / DisplaySettings.1")
set(LIB_EXT_DEFINES "${LIB_EXT_DEFINES} -DUSE_DS_THUNDER_PLUGIN=1")
# 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 +146 to +151
find_package(WPEFramework REQUIRED)
if(WPEFRAMEWORK_FOUND)
include_directories(SYSTEM ${WPEFRAMEWORK_INCLUDE_DIRS})
list(APPEND LIB_EXT_DEPENDS ${WPEFRAMEWORK_LIBRARIES})
else()
message(FATAL_ERROR "CMAKE_DS_THUNDER_PLUGIN requires WPEFramework but it was not found")
endif()
endif()
endif()

if(CMAKE_PLAYER_RFC_REQUIRED)
Expand Down
3 changes: 2 additions & 1 deletion externals/PlayerThunderAccessBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ enum PlayerThunderAccessPlugin
SECMANAGER,
WATERMARK,
HDMIINPUT,
COMPOSITEINPUT
COMPOSITEINPUT,
HDCPPROFILE
};

/*
Expand Down
50 changes: 28 additions & 22 deletions externals/contentsecuritymanager/ThunderAccessPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,30 @@ ThunderAccessPlayer::ThunderAccessPlayer(std::string callsign)
,controllerObject(NULL)
,pluginCallsign(callsign)
{
MW_LOG_INFO( "[ThunderAccessPlayer]Inside");
MW_LOG_WARN( "[GSK-TAP-CTOR] callsign=%s server=%s", callsign.c_str(), SERVER_DETAILS);
uint32_t status = Core::ERROR_NONE;

Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T(SERVER_DETAILS)));
string sToken = "";
#ifdef DISABLE_SECURITY_TOKEN
gSecurityPlayerData.securityToken = "token=" + sToken;
gSecurityPlayerData.tokenQueried = true;
MW_LOG_WARN( "[GSK-TAP-TOKEN] security token DISABLED");
#else
if(!gSecurityPlayerData.tokenQueried)
{
unsigned char buffer[MAX_LENGTH] = {0};
gSecurityPlayerData.tokenStatus = GetSecurityToken(MAX_LENGTH,buffer);
if(gSecurityPlayerData.tokenStatus > 0){
MW_LOG_INFO( "[ThunderAccessPlayer] : GetSecurityToken success");
sToken = (char*)buffer;
gSecurityPlayerData.securityToken = "token=" + sToken;
MW_LOG_WARN( "[GSK-TAP-TOKEN] GetSecurityToken success len=%d", gSecurityPlayerData.tokenStatus);
} else {
MW_LOG_WARN( "[GSK-TAP-TOKEN] GetSecurityToken failed status=%d proceeding without token", gSecurityPlayerData.tokenStatus);
}
gSecurityPlayerData.tokenQueried = true;

//MW_LOG_WARN( "[ThunderAccessPlayer] securityToken : %s tokenStatus : %d tokenQueried : %s", gSecurityPlayerData.securityToken.c_str(), gSecurityPlayerData.tokenStatus, ((gSecurityPlayerData.tokenQueried)?"true":"false"));
} else {
MW_LOG_INFO( "[GSK-TAP-TOKEN] reusing cached token tokenStatus=%d", gSecurityPlayerData.tokenStatus);
}
#endif
if (NULL == controllerObject) {
Expand All @@ -97,9 +100,9 @@ ThunderAccessPlayer::ThunderAccessPlayer(std::string callsign)
}

if (NULL == controllerObject) {
MW_LOG_WARN( "[ThunderAccessPlayer] Controller object creation failed");
MW_LOG_WARN( "[GSK-TAP-CTRL] controller object creation FAILED");
} else {
MW_LOG_INFO( "[ThunderAccessPlayer] Controller object creation success");
MW_LOG_WARN( "[GSK-TAP-CTRL] controller object created OK server=%s", SERVER_DETAILS);
}
}

Expand All @@ -110,9 +113,9 @@ ThunderAccessPlayer::ThunderAccessPlayer(std::string callsign)
remoteObject = new JSONRPC::LinkType<Core::JSON::IElement>(_T(pluginCallsign), _T(""));
}
if (NULL == remoteObject) {
MW_LOG_WARN( "[ThunderAccessPlayer] %s Client initialization failed", pluginCallsign.c_str());
MW_LOG_WARN( "[GSK-TAP-REMOTE] %s remote object creation FAILED", pluginCallsign.c_str());
} else {
MW_LOG_INFO( "[ThunderAccessPlayer] %s Client initialization success", pluginCallsign.c_str());
MW_LOG_WARN( "[GSK-TAP-REMOTE] %s remote object created OK server=%s", pluginCallsign.c_str(), SERVER_DETAILS);
}
}

Expand All @@ -138,18 +141,19 @@ bool ThunderAccessPlayer::ActivatePlugin()

if (NULL != controllerObject) {
controlParam["callsign"] = pluginCallsign;
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());
Comment on lines +144 to +148
}
else
{
MW_LOG_WARN( "[ThunderAccessPlayer] %s plugin Activation failed with error status : %u ", pluginCallsign.c_str(), status);
MW_LOG_WARN( "[GSK-TAP-ACTIVATE] %s activation FAILED errorStatus=%u", pluginCallsign.c_str(), status);
ret = false;
}
} else {
MW_LOG_WARN( "[ThunderAccessPlayer] Controller Object NULL ");
MW_LOG_WARN( "[GSK-TAP-ACTIVATE] controller object is NULL cannot activate %s", pluginCallsign.c_str());
ret = false;
}
return ret;
Expand All @@ -163,16 +167,17 @@ bool ThunderAccessPlayer::SubscribeEvent (string eventName, std::function<void(c
{
bool ret = true;
uint32_t status = Core::ERROR_NONE;
MW_LOG_WARN( "[GSK-TAP-SUBSCRIBE] callsign=%s event=%s", pluginCallsign.c_str(), eventName.c_str());
if (NULL != remoteObject) {
status = remoteObject->Subscribe<JsonObject>(THUNDER_RPC_TIMEOUT, _T(eventName), functionHandler);
if (Core::ERROR_NONE == status) {
MW_LOG_INFO( "[ThunderAccessPlayer] Subscribed to : %s", eventName.c_str());
MW_LOG_WARN( "[GSK-TAP-SUBSCRIBE] %s::%s subscribed OK", pluginCallsign.c_str(), eventName.c_str());
} else {
MW_LOG_WARN( "[ThunderAccessPlayer] Subscription failed for : %s with error status %u", eventName.c_str(), status);
MW_LOG_WARN( "[GSK-TAP-SUBSCRIBE] %s::%s subscription FAILED errorStatus=%u", pluginCallsign.c_str(), eventName.c_str(), status);
ret = false;
}
} else {
MW_LOG_WARN( "[ThunderAccessPlayer] remoteObject not created for the plugin!");
MW_LOG_WARN( "[GSK-TAP-SUBSCRIBE] remoteObject is NULL for %s cannot subscribe to %s", pluginCallsign.c_str(), eventName.c_str());
ret = false;
}
return ret;
Expand All @@ -186,11 +191,12 @@ bool ThunderAccessPlayer::SubscribeEvent (string eventName, std::function<void(c
bool ThunderAccessPlayer::UnSubscribeEvent (std::string eventName)
{
bool ret = true;
MW_LOG_WARN( "[GSK-TAP-UNSUBSCRIBE] callsign=%s event=%s", pluginCallsign.c_str(), eventName.c_str());
if (NULL != remoteObject) {
remoteObject->Unsubscribe(THUNDER_RPC_TIMEOUT, _T(eventName));
MW_LOG_INFO( "[ThunderAccessPlayer] UnSubscribed : %s event", eventName.c_str());
MW_LOG_WARN( "[GSK-TAP-UNSUBSCRIBE] %s::%s unsubscribed OK", pluginCallsign.c_str(), eventName.c_str());
} else {
MW_LOG_WARN( "[ThunderAccessPlayer] remoteObject not created for the plugin!");
MW_LOG_WARN( "[GSK-TAP-UNSUBSCRIBE] remoteObject is NULL for %s cannot unsubscribe %s", pluginCallsign.c_str(), eventName.c_str());
ret = false;
}
return ret;
Expand All @@ -206,26 +212,26 @@ bool ThunderAccessPlayer::InvokeJSONRPC(std::string method, const JsonObject &pa
std::string response;
uint32_t status = Core::ERROR_NONE;

MW_LOG_WARN( "[GSK-TAP-INVOKE] callsign=%s method=%s", pluginCallsign.c_str(), method.c_str());
if(NULL == remoteObject)
{
MW_LOG_WARN( "[ThunderAccessPlayer] client not initialized! ");
MW_LOG_WARN( "[GSK-TAP-INVOKE] remoteObject is NULL for %s cannot invoke %s", pluginCallsign.c_str(), method.c_str());
return false;
}

JsonObject result_internal;
status = remoteObject->Invoke<JsonObject, JsonObject>(waitTime, _T(method), param, result_internal);
result_internal.ToString(response);
if (Core::ERROR_NONE == status)
{
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;
}
Comment on lines 227 to 232
} else {
MW_LOG_WARN( "[ThunderAccessPlayer] %s : invoke failed with error status %u", method.c_str(), status);
MW_LOG_WARN( "[GSK-TAP-INVOKE] %s::%s invoke FAILED errorStatus=%u response=%s", pluginCallsign.c_str(), method.c_str(), status, response.c_str());
ret = false;
}

Expand Down
21 changes: 19 additions & 2 deletions externals/rdk/IFirebolt/DeviceFireboltInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ static void HDCPEventHandlerFirebolt(const Firebolt::Device::HDCPVersionMap& t_H
{
std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();

#ifdef USE_DS_THUNDER_PLUGIN
/* When the Thunder plugin path is active, HDCP version and connection state
* are read authoritatively from HdcpProfile.1::getHDCPStatus inside
* SetHDMIStatus(). Route through the coalescing worker thread so that
* concurrent Firebolt callbacks don't race on the Thunder RPC object. */
MW_LOG_WARN("[DS-Thunder] HDCPEventHandlerFirebolt: routing to PostHDMIStatusUpdate\n");
pInstance->PostHDMIStatusUpdate();
#else
if(t_HDCPVersionMap.hdcp2_2)
{
pInstance->setHdcpProtocol(dsHDCP_VERSION_2X);
Expand All @@ -245,14 +253,23 @@ static void HDCPEventHandlerFirebolt(const Firebolt::Device::HDCPVersionMap& t_H
}

pInstance->SetHDMIStatus();
#endif
}

/**
* @brief IARM event handler for resolution changes
*/
static void ResolutionHandlerFirebolt(const std::string& t_res)
{
#ifdef USE_DS_THUNDER_PLUGIN
/* When the Thunder plugin path is active, resolution is fetched from
* DisplaySettings.1::getCurrentResolution inside SetHDMIStatus(). Route
* through the coalescing worker thread so this event is handled in order
* with HDCP events. */
MW_LOG_WARN("[DS-Thunder] ResolutionHandlerFirebolt: routing to PostHDMIStatusUpdate\n");
std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();
pInstance->PostHDMIStatusUpdate();
#else
int width = 1280;
int height = 720;

Expand All @@ -272,5 +289,5 @@ static void ResolutionHandlerFirebolt(const std::string& t_res)
{
MW_LOG_ERR("Failed to get current resolution");
}

#endif
}
15 changes: 10 additions & 5 deletions externals/rdk/IIarm/DeviceIARMInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t {

std::shared_ptr<DeviceIARMInterface> s_pDeviceIARMInterface = nullptr;

#ifndef USE_DS_EVENT_SUPPORTED
#if !defined(USE_DS_EVENT_SUPPORTED) && !defined(USE_DS_THUNDER_PLUGIN)
static void HDMIEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
static void ResolutionHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
#endif
Expand Down Expand Up @@ -259,6 +259,7 @@ static void IARM_PowerChangeHandler (const PowerController_PowerState_t currentS

void DeviceIARMInterface::IARMInit()
{
#ifndef USE_DS_THUNDER_PLUGIN
//char processName[20] = {0};
IARM_Result_t result;
Comment on lines 260 to 264
MW_PRE_LOGGER_LOG("IARM Interface Init started in Player\n");
Expand Down Expand Up @@ -292,12 +293,12 @@ void DeviceIARMInterface::IARMInit()
}

MW_PRE_LOGGER_LOG("IARM Interface Init completed in Player\n");

#endif /* USE_DS_THUNDER_PLUGIN */
}

void DeviceIARMInterface::RegisterDsMgrEventHandler()
{
#ifndef USE_DS_EVENT_SUPPORTED
#if !defined(USE_DS_EVENT_SUPPORTED) && !defined(USE_DS_THUNDER_PLUGIN)
IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, HDMIEventHandler);
IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, HDMIEventHandler);
IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE, ResolutionHandler);
Expand All @@ -306,16 +307,19 @@ void DeviceIARMInterface::RegisterDsMgrEventHandler()

void DeviceIARMInterface::RemoveEventHandlers()
{
#ifndef USE_DS_EVENT_SUPPORTED
#if !defined(USE_DS_EVENT_SUPPORTED) && !defined(USE_DS_THUNDER_PLUGIN)
IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG, HDMIEventHandler);
IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS, HDMIEventHandler);
IARM_Bus_RemoveEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE, ResolutionHandler);
#endif
#ifndef USE_DS_THUNDER_PLUGIN
IARM_Bus_RemoveEventHandler("NET_SRV_MGR", IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS, getActiveInterfaceEventHandler);
#endif
}

void DeviceIARMInterface::RegisterNtwMgrEventHandler()
{
#ifndef USE_DS_THUNDER_PLUGIN
std::shared_ptr<PlayerExternalsRdkInterface> pInstance = PlayerExternalsRdkInterface::GetPlayerExternalsRdkInterfaceInstance();

bool wifiStatus = false;
Expand All @@ -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 */
}
Comment on lines 320 to 344

char * DeviceIARMInterface::GetTR181Config(const char * paramName, size_t & iConfigLen)
Expand Down Expand Up @@ -407,7 +412,7 @@ static void getActiveInterfaceEventHandler (const char *owner, IARM_EventId_t ev

}

#ifndef USE_DS_EVENT_SUPPORTED
#if !defined(USE_DS_EVENT_SUPPORTED) && !defined(USE_DS_THUNDER_PLUGIN)
/**
* @brief IARM event handler for HDCP and HDMI hot plug events
*/
Expand Down
Loading
Loading