Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9c39fc1
dsmgr removal
preeja33 Jul 1, 2026
ab694e4
Update ctrlm_utils.cpp
balav08 Jul 2, 2026
a163e6e
Update CMakeLists.txt to include thunder plugins
balav08 Jul 2, 2026
56db84f
Update ctrlmf_thunder_plugin.h
balav08 Jul 2, 2026
fac7942
Update ctrlmf_thunder_plugin.cpp
balav08 Jul 2, 2026
f6a8ec7
Update ctrlm_voice_obj.cpp
balav08 Jul 2, 2026
f4764d2
Update ctrlm_voice_obj.cpp
balav08 Jul 2, 2026
5e022b4
Update CMakeLists.txt with macro
balav08 Jul 3, 2026
d976f1d
Update ctrlm_utils.cpp
balav08 Jul 3, 2026
c597cc5
Update ctrlmf_audio_control.cpp
balav08 Jul 3, 2026
18e32e2
Update CMakeLists.txt
balav08 Jul 3, 2026
1d4e4c6
Update ctrlmf_audio_control.cpp
balav08 Jul 3, 2026
9ca67fb
Update CMakeLists.txt
balav08 Jul 3, 2026
7efaff4
Update CMakeLists.txt
balav08 Jul 3, 2026
9a6dc37
Update CMakeLists.txt
balav08 Jul 3, 2026
5f96e85
Update CMakeLists.txt
balav08 Jul 3, 2026
f243495
Update ctrlm_thunder_plugin_display_settings.cpp
balav08 Jul 6, 2026
a5cd360
Update ctrlm_thunder_plugin_display_settings.h
balav08 Jul 6, 2026
2a831a6
Update ctrlm_utils.cpp
balav08 Jul 6, 2026
80118a5
Update ctrlmf_audio_control.cpp
balav08 Jul 6, 2026
2d284d5
Update ctrlm_utils.cpp
balav08 Jul 6, 2026
f5d9461
Update ctrlmf_audio_control.cpp
balav08 Jul 6, 2026
bbff62d
Update CMakeLists.txt
balav08 Jul 6, 2026
270edef
Update CMakeLists.txt
balav08 Jul 6, 2026
593bac6
Update call_plugin on ctrlmf_thunder_plugin.h
balav08 Jul 10, 2026
d282cf9
Update ctrlmf_thunder_plugin.cpp
balav08 Jul 10, 2026
569d862
Update ctrlmf_audio_control.cpp
balav08 Jul 10, 2026
53d8d02
Update ctrlm_utils.cpp
balav08 Jul 10, 2026
610ae7b
Update ctrlm_voice_obj.cpp
balav08 Jul 10, 2026
0ff2be6
Update ctrlm_utils.cpp
balav08 Jul 15, 2026
3a54295
Update ctrlm_thunder_plugin_display_settings.cpp
balav08 Jul 15, 2026
9bc6f4e
Update ctrlmf_audio_control.cpp
balav08 Jul 15, 2026
99ed737
Update ctrlmf_thunder_plugin_display_settings.cpp
balav08 Jul 15, 2026
68611ea
Update ctrlm_utils.cpp
balav08 Jul 16, 2026
44d965d
Delete src/thunder/plugins/ctrlm_thunder_plugin_front_panel.cpp
balav08 Jul 16, 2026
5b2a807
Delete src/thunder/plugins/ctrlm_thunder_plugin_front_panel.h
balav08 Jul 16, 2026
90fe8f5
Update CMakeLists.txt
balav08 Jul 16, 2026
1eab598
Update CMakeLists.txt
balav08 Jul 16, 2026
6b3a6ff
Update CMakeLists.txt
balav08 Jul 16, 2026
ffa57b6
Update ctrlmf_audio_control.cpp
balav08 Jul 16, 2026
fc18d45
Update ctrlm_utils.h
balav08 Jul 16, 2026
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
134 changes: 54 additions & 80 deletions src/ctrlm_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,18 @@
#include "ctrlm_utils.h"
#include <xr_mq.h>
#include <map>
#include <tuple>
#include <string>
#include <linux/input.h>
#include <uuid/uuid.h>

// dsMgr includes
#include "host.hpp"
#include "exception.hpp"
#include "videoOutputPort.hpp"
#include "videoOutputPortType.hpp"
#include "videoOutputPortConfig.hpp"
#include "audioOutputPort.hpp"
#include "frontPanelIndicator.hpp"
#include "manager.hpp"
#include "dsMgr.h"
#include "dsRpc.h"
#include "dsDisplay.h"
#include "thunder/plugins/ctrlm_thunder_plugin_display_settings.h"
#include <regex>
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
// end dsMgr includes

using std::map;
using std::tuple;
using std::get;
using std::string;

#define BLOCK_SIZE (1024 * 4 * 10) /* bytes */
#define MAX_RECURSE_DEPTH 20
Expand Down Expand Up @@ -1574,89 +1569,68 @@ char *ctrlm_do_regex(char *re, char *str) {
}

bool ctrlm_dsmgr_init() {
if(device::Manager::IsInitialized) {
XLOGD_INFO("DSMgr already initialized");
return true;
}
try {
device::Manager::Initialize();
XLOGD_INFO("DSMgr is initialized");
}
catch (...) {
XLOGD_WARN("Failed to initialize DSMgr");
return false;
}
return true;
}

bool ctrlm_dsmgr_deinit() {
try {
if(device::Manager::IsInitialized) {
device::Manager::DeInitialize();
}
}
catch(...) {
XLOGD_WARN("Failed to deinitialize DSMgr");
return false;
}
return true;
}

bool ctrlm_dsmgr_mute_audio(bool mute) {
try {
dsAudioDuckingAction_t action = mute ? dsAUDIO_DUCKINGACTION_START : dsAUDIO_DUCKINGACTION_STOP;
device::Host::getInstance().getAudioOutputPort("SPEAKER0").setAudioDucking(action, dsAUDIO_DUCKINGTYPE_ABSOLUTE, mute ? 0 : 100);
XLOGD_INFO("Audio is %smuted", mute?"":"un-");
}
catch(std::exception& error) {
XLOGD_WARN("Muting sound error : %s", error.what());
return false;
}
return true;
auto *ds = Thunder::DisplaySettings::ctrlm_thunder_plugin_display_settings_t::getInstance();
if(!ds) {
XLOGD_ERROR("DisplaySettings plugin not available");
return false;
Comment thread
balav08 marked this conversation as resolved.
}
bool action = mute; // true = start ducking (mute), false = stop ducking (unmute)
bool type = false; // false = absolute ducking
bool ret = ds->set_audio_ducking(action, type, mute ? 0 : 100);
Comment thread
balav08 marked this conversation as resolved.
if(ret) {
XLOGD_INFO("Audio is %smuted", mute?"":"un-");
} else {
XLOGD_WARN("Muting sound error");
}
return ret;
}

bool ctrlm_dsmgr_duck_audio(bool enable, bool relative, double vol) {

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.

I'm pretty sure this function will not compile when thunder is disabled. The build must complete successfully when thunder is disabled.

if(vol < 0 || vol > 1) {
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Function called: enable=%d, relative=%d, vol=%f", enable, relative, vol);

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.

Please remove all the extra log lines that were added in this function. They look like unnecessary debug logs that don't belong in the final implementation.

if(vol < 0 || vol > 1) {
XLOGD_ERROR("[CTRLM_DUCK_AUDIO] Invalid volume %f (must be 0.0-1.0)", vol);

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.

Remove this line. This doesn't add any value.

XLOGD_ERROR("Invalid volume");
return false;
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
}
try {
unsigned char level = (unsigned char)((vol * 100) + 0.5);

dsAudioDuckingAction_t action = enable ? dsAUDIO_DUCKINGACTION_START : dsAUDIO_DUCKINGACTION_STOP;
dsAudioDuckingType_t type = relative ? dsAUDIO_DUCKINGTYPE_RELATIVE : dsAUDIO_DUCKINGTYPE_ABSOLUTE;
}

device::Host::getInstance().getAudioOutputPort("SPEAKER0").setAudioDucking(action, type, level);
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Using thunder displaysetting path");
unsigned char level = (unsigned char)((vol * 100) + 0.5);
Comment thread
balav08 marked this conversation as resolved.
bool action = enable; // true = start ducking, false = stop ducking
bool type = relative; // true = relative, false = absolute
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Calculated: action=%d, type=%d, level=%u", action, type, level);
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.

if(enable) {
XLOGD_INFO("Audio ducking enabled - type <%s> level <%u%%>", relative ? "RELATIVE" : "ABSOLUTE", level);
} else {
XLOGD_INFO("Audio ducking disabled");
}
}
catch(std::exception& error) {
XLOGD_WARN("Ducking sound error : %s", error.what());
return false;
}
return true;
}

bool ctrlm_dsmgr_LED(bool on) {
try {
device::FrontPanelIndicator &led = device::FrontPanelIndicator::getInstance("Power");
if (on) {
led.setColor(0xFFFFFF);
led.setBrightness(100);
}
led.setState(on);
}
catch(std::exception& error) {
XLOGD_WARN("LED error : %s", error.what());
return false;
}
return true;
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Getting DisplaySettings instance...");
auto *ds = Thunder::DisplaySettings::ctrlm_thunder_plugin_display_settings_t::getInstance();
if(!ds) {
XLOGD_ERROR("[CTRLM_DUCK_AUDIO] DisplaySettings plugin not available");
XLOGD_ERROR("DisplaySettings plugin not available");
Comment thread
balav08 marked this conversation as resolved.
return false;
}
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
XLOGD_INFO("[CTRLM_DUCK_AUDIO] DisplaySettings instance obtained successfully");
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Calling set_audio_ducking...");
bool ret = ds->set_audio_ducking(action, type, level);
XLOGD_INFO("[CTRLM_DUCK_AUDIO] set_audio_ducking returned: %d", ret);
if(ret) {
if(enable) {
XLOGD_INFO("Audio ducking enabled - type <%s> level <%u%%>", relative ? "RELATIVE" : "ABSOLUTE", level);
Comment thread
balav08 marked this conversation as resolved.
} else {
XLOGD_INFO("Audio ducking disabled");
}
} else {
XLOGD_WARN("Muting sound error");
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
}
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
XLOGD_INFO("[CTRLM_DUCK_AUDIO] Returning: %d", ret);
return ret;
}

bool ctrlm_is_voice_assistant(ctrlm_rcu_controller_type_t controller_type) {
switch(controller_type) {
case CTRLM_RCU_CONTROLLER_TYPE_XR19:
Expand Down
1 change: 0 additions & 1 deletion src/ctrlm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ char *ctrlm_do_regex(char *re, char *str);
bool ctrlm_dsmgr_init();
bool ctrlm_dsmgr_mute_audio(bool mute);
bool ctrlm_dsmgr_duck_audio(bool enable, bool relative, double vol);
bool ctrlm_dsmgr_LED(bool on);
bool ctrlm_dsmgr_deinit();

bool ctrlm_is_voice_assistant(ctrlm_rcu_controller_type_t controller_type);
Expand Down
11 changes: 6 additions & 5 deletions src/factory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ target_sources(ctrlm-fta PRIVATE
iarm/ctrlmf_iarm_control_manager.cpp
)

target_link_libraries(ctrlm-fta c rdkversion dbus-1 glib-2.0 IARMBus xr-voice-sdk pthread nopoll secure_wrapper ds)
target_link_libraries(ctrlm-fta c rdkversion dbus-1 glib-2.0 IARMBus xr-voice-sdk pthread nopoll secure_wrapper)
Comment thread
balav08 marked this conversation as resolved.
target_link_libraries(controlFactory c ctrlm-fta secure_wrapper)
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.

if(AUTH_ENABLED)
Expand All @@ -61,19 +61,20 @@ if(THUNDER)
thunder/ctrlmf_thunder_controller.cpp
thunder/ctrlmf_thunder_plugin.cpp
thunder/ctrlmf_thunder_plugin_system_audio_player.cpp
thunder/ctrlmf_thunder_plugin_display_settings.cpp
)

target_link_libraries(controlFactory WPEFrameworkCore WPEFrameworkPlugins)
target_link_libraries(ctrlm-fta WPEFrameworkCore WPEFrameworkPlugins)

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.

This should be an either or. If ctrlm-fta requires WPEFramework, then it doesn't need to be linked for controlFactory.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed linking of controlFactory.

if(WPE_FRAMEWORK_COM_SOCKET)
target_link_libraries(controlFactory WPEFrameworkCOM WPEFrameworkWebSocket)
target_link_libraries(ctrlm-fta WPEFrameworkCOM WPEFrameworkWebSocket)
endif()
if(WPE_FRAMEWORK_PROTO_TRACING)
target_link_libraries(controlFactory WPEFrameworkProtocols WPEFrameworkTracing)
target_link_libraries(ctrlm-fta WPEFrameworkProtocols WPEFrameworkTracing)
endif()

if(THUNDER_SECURITY)
add_compile_definitions(PRIVATE THUNDER_SECURITY)
target_link_libraries(controlFactory WPEFrameworkSecurityUtil secure_wrapper)
target_link_libraries(ctrlm-fta WPEFrameworkSecurityUtil secure_wrapper)
endif()
endif()

Expand Down
106 changes: 49 additions & 57 deletions src/factory/ctrlmf_audio_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,86 @@
#include <rdkx_logger.h>
#include <ctrlm_fta_lib.h>
#include <ctrlmf_utils.h>
// dsMgr includes
#include "host.hpp"
#include "exception.hpp"
#include "videoOutputPort.hpp"
#include "videoOutputPortType.hpp"
#include "videoOutputPortConfig.hpp"
#include "audioOutputPort.hpp"
#include "frontPanelIndicator.hpp"
#include "manager.hpp"
#include "dsMgr.h"
#include "dsRpc.h"
#include "dsDisplay.h"
// end dsMgr includes

#include "thunder/ctrlmf_thunder_plugin_display_settings.h"

bool ctrlmf_audio_control_init(void) {
if(device::Manager::IsInitialized) {
XLOGD_INFO("DSMgr already initialized");
return(true);
}
try {
device::Manager::Initialize();
XLOGD_INFO("DSMgr is initialized");
}
catch (...) {
XLOGD_WARN("Failed to initialize DSMgr");
return(false);
}
// DSMgr initialization is no longer needed; Thunder plugins self-initialise.
return(true);
}

bool ctrlmf_audio_control_term(void) {
try {
if(device::Manager::IsInitialized) {
device::Manager::DeInitialize();
}
}
catch(...) {
XLOGD_WARN("Failed to deinitialize DSMgr");
return(false);
}
// DSMgr deinitialization is no longer needed; Thunder plugins self-manage.
return(true);
}

bool ctrlmf_audio_control_mute(bool mute) {
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Function called: mute=%d", mute);
if(!ctrlmf_is_initialized()) {
XLOGD_ERROR("not initialized");
return(false);
}
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Using Displaysettings path");
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Getting DisplaySettings instance...");

try {
dsAudioDuckingAction_t action = mute ? dsAUDIO_DUCKINGACTION_START : dsAUDIO_DUCKINGACTION_STOP;
device::Host::getInstance().getAudioOutputPort("SPEAKER0").setAudioDucking(action, dsAUDIO_DUCKINGTYPE_ABSOLUTE, mute ? 0 : 100);
XLOGD_INFO("Audio is %smuted", mute?"":"un-");
auto *ds = Thunder::DisplaySettings::ctrlmf_thunder_plugin_display_settings_t::getInstance();
if(!ds) {
XLOGD_ERROR("DisplaySettings plugin not available");
return(false);
}
catch(std::exception& error) {
XLOGD_WARN("Muting sound error : %s", error.what());
return(false);
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] DisplaySettings instance obtained");
bool action = mute; // true = start ducking (mute), false = stop ducking (unmute)
bool type = false; // false = absolute ducking
unsigned char level = mute ? 0 : 100;
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Calculated: action=%d, type=%d, level=%u", action, type, level);
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Calling set_audio_ducking...");
bool ret = ds->set_audio_ducking(action, type, level);
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] set_audio_ducking returned: %d", ret);

if(ret) {
XLOGD_INFO("Audio is %smuted", mute ? "" : "un-");
} else {
XLOGD_WARN("Muting sound error");
}
return(true);
XLOGD_INFO("[CTRLMF_AUDIO_MUTE] Returning: %d", ret);
return(ret);
}

bool ctrlmf_audio_control_attenuate(bool enable, bool relative, double vol) {
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Function called: enable=%d, relative=%d, vol=%f", enable, relative, vol);
if(!ctrlmf_is_initialized()) {
XLOGD_ERROR("not initialized");
return(false);
}

if(vol < 0 || vol > 1) {
XLOGD_ERROR("Invalid volume");
return(false);
XLOGD_ERROR("Invalid volume");
return(false);
}
try {
unsigned char level = (unsigned char)((vol * 100) + 0.5);

dsAudioDuckingAction_t action = enable ? dsAUDIO_DUCKINGACTION_START : dsAUDIO_DUCKINGACTION_STOP;
dsAudioDuckingType_t type = relative ? dsAUDIO_DUCKINGTYPE_RELATIVE : dsAUDIO_DUCKINGTYPE_ABSOLUTE;

device::Host::getInstance().getAudioOutputPort("SPEAKER0").setAudioDucking(action, type, level);
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Using Displaysettings path");
unsigned char level = (unsigned char)((vol * 100) + 0.5);
bool action = enable; // true = start ducking, false = stop ducking
bool type = relative; // true = relative, false = absolute
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Calculated: action=%d, type=%d, level=%u", action, type, level);
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.

XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Getting DisplaySettings instance...");
auto *ds = Thunder::DisplaySettings::ctrlmf_thunder_plugin_display_settings_t::getInstance();
if(!ds) {
Comment thread
balav08 marked this conversation as resolved.
Comment thread
Copilot marked this conversation as resolved.
XLOGD_ERROR("DisplaySettings plugin not available");
return(false);
}
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] DisplaySettings instance obtained successfully");
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Calling set_audio_ducking...");
bool ret = ds->set_audio_ducking(action, type, level);
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] set_audio_ducking returned: %d", ret);
if(ret) {
if(enable) {
XLOGD_INFO("Audio ducking enabled - type <%s> level <%u%%>", relative ? "RELATIVE" : "ABSOLUTE", level);
Comment thread
balav08 marked this conversation as resolved.
Comment thread
balav08 marked this conversation as resolved.
} else {
XLOGD_INFO("Audio ducking disabled");
}
} else {
XLOGD_WARN("Ducking sound error");
}
catch(std::exception& error) {
XLOGD_WARN("Ducking sound error : %s", error.what());
return(false);
}
return(true);
XLOGD_INFO("[CTRLMF_AUDIO_ATTENUATE] Returning: %d", ret);
return(ret);
}
17 changes: 11 additions & 6 deletions src/factory/thunder/ctrlmf_thunder_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,23 @@ void ctrlm_thunder_plugin_t::on_thunder_ready(bool boot) {
}
}

bool ctrlm_thunder_plugin_t::call_plugin(std::string method, void *params, void *response) {
bool ctrlm_thunder_plugin_t::call_plugin(std::string method, void *params, void *response, unsigned int retries) {
bool ret = false;
unsigned int attempts = 0;
auto clientObject = (JSONRPC::LinkType<Core::JSON::IElement>*)this->plugin_client;
Comment thread
msmith113 marked this conversation as resolved.
JsonObject *jsonParams = (JsonObject *)params;
JsonObject *jsonResponse = (JsonObject *)response;
if(clientObject) {
if(!method.empty() && jsonParams && jsonResponse) {
uint32_t thunderRet = clientObject->Invoke<JsonObject, JsonObject>(CALL_TIMEOUT, _T(method), *jsonParams, *jsonResponse);
if(thunderRet == Core::ERROR_NONE) {
ret = true;
} else {
XLOGD_ERROR("%s: Thunder call failed <%s> <%u>\n", __FUNCTION__, method.c_str(), thunderRet);
uint32_t thunderRet = Core::ERROR_TIMEDOUT;
while(thunderRet == Core::ERROR_TIMEDOUT && attempts <= retries) {
thunderRet = clientObject->Invoke<JsonObject, JsonObject>(CALL_TIMEOUT, _T(method), *jsonParams, *jsonResponse);
if(thunderRet == Core::ERROR_NONE) {
ret = true;
} else {
XLOGD_ERROR("%s: Thunder call failed <%s> <%u>\n", __FUNCTION__, method.c_str(), thunderRet);
attempts++;
}
}
Comment thread
balav08 marked this conversation as resolved.
} else {
XLOGD_ERROR("%s: Invalid parameters\n", __FUNCTION__);
Expand Down
Loading
Loading