Skip to content

Commit

Permalink
[WIP] update SSIP, add speech to certain events
Browse files Browse the repository at this point in the history
  • Loading branch information
TTWNO committed Apr 5, 2024
1 parent 905f976 commit 50b61e3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion odilia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ odilia-input = { path = "../input", version = "0.0.3" }
odilia-tts = { path = "../tts", version = "0.1.4" }
serde_json.workspace = true
serde_plain.workspace = true
ssip-client-async.workspace = true
ssip-client-async = { version = "0.13.0", features = ["tokio"] }
tokio.workspace = true
tracing-error.workspace = true
tracing-log.workspace = true
Expand All @@ -57,6 +57,7 @@ odilia-notify = { version = "0.1.0", path = "../odilia-notify" }
clap = { version = "4.5.1", features = ["derive"] }
tokio-util.workspace=true
tower = { version = "0.4.13", features = ["util", "filter"] }
ssip = "0.1.0"

[dev-dependencies]
lazy_static = "1.4.0"
Expand Down
7 changes: 6 additions & 1 deletion odilia/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ mod tower;

use std::{process::exit, sync::Arc, time::Duration};

use ssip::Request as SSIPRequest;
use crate::cli::Args;
use crate::state::ScreenReaderState;
use crate::state::Speech;
use crate::tower::Handlers;
use clap::Parser;
use eyre::WrapErr;
Expand Down Expand Up @@ -73,8 +75,11 @@ async fn sigterm_signal_watcher(

use atspi::events::document::LoadCompleteEvent;

async fn doc_loaded(loaded: LoadCompleteEvent) -> Result<(), odilia_common::errors::OdiliaError> {
async fn doc_loaded(loaded: LoadCompleteEvent, Speech(ssip): Speech) -> Result<(), odilia_common::errors::OdiliaError> {

Check failure on line 78 in odilia/src/main.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `loaded`
println!("Doc loaded!");
ssip.send(SSIPRequest::SetPriority(Priority::Text)).await.unwrap();
ssip.send(SSIPRequest::Speak).await.unwrap();
ssip.send(SSIPRequest::SendLines(Vec::from(["Doc loaded!".to_string()]))).await.unwrap();
Ok(())
}

Check warning on line 84 in odilia/src/main.rs

View check run for this annotation

Codecov / codecov/patch

odilia/src/main.rs#L78-L84

Added lines #L78 - L84 were not covered by tests

Expand Down
8 changes: 8 additions & 0 deletions odilia/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ pub struct ScreenReaderState {
pub cache: Arc<Cache>,
}

pub struct Speech(pub Sender<SSIPRequest>);

impl From<Arc<ScreenReaderState>> for Speech {
fn from(state: Arc<ScreenReaderState>) -> Speech {
Speech(state.ssip.clone())
}

Check warning on line 45 in odilia/src/state.rs

View check run for this annotation

Codecov / codecov/patch

odilia/src/state.rs#L43-L45

Added lines #L43 - L45 were not covered by tests
}

enum ConfigType {
CliOverride,
XDGConfigHome,
Expand Down
3 changes: 2 additions & 1 deletion tts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ categories = ["accessibility", "api-bindings"]
edition = "2021"

[dependencies]
ssip-client-async.workspace = true
ssip-client-async = { version = "0.13.0", features = ["tokio"] }
tokio.workspace = true
tokio-util.workspace=true
tracing.workspace = true
eyre.workspace = true
ssip = "0.1.0"

0 comments on commit 50b61e3

Please sign in to comment.