[][src]Struct sonor::Speaker

pub struct Speaker(_);

A sonos speaker, wrapping a UPnP-Device and providing user-oriented methods in an asynyronous API.

Implementations

impl Speaker[src]

pub fn from_device(device: Device) -> Option<Self>[src]

Creates a speaker from an already found UPnP-Device. Returns None when the URN type doesn't match the schemas-upnp-org:device:ZonePlayer:1, which is used by sonos devices.

pub async fn from_ip(addr: Ipv4Addr) -> Result<Option<Self>, Error>[src]

Creates a speaker from an IPv4 address. It returns Ok(None) when the device was found but isn't a sonos player.

pub fn device(&self) -> &Device[src]

pub async fn name(&self) -> Result<String, Error>[src]

pub async fn uuid(&self) -> Result<String, Error>[src]

pub async fn stop(&self) -> Result<(), Error>[src]

pub async fn play(&self) -> Result<(), Error>[src]

pub async fn pause(&self) -> Result<(), Error>[src]

pub async fn next(&self) -> Result<(), Error>[src]

pub async fn previous(&self) -> Result<(), Error>[src]

pub async fn skip_to(&self, seconds: u32) -> Result<(), Error>[src]

pub async fn skip_by(&self, seconds: i32) -> Result<(), Error>[src]

pub async fn seek_track(&self, track_no: u32) -> Result<(), Error>[src]

The first track number is 1.

pub async fn repeat_mode(&self) -> Result<RepeatMode, Error>[src]

pub async fn shuffle(&self) -> Result<bool, Error>[src]

pub async fn set_repeat_mode(
    &self,
    repeat_mode: RepeatMode
) -> Result<(), Error>
[src]

pub async fn set_shuffle(&self, shuffle: bool) -> Result<(), Error>[src]

pub async fn crossfade(&self) -> Result<bool, Error>[src]

pub async fn set_crossfade(&self, crossfade: bool) -> Result<(), Error>[src]

pub async fn is_playing(&self) -> Result<bool, Error>[src]

pub async fn track(&self) -> Result<Option<TrackInfo>, Error>[src]

pub async fn volume(&self) -> Result<u16, Error>[src]

pub async fn set_volume(&self, volume: u16) -> Result<(), Error>[src]

pub async fn set_volume_relative(&self, adjustment: i16) -> Result<u16, Error>[src]

pub async fn mute(&self) -> Result<bool, Error>[src]

pub async fn set_mute(&self, mute: bool) -> Result<(), Error>[src]

pub async fn bass(&self) -> Result<i8, Error>[src]

pub async fn set_bass(&self, bass: i8) -> Result<(), Error>[src]

pub async fn treble(&self) -> Result<i8, Error>[src]

pub async fn set_treble(&self, treble: i8) -> Result<(), Error>[src]

pub async fn loudness(&self) -> Result<bool, Error>[src]

pub async fn set_loudness(&self, loudness: bool) -> Result<(), Error>[src]

pub async fn queue(&self) -> Result<Vec<Track>, Error>[src]

pub async fn remove_track(&self, track_no: u32) -> Result<(), Error>[src]

pub async fn queue_end(&self, uri: &str, metadata: &str) -> Result<(), Error>[src]

Enqueues a track at the end of the queue.

pub async fn queue_next(&self, uri: &str, metadata: &str) -> Result<(), Error>[src]

Enqueues a track as the next one.

pub async fn clear_queue(&self) -> Result<(), Error>[src]

pub async fn zone_group_state(
    &self
) -> Result<HashMap<String, Vec<SpeakerInfo>>, Error>
[src]

Returns all groups in the system as a map from the group coordinators UUID to a list of Speaker Infos.

pub async fn join(&self, roomname: &str) -> Result<bool, Error>[src]

Form a group with a player. Returns false when no player with that roomname exists. roomname is compared case insensitively.

pub async fn leave(&self) -> Result<(), Error>[src]

Leave the current group. Does nothing when the speaker already has no group.

pub async fn set_transport_uri(
    &self,
    uri: &str,
    metadata: &str
) -> Result<(), Error>
[src]

Set the transport URI for the speaker. Note that (at least my old Play:5 gen 1 speaker) will only accept urls without '?foo=bar' query parameters that end with '.mp3' or '.wav' etc.

pub async fn transport_uri(&self) -> Result<Option<String>, Error>[src]

Get the current transport URI for the speaker.

pub async fn snapshot(&self) -> Result<Snapshot, Error>[src]

Take a snapshot of the state the speaker is in right now. The saved information is the speakers volume, it's currently played song and were you were in the song.

pub async fn apply(&self, snapshot: Snapshot) -> Result<(), Error>[src]

Applies a snapshot previously taken by the snapshot-method.

pub async fn action(
    &self,
    service: &URN,
    action: &str,
    payload: &str
) -> Result<HashMap<String, String>, Error>
[src]

Execute some UPnP Action on the device. A list of services, devices and actions of the 'ZonePlayer:1' standard can be found here.

Trait Implementations

impl Clone for Speaker[src]

impl Debug for Speaker[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.