[][src]Struct sonos_discovery::Discover

pub struct Discover { /* fields omitted */ }

Discover type

Used for discovering sonos devices in the local network via the simple service discovery protocol (ssdp). The ssd-protocol works via udp sockets. First a certain search-message is sent to the multicast address (239.255.255.250:1900).

All answer from upnp (universal plug and play) ready devices are processed and filtered ("Sonos" is in the reply).

Methods

impl Discover[src]

pub fn new() -> Result<Self>[src]

Creates a new Discovery. Uses the default socket on the default ipv4 multicast address (239.255.255.250:1900).

Examples

use sonos_discovery::Discovery;

let discovery: Discovery = Discovery::new().unwrap();

pub fn with_address(address: SocketAddr) -> Result<Self>[src]

Creates a new Discovery with a custom multicast address.

pub fn start(
    &self,
    timeout: Option<u32>,
    device_count: Option<usize>
) -> Result<Vec<IpAddr>>
[src]

Start discovering devices.

Examples

In this example the search will stop if3 devices have been discovered or the default timeout (5s) is reached. This is useful if you know the amount of speakers you have and want to reduce the search time.

use sonos_discovery::Discovery;

let devices: Vec<IpAddr> = Discovery::new().unwrap().start(None, Some(3)).unwrap();

Trait Implementations

impl Debug for Discover[src]

Auto Trait Implementations

Blanket Implementations

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

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

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.

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

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

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