Struct sonos_discovery::Discover
[−]
[src]
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]
fn new() -> Result<Self>
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();
fn with_address(address: SocketAddr) -> Result<Self>
Creates a new Discovery
with a custom multicast address.
fn start(
&self,
timeout: Option<u32>,
device_count: Option<usize>
) -> Result<HashSet<IpAddr>>
&self,
timeout: Option<u32>,
device_count: Option<usize>
) -> Result<HashSet<IpAddr>>
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: HashSet<IpAddr> = Discovery::new().start(None, Some(3));
Trait Implementations
impl Debug for Discover
[src]
impl Drop for Discover
[src]
Drop internal socket on going out of scope