Skip to main content

Crate nestor_satellite

Crate nestor_satellite 

Source
Expand description

Write a Nestor satellite in Rust: pair with the core, stream audio over WebRTC, carry out its intents and report observations, following the nestor.satellite/1 protocol.

use nestor_satellite::{AUDIO_CAPTURE, AUDIO_PLAYBACK, Device, Manifest, Satellite, TokenStore};

let device = Device::new("enceinte-salon", "raspberry-pi-4", "salon")?;
let manifest = Manifest::new(device, [AUDIO_CAPTURE, AUDIO_PLAYBACK])?;
let tokens = TokenStore::new("~/.config/nestor-satellite/enceinte-salon.json");
Satellite::builder("http://nestor.local:8471", manifest, tokens).build()?.run().await

Re-exports§

pub use audio::AudioError;
pub use audio::AudioSink;
pub use audio::AudioSource;
pub use audio::RecordingSink;
pub use audio::SilenceSource;
pub use body::Body;
pub use body::NoBody;
pub use codes::Enrollment;
pub use codes::EnrollmentCode;
pub use codes::PairingUri;
pub use i18n::Language;
pub use pairing::Display;
pub use pairing::Enroller;
pub use pairing::TokenStore;
pub use pairing::Voice;
pub use protocol::AUDIO_CAPTURE;
pub use protocol::AUDIO_PLAYBACK;
pub use protocol::Behavior;
pub use protocol::Capability;
pub use protocol::Device;
pub use protocol::EXPRESSION;
pub use protocol::EnrollmentMethod;
pub use protocol::Expression;
pub use protocol::HEAD_MOTION;
pub use protocol::IDENTIFY;
pub use protocol::Manifest;
pub use protocol::PERSON_DETECTION;
pub use protocol::PROTOCOL;
pub use protocol::PairingMethod;
pub use protocol::ProtocolError;
pub use protocol::SPEECH_ACTIVITY;
pub use protocol::Sdk;

Modules§

audio
Audio in and out of a satellite: 16-bit mono PCM, whatever the hardware.
body
What a driver implements to carry out the core’s intents. Every method has a no-op default: override what the device can do.
codes
Enrollment codes and pairing URIs, as a person hands them to a device.
dispatch
What the satellite does with each message from the core: hand intents to the body and acknowledge them, take note of the welcome, notice the core hanging up.
i18n
What the satellite says to people (its device code, a refused enrollment code, an error), in their language: a Fluent catalogue embedded in the crate (src/i18n/*.ftl), English and French.
pairing
Pairing (nestor.satellite/1): a person proves they mean to pair the device, and the device gets its token.
protocol
The values of the satellite protocol nestor.satellite/1: a device, what it can do, how it can be paired, and the intents it receives.
wire
Messages on the nestor data channel: one JSON envelope {"type", "id", "at", "payload"}.

Structs§

Backoff
The reconnection delay: back to min after a connection that was welcomed, doubled (up to max) after one that was not.
Observer
Reports observations and tells whether the link is up, while the satellite runs.
Satellite
A satellite of a Nestor core. Build it with Satellite::builder, then run it.
SatelliteBuilder
Configures a Satellite.

Enums§

Error
An error of this SDK.

Constants§

PAIRING_CODE_ENV
The environment variable holding an enrollment code alone (K7QF-2M9X), the core’s address being given separately.
PAIRING_URI_ENV
The environment variable holding a pairing URI (nestor+http://host:port/?code=K7QF2M9X).

Type Aliases§

Result
A result of this SDK.