nestor_satellite/lib.rs
1//! Write a [Nestor](https://github.com/nestor-home/nestor) satellite in Rust: pair with the core,
2//! hold one WebSocket link to it, carry out its intents, report observations and talk in writing,
3//! following the `nestor.satellite/1` protocol. With the `voice` feature, it talks aloud too: WebRTC
4//! audio, and the device code said with a bundled voice.
5//!
6//! ```no_run
7//! use nestor_satellite::{Device, IDENTIFY, Manifest, Satellite, TokenStore};
8//!
9//! # async fn run() -> nestor_satellite::Result<()> {
10//! let device = Device::new("ecran-cuisine", "raspberry-pi-zero", "cuisine")?;
11//! let manifest = Manifest::new(device, [IDENTIFY])?;
12//! let tokens = TokenStore::new("~/.config/nestor-satellite/ecran-cuisine.json");
13//! let satellite = Satellite::builder("http://nestor.local:8471", manifest, tokens)
14//! .text_display(|text: &str, _last: bool| println!("{text}")) // declares text.display
15//! .text_input() // declares text.input: send lines with satellite.observer().input_text(…)
16//! .build()?;
17//! satellite.run().await
18//! # }
19//! ```
20//!
21//! Features: `voice` (WebRTC audio with your own [`AudioSource`]/[`AudioSink`]), `audio` (the
22//! machine's microphone and speaker through cpal, with `voice`), `cli` (the `nestor-satellite`
23//! command).
24
25#[cfg(feature = "voice")]
26pub mod audio;
27pub mod body;
28mod client;
29pub mod codes;
30#[cfg(feature = "audio")]
31pub mod devices;
32pub mod dispatch;
33mod error;
34pub mod i18n;
35#[cfg(feature = "voice")]
36mod media;
37pub mod pairing;
38pub mod protocol;
39#[cfg(feature = "voice")]
40mod speech;
41pub mod text;
42#[cfg(feature = "voice")]
43mod voice;
44#[cfg(not(feature = "voice"))]
45#[path = "voiceless.rs"]
46mod voice;
47pub mod wire;
48
49#[cfg(feature = "voice")]
50pub use audio::{AudioError, AudioSink, AudioSource, RecordingSink, SilenceSource};
51pub use body::{Body, NoBody};
52pub use client::{Backoff, Observer, PAIRING_CODE_ENV, PAIRING_URI_ENV, Satellite, SatelliteBuilder};
53pub use codes::{Enrollment, EnrollmentCode, PairingUri};
54pub use error::{Error, Result};
55pub use i18n::Language;
56pub use pairing::{Display, Enroller, TokenStore, Voice};
57pub use protocol::{
58 AUDIO_CAPTURE, AUDIO_PLAYBACK, Behavior, Capability, Device, EXPRESSION, EnrollmentMethod, Expression, HEAD_MOTION,
59 IDENTIFY, Manifest, PERSON_DETECTION, PROTOCOL, PairingMethod, ProtocolError, SPEECH_ACTIVITY, Sdk, TEXT_DISPLAY,
60 TEXT_INPUT,
61};
62pub use text::TextDisplay;