From 414b13084060d0f0b6246be111d45fbd337e6214 Mon Sep 17 00:00:00 2001 From: Gene Gallagher <129112619+egalla204@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:07:48 -0400 Subject: [PATCH 1/4] Release/1.1.12 (#200) https://ccp.sys.comcast.net/browse/RDKEMW-16915 --- CHANGELOG.md | 26 +++++++++- CMakeLists.txt | 2 - include/ctrlm_ipc_voice.h | 2 +- src/auth/ctrlm_auth.h | 1 - src/auth/ctrlm_auth_thunder.cpp | 5 -- src/auth/ctrlm_auth_thunder.h | 1 - src/auth/ctrlm_thunder_plugin_authservice.cpp | 18 ------- src/auth/ctrlm_thunder_plugin_authservice.h | 7 --- src/ctrlm.h | 1 - src/ctrlm_controller.cpp | 4 -- src/ctrlm_controller.h | 1 - src/ctrlm_main.cpp | 46 ------------------ src/ctrlm_network.cpp | 10 ---- src/ctrlm_network.h | 3 -- src/thunder/ctrlm_thunder_plugin.cpp | 47 +++++++++++++++++++ src/thunder/ctrlm_thunder_plugin.h | 29 +++++++++--- .../ctrlm_thunder_plugin_powermanager.cpp | 21 +++++---- src/voice/ctrlm_voice_obj.cpp | 18 ------- src/voice/ctrlm_voice_obj.h | 3 -- src/voice/endpoints/ctrlm_voice_endpoint.cpp | 1 - src/voice/endpoints/ctrlm_voice_endpoint.h | 1 - .../endpoints/ctrlm_voice_endpoint_http.cpp | 8 ---- .../endpoints/ctrlm_voice_endpoint_http.h | 1 - .../ctrlm_voice_endpoint_ws_nextgen.cpp | 8 ---- .../ctrlm_voice_endpoint_ws_nextgen.h | 1 - 25 files changed, 107 insertions(+), 158 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e8cb2d..8121aa80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,32 @@ 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.1.12](https://github.com/rdkcentral/control/compare/1.1.11...1.1.12) + +> 9 April 2026 + +- RDKEMW-16333: Update Thunder plugin to use _string and _boolean [`#197`](https://github.com/rdkcentral/control/pull/197) +- RDKEMW-5849 : remove deprecated "experience" code [`#185`](https://github.com/rdkcentral/control/pull/185) + +#### [1.1.11.2](https://github.com/rdkcentral/control/compare/1.1.11.1...1.1.11.2) + +> 7 April 2026 + +- RDKEMW-16711: CHANGELOG for ctrlm hotfix release 1.1.11.2 [`#196`](https://github.com/rdkcentral/control/pull/196) +- RDKEMW-16711 : Add wakeup reason string, on support/1.1.11 [`#195`](https://github.com/rdkcentral/control/pull/195) + +#### [1.1.11.1](https://github.com/rdkcentral/control/compare/1.1.11...1.1.11.1) + +> 1 April 2026 + +- RDKEMW-16330: Update Control Manager to use bool for NSM [`#188`](https://github.com/rdkcentral/control/pull/188) +- RDKEMW-16330: update CHANGELOG for release 1.1.11p1 [`98ea5f5`](https://github.com/rdkcentral/control/commit/98ea5f51f8da9ef6ded7038d760baa3b41cc4a90) + #### [1.1.11](https://github.com/rdkcentral/control/compare/1.1.10...1.1.11) -> 5 March 2026 +> 6 March 2026 - RDKEMW-14589: No UI action with "Info" keypress from rf4ce remote in RF mode [`#181`](https://github.com/rdkcentral/control/pull/181) - RDKEMW-14445 : Add session end and protocol return to telemetry [`#182`](https://github.com/rdkcentral/control/pull/182) @@ -15,7 +38,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - RDKEMW-12930: RF4CE network export XCONF on pair/unpair/etc. [`#177`](https://github.com/rdkcentral/control/pull/177) - RDKEMW-13833: Remove duplicate RFC fetch attempts in listeners [`#179`](https://github.com/rdkcentral/control/pull/179) - #### [1.1.10](https://github.com/rdkcentral/control/compare/1.1.9...1.1.10) diff --git a/CMakeLists.txt b/CMakeLists.txt index 565ab874..112b3c00 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,8 +234,6 @@ if(THUNDER) if(AUTH_ACTIVATION_STATUS) add_compile_definitions(AUTH_ACTIVATION_STATUS) endif() - #By default disabled but can be enabled - #add_compile_definitions(AUTH_EXPERIENCE) target_link_libraries(controlMgr RdkCertSelector) endif() endif() diff --git a/include/ctrlm_ipc_voice.h b/include/ctrlm_ipc_voice.h index 665ffaa5..ed96c951 100644 --- a/include/ctrlm_ipc_voice.h +++ b/include/ctrlm_ipc_voice.h @@ -64,7 +64,7 @@ #define CTRLM_VOICE_SESSION_TEXT_MAX_LENGTH (512) ///< Session text string maximum length #define CTRLM_VOICE_SESSION_MSG_MAX_LENGTH (128) ///< Session message string maximum length #define CTRLM_VOICE_QUERY_STRING_MAX_LENGTH (128) ///< Query string maximum name or value length -#define CTRLM_VOICE_QUERY_STRING_MAX_PAIRS (16) ///< Query string maximum number of name/value pairs +#define CTRLM_VOICE_QUERY_STRING_MAX_PAIRS (24) ///< Query string maximum number of name/value pairs #define CTRLM_VOICE_REQUEST_IP_MAX_LENGTH (48) ///< cURL request primary IP address string maximum length (big enough for IPv6) #define CTRLM_VOICE_MIN_UTTERANCE_DURATION_MAXIMUM (600) ///< Maximum value of the utterance duration minimum setting (in milliseconds) diff --git a/src/auth/ctrlm_auth.h b/src/auth/ctrlm_auth.h index 0964335f..bda34998 100644 --- a/src/auth/ctrlm_auth.h +++ b/src/auth/ctrlm_auth.h @@ -34,7 +34,6 @@ class ctrlm_auth_t { virtual bool get_device_id(std::string &device_id) = 0; virtual bool get_account_id(std::string &account_id) = 0; virtual bool get_partner_id(std::string &partner_id) = 0; - virtual bool get_experience(std::string &experience) = 0; virtual bool get_sat(std::string &sat, time_t &expiration) = 0; virtual bool supports_sat_expiration() const = 0; diff --git a/src/auth/ctrlm_auth_thunder.cpp b/src/auth/ctrlm_auth_thunder.cpp index 2f954df3..7e37f8b4 100644 --- a/src/auth/ctrlm_auth_thunder.cpp +++ b/src/auth/ctrlm_auth_thunder.cpp @@ -48,11 +48,6 @@ bool ctrlm_auth_thunder_t::get_partner_id(std::string &partner_id) { return(ret); } -bool ctrlm_auth_thunder_t::get_experience(std::string &experience) { - bool ret = this->plugin->get_experience(experience); - return(ret); -} - bool ctrlm_auth_thunder_t::get_sat(std::string &sat, time_t &expiration) { bool ret = this->plugin->get_sat(sat, expiration); return(ret); diff --git a/src/auth/ctrlm_auth_thunder.h b/src/auth/ctrlm_auth_thunder.h index 3a476e67..67a385db 100644 --- a/src/auth/ctrlm_auth_thunder.h +++ b/src/auth/ctrlm_auth_thunder.h @@ -13,7 +13,6 @@ class ctrlm_auth_thunder_t : public ctrlm_auth_t { virtual bool get_device_id(std::string &device_id); virtual bool get_account_id(std::string &account_id); virtual bool get_partner_id(std::string &partner_id); - virtual bool get_experience(std::string &experience); virtual bool get_sat(std::string &sat, time_t &expiration); virtual bool supports_sat_expiration() const; diff --git a/src/auth/ctrlm_thunder_plugin_authservice.cpp b/src/auth/ctrlm_thunder_plugin_authservice.cpp index 60c57d7a..e5913d07 100644 --- a/src/auth/ctrlm_thunder_plugin_authservice.cpp +++ b/src/auth/ctrlm_thunder_plugin_authservice.cpp @@ -125,24 +125,6 @@ bool ctrlm_thunder_plugin_authservice_t::get_account_id(std::string &account_id) return(ret); } -bool ctrlm_thunder_plugin_authservice_t::get_experience(std::string &experience) { - bool ret = false; - JsonObject params, response; - if(this->call_plugin("getExperience", (void *)¶ms, (void *)&response)) { - if(response["success"].Boolean()) { // If success doesn't exist, it defaults to false which is fine. - experience = response["experience"].String(); - if(!experience.empty()) { - ret = true; - } - } else { - XLOGD_WARN("Success for getExperience was false"); - } - } else { - XLOGD_WARN("Call for getExperience failed"); - } - return(ret); -} - bool ctrlm_thunder_plugin_authservice_t::get_sat(std::string &sat, time_t &expiration) { bool ret = false; JsonObject params, response; diff --git a/src/auth/ctrlm_thunder_plugin_authservice.h b/src/auth/ctrlm_thunder_plugin_authservice.h index c39de41d..169cee88 100644 --- a/src/auth/ctrlm_thunder_plugin_authservice.h +++ b/src/auth/ctrlm_thunder_plugin_authservice.h @@ -75,13 +75,6 @@ class ctrlm_thunder_plugin_authservice_t : public Thunder::Plugin::ctrlm_thunder */ bool get_account_id(std::string &account_id); - /** - * Function that retrieves the Experience String from Authservice. - * @param experience The reference to a string which will contain the Experience String. - * @return True on success otherwise False. - */ - bool get_experience(std::string &experience); - /** * Function that retrieves the SAT Token from Authservice. * @param sat The reference to a string which will contain the SAT Token. diff --git a/src/ctrlm.h b/src/ctrlm.h index 905803d1..376608b3 100644 --- a/src/ctrlm.h +++ b/src/ctrlm.h @@ -458,7 +458,6 @@ gboolean ctrlm_main_has_device_id_get(void); gboolean ctrlm_main_has_device_type_get(void); gboolean ctrlm_main_has_service_account_id_get(void); gboolean ctrlm_main_has_partner_id_get(void); -gboolean ctrlm_main_has_experience_get(void); gboolean ctrlm_main_needs_service_access_token_get(void); void ctrlm_main_invalidate_service_access_token(void); void ctrlm_main_sat_enabled_set(gboolean sat_enabled); diff --git a/src/ctrlm_controller.cpp b/src/ctrlm_controller.cpp index 15496dd3..60173d47 100644 --- a/src/ctrlm_controller.cpp +++ b/src/ctrlm_controller.cpp @@ -118,10 +118,6 @@ string ctrlm_obj_controller_t::partner_id_get() const { return(obj_network_->partner_id_get()); } -string ctrlm_obj_controller_t::experience_get() const { - return(obj_network_->experience_get()); -} - string ctrlm_obj_controller_t::stb_name_get() const { return(obj_network_->stb_name_get()); } diff --git a/src/ctrlm_controller.h b/src/ctrlm_controller.h index 66749062..ae9b800b 100644 --- a/src/ctrlm_controller.h +++ b/src/ctrlm_controller.h @@ -63,7 +63,6 @@ class ctrlm_obj_controller_t std::string device_id_get() const; std::string service_account_id_get() const; std::string partner_id_get() const; - std::string experience_get() const; std::string stb_name_get() const; void set_device_minor_id(int device_minor_id); int get_device_minor_id() const; diff --git a/src/ctrlm_main.cpp b/src/ctrlm_main.cpp index f76c3682..c3da8d6d 100644 --- a/src/ctrlm_main.cpp +++ b/src/ctrlm_main.cpp @@ -302,10 +302,6 @@ static void ctrlm_main_has_service_account_id_set(gboolean has_id); static gboolean ctrlm_load_partner_id(void); static void ctrlm_main_has_partner_id_set(gboolean has_id); #endif -#ifdef AUTH_EXPERIENCE -static gboolean ctrlm_load_experience(void); -static void ctrlm_main_has_experience_set(gboolean has_experience); -#endif #ifdef AUTH_SAT_TOKEN static gboolean ctrlm_load_service_access_token(void); static void ctrlm_main_has_service_access_token_set(gboolean has_token); @@ -1421,30 +1417,6 @@ gboolean ctrlm_load_partner_id(void) { } #endif -#ifdef AUTH_EXPERIENCE -gboolean ctrlm_main_has_experience_get(void) { - return(g_ctrlm.has_experience); -} - -void ctrlm_main_has_experience_set(gboolean has_experience) { - g_ctrlm.has_experience = has_experience; -} - -gboolean ctrlm_load_experience(void) { - if(!g_ctrlm.authservice->get_experience(g_ctrlm.experience)) { - ctrlm_main_has_experience_set(false); - return(false); - } - g_ctrlm.voice_session->voice_stb_data_experience_set(g_ctrlm.experience); - - for(auto const &itr : g_ctrlm.networks) { - itr.second->experience_set(g_ctrlm.experience); - } - ctrlm_main_has_experience_set(true); - return(true); -} -#endif - #ifdef AUTH_SAT_TOKEN gboolean ctrlm_main_needs_service_access_token_get(void) { gboolean ret = false; @@ -1510,12 +1482,6 @@ gboolean ctrlm_has_authservice_data(void) { } #endif -#ifdef AUTH_EXPERIENCE - if(!ctrlm_main_has_experience_get()) { - ret = FALSE; - } -#endif - #ifdef AUTH_SAT_TOKEN if(ctrlm_main_needs_service_access_token_get()) { ret = FALSE; @@ -1566,18 +1532,6 @@ gboolean ctrlm_load_authservice_data(void) { } #endif -#ifdef AUTH_EXPERIENCE - if(!ctrlm_main_has_experience_get()) { - XLOGD_INFO("load experience"); - if(!ctrlm_load_experience()) { - XLOGD_TELEMETRY("failed to load experience"); - ret = FALSE; - } else { - XLOGD_INFO("load experience successfully <%s>", ctrlm_is_pii_mask_enabled() ? "***" : g_ctrlm.experience.c_str()); - } - } -#endif - #ifdef AUTH_SAT_TOKEN if(ctrlm_main_needs_service_access_token_get()) { XLOGD_INFO("load sat token"); diff --git a/src/ctrlm_network.cpp b/src/ctrlm_network.cpp index e8f591c3..26201231 100644 --- a/src/ctrlm_network.cpp +++ b/src/ctrlm_network.cpp @@ -187,16 +187,6 @@ string ctrlm_obj_network_t::partner_id_get() const { return(partner_id_); } -void ctrlm_obj_network_t::experience_set(const string& experience) { - THREAD_ID_VALIDATE(); - experience_ = experience; -} - -string ctrlm_obj_network_t::experience_get() const { - THREAD_ID_VALIDATE(); - return(experience_); -} - void ctrlm_obj_network_t::stb_name_set(const string& stb_name) { THREAD_ID_VALIDATE(); XLOGD_INFO("STB Name <%s>", stb_name.c_str()); diff --git a/src/ctrlm_network.h b/src/ctrlm_network.h index 90ea909f..ca6ad547 100644 --- a/src/ctrlm_network.h +++ b/src/ctrlm_network.h @@ -192,8 +192,6 @@ class ctrlm_obj_network_t std::string service_account_id_get() const; void partner_id_set(const std::string& partner_id); std::string partner_id_get() const; - void experience_set(const std::string& experience); - std::string experience_get() const; void mask_key_codes_set(gboolean mask_key_codes); gboolean mask_key_codes_get() const; void stb_name_set(const std::string& stb_name); @@ -325,7 +323,6 @@ class ctrlm_obj_network_t std::string device_id_; std::string service_account_id_; std::string partner_id_; - std::string experience_; std::string stb_name_; ctrlm_rcu_validation_result_t validation_result_ = CTRLM_RCU_VALIDATION_RESULT_MAX; ctrlm_key_code_t validation_key_ = CTRLM_KEY_CODE_INVALID; diff --git a/src/thunder/ctrlm_thunder_plugin.cpp b/src/thunder/ctrlm_thunder_plugin.cpp index 3040fae5..ca6afffc 100644 --- a/src/thunder/ctrlm_thunder_plugin.cpp +++ b/src/thunder/ctrlm_thunder_plugin.cpp @@ -261,6 +261,53 @@ bool ctrlm_thunder_plugin_t::call_plugin(std::string method, void *params, void return(ret); } +bool ctrlm_thunder_plugin_t::call_plugin_boolean(std::string method, void *params, bool *response) { + bool ret = false; + auto clientObject = (JSONRPC::LinkType*)this->plugin_client; + JsonObject *jsonParams = (JsonObject *)params; + if(clientObject) { + if(!method.empty() && jsonParams && response) { + Core::JSON::Boolean jsonResponse; + uint32_t thunderRet = clientObject->Invoke(CALL_TIMEOUT, _T(method), *jsonParams, jsonResponse); + if(thunderRet != Core::ERROR_NONE) { + XLOGD_ERROR("Thunder call failed <%s> <%u>", method.c_str(), thunderRet); + } else { + *response = jsonResponse.Value(); + ret = true; + } + } else { + XLOGD_ERROR("Invalid parameters"); + } + } else { + XLOGD_ERROR("Client is NULL"); + } + return(ret); +} + +bool ctrlm_thunder_plugin_t::call_plugin_string(std::string method, void *params, std::string *response) { + bool ret = false; + auto clientObject = (JSONRPC::LinkType*)this->plugin_client; + JsonObject *jsonParams = (JsonObject *)params; + if(clientObject) { + if(!method.empty() && jsonParams && response) { + Core::JSON::String jsonString; + uint32_t thunderRet = clientObject->Invoke(CALL_TIMEOUT, _T(method), *jsonParams, jsonString); + if(thunderRet != Core::ERROR_NONE) { + XLOGD_ERROR("Thunder call failed <%s> <%u>", method.c_str(), thunderRet); + } else { + *response = jsonString.Value(); + ret = true; + } + } else { + XLOGD_ERROR("Invalid parameters"); + } + } else { + XLOGD_ERROR("Client is NULL"); + } + return(ret); +} + + bool ctrlm_thunder_plugin_t::call_controller(std::string method, void *params, void *response) { bool ret = false; if(this->controller) { diff --git a/src/thunder/ctrlm_thunder_plugin.h b/src/thunder/ctrlm_thunder_plugin.h index f1a3944a..9bf6d780 100644 --- a/src/thunder/ctrlm_thunder_plugin.h +++ b/src/thunder/ctrlm_thunder_plugin.h @@ -105,9 +105,8 @@ class ctrlm_thunder_plugin_t { std::string callsign_with_api(); /** - * This functions is used to get a Thunder Plugin property. - * @param method The method in which the user wants to call. - * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * This function is used to get a Thunder Plugin property. + * @param property The name of the property that the user wants to get * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param retries The number of retries if the call times out. * @return True if the call succeeded, otherwise False. @@ -115,7 +114,7 @@ class ctrlm_thunder_plugin_t { bool property_get(std::string property, void *response, unsigned int retries = 0); /** - * This functions is used to call a Thunder Plugin method. + * This function is used to call a Thunder Plugin method. * @param method The method in which the user wants to call. * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param response The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) @@ -125,7 +124,25 @@ class ctrlm_thunder_plugin_t { bool call_plugin(std::string method, void *params, void *response, unsigned int retries = 0); /** - * This functions is used to call a Thunder Controller method. + * This function is used to call a Thunder Plugin method. + * @param method The method in which the user wants to call. + * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * @param response The boolean pointer which will be assigned the response from the call + * @return True if the call succeeded, otherwise False. + */ + bool call_plugin_boolean(std::string method, void *params, bool *response); + + /** + * This function is used to call a Thunder Plugin method. + * @param method The method in which the user wants to call. + * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) + * @param response The string pointer which will be assigned containing the response from the call. + * @return True if the call succeeded, otherwise False. + */ + bool call_plugin_string(std::string method, void *params, std::string *response); + + /** + * This function is used to call a Thunder Controller method. * @param method The method in which the user wants to call. * @param params The WPEFramework JsonObject containing the parameters for the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) * @param params The WPEFramework JsonObject containing the response from the call. (We can't include WPEFramework headers in controlMgr .h files as their logging macros clash) @@ -164,4 +181,4 @@ class ctrlm_thunder_plugin_t { }; }; -#endif \ No newline at end of file +#endif diff --git a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp index 6e0c83b0..e84fa983 100755 --- a/src/thunder/ctrlm_thunder_plugin_powermanager.cpp +++ b/src/thunder/ctrlm_thunder_plugin_powermanager.cpp @@ -89,16 +89,15 @@ ctrlm_power_state_t ctrlm_thunder_plugin_powermanager_t::get_power_state() { /* root@pioneer-uhd:~# curl --request POST --url http://127.0.0.1:9998/jsonrpc --header 'Content-Type: application/json' --data '{ "jsonrpc": "2.0", "id": 1234567890, "method": "org.rdk.PowerManager.1.getNetworkStandbyMode", "params": {} }' {"jsonrpc":"2.0","id":1234567890,"result":true} */ bool ctrlm_thunder_plugin_powermanager_t::get_networked_standby_mode() { - JsonObject params, response; + JsonObject params; params = {}; bool networked_standby_mode = false; - sem_wait(&this->semaphore); - if(this->call_plugin("getNetworkStandbyMode", (void *)¶ms, (void *)&response)) { - networked_standby_mode = response["result"].Boolean(); + sem_wait(&this->semaphore); + if(this->call_plugin_boolean("getNetworkStandbyMode", (void *)¶ms, &networked_standby_mode)) { XLOGD_DEBUG("networked_standby_mode is %s", networked_standby_mode?"TRUE":"FALSE"); } else { - XLOGD_ERROR("getNetworkedStandbyMode call failed"); + XLOGD_ERROR("getNetworkStandbyMode call failed"); } sem_post(&this->semaphore); @@ -108,19 +107,23 @@ bool ctrlm_thunder_plugin_powermanager_t::get_networked_standby_mode() { /* root@pioneer-uhd:~# curl --request POST --url http://127.0.0.1:9998/jsonrpc --header 'Content-Type: application/json' --data '{ "jsonrpc": "2.0", "id": 1234567890, "method": "org.rdk.PowerManager.1.getLastWakeupReason", "params": {} }' {"jsonrpc":"2.0","id":1234567890,"result":"COLDBOOT"} */ bool ctrlm_thunder_plugin_powermanager_t::get_wakeup_reason_voice() { - JsonObject params, response; + JsonObject params; + std::string response; params = {}; bool wakeup_reason_voice = false; sem_wait(&this->semaphore); - if(this->call_plugin("getLastWakeupReason", (void *)¶ms, (void *)&response)) { - wakeup_reason_voice = (0 == strncmp(response["result"].String().c_str(), "VOICE", 5)); - XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); + if(this->call_plugin_string("getLastWakeupReason", (void *)¶ms, &response)) { + if(response == "VOICE") { + wakeup_reason_voice = true; + } } else { XLOGD_ERROR("getLastWakeupReason call failed"); } sem_post(&this->semaphore); + XLOGD_DEBUG("voice_wakeup is %s", wakeup_reason_voice?"TRUE":"FALSE"); + return wakeup_reason_voice; } diff --git a/src/voice/ctrlm_voice_obj.cpp b/src/voice/ctrlm_voice_obj.cpp index 6e4b354f..a6787b1e 100644 --- a/src/voice/ctrlm_voice_obj.cpp +++ b/src/voice/ctrlm_voice_obj.cpp @@ -2252,18 +2252,6 @@ std::string ctrlm_voice_t::voice_stb_data_partner_id_get() const { return(this->partner_id); } -void ctrlm_voice_t::voice_stb_data_experience_set(std::string &experience) { - XLOGD_DEBUG("Experience Tag set to %s", experience.c_str()); - this->experience = experience; - for(const auto &itr : this->endpoints) { - itr->voice_stb_data_experience_set(experience); - } -} - -std::string ctrlm_voice_t::voice_stb_data_experience_get() const { - return(this->experience); -} - std::string ctrlm_voice_t::voice_stb_data_app_id_http_get() const { return(this->prefs.app_id_http); } @@ -2427,12 +2415,6 @@ bool ctrlm_voice_t::voice_session_has_stb_data() { return(false); } #endif -#ifdef AUTH_EXPERIENCE - if(this->experience == "") { - XLOGD_INFO("No experience tag"); - return(false); - } -#endif #ifdef AUTH_SAT_TOKEN if(this->sat_token_required && this->sat_token[0] == '\0') { XLOGD_INFO("No SAT token"); diff --git a/src/voice/ctrlm_voice_obj.h b/src/voice/ctrlm_voice_obj.h index 38699a6b..3ec217b2 100644 --- a/src/voice/ctrlm_voice_obj.h +++ b/src/voice/ctrlm_voice_obj.h @@ -525,8 +525,6 @@ class ctrlm_voice_t { ctrlm_device_type_t voice_stb_data_device_type_get() const; virtual void voice_stb_data_partner_id_set(std::string &partner_id); std::string voice_stb_data_partner_id_get() const; - virtual void voice_stb_data_experience_set(std::string &experience); - std::string voice_stb_data_experience_get() const; std::string voice_stb_data_app_id_http_get() const; std::string voice_stb_data_app_id_ws_get() const; virtual void voice_stb_data_guide_language_set(const char *language); @@ -662,7 +660,6 @@ class ctrlm_voice_t { std::string device_id; ctrlm_device_type_t device_type; std::string partner_id; - std::string experience; char sat_token[XRSR_SAT_TOKEN_LEN_MAX]; bool sat_token_required; bool mtls_required; diff --git a/src/voice/endpoints/ctrlm_voice_endpoint.cpp b/src/voice/endpoints/ctrlm_voice_endpoint.cpp index 7815cd27..1aed8d46 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint.cpp +++ b/src/voice/endpoints/ctrlm_voice_endpoint.cpp @@ -63,7 +63,6 @@ void ctrlm_voice_endpoint_t::voice_stb_data_account_number_set(std::string &acco void ctrlm_voice_endpoint_t::voice_stb_data_device_id_set(std::string &device_id) {} void ctrlm_voice_endpoint_t::voice_stb_data_device_type_set(ctrlm_device_type_t device_type) {} void ctrlm_voice_endpoint_t::voice_stb_data_partner_id_set(std::string &partner_id) {} -void ctrlm_voice_endpoint_t::voice_stb_data_experience_set(std::string &experience) {} void ctrlm_voice_endpoint_t::voice_stb_data_guide_language_set(const char *language) {} void ctrlm_voice_endpoint_t::voice_stb_data_mask_pii_set(bool enable) {} diff --git a/src/voice/endpoints/ctrlm_voice_endpoint.h b/src/voice/endpoints/ctrlm_voice_endpoint.h index ac881880..3298348f 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint.h +++ b/src/voice/endpoints/ctrlm_voice_endpoint.h @@ -50,7 +50,6 @@ class ctrlm_voice_endpoint_t { virtual void voice_stb_data_device_id_set(std::string &device_id); virtual void voice_stb_data_device_type_set(ctrlm_device_type_t device_type); virtual void voice_stb_data_partner_id_set(std::string &partner_id); - virtual void voice_stb_data_experience_set(std::string &experience); virtual void voice_stb_data_guide_language_set(const char *language); virtual void voice_stb_data_mask_pii_set(bool enable); // End Data Setters diff --git a/src/voice/endpoints/ctrlm_voice_endpoint_http.cpp b/src/voice/endpoints/ctrlm_voice_endpoint_http.cpp index 1ec3e647..c119ee43 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint_http.cpp +++ b/src/voice/endpoints/ctrlm_voice_endpoint_http.cpp @@ -72,14 +72,12 @@ bool ctrlm_voice_endpoint_http_t::open() { std::string device_id = this->voice_obj->voice_stb_data_device_id_get(); std::string partner_id = this->voice_obj->voice_stb_data_partner_id_get(); - std::string experience = this->voice_obj->voice_stb_data_experience_get(); std::string app_id = this->voice_obj->voice_stb_data_app_id_http_get(); std::string language = this->voice_obj->voice_stb_data_guide_language_get().c_str(); xrsv_http_params_t params_http = { .device_id = device_id.c_str(), .partner_id = partner_id.c_str(), - .experience = experience.c_str(), .app_id = app_id.c_str(), .language = language.c_str(), .test_flag = this->voice_obj->voice_stb_data_test_get(), @@ -138,12 +136,6 @@ void ctrlm_voice_endpoint_http_t::voice_stb_data_partner_id_set(std::string &par } } -void ctrlm_voice_endpoint_http_t::voice_stb_data_experience_set(std::string &experience) { - if(this->xrsv_obj_http) { - xrsv_http_update_experience(this->xrsv_obj_http, experience.c_str()); - } -} - void ctrlm_voice_endpoint_http_t::voice_stb_data_guide_language_set(const char *language) { if(this->xrsv_obj_http) { xrsv_http_update_language(this->xrsv_obj_http, language); diff --git a/src/voice/endpoints/ctrlm_voice_endpoint_http.h b/src/voice/endpoints/ctrlm_voice_endpoint_http.h index 9338e20d..79a0d50d 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint_http.h +++ b/src/voice/endpoints/ctrlm_voice_endpoint_http.h @@ -32,7 +32,6 @@ class ctrlm_voice_endpoint_http_t : public ctrlm_voice_endpoint_t { public: void voice_stb_data_device_id_set(std::string &device_id); void voice_stb_data_partner_id_set(std::string &partner_id); - void voice_stb_data_experience_set(std::string &experience); void voice_stb_data_guide_language_set(const char *language); void voice_stb_data_pii_mask_set(bool enable); diff --git a/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.cpp b/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.cpp index e5165cd7..9abc27db 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.cpp +++ b/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.cpp @@ -86,7 +86,6 @@ bool ctrlm_voice_endpoint_ws_nextgen_t::open() { } std::string device_id = this->voice_obj->voice_stb_data_device_id_get(); std::string partner_id = this->voice_obj->voice_stb_data_partner_id_get(); - std::string experience = this->voice_obj->voice_stb_data_experience_get(); std::string language = this->voice_obj->voice_stb_data_guide_language_get().c_str(); std::string account_number = this->voice_obj->voice_stb_data_account_number_get(); std::string device_mac = ctrlm_device_mac_get(); @@ -96,7 +95,6 @@ bool ctrlm_voice_endpoint_ws_nextgen_t::open() { .device_id = (device_id.empty() == false ? device_id.c_str() : NULL), .account_id = (account_number.empty() == false ? account_number.c_str() : NULL), .partner_id = (partner_id.empty() == false ? partner_id.c_str() : NULL), - .experience = (experience.empty() == false ? experience.c_str() : NULL), .audio_profile = controller_name_to_audio_profile(""), .audio_model = controller_name_to_audio_model(""), .language = language.c_str(), @@ -235,12 +233,6 @@ void ctrlm_voice_endpoint_ws_nextgen_t::voice_stb_data_partner_id_set(std::strin } } -void ctrlm_voice_endpoint_ws_nextgen_t::voice_stb_data_experience_set(std::string &experience) { - if(this->xrsv_obj_ws_nextgen) { - xrsv_ws_nextgen_update_experience(this->xrsv_obj_ws_nextgen, experience.c_str()); - } -} - void ctrlm_voice_endpoint_ws_nextgen_t::voice_stb_data_guide_language_set(const char *language) { if(this->xrsv_obj_ws_nextgen) { xrsv_ws_nextgen_update_language(this->xrsv_obj_ws_nextgen, language); diff --git a/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.h b/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.h index 16667f2f..218e1d39 100644 --- a/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.h +++ b/src/voice/endpoints/ctrlm_voice_endpoint_ws_nextgen.h @@ -37,7 +37,6 @@ class ctrlm_voice_endpoint_ws_nextgen_t : public ctrlm_voice_endpoint_t { void voice_stb_data_device_id_set(std::string &device_id); void voice_stb_data_device_type_set(ctrlm_device_type_t device_type); void voice_stb_data_partner_id_set(std::string &partner_id); - void voice_stb_data_experience_set(std::string &experience); void voice_stb_data_guide_language_set(const char *language); void voice_stb_data_mask_pii_set(bool enable); From 645f07895772ab5c9cb2b04744ced298bbd19d6f Mon Sep 17 00:00:00 2001 From: Gene Gallagher Date: Fri, 5 Jun 2026 13:21:03 -0400 Subject: [PATCH 2/4] copilot first draft, haven't tried to compile yet --- src/ble/ctrlm_ble_controller.cpp | 2 + src/ble/ctrlm_ble_network.cpp | 5 ++- src/ctrlm_controller.cpp | 44 ++++++++++++++++++++ src/ctrlm_controller.h | 5 +++ src/database/ctrlm_database.cpp | 68 +++++++++++++++++++++++++++++++ src/database/ctrlm_database.h | 8 ++++ src/irdb/ctrlm_irdb_interface.cpp | 18 +++++++- src/irdb/ctrlm_irdb_interface.h | 7 +++- src/network/ctrlm_ir_rf_db.cpp | 30 +++++++++++++- src/network/ctrlm_ir_rf_db.h | 6 ++- 10 files changed, 186 insertions(+), 7 deletions(-) diff --git a/src/ble/ctrlm_ble_controller.cpp b/src/ble/ctrlm_ble_controller.cpp index f1a87c22..7d98f711 100644 --- a/src/ble/ctrlm_ble_controller.cpp +++ b/src/ble/ctrlm_ble_controller.cpp @@ -665,7 +665,9 @@ void ctrlm_obj_controller_ble_t::print_status() { XLOGD_INFO("IR Database Support : N/A"); } XLOGD_INFO("Programmed TV IRDB Code : %s", irdb_entry_id_name_tv_->to_string().c_str()); + XLOGD_INFO("Programmed TV IRDB Manufacturer/Model: %s / %s", irdb_manufacturer_tv_->to_string().c_str(), irdb_model_tv_->to_string().c_str()); XLOGD_INFO("Programmed AVR IRDB Code : %s", irdb_entry_id_name_avr_->to_string().c_str()); + XLOGD_INFO("Programmed AVR IRDB Manufacturer/Model: %s / %s", irdb_manufacturer_avr_->to_string().c_str(), irdb_model_avr_->to_string().c_str()); XLOGD_INFO(""); voice_metrics_->print(__FUNCTION__); XLOGD_WARN("------------------------------------------------------------"); diff --git a/src/ble/ctrlm_ble_network.cpp b/src/ble/ctrlm_ble_network.cpp index 57cdb6da..1ad4a3ff 100644 --- a/src/ble/ctrlm_ble_network.cpp +++ b/src/ble/ctrlm_ble_network.cpp @@ -781,7 +781,7 @@ void ctrlm_obj_network_ble_t::req_process_program_ir_codes(void *data, int size) std::map> ir_codes; // First add IR Codes to the IR RF Database (this contains all of the logic for maintaining TV vs AVR codes) - ir_rf_database_.add_irdb_codes(dqm->ir_codes); + ir_rf_database_.add_irdb_codes(dqm->ir_codes, dqm->manufacturer, dqm->model); XLOGD_INFO("\n%s", this->ir_rf_database_.to_string(true).c_str()); // Now get the IR codes for the BLE IR slots for(auto key : ctrlm_ble_ir_key_names) { @@ -804,7 +804,8 @@ void ctrlm_obj_network_ble_t::req_process_program_ir_codes(void *data, int size) success = true; controllers_[controller_id]->irdb_entry_id_name_set(CTRLM_IRDB_DEV_TYPE_TV, ir_rf_database_.get_tv_ir_code_id()); controllers_[controller_id]->irdb_entry_id_name_set(CTRLM_IRDB_DEV_TYPE_AVR, ir_rf_database_.get_avr_ir_code_id()); - XLOGD_INFO("irdb_entry_id_name = <%s>", dqm->ir_codes->id.c_str()); + controllers_[controller_id]->irdb_manufacturer_model_set(dqm->ir_codes->type, dqm->manufacturer, dqm->model); + XLOGD_INFO("irdb_entry_id_name = <%s>, manufacturer/model = <%s / %s>", dqm->ir_codes->id.c_str(), dqm->manufacturer.c_str(), dqm->model.c_str()); } } // Store the IR codes in the database diff --git a/src/ctrlm_controller.cpp b/src/ctrlm_controller.cpp index 60173d47..92204af4 100644 --- a/src/ctrlm_controller.cpp +++ b/src/ctrlm_controller.cpp @@ -40,6 +40,10 @@ ctrlm_obj_controller_t::ctrlm_obj_controller_t(ctrlm_controller_id_t controller_ last_key_code_(std::make_shared("Last Keypress Code", CTRLM_KEY_CODE_INVALID, &network, controller_id, "last_key_code")), irdb_entry_id_name_tv_(std::make_shared("TV IRDB Code", "0", &network, controller_id, "irdb_entry_id_name_tv")), irdb_entry_id_name_avr_(std::make_shared("AVR IRDB Code", "0", &network, controller_id, "irdb_entry_id_name_avr")), + irdb_manufacturer_tv_(std::make_shared("TV IRDB Manufacturer", "", &network, controller_id, "irdb_manufacturer_tv")), + irdb_model_tv_(std::make_shared("TV IRDB Model", "", &network, controller_id, "irdb_model_tv")), + irdb_manufacturer_avr_(std::make_shared("AVR IRDB Manufacturer", "", &network, controller_id, "irdb_manufacturer_avr")), + irdb_model_avr_(std::make_shared("AVR IRDB Model", "", &network, controller_id, "irdb_model_avr")), voice_metrics_(std::make_shared(&network, controller_id)), ota_failure_cnt_from_last_success_(std::make_shared("OTA Failure Count From Last Success", 0, &network, controller_id, "ota_failure_cnt_last_success")) { @@ -69,6 +73,10 @@ void ctrlm_obj_controller_t::db_load() { ctrlm_db_attr_read(last_key_code_.get()); ctrlm_db_attr_read(irdb_entry_id_name_tv_.get()); ctrlm_db_attr_read(irdb_entry_id_name_avr_.get()); + ctrlm_db_attr_read(irdb_manufacturer_tv_.get()); + ctrlm_db_attr_read(irdb_model_tv_.get()); + ctrlm_db_attr_read(irdb_manufacturer_avr_.get()); + ctrlm_db_attr_read(irdb_model_avr_.get()); ctrlm_db_attr_read(voice_metrics_.get()); ctrlm_db_attr_read(ota_failure_cnt_from_last_success_.get()); @@ -85,6 +93,10 @@ void ctrlm_obj_controller_t::db_store() { ctrlm_db_attr_write(last_key_code_); ctrlm_db_attr_write(irdb_entry_id_name_tv_); ctrlm_db_attr_write(irdb_entry_id_name_avr_); + ctrlm_db_attr_write(irdb_manufacturer_tv_); + ctrlm_db_attr_write(irdb_model_tv_); + ctrlm_db_attr_write(irdb_manufacturer_avr_); + ctrlm_db_attr_write(irdb_model_avr_); ctrlm_db_attr_write(voice_metrics_); } @@ -208,6 +220,34 @@ void ctrlm_obj_controller_t::irdb_entry_id_name_set(ctrlm_irdb_dev_type_t type, } } +void ctrlm_obj_controller_t::irdb_manufacturer_model_set(ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &model) { + switch(type) { + case CTRLM_IRDB_DEV_TYPE_TV: + if (irdb_manufacturer_tv_->to_string() != manufacturer) { + irdb_manufacturer_tv_->set_value(manufacturer); + ctrlm_db_attr_write(irdb_manufacturer_tv_); + } + if (irdb_model_tv_->to_string() != model) { + irdb_model_tv_->set_value(model); + ctrlm_db_attr_write(irdb_model_tv_); + } + break; + case CTRLM_IRDB_DEV_TYPE_AVR: + if (irdb_manufacturer_avr_->to_string() != manufacturer) { + irdb_manufacturer_avr_->set_value(manufacturer); + ctrlm_db_attr_write(irdb_manufacturer_avr_); + } + if (irdb_model_avr_->to_string() != model) { + irdb_model_avr_->set_value(model); + ctrlm_db_attr_write(irdb_model_avr_); + } + break; + default: + XLOGD_WARN("Invalid type <%d>", type); + break; + } +} + std::string ctrlm_obj_controller_t::get_irdb_entry_id_name_tv() const { return irdb_entry_id_name_tv_->to_string(); } @@ -427,6 +467,10 @@ void ctrlm_obj_controller_t::update_controller_id_and_db_entry(std::string db_na last_key_code_->set_table(new_table); irdb_entry_id_name_tv_->set_table(new_table); irdb_entry_id_name_avr_->set_table(new_table); + irdb_manufacturer_tv_->set_table(new_table); + irdb_model_tv_->set_table(new_table); + irdb_manufacturer_avr_->set_table(new_table); + irdb_model_avr_->set_table(new_table); voice_metrics_->set_table(new_table); ota_failure_cnt_from_last_success_->set_table(new_table); } diff --git a/src/ctrlm_controller.h b/src/ctrlm_controller.h index ae9b800b..429f3995 100644 --- a/src/ctrlm_controller.h +++ b/src/ctrlm_controller.h @@ -55,6 +55,7 @@ class ctrlm_obj_controller_t void send_to(unsigned long delay, unsigned long length, char *data); virtual void irdb_entry_id_name_set(ctrlm_irdb_dev_type_t type, const std::string &irdb_ir_entry_id); + virtual void irdb_manufacturer_model_set(ctrlm_irdb_dev_type_t type, const std::string &manufacturer, const std::string &model); std::string get_irdb_entry_id_name_tv() const; std::string get_irdb_entry_id_name_avr() const; @@ -125,6 +126,10 @@ class ctrlm_obj_controller_t std::shared_ptr irdb_entry_id_name_tv_; std::shared_ptr irdb_entry_id_name_avr_; + std::shared_ptr irdb_manufacturer_tv_; + std::shared_ptr irdb_model_tv_; + std::shared_ptr irdb_manufacturer_avr_; + std::shared_ptr irdb_model_avr_; std::shared_ptr voice_metrics_; diff --git a/src/database/ctrlm_database.cpp b/src/database/ctrlm_database.cpp index dfe2bb21..b8a8f021 100644 --- a/src/database/ctrlm_database.cpp +++ b/src/database/ctrlm_database.cpp @@ -72,6 +72,10 @@ using namespace std; #define CTRLM_DB_DEVICE_UPDATE_SESSION_STATE "du_session_state" #define CTRLM_DB_TV_IR_CODE_ID "tv_ir_code_id" #define CTRLM_DB_AVR_IR_CODE_ID "avr_ir_code_id" +#define CTRLM_DB_TV_MANUFACTURER "tv_manufacturer" +#define CTRLM_DB_TV_MODEL "tv_model" +#define CTRLM_DB_AVR_MANUFACTURER "avr_manufacturer" +#define CTRLM_DB_AVR_MODEL "avr_model" #define CTRLM_DB_TABLE_VOICE "ctrlm_voice" @@ -738,6 +742,70 @@ void ctrlm_db_avr_ir_code_id_read(std::string &id) { } } +void ctrlm_db_tv_manufacturer_write(const std::string manufacturer) { + ctrlm_db_write_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_TV_MANUFACTURER, (const guchar*) manufacturer.c_str(), manufacturer.length()); +} + +void ctrlm_db_tv_manufacturer_read(std::string &manufacturer) { + guchar *data = NULL; + guint32 length = 0; + ctrlm_db_read_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_TV_MANUFACTURER, &data, &length); + if(NULL != data) { + manufacturer.assign((char *)data, length); + ctrlm_db_free(data); + } else { + XLOGD_WARN("Failed to load tv_manufacturer from db"); + } +} + +void ctrlm_db_tv_model_write(const std::string model) { + ctrlm_db_write_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_TV_MODEL, (const guchar*) model.c_str(), model.length()); +} + +void ctrlm_db_tv_model_read(std::string &model) { + guchar *data = NULL; + guint32 length = 0; + ctrlm_db_read_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_TV_MODEL, &data, &length); + if(NULL != data) { + model.assign((char *)data, length); + ctrlm_db_free(data); + } else { + XLOGD_WARN("Failed to load tv_model from db"); + } +} + +void ctrlm_db_avr_manufacturer_write(const std::string manufacturer) { + ctrlm_db_write_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_AVR_MANUFACTURER, (const guchar*) manufacturer.c_str(), manufacturer.length()); +} + +void ctrlm_db_avr_manufacturer_read(std::string &manufacturer) { + guchar *data = NULL; + guint32 length = 0; + ctrlm_db_read_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_AVR_MANUFACTURER, &data, &length); + if(NULL != data) { + manufacturer.assign((char *)data, length); + ctrlm_db_free(data); + } else { + XLOGD_WARN("Failed to load avr_manufacturer from db"); + } +} + +void ctrlm_db_avr_model_write(const std::string model) { + ctrlm_db_write_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_AVR_MODEL, (const guchar*) model.c_str(), model.length()); +} + +void ctrlm_db_avr_model_read(std::string &model) { + guchar *data = NULL; + guint32 length = 0; + ctrlm_db_read_blob(CTRLM_DB_TABLE_CTRLMGR, CTRLM_DB_AVR_MODEL, &data, &length); + if(NULL != data) { + model.assign((char *)data, length); + ctrlm_db_free(data); + } else { + XLOGD_WARN("Failed to load avr_model from db"); + } +} + const char *ctrlm_db_errmsg(int rc) { if(rc == SQLITE_ROW || rc == SQLITE_DONE) { // these are non-error result codes return(""); diff --git a/src/database/ctrlm_database.h b/src/database/ctrlm_database.h index 4716b075..560a8090 100644 --- a/src/database/ctrlm_database.h +++ b/src/database/ctrlm_database.h @@ -81,6 +81,14 @@ void ctrlm_db_tv_ir_code_id_write(const std::string id); void ctrlm_db_tv_ir_code_id_read(std::string &id); void ctrlm_db_avr_ir_code_id_write(const std::string id); void ctrlm_db_avr_ir_code_id_read(std::string &id); +void ctrlm_db_tv_manufacturer_write(const std::string manufacturer); +void ctrlm_db_tv_manufacturer_read(std::string &manufacturer); +void ctrlm_db_tv_model_write(const std::string model); +void ctrlm_db_tv_model_read(std::string &model); +void ctrlm_db_avr_manufacturer_write(const std::string manufacturer); +void ctrlm_db_avr_manufacturer_read(std::string &manufacturer); +void ctrlm_db_avr_model_write(const std::string model); +void ctrlm_db_avr_model_read(std::string &model); void ctrlm_db_rf4ce_networks_list(std::vector *network_ids); void ctrlm_db_rf4ce_controllers_list(ctrlm_network_id_t network_id, std::vector *controller_ids); diff --git a/src/irdb/ctrlm_irdb_interface.cpp b/src/irdb/ctrlm_irdb_interface.cpp index 01fa6588..ac2cf027 100644 --- a/src/irdb/ctrlm_irdb_interface.cpp +++ b/src/irdb/ctrlm_irdb_interface.cpp @@ -408,6 +408,11 @@ bool ctrlm_irdb_interface_t::get_irdb_entry_ids(ctrlm_irdb_entry_id_list_t &code if (g_irdb.pluginGetEntryIds) { ret = (*g_irdb.pluginGetEntryIds)(codes, type, manufacturer, model); } + if(ret) { + m_last_entry_id_manufacturer = manufacturer; + m_last_entry_id_model = model; + m_last_entry_ids = codes; + } return ret; } @@ -563,23 +568,30 @@ bool ctrlm_irdb_interface_t::get_ir_codes_by_autolookup(ctrlm_autolookup_ranked_ bool ctrlm_irdb_interface_t::program_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id, ctrlm_irdb_dev_type_t type, const std::string &id) { std::unique_lock guard(m_mutex); bool ret = false; + std::string manufacturer; + std::string model; XLOGD_INFO("Programming IR codes for (%u, %u) with database id <%s>", network_id, controller_id, id.c_str()); + if(std::find(m_last_entry_ids.begin(), m_last_entry_ids.end(), id) != m_last_entry_ids.end()) { + manufacturer = m_last_entry_id_manufacturer; + model = m_last_entry_id_model; + } + ctrlm_irdb_ir_code_set_t code_set; if (g_irdb.pluginGetCodeSet) { if ( (*g_irdb.pluginGetCodeSet)(code_set, type, id) == false) { XLOGD_ERROR("Failed getting IR code set"); } else { guard.unlock(); - ret = this->_program_ir_codes(network_id, controller_id, &code_set); + ret = this->_program_ir_codes(network_id, controller_id, &code_set, manufacturer, model); } } return(ret); } -bool ctrlm_irdb_interface_t::_program_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id, ctrlm_irdb_ir_code_set_t *ir_codes) { +bool ctrlm_irdb_interface_t::_program_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id, ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer, const std::string &model) { bool ret = false; vector success_vec; @@ -587,6 +599,8 @@ bool ctrlm_irdb_interface_t::_program_ir_codes(ctrlm_network_id_t network_id, ct msg->network_id = network_id; msg->controller_id = controller_id; msg->ir_codes = ir_codes; + msg->manufacturer = manufacturer; + msg->model = model; msg->success = &success_vec; if (false == get_vendor_info(msg->vendor_info)) { diff --git a/src/irdb/ctrlm_irdb_interface.h b/src/irdb/ctrlm_irdb_interface.h index 2f532b15..3a976397 100644 --- a/src/irdb/ctrlm_irdb_interface.h +++ b/src/irdb/ctrlm_irdb_interface.h @@ -41,6 +41,8 @@ typedef struct { ctrlm_network_id_t network_id; ctrlm_controller_id_t controller_id; ctrlm_irdb_ir_code_set_t * ir_codes; + std::string manufacturer; + std::string model; std::vector * success; sem_t * semaphore; ctrlm_irdb_vendor_info_t vendor_info; @@ -91,7 +93,7 @@ class ctrlm_irdb_interface_t { bool open_plugin(); bool close_plugin(); - bool _program_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id, ctrlm_irdb_ir_code_set_t *ir_codes); + bool _program_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id, ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer = "", const std::string &model = ""); bool _clear_ir_codes(ctrlm_network_id_t network_id, ctrlm_controller_id_t controller_id); void *m_irdbPluginHandle; @@ -99,6 +101,9 @@ class ctrlm_irdb_interface_t { ctrlm_irdb_mode_t mode; bool m_platform_tv; std::mutex m_mutex; + std::string m_last_entry_id_manufacturer; + std::string m_last_entry_id_model; + ctrlm_irdb_entry_id_list_t m_last_entry_ids; }; #endif diff --git a/src/network/ctrlm_ir_rf_db.cpp b/src/network/ctrlm_ir_rf_db.cpp index 126e57cb..968eec92 100644 --- a/src/network/ctrlm_ir_rf_db.cpp +++ b/src/network/ctrlm_ir_rf_db.cpp @@ -43,6 +43,10 @@ ctrlm_ir_rf_db_t::ctrlm_ir_rf_db_t(bool power_toggle_favor_tv, bool power_discre this->power_discrete_favor_tv = power_discrete_favor_tv; this->tv_ir_code_id_ = "0"; this->avr_ir_code_id_ = "0"; + this->tv_manufacturer_ = ""; + this->tv_model_ = ""; + this->avr_manufacturer_ = ""; + this->avr_model_ = ""; } ctrlm_ir_rf_db_t::~ctrlm_ir_rf_db_t() { @@ -174,17 +178,21 @@ ctrlm_key_code_t to_ctrlm_keycode(ctrlm_irdb_key_code_t irdb_code) { } } -bool ctrlm_ir_rf_db_t::add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes) { +bool ctrlm_ir_rf_db_t::add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer, const std::string &model) { bool ret = false; if(ir_codes) { ctrlm_ir_rf_db_dev_type_t type = ctrlm_ir_rf_db_entry_t::type_from_irdb(ir_codes->type); switch(type) { case CTRLM_IR_RF_DB_DEV_TV: { this->tv_ir_code_id_ = ir_codes->id; + this->tv_manufacturer_ = manufacturer; + this->tv_model_ = model; break; } case CTRLM_IR_RF_DB_DEV_AVR: { this->avr_ir_code_id_ = ir_codes->id; + this->avr_manufacturer_ = manufacturer; + this->avr_model_ = model; break; } default: { @@ -227,6 +235,8 @@ void ctrlm_ir_rf_db_t::clear_tv_ir_codes() { this->fix_common_slots_and_ir_flags(); this->tv_ir_code_id_ = "0"; + this->tv_manufacturer_ = ""; + this->tv_model_ = ""; } void ctrlm_ir_rf_db_t::clear_avr_ir_codes() { @@ -251,6 +261,8 @@ void ctrlm_ir_rf_db_t::clear_avr_ir_codes() { this->fix_common_slots_and_ir_flags(); this->avr_ir_code_id_ = "0"; + this->avr_manufacturer_ = ""; + this->avr_model_ = ""; } void ctrlm_ir_rf_db_t::clear_ir_codes() { @@ -260,6 +272,10 @@ void ctrlm_ir_rf_db_t::clear_ir_codes() { } this->tv_ir_code_id_ = "0"; this->avr_ir_code_id_ = "0"; + this->tv_manufacturer_ = ""; + this->tv_model_ = ""; + this->avr_manufacturer_ = ""; + this->avr_model_ = ""; } ctrlm_ir_rf_db_entry_t *ctrlm_ir_rf_db_t::get_ir_code(ctrlm_key_code_t key) { @@ -274,7 +290,11 @@ std::string ctrlm_ir_rf_db_t::to_string(bool debug) const { std::stringstream ss; ss << "IR RF Database: "<< std::endl; ss << "\tTV IR Code ID <" << tv_ir_code_id_ << ">" << std::endl; + ss << "\tTV Manufacturer <" << tv_manufacturer_ << ">" << std::endl; + ss << "\tTV Model <" << tv_model_ << ">" << std::endl; ss << "\tAVR IR Code ID <" << avr_ir_code_id_ << ">" << std::endl; + ss << "\tAVR Manufacturer <" << avr_manufacturer_ << ">" << std::endl; + ss << "\tAVR Model <" << avr_model_ << ">" << std::endl; for(auto itr = this->ir_rf_db.begin(); itr != this->ir_rf_db.end(); itr++) { if(itr->second != NULL) { ss << "\tKeySlot <" << ctrlm_key_code_str(itr->first) << ">, " << itr->second->to_string(debug) << std::endl; @@ -375,6 +395,10 @@ void ctrlm_ir_rf_db_t::load_db() { } ctrlm_db_tv_ir_code_id_read(tv_ir_code_id_); ctrlm_db_avr_ir_code_id_read(avr_ir_code_id_); + ctrlm_db_tv_manufacturer_read(tv_manufacturer_); + ctrlm_db_tv_model_read(tv_model_); + ctrlm_db_avr_manufacturer_read(avr_manufacturer_); + ctrlm_db_avr_model_read(avr_model_); } bool ctrlm_ir_rf_db_t::store_db() { @@ -383,6 +407,10 @@ bool ctrlm_ir_rf_db_t::store_db() { } ctrlm_db_tv_ir_code_id_write(tv_ir_code_id_); ctrlm_db_avr_ir_code_id_write(avr_ir_code_id_); + ctrlm_db_tv_manufacturer_write(tv_manufacturer_); + ctrlm_db_tv_model_write(tv_model_); + ctrlm_db_avr_manufacturer_write(avr_manufacturer_); + ctrlm_db_avr_model_write(avr_model_); return(true); // TODO, maybe change to void } diff --git a/src/network/ctrlm_ir_rf_db.h b/src/network/ctrlm_ir_rf_db.h index c9f489a2..4286d33f 100644 --- a/src/network/ctrlm_ir_rf_db.h +++ b/src/network/ctrlm_ir_rf_db.h @@ -60,7 +60,7 @@ class ctrlm_ir_rf_db_t { * @param ir_codes A keymap supplied from the CTRLM IRDB component * @reutrn True if the entries were added to the IRRF Database, False otherwise. */ - bool add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes); + bool add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer = "", const std::string &model = ""); /** * Function to clear all TV IR codes stored in the IR RF Database @@ -158,6 +158,10 @@ class ctrlm_ir_rf_db_t { bool power_discrete_favor_tv; std::string tv_ir_code_id_; std::string avr_ir_code_id_; + std::string tv_manufacturer_; + std::string tv_model_; + std::string avr_manufacturer_; + std::string avr_model_; }; From 077be3b212f46205ffc5ab4c9be3286f2b225e11 Mon Sep 17 00:00:00 2001 From: Gene Gallagher Date: Fri, 17 Jul 2026 17:37:13 +0000 Subject: [PATCH 3/4] retrieve man/model info from autolookup functions --- src/attributes/ctrlm_attr_general.cpp | 10 ++-- src/attributes/ctrlm_attr_voice.cpp | 2 +- src/ble/ctrlm_ble_controller.cpp | 8 ++-- src/ble/ctrlm_ble_controller_attr_version.cpp | 4 +- src/ble/ctrlm_ble_network.cpp | 2 +- src/database/ctrlm_database.cpp | 2 +- src/database/ctrlm_db_types.cpp | 4 +- src/irdb/ctrlm_irdb_interface.cpp | 47 ++++++++++++++++--- src/irdb/ctrlm_irdb_interface.h | 6 +-- src/rf4ce/ctrlm_rf4ce_network.cpp | 2 +- 10 files changed, 61 insertions(+), 26 deletions(-) diff --git a/src/attributes/ctrlm_attr_general.cpp b/src/attributes/ctrlm_attr_general.cpp index a533e6fc..41301732 100644 --- a/src/attributes/ctrlm_attr_general.cpp +++ b/src/attributes/ctrlm_attr_general.cpp @@ -76,7 +76,7 @@ bool ctrlm_string_db_attr_t::read_db(ctrlm_db_ctx_t ctx) { if(blob.read_db(ctx)) { this->value = blob.to_string(); ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("failed to read from db <%s>", this->get_name().c_str()); } @@ -87,7 +87,9 @@ bool ctrlm_string_db_attr_t::write_db(ctrlm_db_ctx_t ctx) { bool ret = false; ctrlm_db_blob_t blob(this->get_key(), this->get_table()); - if(blob.from_string(this->value)) { + if (this->value.empty()) { + XLOGD_DEBUG("value is empty for db key <%s>", this->get_name().c_str()); + } else if(blob.from_string(this->value)) { if(blob.write_db(ctx)) { ret = true; XLOGD_INFO("%s written to database: %s", this->get_name().c_str(), this->to_string().c_str()); @@ -157,7 +159,7 @@ bool ctrlm_uint64_db_attr_t::read_db(ctrlm_db_ctx_t ctx) { if(data.read_db(ctx)) { this->set_value(data.get_uint64()); ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("failed to read from db <%s>", this->get_name().c_str()); } @@ -237,7 +239,7 @@ bool ctrlm_ieee_db_addr_t::read_db(ctrlm_db_ctx_t ctx) { if(data.read_db(ctx)) { this->set_value(data.get_uint64()); ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("failed to read from db <%s>", this->get_name().c_str()); } diff --git a/src/attributes/ctrlm_attr_voice.cpp b/src/attributes/ctrlm_attr_voice.cpp index 87f1759d..98b845a4 100644 --- a/src/attributes/ctrlm_attr_voice.cpp +++ b/src/attributes/ctrlm_attr_voice.cpp @@ -256,7 +256,7 @@ bool ctrlm_voice_metrics_t::read_db(ctrlm_db_ctx_t ctx) { this->utterances_exceeding_packet_loss_threshold_today = ((buf[39] << 24) | (buf[38] << 16) | (buf[37] << 8) | buf[36]); this->utterances_exceeding_packet_loss_threshold_yesterday = ((buf[43] << 24) | (buf[42] << 16) | (buf[41] << 8) | buf[40]); ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("data from db is too small <%s>", this->get_name().c_str()); } diff --git a/src/ble/ctrlm_ble_controller.cpp b/src/ble/ctrlm_ble_controller.cpp index 7d98f711..b656c2fa 100644 --- a/src/ble/ctrlm_ble_controller.cpp +++ b/src/ble/ctrlm_ble_controller.cpp @@ -664,10 +664,10 @@ void ctrlm_obj_controller_ble_t::print_status() { } else { XLOGD_INFO("IR Database Support : N/A"); } - XLOGD_INFO("Programmed TV IRDB Code : %s", irdb_entry_id_name_tv_->to_string().c_str()); - XLOGD_INFO("Programmed TV IRDB Manufacturer/Model: %s / %s", irdb_manufacturer_tv_->to_string().c_str(), irdb_model_tv_->to_string().c_str()); - XLOGD_INFO("Programmed AVR IRDB Code : %s", irdb_entry_id_name_avr_->to_string().c_str()); - XLOGD_INFO("Programmed AVR IRDB Manufacturer/Model: %s / %s", irdb_manufacturer_avr_->to_string().c_str(), irdb_model_avr_->to_string().c_str()); + XLOGD_INFO("Programmed TV IRDB Code : %s (Manufacturer = %s, Model = %s)", + irdb_entry_id_name_tv_->to_string().c_str(), irdb_manufacturer_tv_->to_string().c_str(), irdb_model_tv_->to_string().c_str()); + XLOGD_INFO("Programmed AVR IRDB Code : %s (Manufacturer = %s, Model = %s)", + irdb_entry_id_name_avr_->to_string().c_str(), irdb_manufacturer_avr_->to_string().c_str(), irdb_model_avr_->to_string().c_str()); XLOGD_INFO(""); voice_metrics_->print(__FUNCTION__); XLOGD_WARN("------------------------------------------------------------"); diff --git a/src/ble/ctrlm_ble_controller_attr_version.cpp b/src/ble/ctrlm_ble_controller_attr_version.cpp index 0bfd0a41..a27e9662 100644 --- a/src/ble/ctrlm_ble_controller_attr_version.cpp +++ b/src/ble/ctrlm_ble_controller_attr_version.cpp @@ -40,7 +40,7 @@ bool ctrlm_ble_sw_version_t::read_db(ctrlm_db_ctx_t ctx) { if(blob.read_db(ctx)) { if (this->from_string(blob.to_string())) { ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("%s read from database failed to parse <%s> ", this->get_name().c_str(), blob.to_string().c_str()); } @@ -90,7 +90,7 @@ bool ctrlm_ble_hw_version_t::read_db(ctrlm_db_ctx_t ctx) { if(blob.read_db(ctx)) { if (this->from_string(blob.to_string())) { ret = true; - XLOGD_INFO("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); + XLOGD_DEBUG("%s read from database: %s", this->get_name().c_str(), this->to_string().c_str()); } else { XLOGD_ERROR("%s read from database failed to parse <%s> ", this->get_name().c_str(), blob.to_string().c_str()); } diff --git a/src/ble/ctrlm_ble_network.cpp b/src/ble/ctrlm_ble_network.cpp index 1ad4a3ff..824af15f 100644 --- a/src/ble/ctrlm_ble_network.cpp +++ b/src/ble/ctrlm_ble_network.cpp @@ -770,7 +770,7 @@ void ctrlm_obj_network_ble_t::req_process_program_ir_codes(void *data, int size) } else { ctrlm_controller_id_t controller_id = dqm->controller_id; if (!is_managed_by_network(controller_id)) { - XLOGD_ERROR("Controller %d is not managed by the %s network", controller_id, name_get()); + XLOGD_WARN("Controller %d is not managed by the %s network", controller_id, name_get()); } else if (!controller_exists(controller_id)) { XLOGD_ERROR("Controller doesn't exist!"); } else if (!controllers_[controller_id]->isSupportedIrdb(dqm->vendor_info)) { diff --git a/src/database/ctrlm_database.cpp b/src/database/ctrlm_database.cpp index b8a8f021..5271d460 100644 --- a/src/database/ctrlm_database.cpp +++ b/src/database/ctrlm_database.cpp @@ -476,7 +476,7 @@ gpointer ctrlm_db_thread(gpointer param) { case CTRLM_DB_QUEUE_MSG_TYPE_WRITE_BLOB: { ctrlm_db_queue_msg_write_blob_t *blob = (ctrlm_db_queue_msg_write_blob_t *)msg; XLOGD_DEBUG("WRITE BLOB %s:%s:%u", blob->table, blob->key, blob->length); - ctrlm_print_data_hex(__FUNCTION__, blob->value, blob->length, 16); + // ctrlm_print_data_hex(__FUNCTION__, blob->value, blob->length, 16); ctrlm_db_write_blob_(blob->table, blob->key, blob->value, blob->length); break; } diff --git a/src/database/ctrlm_db_types.cpp b/src/database/ctrlm_db_types.cpp index 0a464b06..362c9f3c 100644 --- a/src/database/ctrlm_db_types.cpp +++ b/src/database/ctrlm_db_types.cpp @@ -35,7 +35,7 @@ ctrlm_db_obj_t::~ctrlm_db_obj_t() { bool ctrlm_db_obj_t::read_db(ctrlm_db_ctx_t ctx) { bool ret = false; sqlite3 *handle = (sqlite3 *)ctx; - XLOGD_INFO("reading blob %s from table %s", this->key.c_str(), this->table.c_str()); + XLOGD_DEBUG("reading blob %s from table %s", this->key.c_str(), this->table.c_str()); if(handle) { sqlite3_stmt *stmt = NULL; std::string query = "SELECT value FROM " + this->table + " WHERE key='" + this->key + "';"; @@ -63,7 +63,7 @@ bool ctrlm_db_obj_t::read_db(ctrlm_db_ctx_t ctx) { bool ctrlm_db_obj_t::write_db(ctrlm_db_ctx_t ctx) { bool ret = false; sqlite3 *handle = (sqlite3 *)ctx; - XLOGD_INFO("writing blob %s to table %s", this->key.c_str(), this->table.c_str()); + XLOGD_DEBUG("writing blob %s to table %s", this->key.c_str(), this->table.c_str()); if(handle) { sqlite3_stmt *stmt = NULL; std::string query = "INSERT OR REPLACE INTO " + this->table + "(key,value) VALUES (?,?);"; diff --git a/src/irdb/ctrlm_irdb_interface.cpp b/src/irdb/ctrlm_irdb_interface.cpp index ac2cf027..ae592335 100644 --- a/src/irdb/ctrlm_irdb_interface.cpp +++ b/src/irdb/ctrlm_irdb_interface.cpp @@ -409,9 +409,9 @@ bool ctrlm_irdb_interface_t::get_irdb_entry_ids(ctrlm_irdb_entry_id_list_t &code ret = (*g_irdb.pluginGetEntryIds)(codes, type, manufacturer, model); } if(ret) { - m_last_entry_id_manufacturer = manufacturer; - m_last_entry_id_model = model; - m_last_entry_ids = codes; + m_last_entry_id_manufacturer[type] = manufacturer; + m_last_entry_id_model[type] = model; + m_last_entry_ids[type] = codes; } return ret; } @@ -562,6 +562,26 @@ bool ctrlm_irdb_interface_t::get_ir_codes_by_autolookup(ctrlm_autolookup_ranked_ codes[CTRLM_IRDB_DEV_TYPE_AVR].erase( unique( codes[CTRLM_IRDB_DEV_TYPE_AVR].begin(), codes[CTRLM_IRDB_DEV_TYPE_AVR].end() ), codes[CTRLM_IRDB_DEV_TYPE_AVR].end() ); } + m_last_entry_ids.clear(); + m_last_entry_id_manufacturer.clear(); + m_last_entry_id_model.clear(); + for(const auto &type_codes : codes) { + ctrlm_irdb_entry_id_list_t entry_ids; + entry_ids.reserve(type_codes.second.size()); + for(const auto &entry : type_codes.second) { + entry_ids.push_back(entry.id); + } + m_last_entry_ids[type_codes.first] = entry_ids; + + // The different auto lookup methods may return a different manufacturer and model for the same device. + // There is no way of knowing which one is correct. For now, just use the highest ranked which is the first one in the list. + if(!type_codes.second.empty()) { + m_last_entry_id_manufacturer[type_codes.first] = type_codes.second.front().manufacturer; + m_last_entry_id_model[type_codes.first] = type_codes.second.front().model; + } + } + + return(ret); } @@ -571,12 +591,25 @@ bool ctrlm_irdb_interface_t::program_ir_codes(ctrlm_network_id_t network_id, ctr std::string manufacturer; std::string model; - XLOGD_INFO("Programming IR codes for (%u, %u) with database id <%s>", network_id, controller_id, id.c_str()); - if(std::find(m_last_entry_ids.begin(), m_last_entry_ids.end(), id) != m_last_entry_ids.end()) { - manufacturer = m_last_entry_id_manufacturer; - model = m_last_entry_id_model; + auto ids_itr = m_last_entry_ids.find(type); + if(ids_itr != m_last_entry_ids.end() && std::find(ids_itr->second.begin(), ids_itr->second.end(), id) != ids_itr->second.end()) { + auto manufacturer_itr = m_last_entry_id_manufacturer.find(type); + auto model_itr = m_last_entry_id_model.find(type); + if(manufacturer_itr != m_last_entry_id_manufacturer.end()) { + manufacturer = manufacturer_itr->second; + } + if(model_itr != m_last_entry_id_model.end()) { + model = model_itr->second; + } } + + XLOGD_INFO("Programming IR codes for (%u, %u) with database id <%s>, manufacturer <%s>, model <%s>", + network_id, + controller_id, + id.c_str(), + manufacturer.empty() ? "INVALID" : manufacturer.c_str(), + model.empty() ? "INVALID" : model.c_str()); ctrlm_irdb_ir_code_set_t code_set; if (g_irdb.pluginGetCodeSet) { diff --git a/src/irdb/ctrlm_irdb_interface.h b/src/irdb/ctrlm_irdb_interface.h index 3a976397..7cc9728f 100644 --- a/src/irdb/ctrlm_irdb_interface.h +++ b/src/irdb/ctrlm_irdb_interface.h @@ -101,9 +101,9 @@ class ctrlm_irdb_interface_t { ctrlm_irdb_mode_t mode; bool m_platform_tv; std::mutex m_mutex; - std::string m_last_entry_id_manufacturer; - std::string m_last_entry_id_model; - ctrlm_irdb_entry_id_list_t m_last_entry_ids; + std::map m_last_entry_id_manufacturer; + std::map m_last_entry_id_model; + std::map m_last_entry_ids; }; #endif diff --git a/src/rf4ce/ctrlm_rf4ce_network.cpp b/src/rf4ce/ctrlm_rf4ce_network.cpp index 2caa75c2..82102185 100644 --- a/src/rf4ce/ctrlm_rf4ce_network.cpp +++ b/src/rf4ce/ctrlm_rf4ce_network.cpp @@ -4433,7 +4433,7 @@ void ctrlm_obj_network_rf4ce_t::req_process_program_ir_codes(void *data, int siz bool success = false; if(!is_managed_by_network(dqm->controller_id)) { - XLOGD_ERROR("controller %d is not managed by the %s network", dqm->controller_id, name_get()); + XLOGD_WARN("controller %d is not managed by the %s network", dqm->controller_id, name_get()); } else if(controller_exists(dqm->controller_id)) { if(dqm->ir_codes) { XLOGD_INFO("Setting IR Codes on Controller %u", dqm->controller_id); From 229ef1bbf9229148bfa85e5463c8cfb63ca2ca49 Mon Sep 17 00:00:00 2001 From: Gene Gallagher Date: Mon, 27 Jul 2026 19:15:15 +0000 Subject: [PATCH 4/4] default man and model and vendor name to INVALID instead of empty string to avoid db write/read errors --- src/network/ctrlm_ir_rf_db.cpp | 12 ++++++------ src/network/ctrlm_ir_rf_db.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/ctrlm_ir_rf_db.cpp b/src/network/ctrlm_ir_rf_db.cpp index 08696686..d36b8aa9 100644 --- a/src/network/ctrlm_ir_rf_db.cpp +++ b/src/network/ctrlm_ir_rf_db.cpp @@ -189,18 +189,18 @@ bool ctrlm_ir_rf_db_t::add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes, const switch(type) { case CTRLM_IR_RF_DB_DEV_TV: { this->tv_ir_code_id_ = ir_codes->id; - this->tv_manufacturer_ = manufacturer; - this->tv_model_ = model; + this->tv_manufacturer_ = manufacturer.empty() ? "INVALID" : manufacturer; + this->tv_model_ = model.empty() ? "INVALID" : model; this->tv_ir_vendor_id_ = ir_vendor_id; - this->tv_ir_vendor_name_ = ir_vendor_name; + this->tv_ir_vendor_name_ = ir_vendor_name.empty() ? "INVALID" : ir_vendor_name; break; } case CTRLM_IR_RF_DB_DEV_AVR: { this->avr_ir_code_id_ = ir_codes->id; - this->avr_manufacturer_ = manufacturer; - this->avr_model_ = model; + this->avr_manufacturer_ = manufacturer.empty() ? "INVALID" : manufacturer; + this->avr_model_ = model.empty() ? "INVALID" : model; this->avr_ir_vendor_id_ = ir_vendor_id; - this->avr_ir_vendor_name_ = ir_vendor_name; + this->avr_ir_vendor_name_ = ir_vendor_name.empty() ? "INVALID" : ir_vendor_name; break; } default: { diff --git a/src/network/ctrlm_ir_rf_db.h b/src/network/ctrlm_ir_rf_db.h index ce57fcb7..838b89d9 100644 --- a/src/network/ctrlm_ir_rf_db.h +++ b/src/network/ctrlm_ir_rf_db.h @@ -60,7 +60,7 @@ class ctrlm_ir_rf_db_t { * @param ir_codes A keymap supplied from the CTRLM IRDB component * @return True if the entries were added to the IRRF Database, False otherwise. */ - bool add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer = "", const std::string &model = "", unsigned char ir_vendor_id = 0, const std::string &ir_vendor_name = ""); + bool add_irdb_codes(ctrlm_irdb_ir_code_set_t *ir_codes, const std::string &manufacturer = "INVALID", const std::string &model = "INVALID", unsigned char ir_vendor_id = 0, const std::string &ir_vendor_name = ""); /** * Function to clear all TV IR codes stored in the IR RF Database