From d12e38c0aecabe0a5aaf797b1b347c86d9745fe2 Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Thu, 26 Sep 2024 15:06:29 -0400 Subject: [PATCH 1/6] Storage Migrator: WIP --- core/main/src/bootstrap/mod.rs | 3 + .../bootstrap/start_storage_migrator_step.rs | 39 +++++ core/main/src/processor/storage/mod.rs | 1 + .../src/processor/storage/storage_migrator.rs | 118 +++++++++++++ core/sdk/src/api/device/device_request.rs | 7 +- .../src/api/device/device_user_settings.rs | 48 ++++++ core/sdk/src/api/device/mod.rs | 1 + core/sdk/src/api/storage_property.rs | 2 +- .../src/bootstrap/setup_thunder_processors.rs | 6 + .../src/client/thunder_plugin.rs | 9 + device/thunder_ripple_sdk/src/lib.rs | 1 + .../src/processors/thunder_user_settings.rs | 160 ++++++++++++++++++ 12 files changed, 392 insertions(+), 3 deletions(-) create mode 100644 core/main/src/bootstrap/start_storage_migrator_step.rs create mode 100644 core/main/src/processor/storage/storage_migrator.rs create mode 100644 core/sdk/src/api/device/device_user_settings.rs create mode 100644 device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs diff --git a/core/main/src/bootstrap/mod.rs b/core/main/src/bootstrap/mod.rs index 7af99555a..1f975f505 100644 --- a/core/main/src/bootstrap/mod.rs +++ b/core/main/src/bootstrap/mod.rs @@ -23,3 +23,6 @@ pub mod start_app_manager_step; pub mod start_communication_broker; pub mod start_fbgateway_step; pub mod start_ws_step; +// +pub mod start_storage_migrator_step; +// diff --git a/core/main/src/bootstrap/start_storage_migrator_step.rs b/core/main/src/bootstrap/start_storage_migrator_step.rs new file mode 100644 index 000000000..a04dae31c --- /dev/null +++ b/core/main/src/bootstrap/start_storage_migrator_step.rs @@ -0,0 +1,39 @@ +// Copyright 2023 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// + +use ripple_sdk::async_trait::async_trait; +use ripple_sdk::{framework::bootstrap::Bootstep, tokio, utils::error::RippleError}; + +use crate::processor::storage::storage_migrator::StorageMigrator; +use crate::state::bootstrap_state::BootstrapState; + +pub struct StartStorageMigratorStep; + +#[async_trait] +impl Bootstep for StartStorageMigratorStep { + fn get_name(&self) -> String { + "StartStorageMigrator".into() + } + + async fn setup(&self, bootstrap_state: BootstrapState) -> Result<(), RippleError> { + tokio::spawn(async move { + let mut migrator = StorageMigrator::new(&bootstrap_state.platform_state); + migrator.migrate().await; + }); + Ok(()) + } +} diff --git a/core/main/src/processor/storage/mod.rs b/core/main/src/processor/storage/mod.rs index 8918f69f7..9e5be4367 100644 --- a/core/main/src/processor/storage/mod.rs +++ b/core/main/src/processor/storage/mod.rs @@ -19,3 +19,4 @@ pub mod default_storage_properties; pub mod storage_manager; pub mod storage_manager_processor; pub mod storage_manager_utils; +pub mod storage_migrator; diff --git a/core/main/src/processor/storage/storage_migrator.rs b/core/main/src/processor/storage/storage_migrator.rs new file mode 100644 index 000000000..d961bef05 --- /dev/null +++ b/core/main/src/processor/storage/storage_migrator.rs @@ -0,0 +1,118 @@ +// Copyright 2023 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// + +use ripple_sdk::{ + api::{device::device_user_settings::UserSettingsRequest, storage_property::StorageProperty}, + extn::extn_client_message::ExtnResponse, + log::error, +}; + +use crate::state::platform_state::PlatformState; + +use super::storage_manager::StorageManager; + +static STORAGE_PROPERTIES: &[StorageProperty] = &[ + StorageProperty::AudioDescriptionEnabled, + // StorageProperty::PreferredAudioLanguages, + // StorageProperty::CCPreferredLanguages, + // StorageProperty::ClosedCaptionsEnabled, +]; + +struct MigrationStatus { + storage_property: StorageProperty, + migrated: bool, +} + +pub struct StorageMigrator { + platform_state: PlatformState, + migration_statuses: Vec, +} + +impl StorageMigrator { + pub fn new(platform_state: &PlatformState) -> Self { + let mut migration_statuses = vec![]; + for storage_property in STORAGE_PROPERTIES.iter() { + migration_statuses.push(MigrationStatus { + storage_property: storage_property.clone(), + migrated: false, + }); + } + Self { + platform_state: platform_state.clone(), + migration_statuses, + } + } + + pub async fn migrate(&mut self) { + println!("*** _DEBUG: StorageMigrator::migrate: entry"); + for migration_status in &mut self.migration_statuses { + if !migration_status.migrated { + let success = match migration_status.storage_property { + StorageProperty::AudioDescriptionEnabled => { + migrate_audio_description_enabled(&self.platform_state).await + } + _ => { + error!( + "migrate: Unsupported property: {:?}", + migration_status.storage_property + ); + false + } + }; + + println!("migrate: success={}", success); + + if success { + migration_status.migrated = true; + } + } + } + } +} + +async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> bool { + if let Ok(enabled) = + StorageManager::get_bool(platform_state, StorageProperty::AudioDescriptionEnabled).await + { + let result = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetAudioDescription(enabled)) + .await; + + println!( + "*** _DEBUG: migrate_audio_description_enabled: result={:?}", + result + ); + + match result { + //Ok(msg) => msg.payload.extract().is_some(), + Ok(msg) => { + if let Some(ExtnResponse::Error(_)) = msg.payload.as_response() { + false + } else { + true + } + } + Err(_) => false, + } + } else { + error!( + "migrate_audio_description_enabled: Failed to retrieve value from persistent storage" + ); + false + } +} diff --git a/core/sdk/src/api/device/device_request.rs b/core/sdk/src/api/device/device_request.rs index f790dd844..fb74d9b70 100644 --- a/core/sdk/src/api/device/device_request.rs +++ b/core/sdk/src/api/device/device_request.rs @@ -27,8 +27,8 @@ use std::str::FromStr; use super::{ device_accessory::RemoteAccessoryRequest, device_apps::AppsRequest, device_browser::BrowserRequest, device_info_request::DeviceInfoRequest, - device_peristence::DevicePersistenceRequest, device_wifi::WifiRequest, - device_window_manager::WindowManagerRequest, + device_peristence::DevicePersistenceRequest, device_user_settings::UserSettingsRequest, + device_wifi::WifiRequest, device_window_manager::WindowManagerRequest, }; #[derive(Debug, Clone, Serialize, Deserialize)] @@ -41,6 +41,9 @@ pub enum DeviceRequest { Wifi(WifiRequest), Accessory(RemoteAccessoryRequest), Apps(AppsRequest), + // + UserSettings(UserSettingsRequest), + // } #[derive(Hash, Eq, PartialEq, Debug, Serialize, Deserialize, Clone)] diff --git a/core/sdk/src/api/device/device_user_settings.rs b/core/sdk/src/api/device/device_user_settings.rs new file mode 100644 index 000000000..3e99670d9 --- /dev/null +++ b/core/sdk/src/api/device/device_user_settings.rs @@ -0,0 +1,48 @@ +use serde::{Deserialize, Serialize}; + +use crate::{ + extn::extn_client_message::{ExtnPayload, ExtnPayloadProvider, ExtnRequest}, + framework::ripple_contract::RippleContract, +}; + +use super::device_request::DeviceRequest; + +#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] +pub enum UserSettingsRequest { + GetAudioDescription, + SetAudioDescription(bool), + GetPreferredAudioLanguages, + SetPreferredAudioLanguages, + GetPresentationLanguage, + SetPresentationLanguage, + GetCaptions, + SetCaptions, + GetPreferredCaptionsLanguages, + SetPreferredCaptionsLanguages, + GetPreferredClosedCaptionService, + SetPreferredClosedCaptionService, + GetPrivacyMode, + SetPrivacyMode, +} + +impl ExtnPayloadProvider for UserSettingsRequest { + fn get_extn_payload(&self) -> ExtnPayload { + ExtnPayload::Request(ExtnRequest::Device(DeviceRequest::UserSettings( + self.clone(), + ))) + } + + fn get_from_payload(payload: ExtnPayload) -> Option { + if let ExtnPayload::Request(ExtnRequest::Device(DeviceRequest::UserSettings(request))) = + payload + { + return Some(request); + } + + None + } + + fn contract() -> RippleContract { + RippleContract::Settings + } +} diff --git a/core/sdk/src/api/device/mod.rs b/core/sdk/src/api/device/mod.rs index 94ca527b2..bace54941 100644 --- a/core/sdk/src/api/device/mod.rs +++ b/core/sdk/src/api/device/mod.rs @@ -28,3 +28,4 @@ pub mod device_user_grants_data; pub mod device_wifi; pub mod device_window_manager; pub mod entertainment_data; +pub mod device_user_settings; diff --git a/core/sdk/src/api/storage_property.rs b/core/sdk/src/api/storage_property.rs index f79952df9..861c0ffd2 100644 --- a/core/sdk/src/api/storage_property.rs +++ b/core/sdk/src/api/storage_property.rs @@ -440,7 +440,7 @@ pub struct PropertyData { pub event_names: Option<&'static [&'static str]>, } -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Hash)] pub enum StorageProperty { ClosedCaptionsEnabled, ClosedCaptionsFontFamily, diff --git a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs index 80e34c7d8..bd316aac7 100644 --- a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs +++ b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs @@ -22,6 +22,7 @@ use ripple_sdk::log::error; use crate::processors::thunder_package_manager::ThunderPackageManagerRequestProcessor; use crate::processors::thunder_rfc::ThunderRFCProcessor; use crate::processors::thunder_telemetry::ThunderTelemetryProcessor; +use crate::processors::thunder_user_settings::ThunderUserSettingsRequestProcessor; use crate::thunder_state::ThunderBootstrapStateWithClient; use crate::processors::{ @@ -48,6 +49,11 @@ impl SetupThunderProcessor { extn_client.add_request_processor(ThunderBrowserRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderWifiRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderStorageRequestProcessor::new(state.clone().state)); + // + extn_client.add_request_processor(ThunderUserSettingsRequestProcessor::new( + state.clone().state, + )); + // extn_client.add_request_processor(ThunderWindowManagerRequestProcessor::new( state.state.clone(), )); diff --git a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs index 893a48e45..61fc5ef7c 100644 --- a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs +++ b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs @@ -35,6 +35,9 @@ pub enum ThunderPlugin { Hdcp, Telemetry, PackageManager, + // + UserSettings, + // } const CONTROLLER_CFG: Cfg = Cfg::new("Controller", false, true); const DEVICE_INFO_CFG: Cfg = Cfg::new("DeviceInfo", true, false); @@ -50,6 +53,9 @@ const LOCATION_SYNC: Cfg = Cfg::new("LocationSync", false, false); const TTS_CFG: Cfg = Cfg::new("org.rdk.TextToSpeech", false, true); const TELEMETRY_CFG: Cfg = Cfg::new("org.rdk.Telemetry", false, false); const PACKAGE_MANAGER_CFG: Cfg = Cfg::new("org.rdk.PackageManager", false, false); +// +const USER_SETTINGS_CFG: Cfg = Cfg::new("org.rdk.UserSettings", false, false); +// impl ThunderPlugin { pub fn cfg(&self) -> Cfg { @@ -69,6 +75,9 @@ impl ThunderPlugin { TextToSpeech => TTS_CFG, Telemetry => TELEMETRY_CFG, PackageManager => PACKAGE_MANAGER_CFG, + // + UserSettings => USER_SETTINGS_CFG, + // } } pub fn callsign(&self) -> &str { diff --git a/device/thunder_ripple_sdk/src/lib.rs b/device/thunder_ripple_sdk/src/lib.rs index d1be27775..c47900eb3 100644 --- a/device/thunder_ripple_sdk/src/lib.rs +++ b/device/thunder_ripple_sdk/src/lib.rs @@ -38,6 +38,7 @@ pub mod processors { pub mod thunder_browser; pub mod thunder_device_info; pub mod thunder_events; + pub mod thunder_user_settings; pub mod events { pub mod thunder_event_handlers; } diff --git a/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs new file mode 100644 index 000000000..e172501e1 --- /dev/null +++ b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs @@ -0,0 +1,160 @@ +// Copyright 2023 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// + +use jsonrpsee::core::async_trait; +use ripple_sdk::{ + api::device::{ + device_operator::{DeviceCallRequest, DeviceChannelParams, DeviceOperator}, + device_user_settings::UserSettingsRequest, + }, + extn::{ + client::{ + extn_client::ExtnClient, + extn_processor::{ + DefaultExtnStreamer, ExtnRequestProcessor, ExtnStreamProcessor, ExtnStreamer, + }, + }, + extn_client_message::{ExtnMessage, ExtnResponse}, + }, + serde_json::json, + tokio::sync::mpsc, + utils::error::RippleError, +}; + +use crate::{client::thunder_plugin::ThunderPlugin, thunder_state::ThunderState}; + +#[derive(Debug)] +pub struct ThunderUserSettingsRequestProcessor { + state: ThunderState, + streamer: DefaultExtnStreamer, +} + +impl ThunderUserSettingsRequestProcessor { + pub fn new(state: ThunderState) -> ThunderUserSettingsRequestProcessor { + ThunderUserSettingsRequestProcessor { + state, + streamer: DefaultExtnStreamer::new(), + } + } + + async fn get_audio_description(state: ThunderState, req: ExtnMessage) -> bool { + let thunder_method = ThunderPlugin::UserSettings.method("getAudioDescription"); + let thunder_resp = state + .get_thunder_client() + .call(DeviceCallRequest { + method: thunder_method, + params: None, + }) + .await; + + println!( + "*** _DEBUG: get_audio_description: thunder_resp={:?}", + thunder_resp + ); + + let extn_resp = match thunder_resp.message["success"].as_bool() { + Some(v) => ExtnResponse::Boolean(v), + None => ExtnResponse::Error(RippleError::InvalidOutput), + }; + + println!( + "*** _DEBUG: get_audio_description: ripple_resp={:?}", + extn_resp + ); + + Self::respond(state.get_client(), req, extn_resp) + .await + .is_ok() + } + + async fn set_audio_description(state: ThunderState, req: ExtnMessage, enabled: bool) -> bool { + let thunder_method = ThunderPlugin::UserSettings.method("setAudioDescription"); + let thunder_resp = state + .get_thunder_client() + .call(DeviceCallRequest { + method: thunder_method, + params: Some(DeviceChannelParams::Json( + json!({"enabled": enabled}).to_string(), + )), + }) + .await; + + println!( + "*** _DEBUG: set_audio_description: thunder_resp={:?}", + thunder_resp + ); + + let extn_resp = match thunder_resp.message["success"].as_bool() { + Some(v) => ExtnResponse::Boolean(v), + None => ExtnResponse::Error(RippleError::InvalidOutput), + }; + + println!( + "*** _DEBUG: set_audio_description: ripple_resp={:?}", + extn_resp + ); + + Self::respond(state.get_client(), req, extn_resp) + .await + .is_ok() + } +} + +impl ExtnStreamProcessor for ThunderUserSettingsRequestProcessor { + type STATE = ThunderState; + type VALUE = UserSettingsRequest; + + fn get_state(&self) -> Self::STATE { + self.state.clone() + } + + fn receiver(&mut self) -> mpsc::Receiver { + self.streamer.receiver() + } + + fn sender(&self) -> mpsc::Sender { + self.streamer.sender() + } +} + +#[async_trait] +impl ExtnRequestProcessor for ThunderUserSettingsRequestProcessor { + fn get_client(&self) -> ExtnClient { + self.state.get_client() + } + async fn process_request( + state: Self::STATE, + msg: ExtnMessage, + extracted_message: Self::VALUE, + ) -> bool { + match extracted_message { + UserSettingsRequest::GetAudioDescription => { + Self::get_audio_description(state.clone(), msg).await + } + UserSettingsRequest::SetAudioDescription(enabled) => { + Self::set_audio_description(state.clone(), msg, enabled).await + } + _ => Self::respond( + state.get_client(), + msg, + ExtnResponse::Error(RippleError::NotAvailable), + ) + .await + .is_ok(), + } + } +} From 0598be479d0156b684b11c1245ef59f9d3af9eb6 Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Mon, 30 Sep 2024 15:10:10 -0400 Subject: [PATCH 2/6] Storage Migrator: UserSettings --- core/main/src/bootstrap/boot.rs | 4 + .../bootstrap/start_storage_migrator_step.rs | 1 + .../src/processor/storage/storage_migrator.rs | 226 +++++++++++++++--- .../src/api/device/device_user_settings.rs | 12 +- core/sdk/src/extn/client/extn_client.rs | 1 + .../src/bootstrap/setup_thunder_processors.rs | 3 + .../src/processors/thunder_user_settings.rs | 140 +++++++++-- 7 files changed, 328 insertions(+), 59 deletions(-) diff --git a/core/main/src/bootstrap/boot.rs b/core/main/src/bootstrap/boot.rs index bc758226d..e269099fe 100644 --- a/core/main/src/bootstrap/boot.rs +++ b/core/main/src/bootstrap/boot.rs @@ -35,6 +35,7 @@ use super::{ start_app_manager_step::StartAppManagerStep, start_communication_broker::{StartCommunicationBroker, StartOtherBrokers}, start_fbgateway_step::FireboltGatewayStep, + start_storage_migrator_step::StartStorageMigratorStep, start_ws_step::StartWsStep, }; /// Starts up Ripple uses `PlatformState` to manage State @@ -72,6 +73,9 @@ pub async fn boot(state: BootstrapState) -> RippleResponse { execute_step(LoadDistributorValuesStep, &bootstrap).await?; execute_step(CheckLauncherStep, &bootstrap).await?; execute_step(StartWsStep, &bootstrap).await?; + // + execute_step(StartStorageMigratorStep, &bootstrap).await?; + // execute_step(FireboltGatewayStep, &bootstrap).await?; Ok(()) } diff --git a/core/main/src/bootstrap/start_storage_migrator_step.rs b/core/main/src/bootstrap/start_storage_migrator_step.rs index a04dae31c..91651b58e 100644 --- a/core/main/src/bootstrap/start_storage_migrator_step.rs +++ b/core/main/src/bootstrap/start_storage_migrator_step.rs @@ -30,6 +30,7 @@ impl Bootstep for StartStorageMigratorStep { } async fn setup(&self, bootstrap_state: BootstrapState) -> Result<(), RippleError> { + println!("*** _DEBUG: StartStorageMigratorStep::setup: entry"); tokio::spawn(async move { let mut migrator = StorageMigrator::new(&bootstrap_state.platform_state); migrator.migrate().await; diff --git a/core/main/src/processor/storage/storage_migrator.rs b/core/main/src/processor/storage/storage_migrator.rs index d961bef05..daca0dfa8 100644 --- a/core/main/src/processor/storage/storage_migrator.rs +++ b/core/main/src/processor/storage/storage_migrator.rs @@ -18,23 +18,42 @@ use ripple_sdk::{ api::{device::device_user_settings::UserSettingsRequest, storage_property::StorageProperty}, extn::extn_client_message::ExtnResponse, - log::error, + log::{error, info}, }; use crate::state::platform_state::PlatformState; use super::storage_manager::StorageManager; +use std::time::{SystemTime, UNIX_EPOCH}; + +fn get_current_time_ms() -> u64 { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() + .try_into() + .unwrap() +} + static STORAGE_PROPERTIES: &[StorageProperty] = &[ StorageProperty::AudioDescriptionEnabled, - // StorageProperty::PreferredAudioLanguages, - // StorageProperty::CCPreferredLanguages, - // StorageProperty::ClosedCaptionsEnabled, + StorageProperty::PreferredAudioLanguages, + StorageProperty::CCPreferredLanguages, + StorageProperty::ClosedCaptionsEnabled, ]; +#[derive(Debug, PartialEq)] +enum MigrationState { + NotStarted, + NotNeeded, + Succeeded, + Failed, +} + struct MigrationStatus { storage_property: StorageProperty, - migrated: bool, + migration_state: MigrationState, } pub struct StorageMigrator { @@ -48,7 +67,7 @@ impl StorageMigrator { for storage_property in STORAGE_PROPERTIES.iter() { migration_statuses.push(MigrationStatus { storage_property: storage_property.clone(), - migrated: false, + migration_state: MigrationState::NotStarted, }); } Self { @@ -59,60 +78,195 @@ impl StorageMigrator { pub async fn migrate(&mut self) { println!("*** _DEBUG: StorageMigrator::migrate: entry"); + let start_time_ms = get_current_time_ms(); + for migration_status in &mut self.migration_statuses { - if !migration_status.migrated { - let success = match migration_status.storage_property { + if [MigrationState::NotStarted, MigrationState::Failed] + .contains(&migration_status.migration_state) + { + migration_status.migration_state = match migration_status.storage_property { StorageProperty::AudioDescriptionEnabled => { migrate_audio_description_enabled(&self.platform_state).await } + StorageProperty::PreferredAudioLanguages => { + migrate_preferred_audio_languages(&self.platform_state).await + } + StorageProperty::CCPreferredLanguages => { + migrate_preferred_cc_languages(&self.platform_state).await + } + StorageProperty::ClosedCaptionsEnabled => { + migrate_cc_enabled(&self.platform_state).await + } _ => { error!( "migrate: Unsupported property: {:?}", migration_status.storage_property ); - false + error!( + "*** _DEBUG: migrate: Unsupported property: {:?}", + migration_status.storage_property + ); + MigrationState::Failed } }; - - println!("migrate: success={}", success); - - if success { - migration_status.migrated = true; - } } } + + info!( + "migrate: Total time taken: {} ms", + get_current_time_ms() - start_time_ms + ); + info!( + "*** _DEBUG: migrate: Total time taken: {} ms", + get_current_time_ms() - start_time_ms + ); } } -async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> bool { +async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> MigrationState { + println!("*** _DEBUG: migrate_audio_description_enabled: entry"); + let mut migration_state = MigrationState::Failed; + let start_time_ms = get_current_time_ms(); + if let Ok(enabled) = StorageManager::get_bool(platform_state, StorageProperty::AudioDescriptionEnabled).await { - let result = platform_state + if let Ok(extn_menssage) = platform_state .get_client() .send_extn_request(UserSettingsRequest::SetAudioDescription(enabled)) - .await; + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + } - println!( - "*** _DEBUG: migrate_audio_description_enabled: result={:?}", - result - ); + info!( + "migrate_audio_description_enabled: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + info!( + "*** _DEBUG: migrate_audio_description_enabled: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + + migration_state +} + +async fn migrate_preferred_audio_languages(platform_state: &PlatformState) -> MigrationState { + println!("*** _DEBUG: migrate_preferred_audio_languages: entry"); + let mut migration_state = MigrationState::Failed; + let start_time_ms = get_current_time_ms(); + + let preferred_cc_languages = + StorageManager::get_vec_string(platform_state, StorageProperty::PreferredAudioLanguages) + .await + .unwrap_or_default(); - match result { - //Ok(msg) => msg.payload.extract().is_some(), - Ok(msg) => { - if let Some(ExtnResponse::Error(_)) = msg.payload.as_response() { - false - } else { - true - } + println!( + "*** _DEBUG: migrate_preferred_audio_languages: preferred_cc_languages={:?}", + preferred_cc_languages + ); + + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetPreferredAudioLanguages( + preferred_cc_languages, + )) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + info!( + "migrate_preferred_audio_languages: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + info!( + "*** _DEBUG: migrate_preferred_audio_languages: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + + migration_state +} + +async fn migrate_preferred_cc_languages(platform_state: &PlatformState) -> MigrationState { + println!("*** _DEBUG: migrate_preferred_cc_languages: entry"); + let mut migration_state = MigrationState::Failed; + let start_time_ms = get_current_time_ms(); + + let preferred_cc_languages = + StorageManager::get_vec_string(platform_state, StorageProperty::CCPreferredLanguages) + .await + .unwrap_or_default(); + + println!( + "*** _DEBUG: migrate_preferred_cc_languages: preferred_cc_languages={:?}", + preferred_cc_languages + ); + + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetPreferredCaptionsLanguages( + preferred_cc_languages, + )) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + info!( + "migrate_preferred_cc_languages: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + info!( + "*** _DEBUG: migrate_preferred_cc_languages: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + + migration_state +} + +async fn migrate_cc_enabled(platform_state: &PlatformState) -> MigrationState { + println!("*** _DEBUG: migrate_cc_enabled: entry"); + let mut migration_state = MigrationState::Failed; + let start_time_ms = get_current_time_ms(); + + if let Ok(enabled) = + StorageManager::get_bool(platform_state, StorageProperty::ClosedCaptionsEnabled).await + { + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsEnabled(enabled)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; } - Err(_) => false, } - } else { - error!( - "migrate_audio_description_enabled: Failed to retrieve value from persistent storage" - ); - false } + + info!( + "migrate_cc_enabled: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + info!( + "*** _DEBUG: migrate_cc_enabled: migration_state={:?}, Time taken: {} ms", + migration_state, + get_current_time_ms() - start_time_ms + ); + + migration_state } diff --git a/core/sdk/src/api/device/device_user_settings.rs b/core/sdk/src/api/device/device_user_settings.rs index 3e99670d9..a33aafc0c 100644 --- a/core/sdk/src/api/device/device_user_settings.rs +++ b/core/sdk/src/api/device/device_user_settings.rs @@ -12,17 +12,17 @@ pub enum UserSettingsRequest { GetAudioDescription, SetAudioDescription(bool), GetPreferredAudioLanguages, - SetPreferredAudioLanguages, + SetPreferredAudioLanguages(Vec), GetPresentationLanguage, SetPresentationLanguage, - GetCaptions, - SetCaptions, + GetClosedCaptionsEnabled, + SetClosedCaptionsEnabled(bool), GetPreferredCaptionsLanguages, - SetPreferredCaptionsLanguages, + SetPreferredCaptionsLanguages(Vec), GetPreferredClosedCaptionService, - SetPreferredClosedCaptionService, + SetPreferredClosedCaptionService(String), GetPrivacyMode, - SetPrivacyMode, + SetPrivacyMode(String), } impl ExtnPayloadProvider for UserSettingsRequest { diff --git a/core/sdk/src/extn/client/extn_client.rs b/core/sdk/src/extn/client/extn_client.rs index 16828945f..d011fe7dd 100644 --- a/core/sdk/src/extn/client/extn_client.rs +++ b/core/sdk/src/extn/client/extn_client.rs @@ -144,6 +144,7 @@ impl ExtnClient { } else { vec![processor.contract()] }; + let contracts_supported: Vec = contracts .into_iter() .filter(|contract| self.sender.check_contract_fulfillment(contract.clone())) diff --git a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs index bd316aac7..719904895 100644 --- a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs +++ b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs @@ -50,6 +50,9 @@ impl SetupThunderProcessor { extn_client.add_request_processor(ThunderWifiRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderStorageRequestProcessor::new(state.clone().state)); // + println!( + "*** _DEBUG: SetupThunderProcessor::setup: adding ThunderUserSettingsRequestProcessor" + ); extn_client.add_request_processor(ThunderUserSettingsRequestProcessor::new( state.clone().state, )); diff --git a/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs index e172501e1..26e314561 100644 --- a/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs +++ b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs @@ -30,12 +30,15 @@ use ripple_sdk::{ }, extn_client_message::{ExtnMessage, ExtnResponse}, }, - serde_json::json, + serde_json::{self, json}, tokio::sync::mpsc, utils::error::RippleError, }; -use crate::{client::thunder_plugin::ThunderPlugin, thunder_state::ThunderState}; +use crate::{ + client::{plugin_manager::ThunderError, thunder_plugin::ThunderPlugin}, + thunder_state::ThunderState, +}; #[derive(Debug)] pub struct ThunderUserSettingsRequestProcessor { @@ -45,6 +48,7 @@ pub struct ThunderUserSettingsRequestProcessor { impl ThunderUserSettingsRequestProcessor { pub fn new(state: ThunderState) -> ThunderUserSettingsRequestProcessor { + println!("*** _DEBUG: ThunderUserSettingsRequestProcessor::new: entry"); ThunderUserSettingsRequestProcessor { state, streamer: DefaultExtnStreamer::new(), @@ -61,18 +65,36 @@ impl ThunderUserSettingsRequestProcessor { }) .await; - println!( - "*** _DEBUG: get_audio_description: thunder_resp={:?}", - thunder_resp - ); - let extn_resp = match thunder_resp.message["success"].as_bool() { Some(v) => ExtnResponse::Boolean(v), None => ExtnResponse::Error(RippleError::InvalidOutput), }; + Self::respond(state.get_client(), req, extn_resp) + .await + .is_ok() + } + + async fn set_audio_description(state: ThunderState, req: ExtnMessage, enabled: bool) -> bool { + println!("*** _DEBUG: set_audio_description: enabled={}", enabled); + let thunder_method = ThunderPlugin::UserSettings.method("setAudioDescription"); + let thunder_resp = state + .get_thunder_client() + .call(DeviceCallRequest { + method: thunder_method, + params: Some(DeviceChannelParams::Json( + json!({"enabled": enabled}).to_string(), + )), + }) + .await; + + let extn_resp = match serde_json::from_value::(thunder_resp.message) { + Ok(_) => ExtnResponse::Error(RippleError::ExtnError), + Err(_) => ExtnResponse::None(()), + }; + println!( - "*** _DEBUG: get_audio_description: ripple_resp={:?}", + "*** _DEBUG: set_audio_description: ripple_resp={:?}", extn_resp ); @@ -81,30 +103,103 @@ impl ThunderUserSettingsRequestProcessor { .is_ok() } - async fn set_audio_description(state: ThunderState, req: ExtnMessage, enabled: bool) -> bool { - let thunder_method = ThunderPlugin::UserSettings.method("setAudioDescription"); + async fn set_preferred_audio_languages( + state: ThunderState, + req: ExtnMessage, + languages: Vec, + ) -> bool { + println!( + "*** _DEBUG: set_preferred_audio_languages: languages={:?}", + languages + ); + let thunder_method = ThunderPlugin::UserSettings.method("setPreferredAudioLanguages"); let thunder_resp = state .get_thunder_client() .call(DeviceCallRequest { method: thunder_method, params: Some(DeviceChannelParams::Json( - json!({"enabled": enabled}).to_string(), + json!({"preferredLanguages": languages.join(",")}).to_string(), )), }) .await; + let extn_resp = match serde_json::from_value::(thunder_resp.message) { + Ok(_) => ExtnResponse::Error(RippleError::ExtnError), + Err(_) => ExtnResponse::None(()), + }; + println!( - "*** _DEBUG: set_audio_description: thunder_resp={:?}", - thunder_resp + "*** _DEBUG: set_preferred_audio_languages: ripple_resp={:?}", + extn_resp ); - let extn_resp = match thunder_resp.message["success"].as_bool() { - Some(v) => ExtnResponse::Boolean(v), - None => ExtnResponse::Error(RippleError::InvalidOutput), + Self::respond(state.get_client(), req, extn_resp) + .await + .is_ok() + } + + async fn set_preferred_cc_languages( + state: ThunderState, + req: ExtnMessage, + languages: Vec, + ) -> bool { + println!( + "*** _DEBUG: set_preferred_cc_languages: languages={:?}", + languages + ); + let thunder_method = ThunderPlugin::UserSettings.method("setPreferredCaptionsLanguages"); + let thunder_resp = state + .get_thunder_client() + .call(DeviceCallRequest { + method: thunder_method, + params: Some(DeviceChannelParams::Json( + json!({"preferredLanguages": languages.join(",")}).to_string(), + )), + }) + .await; + + let extn_resp = match serde_json::from_value::(thunder_resp.message) { + Ok(_) => ExtnResponse::Error(RippleError::ExtnError), + Err(_) => ExtnResponse::None(()), }; println!( - "*** _DEBUG: set_audio_description: ripple_resp={:?}", + "*** _DEBUG: set_preferred_cc_languages: ripple_resp={:?}", + extn_resp + ); + + Self::respond(state.get_client(), req, extn_resp) + .await + .is_ok() + } + + async fn set_closed_captions_enabled( + state: ThunderState, + req: ExtnMessage, + enabled: bool, + ) -> bool { + println!( + "*** _DEBUG: set_closed_captions_enabled: enabled={}", + enabled + ); + let thunder_method = ThunderPlugin::UserSettings.method("setCaptions"); + let thunder_resp = state + .get_thunder_client() + .call(DeviceCallRequest { + method: thunder_method, + params: Some(DeviceChannelParams::Json( + json!({"enabled": enabled}).to_string(), + )), + }) + .await; + + let extn_resp = match serde_json::from_value::(thunder_resp.message) { + Ok(_) => ExtnResponse::Error(RippleError::ExtnError), + Err(_) => ExtnResponse::None(()), + }; + + println!( + "*** _DEBUG: set_closed_captions_enabled: ripple_resp={:?}", extn_resp ); @@ -141,6 +236,7 @@ impl ExtnRequestProcessor for ThunderUserSettingsRequestProcessor { msg: ExtnMessage, extracted_message: Self::VALUE, ) -> bool { + println!("*** _DEBUG: ThunderUserSettingsRequestProcessor::process_request: msg={:?}, extracted_message={:?}", msg, extracted_message); match extracted_message { UserSettingsRequest::GetAudioDescription => { Self::get_audio_description(state.clone(), msg).await @@ -148,6 +244,16 @@ impl ExtnRequestProcessor for ThunderUserSettingsRequestProcessor { UserSettingsRequest::SetAudioDescription(enabled) => { Self::set_audio_description(state.clone(), msg, enabled).await } + UserSettingsRequest::SetPreferredAudioLanguages(languages) => { + Self::set_preferred_audio_languages(state.clone(), msg, languages).await + } + UserSettingsRequest::SetPreferredCaptionsLanguages(languages) => { + Self::set_preferred_cc_languages(state.clone(), msg, languages).await + } + UserSettingsRequest::SetClosedCaptionsEnabled(enabled) => { + Self::set_closed_captions_enabled(state.clone(), msg, enabled).await + } + // TODO: Implement the rest if we wind up going this route. _ => Self::respond( state.get_client(), msg, From 457b42a09f2f6ec811324aed949098751ded7c74 Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Tue, 1 Oct 2024 12:20:28 -0400 Subject: [PATCH 3/6] Storage Migrator: Implmented iterative testing --- .../bootstrap/start_storage_migrator_step.rs | 3 +- .../src/processor/storage/storage_migrator.rs | 400 +++++++++++++----- .../src/api/device/device_user_settings.rs | 20 + .../src/bootstrap/setup_thunder_processors.rs | 3 - .../src/client/thunder_plugin.rs | 3 + device/thunder_ripple_sdk/src/lib.rs | 2 +- .../src/processors/thunder_user_settings.rs | 258 +++++------ 7 files changed, 456 insertions(+), 233 deletions(-) diff --git a/core/main/src/bootstrap/start_storage_migrator_step.rs b/core/main/src/bootstrap/start_storage_migrator_step.rs index 91651b58e..e35385dc9 100644 --- a/core/main/src/bootstrap/start_storage_migrator_step.rs +++ b/core/main/src/bootstrap/start_storage_migrator_step.rs @@ -30,10 +30,9 @@ impl Bootstep for StartStorageMigratorStep { } async fn setup(&self, bootstrap_state: BootstrapState) -> Result<(), RippleError> { - println!("*** _DEBUG: StartStorageMigratorStep::setup: entry"); tokio::spawn(async move { let mut migrator = StorageMigrator::new(&bootstrap_state.platform_state); - migrator.migrate().await; + migrator.migration_test().await; }); Ok(()) } diff --git a/core/main/src/processor/storage/storage_migrator.rs b/core/main/src/processor/storage/storage_migrator.rs index daca0dfa8..6fc7db46a 100644 --- a/core/main/src/processor/storage/storage_migrator.rs +++ b/core/main/src/processor/storage/storage_migrator.rs @@ -41,6 +41,19 @@ static STORAGE_PROPERTIES: &[StorageProperty] = &[ StorageProperty::PreferredAudioLanguages, StorageProperty::CCPreferredLanguages, StorageProperty::ClosedCaptionsEnabled, + StorageProperty::ClosedCaptionsFontFamily, + StorageProperty::ClosedCaptionsFontSize, + StorageProperty::ClosedCaptionsFontColor, + StorageProperty::ClosedCaptionsFontEdge, + StorageProperty::ClosedCaptionsFontEdgeColor, + StorageProperty::ClosedCaptionsFontOpacity, + StorageProperty::ClosedCaptionsBackgroundColor, + StorageProperty::ClosedCaptionsBackgroundOpacity, + StorageProperty::ClosedCaptionsWindowColor, + StorageProperty::ClosedCaptionsWindowOpacity, + // NOTE: Neither UserSettings nor TextTrack supports these: + // StorageProperty::ClosedCaptionsTextAlign, + // StorageProperty::ClosedCaptionsTextAlignVertical, ]; #[derive(Debug, PartialEq)] @@ -76,58 +89,105 @@ impl StorageMigrator { } } - pub async fn migrate(&mut self) { - println!("*** _DEBUG: StorageMigrator::migrate: entry"); + pub async fn migrate(&mut self) -> u64 { + info!("migrate: entry"); let start_time_ms = get_current_time_ms(); for migration_status in &mut self.migration_statuses { - if [MigrationState::NotStarted, MigrationState::Failed] - .contains(&migration_status.migration_state) - { - migration_status.migration_state = match migration_status.storage_property { - StorageProperty::AudioDescriptionEnabled => { - migrate_audio_description_enabled(&self.platform_state).await - } - StorageProperty::PreferredAudioLanguages => { - migrate_preferred_audio_languages(&self.platform_state).await - } - StorageProperty::CCPreferredLanguages => { - migrate_preferred_cc_languages(&self.platform_state).await - } - StorageProperty::ClosedCaptionsEnabled => { - migrate_cc_enabled(&self.platform_state).await - } - _ => { - error!( - "migrate: Unsupported property: {:?}", - migration_status.storage_property - ); - error!( - "*** _DEBUG: migrate: Unsupported property: {:?}", - migration_status.storage_property - ); - MigrationState::Failed - } - }; - } + migration_status.migration_state = + migrate_property(&self.platform_state, &migration_status.storage_property).await; } + let total_duration_ms = get_current_time_ms() - start_time_ms; + info!("migrate: Total duration: {} ms", total_duration_ms); + total_duration_ms + } + + const TEST_ITERATIONS: u64 = 10; + pub async fn migration_test(&mut self) { + let mut duration_ms = 0; + for i in 1..Self::TEST_ITERATIONS + 1 { + info!("migration_test: Iteration: {}", i); + duration_ms += self.migrate().await; + } info!( - "migrate: Total time taken: {} ms", - get_current_time_ms() - start_time_ms - ); - info!( - "*** _DEBUG: migrate: Total time taken: {} ms", - get_current_time_ms() - start_time_ms + "migration_test: Average duration: {} ms", + duration_ms / Self::TEST_ITERATIONS ); } } -async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> MigrationState { - println!("*** _DEBUG: migrate_audio_description_enabled: entry"); +async fn migrate_property( + platform_state: &PlatformState, + storage_property: &StorageProperty, +) -> MigrationState { let mut migration_state = MigrationState::Failed; let start_time_ms = get_current_time_ms(); + match storage_property { + StorageProperty::AudioDescriptionEnabled => { + migration_state = migrate_audio_description_enabled(platform_state).await; + } + StorageProperty::PreferredAudioLanguages => { + migration_state = migrate_preferred_audio_languages(platform_state).await; + } + StorageProperty::CCPreferredLanguages => { + migration_state = migrate_preferred_cc_languages(platform_state).await; + } + StorageProperty::ClosedCaptionsEnabled => { + migration_state = migrate_cc_enabled(platform_state).await; + } + StorageProperty::ClosedCaptionsFontFamily => { + migration_state = migrate_font_family(platform_state).await; + } + StorageProperty::ClosedCaptionsFontSize => { + migration_state = migrate_font_size(platform_state).await; + } + StorageProperty::ClosedCaptionsFontColor => { + migration_state = migrate_font_color(platform_state).await; + } + StorageProperty::ClosedCaptionsFontEdge => { + migration_state = migrate_font_edge(platform_state).await; + } + StorageProperty::ClosedCaptionsFontEdgeColor => { + migration_state = migrate_font_edge_color(platform_state).await; + } + StorageProperty::ClosedCaptionsFontOpacity => { + migration_state = migrate_font_opacity(platform_state).await; + } + StorageProperty::ClosedCaptionsBackgroundColor => { + migration_state = migrate_background_color(platform_state).await; + } + StorageProperty::ClosedCaptionsBackgroundOpacity => { + migration_state = migrate_background_opacity(platform_state).await; + } + StorageProperty::ClosedCaptionsWindowColor => { + migration_state = migrate_window_color(platform_state).await; + } + StorageProperty::ClosedCaptionsWindowOpacity => { + migration_state = migrate_window_opacity(platform_state).await; + } + _ => { + error!( + "migrate_property: Unsupported property: {:?}", + storage_property + ); + } + } + + info!( + "migrate_property: storage_property={:?}, migration_state={:?}, Time taken: {} ms", + storage_property, + migration_state, + get_current_time_ms() - start_time_ms + ); + + migration_state +} + +async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + if let Ok(enabled) = StorageManager::get_bool(platform_state, StorageProperty::AudioDescriptionEnabled).await { @@ -142,35 +202,17 @@ async fn migrate_audio_description_enabled(platform_state: &PlatformState) -> Mi } } - info!( - "migrate_audio_description_enabled: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - info!( - "*** _DEBUG: migrate_audio_description_enabled: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - migration_state } async fn migrate_preferred_audio_languages(platform_state: &PlatformState) -> MigrationState { - println!("*** _DEBUG: migrate_preferred_audio_languages: entry"); let mut migration_state = MigrationState::Failed; - let start_time_ms = get_current_time_ms(); let preferred_cc_languages = StorageManager::get_vec_string(platform_state, StorageProperty::PreferredAudioLanguages) .await .unwrap_or_default(); - println!( - "*** _DEBUG: migrate_preferred_audio_languages: preferred_cc_languages={:?}", - preferred_cc_languages - ); - if let Ok(extn_menssage) = platform_state .get_client() .send_extn_request(UserSettingsRequest::SetPreferredAudioLanguages( @@ -183,35 +225,17 @@ async fn migrate_preferred_audio_languages(platform_state: &PlatformState) -> Mi } } - info!( - "migrate_preferred_audio_languages: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - info!( - "*** _DEBUG: migrate_preferred_audio_languages: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - migration_state } async fn migrate_preferred_cc_languages(platform_state: &PlatformState) -> MigrationState { - println!("*** _DEBUG: migrate_preferred_cc_languages: entry"); let mut migration_state = MigrationState::Failed; - let start_time_ms = get_current_time_ms(); let preferred_cc_languages = StorageManager::get_vec_string(platform_state, StorageProperty::CCPreferredLanguages) .await .unwrap_or_default(); - println!( - "*** _DEBUG: migrate_preferred_cc_languages: preferred_cc_languages={:?}", - preferred_cc_languages - ); - if let Ok(extn_menssage) = platform_state .get_client() .send_extn_request(UserSettingsRequest::SetPreferredCaptionsLanguages( @@ -224,24 +248,11 @@ async fn migrate_preferred_cc_languages(platform_state: &PlatformState) -> Migra } } - info!( - "migrate_preferred_cc_languages: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - info!( - "*** _DEBUG: migrate_preferred_cc_languages: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - migration_state } async fn migrate_cc_enabled(platform_state: &PlatformState) -> MigrationState { - println!("*** _DEBUG: migrate_cc_enabled: entry"); let mut migration_state = MigrationState::Failed; - let start_time_ms = get_current_time_ms(); if let Ok(enabled) = StorageManager::get_bool(platform_state, StorageProperty::ClosedCaptionsEnabled).await @@ -257,16 +268,209 @@ async fn migrate_cc_enabled(platform_state: &PlatformState) -> MigrationState { } } - info!( - "migrate_cc_enabled: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); - info!( - "*** _DEBUG: migrate_cc_enabled: migration_state={:?}, Time taken: {} ms", - migration_state, - get_current_time_ms() - start_time_ms - ); + migration_state +} + +async fn migrate_font_family(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let family = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontFamily) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontFamily(family)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_font_size(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let size = StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontSize) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontSize(size)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_font_color(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let color = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontColor) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontColor(color)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_font_edge(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let edge = StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontEdge) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontEdge(edge)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_font_edge_color(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let color = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontEdgeColor) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontEdgeColor(color)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_font_opacity(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let opacity = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsFontOpacity) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsFontOpacity(opacity)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_background_color(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let color = StorageManager::get_string( + platform_state, + StorageProperty::ClosedCaptionsBackgroundColor, + ) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsBackgroundColor(color)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_background_opacity(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let opacity = StorageManager::get_string( + platform_state, + StorageProperty::ClosedCaptionsBackgroundOpacity, + ) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsBackgroundOpacity( + opacity, + )) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_window_color(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let color = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsWindowColor) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsWindowColor(color)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } + + migration_state +} + +async fn migrate_window_opacity(platform_state: &PlatformState) -> MigrationState { + let mut migration_state = MigrationState::Failed; + + let opacity = + StorageManager::get_string(platform_state, StorageProperty::ClosedCaptionsWindowOpacity) + .await + .unwrap_or_default(); + if let Ok(extn_menssage) = platform_state + .get_client() + .send_extn_request(UserSettingsRequest::SetClosedCaptionsWindowOpacity(opacity)) + .await + { + if let Some(ExtnResponse::None(())) = extn_menssage.payload.as_response() { + migration_state = MigrationState::Succeeded; + } + } migration_state } diff --git a/core/sdk/src/api/device/device_user_settings.rs b/core/sdk/src/api/device/device_user_settings.rs index a33aafc0c..ac91404ee 100644 --- a/core/sdk/src/api/device/device_user_settings.rs +++ b/core/sdk/src/api/device/device_user_settings.rs @@ -23,6 +23,26 @@ pub enum UserSettingsRequest { SetPreferredClosedCaptionService(String), GetPrivacyMode, SetPrivacyMode(String), + GetClosedCaptionsFontFamily, + SetClosedCaptionsFontFamily(String), + GetClosedCaptionsFontSize, + SetClosedCaptionsFontSize(String), + GetClosedCaptionsFontColor, + SetClosedCaptionsFontColor(String), + GetClosedCaptionsFontOpacity, + SetClosedCaptionsFontOpacity(String), + GetClosedCaptionsFontEdge, + SetClosedCaptionsFontEdge(String), + GetClosedCaptionsFontEdgeColor, + SetClosedCaptionsFontEdgeColor(String), + GetClosedCaptionsBackgroundColor, + SetClosedCaptionsBackgroundColor(String), + GetClosedCaptionsBackgroundOpacity, + SetClosedCaptionsBackgroundOpacity(String), + GetClosedCaptionsWindowColor, + SetClosedCaptionsWindowColor(String), + GetClosedCaptionsWindowOpacity, + SetClosedCaptionsWindowOpacity(String), } impl ExtnPayloadProvider for UserSettingsRequest { diff --git a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs index 719904895..bd316aac7 100644 --- a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs +++ b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs @@ -50,9 +50,6 @@ impl SetupThunderProcessor { extn_client.add_request_processor(ThunderWifiRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderStorageRequestProcessor::new(state.clone().state)); // - println!( - "*** _DEBUG: SetupThunderProcessor::setup: adding ThunderUserSettingsRequestProcessor" - ); extn_client.add_request_processor(ThunderUserSettingsRequestProcessor::new( state.clone().state, )); diff --git a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs index 61fc5ef7c..9086df777 100644 --- a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs +++ b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs @@ -37,6 +37,7 @@ pub enum ThunderPlugin { PackageManager, // UserSettings, + TextTrack, // } const CONTROLLER_CFG: Cfg = Cfg::new("Controller", false, true); @@ -55,6 +56,7 @@ const TELEMETRY_CFG: Cfg = Cfg::new("org.rdk.Telemetry", false, false); const PACKAGE_MANAGER_CFG: Cfg = Cfg::new("org.rdk.PackageManager", false, false); // const USER_SETTINGS_CFG: Cfg = Cfg::new("org.rdk.UserSettings", false, false); +const TEXT_TRACK_CFG: Cfg = Cfg::new("org.rdk.TextTrack", false, false); // impl ThunderPlugin { @@ -77,6 +79,7 @@ impl ThunderPlugin { PackageManager => PACKAGE_MANAGER_CFG, // UserSettings => USER_SETTINGS_CFG, + TextTrack => TEXT_TRACK_CFG, // } } diff --git a/device/thunder_ripple_sdk/src/lib.rs b/device/thunder_ripple_sdk/src/lib.rs index c47900eb3..813aae550 100644 --- a/device/thunder_ripple_sdk/src/lib.rs +++ b/device/thunder_ripple_sdk/src/lib.rs @@ -38,7 +38,6 @@ pub mod processors { pub mod thunder_browser; pub mod thunder_device_info; pub mod thunder_events; - pub mod thunder_user_settings; pub mod events { pub mod thunder_event_handlers; } @@ -47,6 +46,7 @@ pub mod processors { pub mod thunder_remote; pub mod thunder_rfc; pub mod thunder_telemetry; + pub mod thunder_user_settings; pub mod thunder_wifi; pub mod thunder_window_manager; } diff --git a/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs index 26e314561..c81c52fbb 100644 --- a/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs +++ b/device/thunder_ripple_sdk/src/processors/thunder_user_settings.rs @@ -48,78 +48,18 @@ pub struct ThunderUserSettingsRequestProcessor { impl ThunderUserSettingsRequestProcessor { pub fn new(state: ThunderState) -> ThunderUserSettingsRequestProcessor { - println!("*** _DEBUG: ThunderUserSettingsRequestProcessor::new: entry"); ThunderUserSettingsRequestProcessor { state, streamer: DefaultExtnStreamer::new(), } } - async fn get_audio_description(state: ThunderState, req: ExtnMessage) -> bool { - let thunder_method = ThunderPlugin::UserSettings.method("getAudioDescription"); - let thunder_resp = state - .get_thunder_client() - .call(DeviceCallRequest { - method: thunder_method, - params: None, - }) - .await; - - let extn_resp = match thunder_resp.message["success"].as_bool() { - Some(v) => ExtnResponse::Boolean(v), - None => ExtnResponse::Error(RippleError::InvalidOutput), - }; - - Self::respond(state.get_client(), req, extn_resp) - .await - .is_ok() - } - - async fn set_audio_description(state: ThunderState, req: ExtnMessage, enabled: bool) -> bool { - println!("*** _DEBUG: set_audio_description: enabled={}", enabled); - let thunder_method = ThunderPlugin::UserSettings.method("setAudioDescription"); - let thunder_resp = state - .get_thunder_client() - .call(DeviceCallRequest { - method: thunder_method, - params: Some(DeviceChannelParams::Json( - json!({"enabled": enabled}).to_string(), - )), - }) - .await; - - let extn_resp = match serde_json::from_value::(thunder_resp.message) { - Ok(_) => ExtnResponse::Error(RippleError::ExtnError), - Err(_) => ExtnResponse::None(()), - }; - - println!( - "*** _DEBUG: set_audio_description: ripple_resp={:?}", - extn_resp - ); - - Self::respond(state.get_client(), req, extn_resp) - .await - .is_ok() - } - - async fn set_preferred_audio_languages( - state: ThunderState, - req: ExtnMessage, - languages: Vec, - ) -> bool { - println!( - "*** _DEBUG: set_preferred_audio_languages: languages={:?}", - languages - ); - let thunder_method = ThunderPlugin::UserSettings.method("setPreferredAudioLanguages"); + async fn set(state: ThunderState, req: ExtnMessage, method: String, params: String) -> bool { let thunder_resp = state .get_thunder_client() .call(DeviceCallRequest { - method: thunder_method, - params: Some(DeviceChannelParams::Json( - json!({"preferredLanguages": languages.join(",")}).to_string(), - )), + method, + params: Some(DeviceChannelParams::Json(params)), }) .await; @@ -128,81 +68,26 @@ impl ThunderUserSettingsRequestProcessor { Err(_) => ExtnResponse::None(()), }; - println!( - "*** _DEBUG: set_preferred_audio_languages: ripple_resp={:?}", - extn_resp - ); - Self::respond(state.get_client(), req, extn_resp) .await .is_ok() } - async fn set_preferred_cc_languages( - state: ThunderState, - req: ExtnMessage, - languages: Vec, - ) -> bool { - println!( - "*** _DEBUG: set_preferred_cc_languages: languages={:?}", - languages - ); - let thunder_method = ThunderPlugin::UserSettings.method("setPreferredCaptionsLanguages"); - let thunder_resp = state - .get_thunder_client() - .call(DeviceCallRequest { - method: thunder_method, - params: Some(DeviceChannelParams::Json( - json!({"preferredLanguages": languages.join(",")}).to_string(), - )), - }) - .await; - - let extn_resp = match serde_json::from_value::(thunder_resp.message) { - Ok(_) => ExtnResponse::Error(RippleError::ExtnError), - Err(_) => ExtnResponse::None(()), - }; - - println!( - "*** _DEBUG: set_preferred_cc_languages: ripple_resp={:?}", - extn_resp - ); - - Self::respond(state.get_client(), req, extn_resp) - .await - .is_ok() - } - - async fn set_closed_captions_enabled( - state: ThunderState, - req: ExtnMessage, - enabled: bool, - ) -> bool { - println!( - "*** _DEBUG: set_closed_captions_enabled: enabled={}", - enabled - ); - let thunder_method = ThunderPlugin::UserSettings.method("setCaptions"); + async fn get_audio_description(state: ThunderState, req: ExtnMessage) -> bool { + let thunder_method = ThunderPlugin::UserSettings.method("getAudioDescription"); let thunder_resp = state .get_thunder_client() .call(DeviceCallRequest { method: thunder_method, - params: Some(DeviceChannelParams::Json( - json!({"enabled": enabled}).to_string(), - )), + params: None, }) .await; - let extn_resp = match serde_json::from_value::(thunder_resp.message) { - Ok(_) => ExtnResponse::Error(RippleError::ExtnError), - Err(_) => ExtnResponse::None(()), + let extn_resp = match thunder_resp.message["success"].as_bool() { + Some(v) => ExtnResponse::Boolean(v), + None => ExtnResponse::Error(RippleError::InvalidOutput), }; - println!( - "*** _DEBUG: set_closed_captions_enabled: ripple_resp={:?}", - extn_resp - ); - Self::respond(state.get_client(), req, extn_resp) .await .is_ok() @@ -236,23 +121,138 @@ impl ExtnRequestProcessor for ThunderUserSettingsRequestProcessor { msg: ExtnMessage, extracted_message: Self::VALUE, ) -> bool { - println!("*** _DEBUG: ThunderUserSettingsRequestProcessor::process_request: msg={:?}, extracted_message={:?}", msg, extracted_message); match extracted_message { UserSettingsRequest::GetAudioDescription => { Self::get_audio_description(state.clone(), msg).await } UserSettingsRequest::SetAudioDescription(enabled) => { - Self::set_audio_description(state.clone(), msg, enabled).await + Self::set( + state.clone(), + msg, + ThunderPlugin::UserSettings.method("setAudioDescription"), + json!({"enabled": enabled}).to_string(), + ) + .await } UserSettingsRequest::SetPreferredAudioLanguages(languages) => { - Self::set_preferred_audio_languages(state.clone(), msg, languages).await + Self::set( + state.clone(), + msg, + ThunderPlugin::UserSettings.method("setPreferredAudioLanguages"), + json!({"preferredLanguages": languages.join(",")}).to_string(), + ) + .await } UserSettingsRequest::SetPreferredCaptionsLanguages(languages) => { - Self::set_preferred_cc_languages(state.clone(), msg, languages).await + Self::set( + state.clone(), + msg, + ThunderPlugin::UserSettings.method("setPreferredCaptionsLanguages"), + json!({"preferredLanguages": languages.join(",")}).to_string(), + ) + .await } UserSettingsRequest::SetClosedCaptionsEnabled(enabled) => { - Self::set_closed_captions_enabled(state.clone(), msg, enabled).await + Self::set( + state.clone(), + msg, + ThunderPlugin::UserSettings.method("setCaptions"), + json!({"enabled": enabled}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsFontFamily(family) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontFamily"), + json!({"fontFamily": family}).to_string(), + ) + .await } + + UserSettingsRequest::SetClosedCaptionsFontSize(size) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontSize"), + json!({"fontSize": size}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsFontColor(color) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontColor"), + json!({"fontColor": color}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsFontOpacity(opacity) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontOpacity"), + json!({"fontOpacity": opacity}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsFontEdge(edge) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontEdge"), + json!({"fontEdge": edge}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsFontEdgeColor(color) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setFontEdgeColor"), + json!({"fontEdgeColor": color}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsBackgroundColor(color) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setBackgroundColor"), + json!({"backgroundColor": color}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsBackgroundOpacity(opacity) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setBackgroundOpacity"), + json!({"backgroundOpacity": opacity}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsWindowColor(color) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setWindowColor"), + json!({"windowColor": color}).to_string(), + ) + .await + } + UserSettingsRequest::SetClosedCaptionsWindowOpacity(opacity) => { + Self::set( + state.clone(), + msg, + ThunderPlugin::TextTrack.method("setWindowOpacity"), + json!({"windowOpacity": opacity}).to_string(), + ) + .await + } + // TODO: Implement the rest if we wind up going this route. _ => Self::respond( state.get_client(), From 50856d8f2e0094cd6c38c801cc239732857f4deb Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Tue, 1 Oct 2024 12:24:17 -0400 Subject: [PATCH 4/6] Storage Migrator: Removed debug --- core/main/src/bootstrap/boot.rs | 2 -- core/main/src/bootstrap/mod.rs | 4 +--- core/sdk/src/api/device/device_request.rs | 2 -- .../src/bootstrap/setup_thunder_processors.rs | 2 -- device/thunder_ripple_sdk/src/client/thunder_plugin.rs | 6 ------ 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/core/main/src/bootstrap/boot.rs b/core/main/src/bootstrap/boot.rs index e269099fe..7022e2159 100644 --- a/core/main/src/bootstrap/boot.rs +++ b/core/main/src/bootstrap/boot.rs @@ -73,9 +73,7 @@ pub async fn boot(state: BootstrapState) -> RippleResponse { execute_step(LoadDistributorValuesStep, &bootstrap).await?; execute_step(CheckLauncherStep, &bootstrap).await?; execute_step(StartWsStep, &bootstrap).await?; - // execute_step(StartStorageMigratorStep, &bootstrap).await?; - // execute_step(FireboltGatewayStep, &bootstrap).await?; Ok(()) } diff --git a/core/main/src/bootstrap/mod.rs b/core/main/src/bootstrap/mod.rs index 1f975f505..342213a25 100644 --- a/core/main/src/bootstrap/mod.rs +++ b/core/main/src/bootstrap/mod.rs @@ -22,7 +22,5 @@ pub mod setup_extn_client_step; pub mod start_app_manager_step; pub mod start_communication_broker; pub mod start_fbgateway_step; -pub mod start_ws_step; -// pub mod start_storage_migrator_step; -// +pub mod start_ws_step; diff --git a/core/sdk/src/api/device/device_request.rs b/core/sdk/src/api/device/device_request.rs index fb74d9b70..038e03573 100644 --- a/core/sdk/src/api/device/device_request.rs +++ b/core/sdk/src/api/device/device_request.rs @@ -41,9 +41,7 @@ pub enum DeviceRequest { Wifi(WifiRequest), Accessory(RemoteAccessoryRequest), Apps(AppsRequest), - // UserSettings(UserSettingsRequest), - // } #[derive(Hash, Eq, PartialEq, Debug, Serialize, Deserialize, Clone)] diff --git a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs index bd316aac7..d385c414d 100644 --- a/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs +++ b/device/thunder_ripple_sdk/src/bootstrap/setup_thunder_processors.rs @@ -49,11 +49,9 @@ impl SetupThunderProcessor { extn_client.add_request_processor(ThunderBrowserRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderWifiRequestProcessor::new(state.clone().state)); extn_client.add_request_processor(ThunderStorageRequestProcessor::new(state.clone().state)); - // extn_client.add_request_processor(ThunderUserSettingsRequestProcessor::new( state.clone().state, )); - // extn_client.add_request_processor(ThunderWindowManagerRequestProcessor::new( state.state.clone(), )); diff --git a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs index 9086df777..d7183f12c 100644 --- a/device/thunder_ripple_sdk/src/client/thunder_plugin.rs +++ b/device/thunder_ripple_sdk/src/client/thunder_plugin.rs @@ -35,10 +35,8 @@ pub enum ThunderPlugin { Hdcp, Telemetry, PackageManager, - // UserSettings, TextTrack, - // } const CONTROLLER_CFG: Cfg = Cfg::new("Controller", false, true); const DEVICE_INFO_CFG: Cfg = Cfg::new("DeviceInfo", true, false); @@ -54,10 +52,8 @@ const LOCATION_SYNC: Cfg = Cfg::new("LocationSync", false, false); const TTS_CFG: Cfg = Cfg::new("org.rdk.TextToSpeech", false, true); const TELEMETRY_CFG: Cfg = Cfg::new("org.rdk.Telemetry", false, false); const PACKAGE_MANAGER_CFG: Cfg = Cfg::new("org.rdk.PackageManager", false, false); -// const USER_SETTINGS_CFG: Cfg = Cfg::new("org.rdk.UserSettings", false, false); const TEXT_TRACK_CFG: Cfg = Cfg::new("org.rdk.TextTrack", false, false); -// impl ThunderPlugin { pub fn cfg(&self) -> Cfg { @@ -77,10 +73,8 @@ impl ThunderPlugin { TextToSpeech => TTS_CFG, Telemetry => TELEMETRY_CFG, PackageManager => PACKAGE_MANAGER_CFG, - // UserSettings => USER_SETTINGS_CFG, TextTrack => TEXT_TRACK_CFG, - // } } pub fn callsign(&self) -> &str { From 9b13ba93b18663b435bbfd29c38f17835059cb64 Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Tue, 1 Oct 2024 12:37:53 -0400 Subject: [PATCH 5/6] feat: RPPL-2565: Storage Migrator: Clippy --- core/main/src/processor/storage/storage_migrator.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/main/src/processor/storage/storage_migrator.rs b/core/main/src/processor/storage/storage_migrator.rs index 6fc7db46a..7317c1480 100644 --- a/core/main/src/processor/storage/storage_migrator.rs +++ b/core/main/src/processor/storage/storage_migrator.rs @@ -56,10 +56,9 @@ static STORAGE_PROPERTIES: &[StorageProperty] = &[ // StorageProperty::ClosedCaptionsTextAlignVertical, ]; -#[derive(Debug, PartialEq)] +#[derive(Debug)] enum MigrationState { NotStarted, - NotNeeded, Succeeded, Failed, } From 93bd90103b29127655e6b205686e70a1ab90fb51 Mon Sep 17 00:00:00 2001 From: pahearn73 Date: Tue, 1 Oct 2024 12:49:13 -0400 Subject: [PATCH 6/6] Storage Migrator: Clippy --- core/sdk/src/api/device/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/sdk/src/api/device/mod.rs b/core/sdk/src/api/device/mod.rs index bace54941..8f9dbed59 100644 --- a/core/sdk/src/api/device/mod.rs +++ b/core/sdk/src/api/device/mod.rs @@ -25,7 +25,7 @@ pub mod device_operator; pub mod device_peristence; pub mod device_request; pub mod device_user_grants_data; +pub mod device_user_settings; pub mod device_wifi; pub mod device_window_manager; pub mod entertainment_data; -pub mod device_user_settings;