Skip to content
Merged
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
2 changes: 2 additions & 0 deletions HdcpProfile/HdcpProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ namespace WPEFramework
{
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
.withIShell(service)
.withRetryIntervalMS(200)
.withRetryCount(25)
.createInterface();
}

Expand Down
5 changes: 3 additions & 2 deletions HdmiCecSink/HdmiCecSink.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdmiCecSink/HdmiCecSink.cpp' (Match: rdkcentral/rdkservices/1, 3471 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)

Check failure on line 1 in HdmiCecSink/HdmiCecSink.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'HdmiCecSink/HdmiCecSink.cpp' (Match: rdkcentral/rdkservices/866, 3446 lines, url: https://github.com/rdkcentral/rdkservices/archive/AML_BSP_VERSION_866.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand All @@ -23,7 +23,6 @@
#include "ccec/CECFrame.hpp"
#include "ccec/MessageEncoder.hpp"
#include "host.hpp"
#include "ccec/host/RDK.hpp"
#include "UtilsgetRFCConfig.h"

#include "dsMgr.h"
Expand Down Expand Up @@ -901,6 +900,8 @@
{
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
.withIShell(service)
.withRetryIntervalMS(200)
.withRetryCount(25)
.createInterface();
registerEventHandlers();
}
Expand All @@ -910,7 +911,7 @@

if(!_registeredEventHandlers && _powerManagerPlugin) {
_registeredEventHandlers = true;
_powerManagerPlugin->Register(&_pwrMgrNotification);
_powerManagerPlugin->Register(_pwrMgrNotification.baseInterface<Exchange::IPowerManager::IModeChangedNotification>());
}
}

Expand Down
22 changes: 12 additions & 10 deletions HdmiCecSink/HdmiCecSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,33 +585,35 @@ namespace WPEFramework {
END_INTERFACE_MAP

private:
class PowerManagerNotification : public Exchange::IPowerManager::INotification {
class PowerManagerNotification : public Exchange::IPowerManager::IModeChangedNotification {
private:
PowerManagerNotification(const PowerManagerNotification&) = delete;
PowerManagerNotification& operator=(const PowerManagerNotification&) = delete;

public:
explicit PowerManagerNotification(HdmiCecSink& parent)
: _parent(parent)
{
}
~PowerManagerNotification() override = default;

public:
void OnPowerModeChanged(const PowerState &currentState, const PowerState &newState) override
{
_parent.onPowerModeChanged(currentState, newState);
}
void OnPowerModePreChange(const PowerState &currentState, const PowerState &newState) override {}
void OnDeepSleepTimeout(const int &wakeupTimeout) override {}
void OnNetworkStandbyModeChanged(const bool &enabled) override {}
void OnThermalModeChanged(const ThermalTemperature &currentThermalLevel, const ThermalTemperature &newThermalLevel, const float &currentTemperature) override {}
void OnRebootBegin(const string &rebootReasonCustom, const string &rebootReasonOther, const string &rebootRequestor) override {}

template <typename T>
T* baseInterface()
{
static_assert(std::is_base_of<T, PowerManagerNotification>(), "base type mismatch");
return static_cast<T*>(this);
}

BEGIN_INTERFACE_MAP(PowerManagerNotification)
INTERFACE_ENTRY(Exchange::IPowerManager::INotification)
INTERFACE_ENTRY(Exchange::IPowerManager::IModeChangedNotification)
END_INTERFACE_MAP

private:
HdmiCecSink& _parent;
};
Expand Down
4 changes: 3 additions & 1 deletion HdmiCecSource/HdmiCecSourceImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ namespace WPEFramework

if(!_registeredEventHandlers && _powerManagerPlugin) {
_registeredEventHandlers = true;
_powerManagerPlugin->Register(&_pwrMgrNotification);
_powerManagerPlugin->Register(_pwrMgrNotification.baseInterface<Exchange::IPowerManager::IModeChangedNotification>());
}


Expand Down Expand Up @@ -725,6 +725,8 @@ namespace WPEFramework
LOGINFO("Connect the COM-RPC socket\n");
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
.withIShell(service)
.withRetryIntervalMS(200)
.withRetryCount(25)
.createInterface();
registerEventHandlers();
}
Expand Down
18 changes: 10 additions & 8 deletions HdmiCecSource/HdmiCecSourceImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ namespace WPEFramework {


private:
class PowerManagerNotification : public Exchange::IPowerManager::INotification {
class PowerManagerNotification : public Exchange::IPowerManager::IModeChangedNotification {
private:
PowerManagerNotification(const PowerManagerNotification&) = delete;
PowerManagerNotification& operator=(const PowerManagerNotification&) = delete;
Expand All @@ -243,14 +243,16 @@ namespace WPEFramework {
{
_parent.onPowerModeChanged(currentState, newState);
}
void OnPowerModePreChange(const PowerState &currentState, const PowerState &newState) override {}
void OnDeepSleepTimeout(const int &wakeupTimeout) override {}
void OnNetworkStandbyModeChanged(const bool &enabled) override {}
void OnThermalModeChanged(const ThermalTemperature &currentThermalLevel, const ThermalTemperature &newThermalLevel, const float &currentTemperature) override {}
void OnRebootBegin(const string &rebootReasonCustom, const string &rebootReasonOther, const string &rebootRequestor) override {}


template <typename T>
T* baseInterface()
{
static_assert(std::is_base_of<T, PowerManagerNotification>(), "base type mismatch");
return static_cast<T*>(this);
}

BEGIN_INTERFACE_MAP(PowerManagerNotification)
INTERFACE_ENTRY(Exchange::IPowerManager::INotification)
INTERFACE_ENTRY(Exchange::IPowerManager::IModeChangedNotification)
END_INTERFACE_MAP

private:
Expand Down
3 changes: 1 addition & 2 deletions cmake/FindCEC.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# If not stated otherwise in this file or this component's license file the

Check failure on line 1 in cmake/FindCEC.cmake

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'cmake/FindCEC.cmake' (Match: rdkcentral/rdkservices/1, 49 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: cmake/FindCEC.cmake)
# following copyright and licenses apply:
#
# Copyright 2020 RDK Management
Expand Down Expand Up @@ -31,13 +31,12 @@

find_path(CEC_INCLUDE_DIRS NAMES ccec/Connection.hpp PATH_SUFFIXES ccec/include)
find_path(OSAL_INCLUDE_DIRS NAMES osal/Mutex.hpp PATH_SUFFIXES osal/include)
find_path(CEC_HOST_INCLUDE_DIRS NAMES ccec/host/RDK.hpp PATH_SUFFIXES host/include)

set(CEC_LIBRARIES "-Wl,--no-as-needed" ${CEC_LIBRARIES} ${CEC_HAL_LIBRARIES} ${OSAL_LIBRARIES} "-Wl,--as-needed")

set(CEC_LIBRARIES ${CEC_LIBRARIES} CACHE PATH "Path to CEC library")

set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS})
set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS})
set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to CEC include")

include(FindPackageHandleStandardArgs)
Expand Down
50 changes: 45 additions & 5 deletions helpers/PluginInterfaceBuilder.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,32 @@ namespace Plugin {
{
WPEFramework::PluginHost::IShell* controller = builder.controller();
const std::string& callsign = builder.callSign();
const int retry_count = builder.retryCount();
const uint32_t retry_interval = builder.retryInterval();
int count = 0;

if (!controller) {
LOGERR("Invalid controller");
return nullptr;
}

auto pluginInterface = controller->QueryInterfaceByCallsign<INTERFACE>(callsign.c_str());
do {
auto pluginInterface = controller->QueryInterfaceByCallsign<INTERFACE>(callsign.c_str());

if (pluginInterface) {
pluginInterface->AddRef();
}
if (pluginInterface) {
pluginInterface->AddRef();
LOGINFO("plugin interface succeed and retry count: %d",count);
return pluginInterface;
}
else
{
count++;
LOGERR("plugin interface failed and retry: %d",count);
usleep(retry_interval*1000);
}
}while(count < retry_count);

return pluginInterface;
return nullptr;
}

template <typename T, typename... Args>
Expand All @@ -127,13 +141,17 @@ namespace Plugin {
PluginHost::IShell* _service;
uint32_t _version;
uint32_t _timeout;
int _retry_count;
uint32_t _retry_interval;

public:
PluginInterfaceBuilder(const char* callsign)
: _callsign(callsign)
, _service(nullptr)
, _version(static_cast<uint32_t>(~0))
, _timeout(3000)
,_retry_count(0)
,_retry_interval(0)
{
}

Expand All @@ -158,6 +176,18 @@ namespace Plugin {
return *this;
}

inline PluginInterfaceBuilder& withRetryIntervalMS(int retryInterval)
{
_retry_interval = retryInterval;
return *this;
}

inline PluginInterfaceBuilder& withRetryCount(int retryCount)
{
_retry_count = retryCount;
return *this;
}

PluginInterfaceRef<INTERFACE> createInterface()
{
auto* interface = ::WPEFramework::Plugin::createInterface<INTERFACE>(*this);
Expand All @@ -170,6 +200,16 @@ namespace Plugin {
return std::move(PluginInterfaceRef<INTERFACE>(interface, _service));
}

const uint32_t retryInterval() const
{
return _retry_interval;
}

const int retryCount() const
{
return _retry_count;
}

const std::string& callSign() const
{
return _callsign;
Expand Down
2 changes: 2 additions & 0 deletions helpers/frontpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ namespace WPEFramework
{
_powerManagerPlugin = PowerManagerInterfaceBuilder(_T("org.rdk.PowerManager"))
.withIShell(service)
.withRetryIntervalMS(200)
.withRetryCount(25)
.createInterface();
}
if (!s_instance)
Expand Down
Loading