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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ 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.10.3](https://github.com/rdkcentral/entservices-inputoutput/compare/1.10.2...1.10.3)

- RDKEMW-11398: Implement HdmiCecSink & UserSettings communication. [`#342`](https://github.com/rdkcentral/entservices-inputoutput/pull/342)
- Merge tag '1.10.2' into develop [`e22d4a8`](https://github.com/rdkcentral/entservices-inputoutput/commit/e22d4a8db483fc7f6dbfeb67a43e207830ff7905)

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

> 13 January 2026

- RDKEMW-12459: ARC - SAD is not updating as expected. [`#358`](https://github.com/rdkcentral/entservices-inputoutput/pull/358)
- 1.10.2 release changelog updates [`67dca55`](https://github.com/rdkcentral/entservices-inputoutput/commit/67dca55a00bd3e9bc6f5b4be23723cc916166b3b)
- Merge tag '1.10.1' into develop [`168ed58`](https://github.com/rdkcentral/entservices-inputoutput/commit/168ed5828d53b3a411026b65cc53b866575ca31a)

#### [1.10.1](https://github.com/rdkcentral/entservices-inputoutput/compare/1.10.0...1.10.1)
Expand Down
88 changes: 85 additions & 3 deletions HdmiCecSink/HdmiCecSinkImplementation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in HdmiCecSink/HdmiCecSinkImplementation.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/HdmiCecSinkImplementation.cpp' (Match: rdkcentral/rdkservices/2101, 3164 lines, url: https://github.com/rdkcentral/rdkservices/archive/refs/tags/sprint_2101.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)

Check failure on line 1 in HdmiCecSink/HdmiCecSinkImplementation.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/HdmiCecSinkImplementation.cpp' (Match: rdkcentral/rdkservices/1, 3511 lines, url: https://github.com/rdkcentral/rdkservices/archive/refs/tags/GRT_v1.tar.gz, file: HdmiCecSink/HdmiCecSink.cpp)

Check failure on line 1 in HdmiCecSink/HdmiCecSinkImplementation.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/HdmiCecSinkImplementation.cpp' (Match: rdkcentral/rdkservices/6.1.7, 3511 lines, url: https://github.com/rdkcentral/rdkservices/archive/refs/tags/AML_BSP_REL_VERSION_RDK6.1.7.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 @@ -92,7 +92,6 @@
static VendorID lgVendorId = {0x00,0xE0,0x91};
static PhysicalAddress physical_addr = {0x0F,0x0F,0x0F,0x0F};
static LogicalAddress logicalAddress = 0xF;
static Language defaultLanguage = "eng";
static OSDName osdName = "TV Box";
static int32_t powerState = DEVICE_POWER_STATE_OFF;
static std::vector<uint8_t> formatid = {0,0};
Expand Down Expand Up @@ -606,6 +605,8 @@
, m_connectedDevices()
, msgProcessor(nullptr)
, msgFrameListener(nullptr)
, _userSettingsPlugin(nullptr)
, _userSettingsNotification(*this)
, _powerManagerPlugin()
, _pwrMgrNotification(*this)
, _registeredEventHandlers(false)
Expand All @@ -621,6 +622,13 @@
_powerManagerPlugin.Reset();
}
_registeredEventHandlers = false;

if(_userSettingsPlugin)
{
_userSettingsPlugin->Unregister(&_userSettingsNotification);
_userSettingsPlugin->Release();
_userSettingsPlugin = nullptr;
}

CECDisable();
m_currentArcRoutingState = ARC_STATE_ARC_EXIT;
Expand Down Expand Up @@ -779,6 +787,29 @@
}
}
getCecVersion();

_userSettingsPlugin = service->QueryInterfaceByCallsign<Exchange::IUserSettings>("org.rdk.UserSettings");
if (nullptr == _userSettingsPlugin) {
LOGERR("Failed to get UserSettings interface");
}
else
{
_userSettingsPlugin->Register(&_userSettingsNotification);
LOGINFO("Successfully registered for UserSettings notifications");

string presentationLanguage, isoLang;
uint32_t status = _userSettingsPlugin->GetPresentationLanguage(presentationLanguage);
if (status == Core::ERROR_NONE) {
isoLang = mapToIso639_2(presentationLanguage);
LOGINFO("Successfully retrieved the Presentation language from the userSettings plugin - BCP47: %s, ISO 639-2: %s", presentationLanguage.c_str(), isoLang.c_str());
setCurrentLanguage(Language(isoLang.data()));
sendMenuLanguage();
}
else {
LOGERR("Failed to get presentation language: %u", status);
}
}

LOGINFO(" HdmiCecSinkImplementation plugin Initialize completed \n");
return Core::ERROR_NONE;

Expand Down Expand Up @@ -853,6 +884,17 @@
HdmiCecSinkImplementation::_instance->onHdmiHotPlug((int) port, isConnected);
}

void HdmiCecSinkImplementation::onPresentationLanguageChanged(const string& presentationLanguage)
{
if(!HdmiCecSinkImplementation::_instance)
return;

string isoLang = mapToIso639_2(presentationLanguage);
LOGINFO("OnPresentationLanguageChanged - language BCP47: %s, ISO 639-2: %s", presentationLanguage.c_str(), isoLang.c_str());
setCurrentLanguage(Language(isoLang.data()));
sendMenuLanguage();
}

void HdmiCecSinkImplementation::onPowerModeChanged(const PowerState &currentState, const PowerState &newState)
{
if(!HdmiCecSinkImplementation::_instance)
Expand Down Expand Up @@ -1484,6 +1526,7 @@
lang = language;

setCurrentLanguage(Language(lang.data()));
sendMenuLanguage();
successResult.success = true;

return Core::ERROR_NONE;
Expand Down Expand Up @@ -1722,6 +1765,46 @@
return cecSettingEnabled;
}

std::string HdmiCecSinkImplementation::mapToIso639_2(const string& lang_BCP47)
{
if (lang_BCP47.empty())
return "eng";

std::string lang = lang_BCP47.substr(0, lang_BCP47.find('-'));
std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);

if (lang.length() == 3)
return lang;

static const std::unordered_map<std::string, std::string> iso639_1_to_2 = {
{"en", "eng"},
{"fr", "fra"},
{"de", "deu"},
{"es", "spa"},
{"it", "ita"},
{"pt", "por"},
{"ru", "rus"},
{"zh", "zho"},
{"ja", "jpn"},
{"ko", "kor"},
{"ar", "ara"},
{"hi", "hin"},
{"nl", "nld"},
{"sv", "swe"},
{"fi", "fin"},
{"no", "nor"},
{"da", "dan"},
{"pl", "pol"},
{"tr", "tur"}
};

auto it = iso639_1_to_2.find(lang);
if (it != iso639_1_to_2.end())
return it->second;

return "eng";
}

void HdmiCecSinkImplementation::setEnabled(bool enabled)
{
LOGINFO("Entered setEnabled: %d cecSettingEnabled :%d ",enabled, cecSettingEnabled);
Expand Down Expand Up @@ -2637,7 +2720,6 @@
_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;
Expand Down Expand Up @@ -3497,4 +3579,4 @@
}

} // namespace Plugin
} // namespace WPEFramework
} // namespace WPEFramework
32 changes: 32 additions & 0 deletions HdmiCecSink/HdmiCecSinkImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include "UtilsLogging.h"
#include <interfaces/IPowerManager.h>
#include <interfaces/IUserSettings.h>
#include "PowerManagerInterface.h"
#include <interfaces/IHdmiCecSink.h>
#include "host.hpp"
Expand Down Expand Up @@ -527,6 +528,7 @@ namespace WPEFramework {
static HdmiCecSinkImplementation* _instance;
CECDeviceParams deviceList[16];
std::vector<HdmiPortMap> hdmiInputs;
std::string mapToIso639_2(const string& lang_BCP47);
int m_currentActiveSource;
void updateInActiveSource(const int logical_address, const InActiveSource &source );
void updateActiveSource(const int logical_address, const ActiveSource &source );
Expand Down Expand Up @@ -570,6 +572,7 @@ namespace WPEFramework {
void sendGiveAudioStatusMsg();
void onPowerModeChanged(const PowerState &currentState, const PowerState &newState);
void registerEventHandlers();
void onPresentationLanguageChanged(const string& language);
void getHdmiArcPortID();
int m_numberOfDevices; /* Number of connected devices othethan own device */
bool m_audioDevicePowerStatusRequested;
Expand Down Expand Up @@ -612,6 +615,33 @@ namespace WPEFramework {
HdmiCecSinkImplementation& _parent;

};

class UserSettingsNotification : public Exchange::IUserSettings::INotification {
private:
UserSettingsNotification(const UserSettingsNotification&) = delete;
UserSettingsNotification& operator=(const UserSettingsNotification&) = delete;

public:
explicit UserSettingsNotification(HdmiCecSinkImplementation& parent)
: _parent(parent)
{
}
~UserSettingsNotification() override = default;

public:
void OnPresentationLanguageChanged(const string& language) override
{
_parent.onPresentationLanguageChanged(language);
}

BEGIN_INTERFACE_MAP(UserSettingsNotification)
INTERFACE_ENTRY(Exchange::IUserSettings::INotification)
END_INTERFACE_MAP

private:
HdmiCecSinkImplementation& _parent;
};

// We do not allow this plugin to be copied !!
HdmiCecSinkImplementation(const HdmiCecSinkImplementation&) = delete;
HdmiCecSinkImplementation& operator=(const HdmiCecSinkImplementation&) = delete;
Expand Down Expand Up @@ -664,6 +694,8 @@ namespace WPEFramework {
std::vector<uint8_t> m_connectedDevices;
HdmiCecSinkProcessor *msgProcessor;
HdmiCecSinkFrameListener *msgFrameListener;
Exchange::IUserSettings *_userSettingsPlugin;
Core::Sink<UserSettingsNotification> _userSettingsNotification;
PowerManagerInterfaceRef _powerManagerPlugin;
Core::Sink<PowerManagerNotification> _pwrMgrNotification;
bool _registeredEventHandlers;
Expand Down
Loading