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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [1.0.8](https://github.com/rdkcentral/entservices-inputoutput/compare/1.0.7...1.0.8)

- RDK-57093: Update Plugin Clients to use update Power manager interface [`#39`](https://github.com/rdkcentral/entservices-inputoutput/pull/39)
- Merge tag '1.0.7' into develop [`ac5ef43`](https://github.com/rdkcentral/entservices-inputoutput/commit/ac5ef4349be7cb05477dfbe9785aa1a60d1293a1)

#### [1.0.7](https://github.com/rdkcentral/entservices-inputoutput/compare/1.0.6...1.0.7)

> 11 April 2025

- RDKEMW-3359:HdmiCecSink RDK-V to RDK-E sync changes [`#48`](https://github.com/rdkcentral/entservices-inputoutput/pull/48)
- Update run_peru.sh by removing secrets [`#47`](https://github.com/rdkcentral/entservices-inputoutput/pull/47)
- RDK-55408: RDKE Services L2 Test Suite Development [`#30`](https://github.com/rdkcentral/entservices-inputoutput/pull/30)
- RDKEMW-2208 and RDKEMW-2209 Enabling L1 and L2 tests for entservices-inputoutput repo [`#25`](https://github.com/rdkcentral/entservices-inputoutput/pull/25)
- 1.0.7 release change log updates [`65465ee`](https://github.com/rdkcentral/entservices-inputoutput/commit/65465ee6c7cc800f3639a616209560ba800a3173)
- Enabling workflow for L1 and L2 [`4049a2e`](https://github.com/rdkcentral/entservices-inputoutput/commit/4049a2eb188efede1c1547be50847d29ddcb9e03)
- Merge tag '1.0.6' into develop [`f46b084`](https://github.com/rdkcentral/entservices-inputoutput/commit/f46b084ed21e61d89e20868eacdea4ba8198266d)

#### [1.0.6](https://github.com/rdkcentral/entservices-inputoutput/compare/1.0.5...1.0.6)

> 27 March 2025

- Removed Cec host header [`#35`](https://github.com/rdkcentral/entservices-inputoutput/pull/35)
- 1.0.9 release change log updates [`8abd094`](https://github.com/rdkcentral/entservices-inputoutput/commit/8abd09439355af4041436e562c4590769b55bc0c)
- Merge tag '1.0.5' into develop [`3b26eeb`](https://github.com/rdkcentral/entservices-inputoutput/commit/3b26eebfdf0e992e369e5cd3cdc981748c9cdb69)

#### [1.0.5](https://github.com/rdkcentral/entservices-inputoutput/compare/1.0.4...1.0.5)
Expand Down
1 change: 0 additions & 1 deletion HdmiCecSink/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ All notable changes to this RDK Service will be documented in this file.
* **Security** in case of vulnerabilities.

* Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development.

178 changes: 132 additions & 46 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, 3557 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, 3532 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 Down Expand Up @@ -75,6 +75,7 @@
#define HDMICECSINK_NUMBER_TV_ADDR 2
#define HDMICECSINK_UPDATE_POWER_STATUS_INTERVA_MS (60 * 1000)
#define HDMISINK_ARC_START_STOP_MAX_WAIT_MS 4000
#define HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS 500


#define SAD_FMT_CODE_AC3 2
Expand Down Expand Up @@ -174,9 +175,7 @@

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 3
#define API_VERSION_NUMBER_PATCH 7

using PowerState = WPEFramework::Exchange::IPowerManager::PowerState;
#define API_VERSION_NUMBER_PATCH 10

namespace WPEFramework
{
Expand Down Expand Up @@ -710,7 +709,10 @@
m_currentActiveSource = -1;
m_isHdmiInConnected = false;
hdmiCecAudioDeviceConnected = false;
m_audioDevicePowerStatusRequested = false;
m_isAudioStatusInfoUpdated = false;
m_audioStatusReceived = false;
m_audioStatusTimerStarted = false;
m_audioDevicePowerStatusRequested = false;
m_pollNextState = POLL_THREAD_STATE_NONE;
m_pollThreadState = POLL_THREAD_STATE_NONE;
m_video_latency = DEFAULT_VIDEO_LATENCY;
Expand Down Expand Up @@ -745,22 +747,23 @@
Register(HDMICECSINK_METHOD_SET_LATENCY_INFO, &HdmiCecSink::setLatencyInfoWrapper, this);
logicalAddressDeviceType = "None";
logicalAddress = 0xFF;
// load persistence setting
loadSettings();

int err;
dsHdmiInGetNumberOfInputsParam_t hdmiInput;
InitializeIARM();
m_sendKeyEventThreadExit = false;
m_sendKeyEventThread = std::thread(threadSendKeyEvent);

m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED;
m_semSignaltoArcRoutingThread.acquire();
m_arcRoutingThread = std::thread(threadArcRouting);


m_audioStatusDetectionTimer.connect( std::bind( &HdmiCecSink::audioStatusTimerFunction, this ) );
m_audioStatusDetectionTimer.setSingleShot(true);
m_arcStartStopTimer.connect( std::bind( &HdmiCecSink::arcStartStopTimerFunction, this ) );
m_arcStartStopTimer.setSingleShot(true);
// load persistence setting
loadSettings();

int err;
dsHdmiInGetNumberOfInputsParam_t hdmiInput;
InitializeIARM();
// get power state:
uint32_t res = Core::ERROR_GENERAL;
PowerState pwrStateCur = WPEFramework::Exchange::IPowerManager::POWER_STATE_UNKNOWN;
Expand Down Expand Up @@ -812,7 +815,7 @@
}
}
getCecVersion();
getHdmiArcPortID();
LOGINFO(" HdmiCecSink plugin Initialize completed \n");
return (std::string());

}
Expand Down Expand Up @@ -930,7 +933,7 @@
}
}

void HdmiCecSink::onPowerModeChanged(const PowerState &currentState, const PowerState &newState)
void HdmiCecSink::onPowerModeChanged(const PowerState currentState, const PowerState newState)
{
if(!HdmiCecSink::_instance)
return;
Expand Down Expand Up @@ -1147,6 +1150,18 @@
JsonObject params;
if(!HdmiCecSink::_instance)
return;
if (m_audioStatusTimerStarted)
{
m_audioStatusReceived = true;
m_isAudioStatusInfoUpdated = true;
m_audioStatusTimerStarted = false;
if (m_audioStatusDetectionTimer.isActive())
{
LOGINFO("AudioStatus received from the Audio Device and the timer is still active. So stopping the timer!\n");
m_audioStatusDetectionTimer.stop();
}
LOGINFO("AudioStatus received from the Audio Device. Updating the AudioStatus info! m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted);
}
LOGINFO("Command: ReportAudioStatus %s audio Mute status %d means %s and current Volume level is %d \n",GetOpName(msg.opCode()),msg.status.getAudioMuteStatus(),msg.status.toString().c_str(),msg.status.getAudioVolume());
params["muteStatus"] = msg.status.getAudioMuteStatus();
params["volumeLevel"] = msg.status.getAudioVolume();
Expand Down Expand Up @@ -2477,7 +2492,14 @@
params["status"] = string("success");
params["audioDeviceConnected"] = string("false");
hdmiCecAudioDeviceConnected = false;
sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params);
if (m_audioStatusDetectionTimer.isActive()){
m_audioStatusDetectionTimer.stop();
}
m_isAudioStatusInfoUpdated = false;
m_audioStatusReceived = false;
m_audioStatusTimerStarted = false;
LOGINFO("Audio device removed, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted);
sendNotify(eventString[HDMICECSINK_EVENT_AUDIO_DEVICE_CONNECTED_STATUS], params)
}

_instance->deviceList[logicalAddress].m_isRequestRetry = 0;
Expand Down Expand Up @@ -2720,29 +2742,44 @@
_instance->allocateLogicalAddress(DeviceType::TV);
if ( _instance->m_logicalAddressAllocated != LogicalAddress::UNREGISTERED)
{
logicalAddress = LogicalAddress(_instance->m_logicalAddressAllocated);
LibCCEC::getInstance().addLogicalAddress(logicalAddress);
_instance->smConnection->setSource(logicalAddress);
_instance->m_numberOfDevices = 0;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType = DeviceType::TV;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_isDevicePresent = true;
_instance->deviceList[_instance->m_logicalAddressAllocated].update(physical_addr);
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_1_4;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_vendorID = appVendorId;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_powerStatus = PowerStatus(powerState);
_instance->deviceList[_instance->m_logicalAddressAllocated].m_currentLanguage = defaultLanguage;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_osdName = osdName.toString().c_str();
if(cecVersion == 2.0) {
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_2_0;
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST),
MessageEncoder().encode(ReportFeatures(Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500);
}
_instance->smConnection->addFrameListener(_instance->msgFrameListener);
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST),
MessageEncoder().encode(ReportPhysicalAddress(physical_addr, _instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType)), 100);

_instance->m_sleepTime = 0;
_instance->m_pollThreadState = POLL_THREAD_STATE_PING;
try{

logicalAddress = LogicalAddress(_instance->m_logicalAddressAllocated);
LibCCEC::getInstance().addLogicalAddress(logicalAddress);
_instance->smConnection->setSource(logicalAddress);
_instance->m_numberOfDevices = 0;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType = DeviceType::TV;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_isDevicePresent = true;
_instance->deviceList[_instance->m_logicalAddressAllocated].update(physical_addr);
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_1_4;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_vendorID = appVendorId;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_powerStatus = PowerStatus(powerState);
_instance->deviceList[_instance->m_logicalAddressAllocated].m_currentLanguage = defaultLanguage;
_instance->deviceList[_instance->m_logicalAddressAllocated].m_osdName = osdName.toString().c_str();
if(cecVersion == 2.0) {
_instance->deviceList[_instance->m_logicalAddressAllocated].m_cecVersion = Version::V_2_0;
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST),
MessageEncoder().encode(ReportFeatures(Version::V_2_0,allDevicetype,rcProfile,deviceFeatures)), 500);
}
_instance->smConnection->addFrameListener(_instance->msgFrameListener);
_instance->smConnection->sendTo(LogicalAddress(LogicalAddress::BROADCAST),
MessageEncoder().encode(ReportPhysicalAddress(physical_addr, _instance->deviceList[_instance->m_logicalAddressAllocated].m_deviceType)), 100);

_instance->m_sleepTime = 0;
_instance->m_pollThreadState = POLL_THREAD_STATE_PING;
}
catch(InvalidStateException &e){
LOGWARN("InvalidStateException caught while allocated logical address. %s", e.what());
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
}
catch(IOException &e){
LOGWARN("IOException caught while allocated logical address. %s", e.what());
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
}
catch(...){
LOGWARN("Exception caught while allocated logical address.");
_instance->m_pollThreadState = POLL_THREAD_STATE_EXIT;
}
}
else
{
Expand Down Expand Up @@ -2978,9 +3015,14 @@
{
LibCCEC::getInstance().init("HdmiCecSink");
}
catch (const std::exception& e)
{
LOGWARN("CEC exception caught from LibCCEC::getInstance().init()");
catch(InvalidStateException &e){
LOGWARN("InvalidStateException caught in LibCCEC::init %s", e.what());
}
catch(IOException &e){
LOGWARN("IOException caught in LibCCEC::init %s", e.what());
}
catch(...){
LOGWARN("Exception caught in LibCCEC::init");
}
}
libcecInitStatus++;
Expand Down Expand Up @@ -3074,6 +3116,14 @@

m_logicalAddressAllocated = LogicalAddress::UNREGISTERED;
m_currentArcRoutingState = ARC_STATE_ARC_TERMINATED;
if (m_audioStatusDetectionTimer.isActive()){
m_audioStatusDetectionTimer.stop();
}
m_isAudioStatusInfoUpdated = false;
m_audioStatusReceived = false;
m_audioStatusTimerStarted = false;
LOGINFO("CEC Disabled, reset the audio status info. m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted);


for(int i=0; i< 16; i++)
{
Expand All @@ -3089,9 +3139,14 @@
{
LibCCEC::getInstance().term();
}
catch (const std::exception& e)
{
LOGWARN("CEC exception caught from LibCCEC::getInstance().term() ");
catch(InvalidStateException &e){
LOGWARN("InvalidStateException caught in LibCCEC::term %s", e.what());
}
catch(IOException &e){
LOGWARN("IOException caught in LibCCEC::term %s", e.what());
}
catch(...){
LOGWARN("Exception caught in LibCCEC::term");
}
}

Expand Down Expand Up @@ -3324,12 +3379,43 @@

if((_instance->m_SendKeyQueue.size()<=1 || (_instance->m_SendKeyQueue.size() % 2 == 0)) && ((keyInfo.keyCode == VOLUME_UP) || (keyInfo.keyCode == VOLUME_DOWN) || (keyInfo.keyCode == MUTE)) )
{
_instance->sendGiveAudioStatusMsg();
}
if(keyInfo.keyCode == MUTE)
{
_instance->sendGiveAudioStatusMsg();
}
else
{
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ",_instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted);
if (!_instance->m_isAudioStatusInfoUpdated)
{
if ( !(_instance->m_audioStatusDetectionTimer.isActive()))
{
LOGINFO("Audio status info not updated. Starting the Timer!");
_instance->m_audioStatusTimerStarted = true;
_instance->m_audioStatusDetectionTimer.start((HDMICECSINK_UPDATE_AUDIO_STATUS_INTERVAL_MS));
}
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", _instance->m_isAudioStatusInfoUpdated,_instance->m_audioStatusReceived,_instance->m_audioStatusTimerStarted);
}
else
{
if (!_instance->m_audioStatusReceived){
_instance->sendGiveAudioStatusMsg();
}
}
}
}

}//while(!_instance->m_sendKeyEventThreadExit)
}//threadSendKeyEvent

void HdmiCecSink::audioStatusTimerFunction()
{
m_audioStatusTimerStarted = false;
m_isAudioStatusInfoUpdated = true;
LOGINFO("Timer Expired. Requesting the AudioStatus since not received.\n");
sendGiveAudioStatusMsg();
LOGINFO("m_isAudioStatusInfoUpdated :%d, m_audioStatusReceived :%d, m_audioStatusTimerStarted:%d ", m_isAudioStatusInfoUpdated,m_audioStatusReceived,m_audioStatusTimerStarted);
}

void HdmiCecSink::threadArcRouting()
{
Expand All @@ -3340,7 +3426,7 @@
return;

LOGINFO("Running threadArcRouting");

_instance->getHdmiArcPortID();

while(1)
{
Expand Down
12 changes: 9 additions & 3 deletions HdmiCecSink/HdmiCecSink.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in HdmiCecSink/HdmiCecSink.h

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.h' (Match: rdkcentral/rdkservices/1, 745 lines, url: https://github.com/rdkcentral/rdkservices/archive/GRT_v1.tar.gz, file: HdmiCecSink/HdmiCecSink.h)
* If not stated otherwise in this file or this component's LICENSE
* file the following copyright and licenses apply:
*
Expand Down Expand Up @@ -574,8 +574,10 @@
void sendUserControlPressed(const int logicalAddress, int keyCode);
void sendUserControlReleased(const int logicalAddress);
void sendGiveAudioStatusMsg();
void onPowerModeChanged(const PowerState &currentState, const PowerState &newState);
void onPowerModeChanged(const PowerState currentState, const PowerState newState);
void registerEventHandlers();
void sendGiveAudioStatusMsg();
void getHdmiArcPortID();
int m_numberOfDevices; /* Number of connected devices othethan own device */
bool m_audioDevicePowerStatusRequested;

Expand All @@ -598,7 +600,7 @@
~PowerManagerNotification() override = default;

public:
void OnPowerModeChanged(const PowerState &currentState, const PowerState &newState) override
void OnPowerModeChanged(const PowerState currentState, const PowerState newState) override
{
_parent.onPowerModeChanged(currentState, newState);
}
Expand Down Expand Up @@ -669,6 +671,9 @@
/* Send Key event related */
bool m_sendKeyEventThreadExit;
bool m_sendKeyEventThreadRun;
bool m_isAudioStatusInfoUpdated;
bool m_audioStatusReceived;
bool m_audioStatusTimerStarted;
std::thread m_sendKeyEventThread;
std::mutex m_sendKeyEventMutex;
std::queue<SendKeyInfo> m_SendKeyQueue;
Expand All @@ -687,6 +692,7 @@
binary_semaphore m_semSignaltoArcRoutingThread;
bool m_arcstarting;
TpTimer m_arcStartStopTimer;
TpTimer m_audioStatusDetectionTimer;

Connection *smConnection;
std::vector<uint8_t> m_connectedDevices;
Expand Down Expand Up @@ -733,7 +739,7 @@
void Send_Request_Arc_Termination_Message();
void Send_Report_Arc_Terminated_Message();
void arcStartStopTimerFunction();
void getHdmiArcPortID();
void audioStatusTimerFunction();
void getCecVersion();
};
} // namespace Plugin
Expand Down
2 changes: 1 addition & 1 deletion HdmiCecSource/HdmiCecSourceImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ namespace WPEFramework
}
}

void HdmiCecSourceImplementation::onPowerModeChanged(const PowerState &currentState, const PowerState &newState)
void HdmiCecSourceImplementation::onPowerModeChanged(const PowerState currentState, const PowerState newState)
{
if(!HdmiCecSourceImplementation::_instance)
return;
Expand Down
Loading
Loading