Skip to main content

Module rendering_control

Module rendering_control 

Source
Expand description

RenderingControl service for audio rendering operations and events

This service handles audio rendering operations on individual Sonos speakers and related events (volume changes, mute state changes, etc.).

§Operations

OperationDescription
get_volume / set_volumeGet/set volume level (0-100)
set_relative_volumeAdjust volume relatively (-100 to +100)
get_mute / set_muteGet/set mute state
get_bass / set_bassGet/set bass level (-10 to +10)
get_treble / set_trebleGet/set treble level (-10 to +10)
get_loudness / set_loudnessGet/set loudness compensation

§Examples

use sonos_api::services::rendering_control;

// Volume
let op = rendering_control::set_volume("Master".to_string(), 75).build()?;
client.execute("192.168.1.100", op)?;

// Mute
let op = rendering_control::get_mute("Master".to_string()).build()?;
let response = client.execute_enhanced("192.168.1.100", op)?;
println!("Muted: {}", response.current_mute);

// Bass / Treble
let op = rendering_control::set_bass(5).build()?;
client.execute("192.168.1.100", op)?;

§Event Subscriptions

let subscription = rendering_control::subscribe(&client, "192.168.1.100", "http://callback")?;

§Event Handling

use sonos_api::services::rendering_control::events::{RenderingControlEventParser, create_enriched_event};
use sonos_api::events::EventSource;

let parser = RenderingControlEventParser;
let event_data = parser.parse_upnp_event(xml_content)?;
let enriched = create_enriched_event(speaker_ip, event_source, event_data);

Re-exports§

pub use events::create_enriched_event;
pub use events::create_enriched_event_with_registration_id;
pub use events::RenderingControlEvent;
pub use events::RenderingControlEventParser;
pub use state::RenderingControlState;
pub use operations::*;

Modules§

events
RenderingControl service event types and parsing
operations
RenderingControl service operations
state
Canonical RenderingControl service state type.