-
Notifications
You must be signed in to change notification settings - Fork 5
RDKEMW-20784: Support ctrlmain to use thunder plugin for libds methods and events #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
9c39fc1
ab694e4
a163e6e
56db84f
fac7942
f6a8ec7
f4764d2
5e022b4
d976f1d
c597cc5
18e32e2
1d4e4c6
9ca67fb
7efaff4
9a6dc37
5f96e85
f243495
a5cd360
2a831a6
80118a5
2d284d5
f5d9461
bbff62d
270edef
593bac6
d282cf9
569d862
53d8d02
610ae7b
0ff2be6
3a54295
9bc6f4e
99ed737
68611ea
44d965d
5b2a807
90fe8f5
1eab598
6b3a6ff
ffa57b6
fc18d45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
|
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 | ||
|
|
@@ -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; | ||
|
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); | ||
|
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) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
balav08 marked this conversation as resolved.
balav08 marked this conversation as resolved.
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); | ||
|
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); | ||
|
balav08 marked this conversation as resolved.
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"); | ||
|
balav08 marked this conversation as resolved.
|
||
| return false; | ||
| } | ||
|
balav08 marked this conversation as resolved.
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); | ||
|
balav08 marked this conversation as resolved.
|
||
| } else { | ||
| XLOGD_INFO("Audio ducking disabled"); | ||
| } | ||
| } else { | ||
| XLOGD_WARN("Muting sound error"); | ||
|
balav08 marked this conversation as resolved.
balav08 marked this conversation as resolved.
balav08 marked this conversation as resolved.
|
||
| } | ||
|
balav08 marked this conversation as resolved.
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: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
balav08 marked this conversation as resolved.
|
||
| target_link_libraries(controlFactory c ctrlm-fta secure_wrapper) | ||
|
balav08 marked this conversation as resolved.
balav08 marked this conversation as resolved.
balav08 marked this conversation as resolved.
|
||
|
|
||
| if(AUTH_ENABLED) | ||
|
|
@@ -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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.