Skip to content

Commit

Permalink
feat: Changes for 1.0.0 (#296)
Browse files Browse the repository at this point in the history
* feat: Changes for 1.0.0

* fix: for caps and updated manifests

* fix: Audio description

* fix: add done for close reason
  • Loading branch information
satlead authored Nov 3, 2023
1 parent aeeab03 commit 39c99e0
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ members = [
]

[workspace.package]
version = "0.8.0"
version = "1.0.0"
2 changes: 1 addition & 1 deletion core/launcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[package]
name = "launcher"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 1 addition & 1 deletion core/launcher/src/manager/app_launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ impl AppLauncher {
) -> Result<AppManagerResponse, AppError> {
info!("close {:?}", reason);
match reason {
CloseReason::UserExit | CloseReason::RemoteButton => {
CloseReason::UserExit | CloseReason::RemoteButton | CloseReason::Done => {
Self::set_state(state.clone(), app_id.into(), LifecycleState::Inactive).await
}
CloseReason::Error => {
Expand Down
3 changes: 2 additions & 1 deletion core/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[package]
name = "main"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"
build = "build.rs"
Expand All @@ -31,6 +31,7 @@ path = "src/main.rs"
[features]
local_dev = []
sysd = ["sd-notify"]
pre_prod = []

[dependencies]
ripple_sdk = { path = "../sdk", features = ["full"] }
Expand Down
6 changes: 4 additions & 2 deletions core/main/src/bootstrap/manifest/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ impl LoadDeviceManifestStep {
type DeviceManifestLoader = Vec<fn() -> Result<(String, DeviceManifest), RippleError>>;

fn try_manifest_files() -> Result<DeviceManifest, RippleError> {
let dm_arr: DeviceManifestLoader = if cfg!(test) {
let dm_arr: DeviceManifestLoader = if cfg!(any(feature = "local_dev", feature = "pre_prod")) {
vec![load_from_env, load_from_home, load_from_opt, load_from_etc]
} else if cfg!(test) {
vec![load_from_env]
} else {
vec![load_from_env, load_from_home, load_from_opt, load_from_etc]
vec![load_from_etc]
};

for dm_provider in dm_arr {
Expand Down
6 changes: 4 additions & 2 deletions core/main/src/bootstrap/manifest/extn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ impl LoadExtnManifestStep {
type ExtnManifestLoader = Vec<fn() -> Result<(String, ExtnManifest), RippleError>>;

fn try_manifest_files() -> Result<ExtnManifest, RippleError> {
let dm_arr: ExtnManifestLoader = if cfg!(test) {
let dm_arr: ExtnManifestLoader = if cfg!(any(feature = "local_dev", feature = "pre_prod")) {
vec![load_from_env, load_from_home, load_from_opt, load_from_etc]
} else if cfg!(test) {
vec![load_from_env]
} else {
vec![load_from_env, load_from_home, load_from_opt, load_from_etc]
vec![load_from_etc]
};

for dm_provider in dm_arr {
Expand Down
41 changes: 37 additions & 4 deletions core/main/src/firebolt/handlers/audio_description_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::{
processor::storage::storage_manager::StorageManager,
service::apps::app_events::{AppEventDecorationError, AppEventDecorator},
state::platform_state::PlatformState,
utils::rpc_utils::rpc_add_event_listener_with_decorator,
utils::rpc_utils::{rpc_add_event_listener, rpc_add_event_listener_with_decorator},
};

use ripple_sdk::serde_json::Value;
Expand Down Expand Up @@ -64,14 +64,25 @@ impl AppEventDecorator for AudioDescriptionEventDecorator {

#[rpc(server)]
pub trait AudioDescription {
#[method(name = "audiodescriptions.enabled", aliases=["accessibility.audioDescriptionSettings"])]
async fn ad_enabled(&self, ctx: CallContext) -> RpcResult<AudioDescriptionSettings>;
#[method(name = "audiodescriptions.enabled")]
async fn ad_enabled(&self, ctx: CallContext) -> RpcResult<bool>;

#[method(name = "accessibility.audioDescriptionSettings")]
async fn ad_settings_get(&self, ctx: CallContext) -> RpcResult<AudioDescriptionSettings>;

#[method(name = "audiodescriptions.setEnabled")]
async fn ad_enabled_set(
&self,
ctx: CallContext,
set_request: AudioDescriptionSettingsSet,
) -> RpcResult<()>;
#[method(name = "audiodescriptions.onEnabledChanged")]
async fn on_audio_description_enabled_changed(
&self,
ctx: CallContext,
request: ListenRequest,
) -> RpcResult<ListenerResponse>;

#[method(name = "accessibility.onAudioDescriptionSettingsChanged")]
async fn on_audio_description_settings_changed(
&self,
Expand All @@ -87,7 +98,15 @@ pub struct AudioDescriptionImpl {

#[async_trait]
impl AudioDescriptionServer for AudioDescriptionImpl {
async fn ad_enabled(&self, _ctx: CallContext) -> RpcResult<AudioDescriptionSettings> {
async fn ad_enabled(&self, _ctx: CallContext) -> RpcResult<bool> {
Ok(StorageManager::get_bool(
&self.platform_state,
StorageProperty::AudioDescriptionEnabled,
)
.await?)
}

async fn ad_settings_get(&self, _ctx: CallContext) -> RpcResult<AudioDescriptionSettings> {
let v = StorageManager::get_bool(
&self.platform_state,
StorageProperty::AudioDescriptionEnabled,
Expand Down Expand Up @@ -124,6 +143,20 @@ impl AudioDescriptionServer for AudioDescriptionImpl {
)
.await
}

async fn on_audio_description_enabled_changed(
&self,
ctx: CallContext,
request: ListenRequest,
) -> RpcResult<ListenerResponse> {
rpc_add_event_listener(
&self.platform_state,
ctx,
request,
EVENT_AUDIO_DESCRIPTION_SETTINGS_CHANGED,
)
.await
}
}

pub struct AudioDescriptionRPCProvider;
Expand Down
20 changes: 13 additions & 7 deletions core/main/src/firebolt/handlers/capabilities_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,17 @@ impl CapabilityServer for CapabilityImpl {
ctx: CallContext,
grants: CapRequestRpcRequest,
) -> RpcResult<Vec<CapabilityInfo>> {
let fb_perms: Vec<FireboltPermission> = grants.clone().into();
self.state
.cap_state
.generic
.check_supported(&fb_perms)
.map_err(|err| Error::Custom(format!("{:?} not supported", err.caps)))?;
let mut fb_perms: Vec<FireboltPermission> = grants.clone().into();
let mut cap_info = Vec::new();
if let Err(e) = self.state.cap_state.generic.check_supported(&fb_perms) {
fb_perms.retain(|x| !e.caps.contains(&x.cap));
for cap in e.caps {
cap_info.push(CapabilityInfo::get(
cap.as_str(),
Some(DenyReason::Unsupported),
))
}
}
let permitted_result: Result<
(),
ripple_sdk::api::firebolt::fb_capabilities::DenyReasonWithCap,
Expand All @@ -268,7 +273,8 @@ impl CapabilityServer for CapabilityImpl {
.collect();

if let Ok(a) = CapState::get_cap_info(&self.state, ctx, &request).await {
Ok(a)
cap_info.extend(a);
Ok(cap_info)
} else {
Err(jsonrpsee::core::Error::Custom(String::from(
"Error retreiving Capability Info TBD",
Expand Down
4 changes: 2 additions & 2 deletions core/main/src/state/firebolt-open-rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,11 +893,11 @@
}
},
"apis": {
"0": {
"1": {
"openrpc": "1.2.4",
"info": {
"title": "Firebolt JSON-RPC API",
"version": "0.18.0-next.7",
"version": "1.0.0",
"x-module-descriptions": {
"Internal": "Internal methods for SDK / FEE integration",
"Accessibility": "The `Accessibility` module provides access to the user/device settings for closed captioning and voice guidance.\n\nApps **SHOULD** attempt o respect these settings, rather than manage and persist seprate settings, which would be different per-app.",
Expand Down
2 changes: 1 addition & 1 deletion core/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[package]
name = "ripple_sdk"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 2 additions & 0 deletions core/sdk/src/api/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ pub enum CloseReason {
Error,
AppNotReady,
ResourceContention,
Done,
}

impl CloseReason {
Expand All @@ -242,6 +243,7 @@ impl CloseReason {
CloseReason::Error => "error",
CloseReason::AppNotReady => "appNotReady",
CloseReason::ResourceContention => "resourceContention",
CloseReason::Done => "done",
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/tdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[package]
name = "ripple_tdk"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 1 addition & 1 deletion device/thunder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

[package]
name = "thunder"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 1 addition & 1 deletion device/thunder_ripple_sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

[package]
name = "thunder_ripple_sdk"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 1 addition & 1 deletion distributor/general/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

[package]
name = "distributor_general"
version = "0.8.0"
version = "1.0.0"
edition = "2021"
repository = "https://github.com/rdkcentral/Ripple"

Expand Down
2 changes: 1 addition & 1 deletion examples/rpc_extn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

[package]
name = "rpc_extn"
version = "0.8.0"
version = "1.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion examples/tm_extn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

[package]
name = "tm_extn"
version = "0.8.0"
version = "1.0.0"
edition = "2021"

# See more keys and their definitions at https:#doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 2 additions & 2 deletions ripple
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ case ${1} in
echo "All Done!"
;;
"run")
cargo build
THUNDER_HOST=${2} cargo run core/main
cargo build --features local_dev
THUNDER_HOST=${2} cargo run --features local_dev core/main
;;
"-h")
print_help
Expand Down

0 comments on commit 39c99e0

Please sign in to comment.